refactor: 上传文件支持多选

This commit is contained in:
CaptainB 2024-12-04 14:36:11 +08:00
parent 6b4cee1412
commit b35b57fcd0

View File

@ -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,8 +246,8 @@ const uploadFile = async (file: any, fileList: any) => {
fileList.splice(0, fileList.length) fileList.splice(0, fileList.length)
return return
} }
const formData = new FormData() const formData = new FormData()
for (const file of fileList) {
formData.append('file', file.raw, file.name) formData.append('file', file.raw, file.name)
// //
const extension = file.name.split('.').pop().toLowerCase() // const extension = file.name.split('.').pop().toLowerCase() //
@ -261,7 +261,7 @@ const uploadFile = async (file: any, fileList: any) => {
} else if (audioExtensions.includes(extension)) { } else if (audioExtensions.includes(extension)) {
// audios.push(file) // audios.push(file)
} }
}
if (!chatId_context.value) { if (!chatId_context.value) {
const res = await props.openChatId() const res = await props.openChatId()