refactor: 上传文件支持多选
This commit is contained in:
parent
6b4cee1412
commit
b35b57fcd0
@ -75,9 +75,9 @@
|
|||||||
|
|
||||||
<div class="operate flex align-center">
|
<div class="operate flex align-center">
|
||||||
<span v-if="props.applicationDetails.file_upload_enable" class="flex align-center">
|
<span v-if="props.applicationDetails.file_upload_enable" class="flex align-center">
|
||||||
<!-- accept="image/jpeg, image/png, image/gif"-->
|
|
||||||
<el-upload
|
<el-upload
|
||||||
action="#"
|
action="#"
|
||||||
|
multiple
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:accept="getAcceptList()"
|
:accept="getAcceptList()"
|
||||||
@ -246,23 +246,23 @@ const uploadFile = async (file: any, fileList: any) => {
|
|||||||
fileList.splice(0, fileList.length)
|
fileList.splice(0, fileList.length)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const formData = new FormData()
|
|
||||||
for (const file of fileList) {
|
|
||||||
formData.append('file', file.raw, file.name)
|
|
||||||
//
|
|
||||||
const extension = file.name.split('.').pop().toLowerCase() // 获取文件后缀名并转为小写
|
|
||||||
|
|
||||||
if (imageExtensions.includes(extension)) {
|
const formData = new FormData()
|
||||||
uploadImageList.value.push(file)
|
formData.append('file', file.raw, file.name)
|
||||||
} else if (documentExtensions.includes(extension)) {
|
//
|
||||||
uploadDocumentList.value.push(file)
|
const extension = file.name.split('.').pop().toLowerCase() // 获取文件后缀名并转为小写
|
||||||
} else if (videoExtensions.includes(extension)) {
|
|
||||||
// videos.push(file)
|
if (imageExtensions.includes(extension)) {
|
||||||
} else if (audioExtensions.includes(extension)) {
|
uploadImageList.value.push(file)
|
||||||
// audios.push(file)
|
} else if (documentExtensions.includes(extension)) {
|
||||||
}
|
uploadDocumentList.value.push(file)
|
||||||
|
} else if (videoExtensions.includes(extension)) {
|
||||||
|
// videos.push(file)
|
||||||
|
} else if (audioExtensions.includes(extension)) {
|
||||||
|
// audios.push(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!chatId_context.value) {
|
if (!chatId_context.value) {
|
||||||
const res = await props.openChatId()
|
const res = await props.openChatId()
|
||||||
chatId_context.value = res
|
chatId_context.value = res
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user