refactor(系统设置): 系统上传logo增加文件格式校验

--bug=1027803 --user=王孝刚
【系统设置】github#25588,优化建议:系统设置-系统参数设置,页面上传logo图片没有校验格式,上传zip文件,点确定后一直转圈报错
https://www.tapd.cn/55049933/s/1396447
This commit is contained in:
wxg0103 2023-07-24 14:45:47 +08:00 committed by 刘瑞斌
parent 8d114623da
commit 1dff3e87cd
5 changed files with 14 additions and 6 deletions

View File

@ -1243,6 +1243,7 @@ const message = {
delete_file:
"The file already exists, please delete the file with the same name first!",
thread_num: "VUs:",
file_type_limit: "Only files in image format can be uploaded",
input_thread_num: "Please enter the number of threads",
duration: "Duration time",
granularity: "Aggregation time (seconds)",

View File

@ -664,7 +664,7 @@ const message = {
option_value_check: "请填写完整选项值",
sync_issue_tips: "注: 系统在每天00:00:00会自动同步一次",
case_priority_option_check_error: "用例等级需按照顺序添加选项值, 例: P",
remote_search_tip: "输入用户名,系统会提供更多匹配的用户列表供您选择"
remote_search_tip: "输入用户名,系统会提供更多匹配的用户列表供您选择",
},
workspace: {
id: "工作空间ID",
@ -1199,6 +1199,7 @@ const message = {
delete_file_confirm: "确认删除文件: ",
unrelated_file_confirm: "确认取消关联: ",
file_size_limit: "文件个数超出限制!",
file_type_limit: "只能上传图片格式的文件!",
file_size_out_of_bounds: "文件大小超出范围, 文件名称: ",
delete_file: "文件已存在,请先删除同名文件!",
thread_num: "并发用户数",
@ -3541,7 +3542,7 @@ const message = {
},
jar_config: {
upload_limit_size: "上传文件大小不能超过 50MB!",
}
},
};
export default {

View File

@ -663,7 +663,7 @@ const message = {
option_value_check: "請填寫完整選項值",
sync_issue_tips: "注系統在每天00:00:00會自動同步一次",
case_priority_option_check_error: "用例等級需按照順序添加選項值, 例: P",
remote_search_tip: "輸入用戶名,系統會提供更多匹配的用戶列表供您選擇"
remote_search_tip: "輸入用戶名,系統會提供更多匹配的用戶列表供您選擇",
},
workspace: {
id: "工作空間ID",
@ -1199,6 +1199,7 @@ const message = {
unrelated_file_confirm: "確認取消關聯: ",
file_size_limit: "文件個數超出限製!",
file_size_out_of_bounds: "文件大小超出範圍, 文件名称: ",
file_type_limit: "只能上傳图片格式的文件! ",
delete_file: "文件已存在,請先刪除同名文件!",
thread_num: "並發用戶數",
input_thread_num: "請輸入線程數",
@ -3538,7 +3539,7 @@ const message = {
},
jar_config: {
upload_limit_size: "上传文件大小不能超过 50MB!",
}
},
};
export default {

View File

@ -7,7 +7,7 @@ const message = {
environment_import_repeat_tip:
"(Environment configuration with the same name filtered {0})",
check_third_project_success: "inspection passed",
api_run_pool_title: "Interface resource pool",
api_run_pool_title: "Api execution resource pool",
api_script_review: "Interface script review",
api_script_review_tips: "User review must be specified when interface use cases include script steps",
reviewers: "Reviewers",

View File

@ -164,7 +164,12 @@ export default {
this.query();
},
methods: {
beforeUpload() {
beforeUpload(file) {
// .jpg,.jpeg,.png pngtifgifpcxtgaexiffpxsvgpsdcdrpcddxfufoepsairawWMFwebpavifapng
if (!/\.(jpg|jpeg|png|JPG|PNG|tif|gif|pcx|tga|exif|fpx|svg|psd|cdr|pcd|dxf|ufo|eps|ai|raw|WMF|webp|avif|apng)$/.test(file.name)) {
this.$error(this.$t('load_test.file_type_limit'));
return false;
}
return true;
},
handleUploadLogo(uploadResources) {