From c64fd964235f19a32f041fab72da679bd2e4fc76 Mon Sep 17 00:00:00 2001 From: zhf <1204297681@qq.com> Date: Fri, 4 Jul 2025 10:28:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A1=A5=E5=85=85=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=BF=90=E7=BB=B4=E7=8A=B6=E6=80=81=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/global-util-design/package.json | 14 ++++---- .../global-util-design/src/hooks/index.ts | 1 + .../src/hooks/router-hook.ts | 35 +++++++++++++++++++ packages/global-util-design/src/index.ts | 2 ++ 4 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 packages/global-util-design/src/hooks/index.ts create mode 100644 packages/global-util-design/src/hooks/router-hook.ts diff --git a/packages/global-util-design/package.json b/packages/global-util-design/package.json index d1722b08..b818f093 100644 --- a/packages/global-util-design/package.json +++ b/packages/global-util-design/package.json @@ -33,13 +33,13 @@ "publish:npm": "npm run build && npm publish --access public --registry=http://172.16.240.221:8081/repository/local/" }, "dependencies": { - "@ibiz-template/core": "0.7.39-alpha.2", - "@ibiz-template/model-helper": "0.7.39-alpha.2", - "@ibiz-template/runtime": "0.7.39-alpha.2", - "@ibiz-template/theme": "^0.7.0", - "@ibiz-template/vue3-components": "0.7.38-alpha.59", - "@ibiz-template/vue3-util": "0.7.39-alpha.2", - "@ibiz/model-core": "^0.1.58", + "@ibiz-template/core": "0.7.41-alpha.7", + "@ibiz-template/model-helper": "0.7.41-alpha.8", + "@ibiz-template/runtime": "0.7.41-alpha.8", + "@ibiz-template/theme": "0.7.39", + "@ibiz-template/vue3-components": "0.7.41-alpha.8", + "@ibiz-template/vue3-util": "0.7.41-alpha.8", + "@ibiz/model-core": "^0.1.78", "@imengyu/vue3-context-menu": "^1.3.3", "async-validator": "^4.2.5", "axios": "^1.6.2", diff --git a/packages/global-util-design/src/hooks/index.ts b/packages/global-util-design/src/hooks/index.ts new file mode 100644 index 00000000..f1797953 --- /dev/null +++ b/packages/global-util-design/src/hooks/index.ts @@ -0,0 +1 @@ +export { routerHook } from './router-hook'; diff --git a/packages/global-util-design/src/hooks/router-hook.ts b/packages/global-util-design/src/hooks/router-hook.ts new file mode 100644 index 00000000..574b28fb --- /dev/null +++ b/packages/global-util-design/src/hooks/router-hook.ts @@ -0,0 +1,35 @@ +import { routePath2string } from '@ibiz-template/vue3-util'; +import { Router } from 'vue-router'; + +export function routerHook(): void { + ibiz.appUtil.onRouteIsReady().then(() => { + if (ibiz.appData) { + const appUtil = ibiz.appUtil as IData; + (appUtil.router as Router).beforeEach((_to, from, next) => { + if ( + from.params?.view1 === 'devsysstateview' && + ibiz.appData && + ibiz.appData.devsysstate !== 30 + ) { + next(false); + } else { + next(); + } + }); + const { devsysstate, devsysstatemsg } = ibiz.appData; + const globalParam = ibiz.util.getGlobalParam(); + globalParam.devsysstatemsg = devsysstatemsg; + if (devsysstate !== 30) { + const path = routePath2string({ + appContext: ibiz.appUtil.getAppContext(), + pathNodes: [ + { + viewName: 'devsysstateview', + }, + ], + }); + ibiz.openView.push(path); + } + } + }); +} diff --git a/packages/global-util-design/src/index.ts b/packages/global-util-design/src/index.ts index 89ea2b67..783301ac 100644 --- a/packages/global-util-design/src/index.ts +++ b/packages/global-util-design/src/index.ts @@ -2,6 +2,7 @@ import { App } from 'vue'; import Views from './views'; import Platform from './platform'; import Editors from './editors'; +import { routerHook } from './hooks'; import './style/index.scss'; export default { @@ -9,5 +10,6 @@ export default { app.use(Views); app.use(Platform); app.use(Editors); + routerHook(); }, }; -- Gitee