From e7ad4f504851eeeb84a96823f57258a282cf21d6 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期四, 23 二月 2023 10:55:28 +0800 Subject: [PATCH] 日志管理使用索引提升查询性能 --- src/components/FileUpload/index.vue | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index d3a0b97..2deb0b4 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -70,7 +70,7 @@ const number = ref(0); const uploadList = ref([]); const baseUrl = import.meta.env.VITE_APP_BASE_API; -const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 +const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 涓婁紶鏂囦欢鏈嶅姟鍣ㄥ湴鍧� const headers = ref({ Authorization: "Bearer " + getToken() }); const fileList = ref([]); const showTip = computed( @@ -100,15 +100,9 @@ function handleBeforeUpload(file) { // 鏍℃鏂囦欢绫诲瀷 if (props.fileType.length) { - let fileExtension = ""; - if (file.name.lastIndexOf(".") > -1) { - fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1); - } - const isTypeOk = props.fileType.some((type) => { - if (file.type.indexOf(type) > -1) return true; - if (fileExtension && fileExtension.indexOf(type) > -1) return true; - return false; - }); + const fileName = file.name.split('.'); + const fileExt = fileName[fileName.length - 1]; + const isTypeOk = props.fileType.indexOf(fileExt) >= 0; if (!isTypeOk) { proxy.$modal.msgError(`鏂囦欢鏍煎紡涓嶆纭�, 璇蜂笂浼�${props.fileType.join("/")}鏍煎紡鏂囦欢!`); return false; -- Gitblit v1.9.3