From 692173e65403d8482db6adebedbc6cf99f5e70e7 Mon Sep 17 00:00:00 2001 From: liulong <18539103286> Date: Tue, 26 May 2026 21:56:49 +0800 Subject: [PATCH] feat:0 --- .../src/pages/index/components/nav/index2.vue | 10 +- .../src/pages/index/utils/tzzx-iframe.js | 45 -- txw-mhzc-web/src/pages/index/views/main.vue | 3 +- .../src/pages/index/views/tzzx/index.vue | 757 ++++++++++++------ 4 files changed, 507 insertions(+), 308 deletions(-) diff --git a/txw-mhzc-web/src/pages/index/components/nav/index2.vue b/txw-mhzc-web/src/pages/index/components/nav/index2.vue index e9157e1..0916ede 100644 --- a/txw-mhzc-web/src/pages/index/components/nav/index2.vue +++ b/txw-mhzc-web/src/pages/index/components/nav/index2.vue @@ -474,16 +474,10 @@ export default { } }, updateIframeUrl(menus) { - if (!menus) return; + if (!menus || !this.kxurl) return; menus.forEach(menu => { if (menu.path) { - // 门户内嵌碳证中心:走同源 /web/ 反代(测试/生产 nginx),便于 iframe 高度自适应 - const portalEmbed = menu.iframeUrl && String(menu.iframeUrl).startsWith('/web/'); - if (portalEmbed) { - menu.iframeUrl = `/web${menu.path}`; - } else if (this.kxurl) { - menu.iframeUrl = `${this.kxurl}${menu.path}`; - } + menu.iframeUrl = `${this.kxurl}${menu.path}`; } if (menu.child && menu.child.length > 0) { this.updateIframeUrl(menu.child); diff --git a/txw-mhzc-web/src/pages/index/utils/tzzx-iframe.js b/txw-mhzc-web/src/pages/index/utils/tzzx-iframe.js index 60bf8c0..9c38ea7 100644 --- a/txw-mhzc-web/src/pages/index/utils/tzzx-iframe.js +++ b/txw-mhzc-web/src/pages/index/utils/tzzx-iframe.js @@ -1,48 +1,3 @@ -/** - * 碳证中心 iframe 地址归一化:门户内嵌统一走同源 /web/ 反代(如 carbon.liantu.tech/web/...) - */ -export function normalizeTzzxPageUrl(page) { - if (!page || typeof page !== 'string') return ''; - - let url = page.trim(); - if (!url) return ''; - - if (url.startsWith('http://') || url.startsWith('https://')) { - try { - const parsed = new URL(url); - if (parsed.origin === window.location.origin) { - url = parsed.pathname + parsed.search + parsed.hash; - } - } catch (e) { - return url; - } - } - - if (url.startsWith('/web/')) { - return url; - } - - const kxtfwzxMarker = '/view/kxtfwzx'; - const kxtIdx = url.indexOf(kxtfwzxMarker); - if (kxtIdx !== -1) { - const rest = url.slice(kxtIdx + kxtfwzxMarker.length); - return `/web${rest.startsWith('/') ? rest : `/${rest}`}`; - } - - const carbonPathMatch = url.match(/\/(carbon[\w-]*|trustedCarbon[\w-/]*)(?:\?.*)?$/i); - if (carbonPathMatch) { - const pathStart = url.indexOf(carbonPathMatch[0]); - const subPath = url.slice(pathStart); - return subPath.startsWith('/web/') ? subPath : `/web${subPath.startsWith('/') ? subPath : `/${subPath}`}`; - } - - if (url.startsWith('/') && !url.startsWith('/web/')) { - return `/web${url}`; - } - - return url; -} - export function getViewportIframeFallbackHeight() { const navOffset = parseInt( getComputedStyle(document.documentElement).getPropertyValue('--page-offset-top'), diff --git a/txw-mhzc-web/src/pages/index/views/main.vue b/txw-mhzc-web/src/pages/index/views/main.vue index 6fa06ee..ebe241e 100644 --- a/txw-mhzc-web/src/pages/index/views/main.vue +++ b/txw-mhzc-web/src/pages/index/views/main.vue @@ -129,8 +129,7 @@ export default { return; } this.$router.push({ - path: '/tzzx', - query: { page: iframeUrl }, + path: `/tzzx?page=${iframeUrl}`, }); }, diff --git a/txw-mhzc-web/src/pages/index/views/tzzx/index.vue b/txw-mhzc-web/src/pages/index/views/tzzx/index.vue index 43a6141..265ca44 100644 --- a/txw-mhzc-web/src/pages/index/views/tzzx/index.vue +++ b/txw-mhzc-web/src/pages/index/views/tzzx/index.vue @@ -1,253 +1,504 @@ - - - - - + + + + + + + + + +