Commit 280efdcc authored by nick zheng's avatar nick zheng

fix: 对话上传文件限制上传类型

parent c494f7af
...@@ -20,8 +20,17 @@ export function useDialogueFile() { ...@@ -20,8 +20,17 @@ export function useDialogueFile() {
const uploadFileList = ref<FileInfoItem[]>([]) const uploadFileList = ref<FileInfoItem[]>([])
function handleLimitUpload(data: { file: UploadFileInfo }) { function handleLimitUpload(data: { file: UploadFileInfo }) {
const allowTypeList = ['md', 'doc', 'docx', 'pdf', 'txt']
const fileType = (data.file.file && data.file.file?.name.split('.')?.pop()?.toLowerCase()) || '' const fileType = (data.file.file && data.file.file?.name.split('.')?.pop()?.toLowerCase()) || ''
if (fileType && !allowTypeList.includes(fileType)) {
window.$message.error(
t('personal_space_module.knowledge_module.upload_document_module.upload_format_error_message'),
)
return false
}
if (data.file.file && data.file.file?.size === 0) { if (data.file.file && data.file.file?.size === 0) {
window.$message.error( window.$message.error(
t('personal_space_module.knowledge_module.upload_document_module.empty_document_content_message'), t('personal_space_module.knowledge_module.upload_document_module.empty_document_content_message'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment