|
@@ -4,13 +4,22 @@ import type { Router } from 'vue-router'
|
|
|
NProgress.configure({
|
|
|
showSpinner: false
|
|
|
})
|
|
|
+const VALID_PARAM_NAME = 'tkn_8f9a1c7b3e24fd'
|
|
|
+const VALID_ACCESS_KEY = 'c154d4a7-dad3-45d0-a11f-07893dd4fbba'
|
|
|
|
|
|
export function createRouterGuards(router: Router) {
|
|
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
|
-
|
|
|
- NProgress.start()
|
|
|
- next()
|
|
|
+ const accessKey = to.query[VALID_PARAM_NAME]
|
|
|
+ if (accessKey !== VALID_ACCESS_KEY && location.hostname.includes('zszs.gloria.com.cn')) {
|
|
|
+ // 可以跳转到提示页面,或者终止导航
|
|
|
+ next(false) // 阻止路由跳转
|
|
|
+ // eslint-disable-next-line no-alert
|
|
|
+ window.alert('禁止访问:缺少或无效的访问凭证')
|
|
|
+ } else {
|
|
|
+ NProgress.start()
|
|
|
+ next()
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
router.afterEach(() => {
|