Commit da5d9a8d authored by tyyin lan's avatar tyyin lan

fix(首页): 文件不能重复上传

parent 03ac1362
...@@ -102,6 +102,8 @@ common_module: ...@@ -102,6 +102,8 @@ common_module:
stop_playing: 'stop' stop_playing: 'stop'
response_error: 'Response error' response_error: 'Response error'
agent_exception: 'Agent exception, please try again later!' agent_exception: 'Agent exception, please try again later!'
equity: 'Equity'
file_size_limit: 'The file size cannot exceed {size}'
dialogue_module: dialogue_module:
continue_question_message: 'You can keep asking questions' continue_question_message: 'You can keep asking questions'
...@@ -479,3 +481,6 @@ personal_settings_module: ...@@ -479,3 +481,6 @@ personal_settings_module:
upload_file: 'Upload file' upload_file: 'Upload file'
file_type_restriction_doc: 'Only.pdf,.txt, .md, .doc, and.docx file types are supported' file_type_restriction_doc: 'Only.pdf,.txt, .md, .doc, and.docx file types are supported'
the_file_type_cannot_be_uploaded: 'The file type cannot be uploaded' the_file_type_cannot_be_uploaded: 'The file type cannot be uploaded'
equity_Module:
file_empty_tip: 'The file content cannot be empty'
...@@ -101,6 +101,8 @@ common_module: ...@@ -101,6 +101,8 @@ common_module:
stop_playing: '停止播放' stop_playing: '停止播放'
response_error: '响应错误' response_error: '响应错误'
agent_exception: '应用异常,请稍后重试!' agent_exception: '应用异常,请稍后重试!'
equity: '权益'
file_size_limit: '文件大小不能超过 {size}'
dialogue_module: dialogue_module:
continue_question_message: '你可以继续提问' continue_question_message: '你可以继续提问'
...@@ -477,3 +479,6 @@ personal_settings_module: ...@@ -477,3 +479,6 @@ personal_settings_module:
upload_file: '上传文件' upload_file: '上传文件'
file_type_restriction_doc: '只支持.pdf, .txt,.md,.doc,.docx文件类型' file_type_restriction_doc: '只支持.pdf, .txt,.md,.doc,.docx文件类型'
the_file_type_cannot_be_uploaded: '暂不支持上传该文件类型' the_file_type_cannot_be_uploaded: '暂不支持上传该文件类型'
equity_Module:
file_empty_tip: '文件内容不能为空'
...@@ -101,6 +101,8 @@ common_module: ...@@ -101,6 +101,8 @@ common_module:
stop_playing: '停止播放' stop_playing: '停止播放'
response_error: '響應錯誤' response_error: '響應錯誤'
agent_exception: '應用異常,請稍後重試!' agent_exception: '應用異常,請稍後重試!'
equity: '权益'
file_size_limit: '文件大小不能超過 {size}'
dialogue_module: dialogue_module:
continue_question_message: '你可以繼續提問' continue_question_message: '你可以繼續提問'
...@@ -477,3 +479,6 @@ personal_settings_module: ...@@ -477,3 +479,6 @@ personal_settings_module:
upload_file: '上傳文件' upload_file: '上傳文件'
file_type_restriction_doc: '只支持.pdf, .txt,.md,.doc,.docx文件類型' file_type_restriction_doc: '只支持.pdf, .txt,.md,.doc,.docx文件類型'
the_file_type_cannot_be_uploaded: '暫不支持上傳該文件類型' the_file_type_cannot_be_uploaded: '暫不支持上傳該文件類型'
equity_Module:
file_empty_tip: '文件內容不能為空'
...@@ -223,6 +223,14 @@ function handleFileUpload(e: Event) { ...@@ -223,6 +223,14 @@ function handleFileUpload(e: Event) {
return return
} }
if (file.size === 0) {
window.$message.warning(t('equity_Module.file_empty_tip'))
return
} else if (file.size > 1024 * 1024 * 10) {
window.$message.warning(t('common_module.file_size_limit', { size: '10MB' }))
return
}
currentInputFileInfo.value = { currentInputFileInfo.value = {
fileName: file.name, fileName: file.name,
url: URL.createObjectURL(file), url: URL.createObjectURL(file),
...@@ -262,6 +270,8 @@ function handleFileUploadCancel() { ...@@ -262,6 +270,8 @@ function handleFileUploadCancel() {
uploading: false, uploading: false,
} }
inputFileRef.value && (inputFileRef.value.value = '')
if (fileUploadController.value) { if (fileUploadController.value) {
fileUploadController.value.abort() fileUploadController.value.abort()
fileUploadController.value = null fileUploadController.value = null
......
...@@ -102,6 +102,8 @@ declare namespace I18n { ...@@ -102,6 +102,8 @@ declare namespace I18n {
stop_playing: string stop_playing: string
response_error: string response_error: string
agent_exception: string agent_exception: string
equity: string
file_size_limit: string
dialogue_module: { dialogue_module: {
continue_question_message: string continue_question_message: string
...@@ -494,5 +496,9 @@ declare namespace I18n { ...@@ -494,5 +496,9 @@ declare namespace I18n {
file_type_restriction_doc: string file_type_restriction_doc: string
the_file_type_cannot_be_uploaded: string the_file_type_cannot_be_uploaded: string
} }
equity_Module: {
file_empty_tip: string
}
} }
} }
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