|
@@ -29,7 +29,10 @@
|
|
|
<div v-if="currentSelect == '图片'">
|
|
|
<van-field name="uploader" label="上传照片" :rules="[{ required: true, message: '请上传图片' }]">
|
|
|
<template #input>
|
|
|
- <van-uploader multiple :deletable="true"
|
|
|
+ <van-uploader
|
|
|
+ multiple
|
|
|
+ :deletable="true"
|
|
|
+ progress
|
|
|
v-model="uploader" :after-read="afterRead" :before-read="beforeRead" :max-count="1" />
|
|
|
</template>
|
|
|
</van-field>
|
|
@@ -96,6 +99,7 @@ export default {
|
|
|
photoIMG:'',//储存展示图片
|
|
|
canvasPhotoIMG:'',//展示图片
|
|
|
hasUploadedImage: false, // 标记是否已上传图片
|
|
|
+ upfileLoading:''
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -197,6 +201,12 @@ export default {
|
|
|
formData.append('file', file);
|
|
|
const res = await appUploadTheSignature(formData)
|
|
|
this.getFileUrl = res.data
|
|
|
+ this.upfileLoading.clear()
|
|
|
+ if (res.code == 0) {
|
|
|
+ this.getFileUrl = res.data;
|
|
|
+ } else {
|
|
|
+ this.$toast("上传图片失败");
|
|
|
+ }
|
|
|
console.log(this.getFileUrl,'=addresse')
|
|
|
});
|
|
|
this.currentSelect = "签字板"
|
|
@@ -225,6 +235,11 @@ export default {
|
|
|
beforeRead(file) {
|
|
|
// 在这里可以添加对文件的校验逻辑
|
|
|
// 如果返回 true, 则继续读取文件
|
|
|
+ this.upfileLoading = this.$toast.loading({
|
|
|
+ duration: 0, // 持续展示 toast
|
|
|
+ forbidClick: true,
|
|
|
+ message: "上传中"
|
|
|
+ });
|
|
|
return true;
|
|
|
},
|
|
|
// 文件读取完成后的钩子
|
|
@@ -236,6 +251,7 @@ export default {
|
|
|
const formData = new FormData();
|
|
|
formData.append('file', file.file); // 这里的 'file' 是后端接收文件的字段名
|
|
|
const res = await appUploadTheSignature(formData)
|
|
|
+ this.upfileLoading.clear()
|
|
|
this.getFileUrl = res.data
|
|
|
},
|
|
|
async onSubmit(values) {
|