From fde624998f89ee20394bb5a310eaf53c744286f5 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期四, 13 十月 2022 15:59:43 +0800 Subject: [PATCH] Merge remote-tracking branch 'ruoyi-vue/master' into dev --- ruoyi-ui/src/components/FileUpload/index.vue | 16 +++++----------- 1 files changed, 5 insertions(+), 11 deletions(-) diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index 1095824..2e33c1b 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -74,7 +74,7 @@ number: 0, uploadList: [], baseUrl: process.env.VUE_APP_BASE_API, - uploadFileUrl: process.env.VUE_APP_BASE_API + "/system/oss/upload", // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 + uploadFileUrl: process.env.VUE_APP_BASE_API + "/system/oss/upload", // 涓婁紶鏂囦欢鏈嶅姟鍣ㄥ湴鍧� headers: { Authorization: "Bearer " + getToken(), }, @@ -124,15 +124,9 @@ handleBeforeUpload(file) { // 鏍℃鏂囦欢绫诲瀷 if (this.fileType) { - let fileExtension = ""; - if (file.name.lastIndexOf(".") > -1) { - fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1); - } - const isTypeOk = this.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 = this.fileType.indexOf(fileExt) >= 0; if (!isTypeOk) { this.$modal.msgError(`鏂囦欢鏍煎紡涓嶆纭�, 璇蜂笂浼�${this.fileType.join("/")}鏍煎紡鏂囦欢!`); return false; @@ -156,7 +150,7 @@ }, // 涓婁紶澶辫触 handleUploadError(err) { - this.$modal.msgError("涓婁紶鍥剧墖澶辫触锛岃閲嶈瘯"); + this.$modal.msgError("涓婁紶鏂囦欢澶辫触锛岃閲嶈瘯"); this.$modal.closeLoading(); }, // 涓婁紶鎴愬姛鍥炶皟 -- Gitblit v1.9.3