优化打包为小程序时巡检图片的bug

Signed-off-by: java110 <928255095@qq.com>
This commit is contained in:
java110 2023-03-14 16:42:09 +00:00 committed by Gitee
parent f0b05be2b2
commit 5658df9a7e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 5 additions and 58 deletions

View File

@ -142,7 +142,7 @@
var tempFilePaths = upImgRes.tempFilePaths[0]
that.imgList.push(tempFilePaths);
that.$forceUpdate();
//#ifdef H5
TanslateImage.translate(tempFilePaths, (base64) => {
let _objData = {
uploadFile: base64,
@ -152,19 +152,6 @@
that.photos.push(res);
})
})
//#endif
//#ifndef H5
factory.base64.urlTobase64(tempFilePaths).then(function(base64) {
let _objData = {
uploadFile: base64,
communityId: that.communityId
}
uploadImageAsync(_objData, that).then((res) => {
that.photos.push(res);
})
});
//#endif
}
});
},

View File

@ -29,7 +29,7 @@
</view>
</view>
<uploadImageAsync ref="vcUploadRef" :communityId="communityId" :maxPhotoNum="uploadImage.maxPhotoNum" :canEdit="uploadImage.canEdit" :title="uploadImage.imgTitle" @sendImagesData="sendImagesData" style="margin-top: 30rpx;"></uploadImageAsync>
<uploadImageAsync ref="vcUploadRef" :communityId="communityId" :sourceType="sourceType" :maxPhotoNum="uploadImage.maxPhotoNum" :canEdit="uploadImage.canEdit" :title="uploadImage.imgTitle" @sendImagesData="sendImagesData" style="margin-top: 30rpx;"></uploadImageAsync>
<view class="cu-form-group margin-top" v-if="mapKey">
<view class="title">当前位置</view>
@ -86,19 +86,17 @@
maxPhotoNum: 4,
imgTitle: '巡检图片',
canEdit: true
}
},
sourceType:[ 'camera']
}
},
components: {
uploadImageAsync
},
onLoad(option) {
this.java110Context.onLoad();
let that = this;
this.mapKey = conf.QQMapKey;
wx.getLocation({
type: 'gcj02',
@ -198,45 +196,7 @@
this.patrolTypeName = selected.name;
this.patrolType = selected.statusCd;
},
removePhoto: function(e) {
let _imgList = [];
this.imgList.forEach(function(item, index) {
if (index != e) {
_imgList.push(item);
}
});
let _photos = [];
this.photos.forEach(function(item, index) {
if (index != e) {
_photos.push(item);
}
});
this.photos = _photos;
this.imgList = _imgList;
},
deleteImage: function(e) {
let imageArr = this.$data.imgList;
imageArr.splice(e, 1);
this.photos.splice(e, 1);
},
ChooseImage: function(e) {
let that = this;
wx.chooseImage({
count: 4, //9
sizeType: ['original', 'compressed'], //
sourceType: ['camera'], //
success: (res) => {
that.$data.imgList.push(res.tempFilePaths[0]);
var tempFilePaths = res.tempFilePaths[0]
TanslateImage.translate(tempFilePaths, (url) => {
that.photos.push(url);
})
}
});
},
_submitExcuteInspection: function() {
let _that = this;
uni.showLoading({