feat: 图片支持多张上传
This commit is contained in:
parent
78c4b847f7
commit
0bbfe8a04a
|
|
@ -41,21 +41,13 @@ import api from "../../api/api";
|
||||||
import {throttle} from "../../utils/throttle";
|
import {throttle} from "../../utils/throttle";
|
||||||
import enums from "../../utils/enums";
|
import enums from "../../utils/enums";
|
||||||
|
|
||||||
let url = 'https://allocatr.oss-cn-hangzhou.aliyuncs.com/uploads/20250418/560cb5b5baea2ba5a5ef479af7dc79e0.png'
|
const images = ref([])
|
||||||
const images = ref([
|
|
||||||
url,
|
|
||||||
url,
|
|
||||||
url,
|
|
||||||
url,
|
|
||||||
url,
|
|
||||||
url,
|
|
||||||
url,
|
|
||||||
url,
|
|
||||||
url,
|
|
||||||
url,
|
|
||||||
])
|
|
||||||
|
|
||||||
const upload = () => {
|
const upload = () => {
|
||||||
|
if (images.value.length >= 10) {
|
||||||
|
return helpers.showToast('最多上传 10 张图片')
|
||||||
|
}
|
||||||
|
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sizeType: ['original'],
|
sizeType: ['original'],
|
||||||
|
|
@ -75,7 +67,7 @@ const upload = () => {
|
||||||
url: res.cdnurl,
|
url: res.cdnurl,
|
||||||
filePath: tempFilePath,
|
filePath: tempFilePath,
|
||||||
name: 'file',
|
name: 'file',
|
||||||
timeout: 5 * 60 * 1000,
|
timeout: 30 * 1000,
|
||||||
formData: {
|
formData: {
|
||||||
'signature': res.signature,
|
'signature': res.signature,
|
||||||
'ossAccessKeyId': res.OSSAccessKeyId,
|
'ossAccessKeyId': res.OSSAccessKeyId,
|
||||||
|
|
@ -110,9 +102,9 @@ const delImg = (idx) => {
|
||||||
helpers.showToast('图片已删除')
|
helpers.showToast('图片已删除')
|
||||||
}
|
}
|
||||||
|
|
||||||
//预约上门时间
|
//提交上门信息
|
||||||
const submit = throttle(() => {
|
const submit = throttle(() => {
|
||||||
if (!images.value) {
|
if (images.value.length === 0) {
|
||||||
return helpers.showToast('请上传上门的打卡照片')
|
return helpers.showToast('请上传上门的打卡照片')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,16 +117,18 @@ const submit = throttle(() => {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '提交中'
|
title: '提交中'
|
||||||
});
|
});
|
||||||
// api.arrivedOnSite({order_dispatch_id: id.value, images: images.value}).then(() => {
|
|
||||||
// uni.hideLoading();
|
let imagesStr = (images.value).join(',')
|
||||||
// uni.showToast({
|
api.arrivedOnSite({order_dispatch_id: id.value, images: imagesStr}).then(() => {
|
||||||
// title: '已上门',
|
uni.hideLoading();
|
||||||
// icon: "success"
|
uni.showToast({
|
||||||
// })
|
title: '已上门',
|
||||||
// setTimeout(() => {
|
icon: "success"
|
||||||
// helpers.jumpToPage('order-info', `id=${id.value}`, 'redirectTo')
|
})
|
||||||
// }, 1000)
|
setTimeout(() => {
|
||||||
// }).catch(() => {})
|
helpers.jumpToPage('order-info', `id=${id.value}`, 'redirectTo')
|
||||||
|
}, 1000)
|
||||||
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user