From ba448fc7a073840dba5a870b67a4e7cf62a048e0 Mon Sep 17 00:00:00 2001 From: chenxing Date: Mon, 19 Oct 2026 16:50:49 +0800 Subject: [PATCH] =?UTF-8?q?[v2.1]=20A=20=E5=8E=BB=E5=A3=B3=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=8A=9E=E7=90=86=EF=BC=9AApp=20=E5=A2=9E=20bare=20?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=BD=A2=E6=80=81(/task/*=3Fembed=3D1=20?= =?UTF-8?q?=E4=BF=9D=20CAS=20=E5=8E=BB=E5=B8=83=E5=B1=80)=EF=BC=8CTaskHand?= =?UTF-8?q?le=20=E5=8A=9E=E7=90=86=E6=88=90=E5=8A=9F/=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E4=B8=9A=E5=8A=A1/=E9=AB=98=E5=BA=A6=E5=8F=98=E5=8C=96=20postM?= =?UTF-8?q?essage=20=E5=9B=9E=E7=88=B6=E9=A1=B5=EF=BC=8Cbare=20=E4=B8=8D?= =?UTF-8?q?=E8=B7=B3=E5=B7=A5=E4=BD=9C=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 31 +++++++---- src/utils/taskEmbed.ts | 70 +++++++++++++++++++++++ src/views/flow/TaskHandle.vue | 101 ++++++++++++++++++++++++++++++---- 3 files changed, 181 insertions(+), 21 deletions(-) create mode 100644 src/utils/taskEmbed.ts diff --git a/src/App.vue b/src/App.vue index 80716d1..5ad2af1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,22 +5,29 @@ import { useRouter } from "vue-router"; import config from "@/assets/config/host.config"; import { baseApi } from "@/api/module/base"; import { resolveMenuPage } from "@/utils/menuRoute"; +import { isBareTaskRoute } from "@/utils/taskEmbed"; import { Message } from "view-ui-plus"; const router = useRouter(); const isLogin = ref(false); // 嵌入页旁路(/embed/**,iframe 免签嵌入):子应用 Drawer 里打开,带不了本应用 CAS 会话, // 也不该出现菜单壳。判定用路由前缀而非 query 标记——刷新/直链/分享均稳定 -const isEmbed = computed(() => router.currentRoute.value.path.startsWith("/embed/")); +const isTokenEmbed = computed(() => router.currentRoute.value.path.startsWith("/embed/")); +// 去壳任务页(/task/{taskId}?embed=1,v2.1 完整办理内嵌):只去菜单壳,CAS 一律保留—— +// 办理是写操作,旁路鉴权等于把审批动作挂在免签 URL 上。与 token 页共享"无壳"渲染, +// 但鉴权分支只走 isTokenEmbed +const isBareTask = computed(() => + isBareTaskRoute(router.currentRoute.value.path, router.currentRoute.value.query.embed)); +const isShellless = computed(() => isTokenEmbed.value || isBareTask.value); // 嵌入页必须旁路全局 body 的 min-width(assets/styles/base/_base.scss 的 1200px): -// 上面 isEmbed 只旁路了组件壳,管不到全局 CSS,740px 的 iframe 里页面仍按 ≥1200px 排版, +// 上面 isShellless 只旁路了组件壳,管不到全局 CSS,740px 的 iframe 里页面仍按 ≥1200px 排版, // 表现为整体右偏 + 右侧被裁。用内联样式覆盖(优先级高于样式表),非嵌入态移除内联属性回落到原值 function syncEmbedLayout(embed: boolean) { if (embed) document.body.style.minWidth = "0"; else document.body.style.removeProperty("min-width"); } -watch(isEmbed, syncEmbedLayout, { immediate: true }); +watch(isShellless, syncEmbedLayout, { immediate: true }); onBeforeUnmount(() => syncEmbedLayout(false)); const layoutData = reactive({ @@ -37,8 +44,9 @@ onMounted(async () => { // 首次导航异步完成:mount 时 currentRoute 可能仍是初始 "/",先等路由就绪再判嵌入前缀, // 否则直链 /#/embed/* 会在旁路前误发鉴权请求 await router.isReady(); - // 嵌入页:跳过两个鉴权请求(失败会弹错误 Message 且渲染带菜单壳的 layout,嵌入场景均不可接受) - if (isEmbed.value) { + // 嵌入页:跳过两个鉴权请求(失败会弹错误 Message 且渲染带菜单壳的 layout,嵌入场景均不可接受)。 + // 去壳任务页不走这个分支——它是写面,getUserInfo/getUserMod 正是触发 CAS 的地方 + if (isTokenEmbed.value) { isLogin.value = true; return; } @@ -97,11 +105,14 @@ onMounted(async () => {