|
@@ -135,14 +135,14 @@
|
|
/>
|
|
/>
|
|
</van-cell-group>
|
|
</van-cell-group>
|
|
<div style="margin: 16px; background-color: #f5f5f5">
|
|
<div style="margin: 16px; background-color: #f5f5f5">
|
|
- <van-button block color="#00B3EC" type="primary" native-type="submit"> 提交 </van-button>
|
|
|
|
|
|
+ <van-button :loading="loading" loading-text="上传中..." block color="#00B3EC" type="primary" native-type="submit"> 提交 </van-button>
|
|
</div>
|
|
</div>
|
|
</van-form>
|
|
</van-form>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup name="HomeSubmit">
|
|
<script lang="ts" setup name="HomeSubmit">
|
|
import { showLoadingToast, closeToast } from 'vant';
|
|
import { showLoadingToast, closeToast } from 'vant';
|
|
-import { computed, reactive, unref } from 'vue';
|
|
|
|
|
|
+import { computed, reactive, unref, ref } from 'vue';
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
import { showToast, showSuccessToast } from 'vant';
|
|
import { showToast, showSuccessToast } from 'vant';
|
|
import axios from 'axios';
|
|
import axios from 'axios';
|
|
@@ -154,6 +154,7 @@ import { cameraRepair } from '/@/api';
|
|
const emit = defineEmits(['setActive']);
|
|
const emit = defineEmits(['setActive']);
|
|
// const { locale } = useI18n();
|
|
// const { locale } = useI18n();
|
|
const userStore = useUserStore();
|
|
const userStore = useUserStore();
|
|
|
|
+const loading = ref(false)
|
|
const wxOpenId = computed(() => {
|
|
const wxOpenId = computed(() => {
|
|
return userStore.getWxOpenId;
|
|
return userStore.getWxOpenId;
|
|
});
|
|
});
|
|
@@ -210,16 +211,11 @@ function clzpAfterRead(file) {
|
|
// 上传状态提示开启
|
|
// 上传状态提示开启
|
|
file.status = 'uploading';
|
|
file.status = 'uploading';
|
|
file.message = '上传中...';
|
|
file.message = '上传中...';
|
|
|
|
+ loading.value = true
|
|
// 创建一个空对象实例
|
|
// 创建一个空对象实例
|
|
let formData = new FormData();
|
|
let formData = new FormData();
|
|
// 调用append()方法添加数据
|
|
// 调用append()方法添加数据
|
|
formData.append('file', file.file);
|
|
formData.append('file', file.file);
|
|
- showLoadingToast({
|
|
|
|
- message: '上传中...',
|
|
|
|
- forbidClick: true,
|
|
|
|
- duration: 0,
|
|
|
|
- iconSize: 35,
|
|
|
|
- });
|
|
|
|
axios({
|
|
axios({
|
|
url: '/service/sale/upload/file',
|
|
url: '/service/sale/upload/file',
|
|
method: 'POST',
|
|
method: 'POST',
|
|
@@ -228,8 +224,8 @@ function clzpAfterRead(file) {
|
|
'Content-Type': 'multipart/form-data',
|
|
'Content-Type': 'multipart/form-data',
|
|
},
|
|
},
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
|
|
+ loading.value = false
|
|
let { data } = res;
|
|
let { data } = res;
|
|
- closeToast()
|
|
|
|
if (data.code == 200) {
|
|
if (data.code == 200) {
|
|
// 上传状态提示关闭
|
|
// 上传状态提示关闭
|
|
file.url = data.data;
|
|
file.url = data.data;
|
|
@@ -237,7 +233,7 @@ function clzpAfterRead(file) {
|
|
showToast('上传成功!');
|
|
showToast('上传成功!');
|
|
}
|
|
}
|
|
}).catch(() =>{
|
|
}).catch(() =>{
|
|
- closeToast()
|
|
|
|
|
|
+ loading.value = false
|
|
});
|
|
});
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|