|
|
@@ -22,13 +22,16 @@
|
|
|
</view>
|
|
|
<!-- 上传图片 -->
|
|
|
<view class="ui-upload" id="descripImg">
|
|
|
- <view class="ui-upload_file">
|
|
|
- <image src="@/static/demo/demo2.png" @click="previewImage()" class="ui-upload_img"
|
|
|
- mode="aspectFill">
|
|
|
+
|
|
|
+ <view class="ui-upload_file" v-for="(item,index) in imgList" :key="index">
|
|
|
+ <image :src="item" @click="previewImage(index)" class="ui-upload_img" mode="aspectFill">
|
|
|
</image>
|
|
|
</view>
|
|
|
- <view class="ui-upload_input" @click="uploadFile">
|
|
|
- <image src="@/static/img/upload.png" class="ui-upload_img" mode="aspectFill"></image>
|
|
|
+ <view class="ui-upload_input" @click="uploadFile('image')">
|
|
|
+ <image src="@/static/img/image.png" class="ui-upload_img" mode="aspectFill"></image>
|
|
|
+ </view>
|
|
|
+ <view class="ui-upload_input" @click="uploadFile('video')">
|
|
|
+ <image src="@/static/img/video.png" class="ui-upload_img" mode="aspectFill"></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -65,21 +68,29 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 上传图片
|
|
|
- async uploadFile(e) {
|
|
|
+ /**
|
|
|
+ * 上传图片
|
|
|
+ * @param {String} type image:图片,video 视频
|
|
|
+ */
|
|
|
+ async uploadFile(type) {
|
|
|
let res = await this.uploadImageSync();
|
|
|
- if (res.success) {
|
|
|
-
|
|
|
+ if (res) {
|
|
|
+ uploadFile({
|
|
|
+ file: res
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
uploadImageSync() {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
uni.chooseImage({
|
|
|
- count: 5, // 默认9
|
|
|
+ count: 1, // 默认9
|
|
|
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
|
success(res) {
|
|
|
- const tempFilePaths = res.tempFilePaths;
|
|
|
+ resolve(res.tempFiles[0]);
|
|
|
+ },
|
|
|
+ fail(e) {
|
|
|
+ resolve(null);
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
@@ -98,9 +109,12 @@
|
|
|
async submitAftersaleInfo(e) {
|
|
|
this.$api.loading("上报中...");
|
|
|
this.saveLoading = true;
|
|
|
- await saveAftersaleInfo(this.aftersale);
|
|
|
+ let res = await saveAftersaleInfo(this.aftersale);
|
|
|
this.saveLoading = false;
|
|
|
this.$api.hide();
|
|
|
+ if (res) {
|
|
|
+ this.$api.msg('上报成功', 'success');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|