Browse Source

巡检记录补充图片预览

wyx
fp 1 month ago
parent
commit
2a85557bc6
  1. 26
      pages/tabBar/xjPage/xj.vue
  2. 30
      pages/tabBar/xjPage/xjRecord.vue

26
pages/tabBar/xjPage/xj.vue

@ -43,13 +43,10 @@
<view class="icon-box">
<image class="camera-icon" src="/static/img/camera-icon.png" mode="aspectFill"></image>
</view>
<view class="upload-tips">点击上传</view>
</view>
</u-upload>
</u-form-item>
</u-form>
</view>
@ -180,8 +177,8 @@ export default {
"children",
2
);
this.form.areaId = this.deptOptions[0].children[0].deptId
this.deptOptions = await this.getListByParentId("1", this.deptOptions[0].children[0].deptId);
this.form.apartmentId = this.deptOptions[0].children.filter(item=>item.deptName == '城阳区')[0].deptId
this.deptOptions = await this.getListByParentId("1", this.form.apartmentId);
console.log(this.deptOptions);
});
},
@ -237,10 +234,27 @@ export default {
delete parmas.apartmentName
delete parmas.questionName
addInspection(parmas).then(res=>{
if(res.code == 200){
uni.showToast({
icon: 'success',
title: '提交成功!'
title: '提交成功!',
success:()=>{
this.fileList = []
this.form = {
apartmentId: '',
apartmentName:'',
questionType: '',
questionName: '',
title: '',
content: '',
inspector: '',
inspectorPhone: '',
inspectionTime: '',
imageList: []
}
}
})
}
})
},
handleTreeSelect (e) {

30
pages/tabBar/xjPage/xjRecord.vue

@ -27,7 +27,15 @@
<view class="recordItem">
<view class="recordItemName">图片/视频</view>
<view class="recordItemCon" style="display: flex;flex-wrap: wrap;">
<image v-for="image in item.imageList" :key="image.id" :src="image.url" class="recordItemConImg"></image>
<view v-for="(v,index) in item.imageList" :key="v.id" @click="handlePreviewImage(item.imageList,index)">
<image v-if="v.format == 'image'" :src="v.url" class="recordItemConImg"></image>
</view>
<view v-for="v in item.imageList" :key="v.id">
<view v-if="v.format == 'video'" style="width: 400rpx;height: 240rpx;">
<video id="myVideo" style="width: 100%;height: 100%;" :src="v.url"
@error="videoErrorCallback" controls></video>
</view>
</view>
</view>
</view>
<view class="recordItem">
@ -122,6 +130,24 @@ export default {
this.isRefreshing = false
uni.stopPullDownRefresh();
})
},
handlePreviewImage(list,index){
const images = list.filter(item=> item.format == 'image')
const filePaths = images.map(item=> item.url)
uni.previewImage({
urls: filePaths,
current:index,
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function(data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function(err) {
console.log(err.errMsg);
}
}
});
}
}
}
@ -141,7 +167,7 @@ export default {
border-radius: 10rpx;
margin-left: 20rpx;
background-color: rgba(255, 255, 255, 1);
box-shadow: 2rpx 2rpx 4rpx rgba(0, 0, 0, 0.2);
box-shadow: 0 8rpx 16rpx rgba(0, 0, 0, 0.2);
margin-bottom: 20rpx;
padding: 20rpx;
box-sizing: border-box;

Loading…
Cancel
Save