diff --git a/src/common/globalRouter.js b/src/common/globalRouter.js index 6949c05..53d4787 100644 --- a/src/common/globalRouter.js +++ b/src/common/globalRouter.js @@ -23,41 +23,45 @@ const $globalRouter = createRouter({ $globalExpandRouter($globalRouter, routes); // 添加路由扩展 $globalRouter.beforeEach((to, from, next) => { - // 在这里进行身份验证、权限检查等 - // ... - let pattern3 = new RegExp("^[0-9]*$"); - if (null != to.query) { - for (let key in to.query) { - if (pattern3.test(to.query[key])) { - if (to.query[key].toString().length > 9) { - to.query[key] = 0; - } - } else { - if (to.query[key].toString().length > 33) { - to.query[key] = ""; - } - } - } - } - if (null != to.params) { - for (let key in to.params) { - if (pattern3.test(to.params[key])) { - if (to.params[key].toString().length > 9) { - to.params[key] = 0; - } - } else { - if (to.params[key].toString().length > 33) { - to.params[key] = ""; - } - } - } + // let pattern3 = new RegExp("^[0-9]*$"); + // if (null != to.query) { + // for (let key in to.query) { + // if (pattern3.test(to.query[key])) { + // if (to.query[key].toString().length > 9) { + // console.log(to.query[key]) + // to.query[key] = 0; + // console.log(to.query[key]) + // } + // } else { + // if (to.query[key].toString().length > 33) { + // to.query[key] = ""; + // } + // } + // } + // } + // + // if (null != to.params) { + // for (let key in to.params) { + // if (pattern3.test(to.params[key])) { + // if (to.params[key].toString().length > 9) { + // to.params[key] = 0; + // } + // } else { + // if (to.params[key].toString().length > 33) { + // to.params[key] = ""; + // } + // } + // } + // } + + if (to.path.includes('src')) { + // 可以重定向或者做其他处理 + next('/'); // 或者 next(from.path) 返回之前的路径 + } else { + next(); // 允许路由继续 } - // 必须调用next()来resolve这个钩子。 - // 可以传递'next()'、'next(false)'或者'next("/path")'来控制路由 - next(); // 允许路由继续 - // next(false); // 中断路由,并且不跳转到任何地方 - // next("/path"); // 中断路由,并跳转到指定的路径 + }); export { $globalRouter }; diff --git a/src/views/enforce/historyCheck.vue b/src/views/enforce/historyCheck.vue index af97151..c7eb6a0 100644 --- a/src/views/enforce/historyCheck.vue +++ b/src/views/enforce/historyCheck.vue @@ -311,7 +311,6 @@ * @param {*} name */ const toDetailView = (id) =>{ - console.log(id) router.push( { path: "/registrationDetail",