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