Browse Source

feat:优化图片上传功能

master
zhaobing’ 1 year ago
parent
commit
eb58d60f8f
  1. 9
      weapp/package/report/report.js
  2. 2
      weapp/package/report/report.wxml

9
weapp/package/report/report.js

@ -400,6 +400,15 @@ Page({
}, deviceidx, itemidx);
},
})
},
// 删除图片
deleteImg: function (e) {
const { deviceidx, itemidx, index } = e.currentTarget.dataset;
let imgs = this.data.inspectContentArr[deviceidx].checkItems[itemidx].imgs;
imgs.splice(index, 1);
let nextInspectContentArr = this.data.inspectContentArr;
nextInspectContentArr[deviceidx].checkItems[itemidx].imgs = imgs;
this.setData({ inspectContentArr: nextInspectContentArr })
},
// 巡查详情
bindInput: function (e) {

2
weapp/package/report/report.wxml

@ -75,7 +75,7 @@
<view class="weui-uploader" style="padding: 20rpx 30rpx;overflow-y:scroll;" wx:if="{{item.isNormal === false}}">
<view class="img-v weui-uploader__bd" style="overflow:hidden;">
<view class="pic" wx:for="{{item.imgs}}" wx:for-item="img" wx:key="*this">
<image class="weui-uploader__img showImg" src="{{imgUrl + img}}" data-index="{{index}}" data-deviceidx="{{deviceidx}}" data-itemidx="{{itemidx}}" mode="aspectFill" bindtap="bindInput">
<image class="weui-uploader__img showImg" src="{{imgUrl + img}}" data-index="{{index}}" data-deviceidx="{{deviceidx}}" data-itemidx="{{itemidx}}" mode="aspectFill" bindtap="previewImg">
<icon type="cancel" class="delete-btn" data-index="{{index}}" data-deviceidx="{{deviceidx}}" data-itemidx="{{itemidx}}" catchtap="deleteImg" />
</image>
</view>

Loading…
Cancel
Save