From 589151d1edded867fd8d15e9249fd0dfbf3544ef Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期一, 21 四月 2025 13:23:19 +0800 Subject: [PATCH] 优化菜单搜索查询页 --- src/components/ImageUpload/index.vue | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue index d232da6..2bedc33 100644 --- a/src/components/ImageUpload/index.vue +++ b/src/components/ImageUpload/index.vue @@ -6,6 +6,7 @@ list-type="picture-card" :on-success="handleUploadSuccess" :before-upload="handleBeforeUpload" + :data="data" :limit="limit" :on-error="handleUploadError" :on-exceed="handleExceed" @@ -51,6 +52,15 @@ const props = defineProps({ modelValue: [String, Object, Array], + // 涓婁紶鎺ュ彛鍦板潃 + action: { + type: String, + default: "/common/upload" + }, + // 涓婁紶鎼哄甫鐨勫弬鏁� + data: { + type: Object + }, // 鍥剧墖鏁伴噺闄愬埗 limit: { type: Number, @@ -80,7 +90,7 @@ const dialogImageUrl = ref(""); const dialogVisible = ref(false); const baseUrl = import.meta.env.VITE_APP_BASE_API; -const uploadImgUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 +const uploadImgUrl = ref(import.meta.env.VITE_APP_BASE_API + props.action); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 const headers = ref({ Authorization: "Bearer " + getToken() }); const fileList = ref([]); const showTip = computed( @@ -125,9 +135,11 @@ isImg = file.type.indexOf("image") > -1; } if (!isImg) { - proxy.$modal.msgError( - `鏂囦欢鏍煎紡涓嶆纭�, 璇蜂笂浼�${props.fileType.join("/")}鍥剧墖鏍煎紡鏂囦欢!` - ); + proxy.$modal.msgError(`鏂囦欢鏍煎紡涓嶆纭紝璇蜂笂浼�${props.fileType.join("/")}鍥剧墖鏍煎紡鏂囦欢!`); + return false; + } + if (file.name.includes(',')) { + proxy.$modal.msgError('鏂囦欢鍚嶄笉姝g‘锛屼笉鑳藉寘鍚嫳鏂囬�楀彿!'); return false; } if (props.fileSize) { -- Gitblit v1.9.3