You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.4 KiB
60 lines
1.4 KiB
<template> |
|
<view v-for="item in photoGroups" class="container"> |
|
<view class="photo-date">记录时间:{{ item.date }}</view> |
|
<view class="photo-container"> |
|
<view v-for="photo in item.photos" class="photo-item" @tap="handleCheckPhoto(photo)"> |
|
<net-image :filepath="photo.filePath" /> |
|
<radio :checked="activePhotos.findIndex(o => o.filePath === photo.filePath) > -1" @tap.stop="handleCheckPhoto(photo)" /> |
|
</view> |
|
</view> |
|
</view> |
|
<empty v-if="photoGroups.length === 0" description="无照片" /> |
|
<view class="footer col-24"> |
|
<button type="primary" @click="openInspectionAdd">关联问题</button> |
|
</view> |
|
</template> |
|
|
|
<script> |
|
import store from '@/store' |
|
import { listPhoto } from '@/api/photo' |
|
|
|
export default { |
|
data() { |
|
return { |
|
photoGroups: [], |
|
activePhotos: [] |
|
} |
|
}, |
|
onLoad() { |
|
listPhoto().then(data => { |
|
this.photoGroups = data; |
|
}) |
|
}, |
|
methods: { |
|
openInspectionAdd() { |
|
uni.navigateTo({ |
|
url: '/pages/task/problem/add?files=' + JSON.stringify(this.activePhotos) |
|
}); |
|
}, |
|
handleCheckPhoto(photo) { |
|
const index = this.activePhotos.findIndex(o => o.filePath === photo.filePath); |
|
if (index === -1) { |
|
this.activePhotos.push({ |
|
filePath: photo.filePath, |
|
fileName: photo.fileName |
|
}) |
|
} else { |
|
this.activePhotos.splice(index, 1) |
|
} |
|
} |
|
} |
|
} |
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
.photo-date { |
|
margin-bottom: 24rpx; |
|
font-size: 12px; |
|
} |
|
|
|
</style> |