修改bug

This commit is contained in:
田岩
2025-07-11 16:00:56 +08:00
parent 297875755a
commit ff3ed2a765
6 changed files with 11173 additions and 305 deletions
@@ -52,7 +52,13 @@
mark: {
type: [String, Number],
default: ''
}
},
fileType: {
type: Array,
default: function() {
return ['jpg', 'png']
}
},
})
// 状态管理
const fileList = reactive([])
@@ -105,13 +111,22 @@
success: async ({
tempFilePaths
}) => {
const valid = tempFilePaths.every(url => {
if (props.fileType.length === 0) return true;
console.log(url);
const lastDotIndex = url.lastIndexOf('.')
if (lastDotIndex === -1) return false;
const extension = url.slice(lastDotIndex + 1).split('?')[0].toLowerCase()
return props.fileType.includes(extension)
})
if (!valid) return common.msg('您选择的图片格式有误。')
console.log(valid)
const data = {
bizScen: 'S3005'
}
console.log(tempFilePaths[0]);
const upload_map = tempFilePaths.map((file) => uploadFile(file, data))
Promise.all(upload_map).then(res => {
fileList.push(...res)
fileList.push(...res.splice(0, props.limit - fileList.length))
emits('update:modelValue', fileList.map(res => res.fileId))
}).catch(() => {