From 141a8891ec320f4e80e001e4fb2a09c480b96a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Tue, 26 Aug 2025 10:21:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/hTable/index.vue | 16 ++++++++-------- src/views/exam/examFun.ts | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/hTable/index.vue b/src/components/hTable/index.vue index 2c47c41..7e391ad 100644 --- a/src/components/hTable/index.vue +++ b/src/components/hTable/index.vue @@ -29,7 +29,7 @@ import { hTableAPI } from "@/api/hTable"; import { getenum } from "@/api/enum"; //按钮权限 import { hasPerms } from "@/utils/auth"; - +const modules = import.meta.glob("/src/views/**/*.{vue,tsx}"); const props = defineProps({ //** 传入的表单数据 */ Row: { @@ -200,13 +200,13 @@ async function handleCustom(obj, row, custom: ButtonCustomConfig) { dialog.value.custom.data = row || []; dialog.value.custom.custom = custom || []; // 异步加载组件 - dialog.value.custom.component = defineAsyncComponent({ - loader: () => import(/* @vite-ignore */ `../../views/${custom.src}.vue`), - }); - // let r = shallowRef(null); - // const module = await import(custom.src); - // r.value = module.default; - // dialog.value.custom.component = r; + // dialog.value.custom.component = defineAsyncComponent({ + // loader: () => import(/* @vite-ignore */ `../../views/${custom.src}.vue`), + // }); + let r = shallowRef(null); + const module: any = await modules[`/src/views/${custom.src}.vue`](); //import(`@/views/${custom.src}.vue`); + r.value = module.default; + dialog.value.custom.component = r; dialog.value.width = custom.width; dialog.value.title = custom.title; diff --git a/src/views/exam/examFun.ts b/src/views/exam/examFun.ts index dbff05d..9c754a2 100644 --- a/src/views/exam/examFun.ts +++ b/src/views/exam/examFun.ts @@ -12,9 +12,9 @@ export function entryExamInfo(eid: number) { if (res.code !== 200) return ElMessage.error(res.message); else return ElMessage.success("所有数据录入成功"); } else if (res.type === "application/json") { - let json = await res.text(); - if (json !== undefined && json.Code !== 200) { - return ElMessage.error(json.Message); + let json = JSON.parse(await res.text()); + if (json !== undefined && json.code !== 200) { + return ElMessage.error(json.message); } else { return ElMessage.success("操所有数据录入成功作成功"); }