|
|
@@ -41,7 +41,8 @@ const router = new VueRouter({
|
|
|
//设计页
|
|
|
{
|
|
|
path: "/AIDesign/design",
|
|
|
- component: () => import("../views/AIDesign/design.vue")
|
|
|
+ component: () => import("../views/AIDesign/design.vue"),
|
|
|
+ meta: { requiresAuth: true } // 标记需要登录的页面
|
|
|
},
|
|
|
//结果页
|
|
|
{
|
|
|
@@ -52,22 +53,26 @@ const router = new VueRouter({
|
|
|
//历史页
|
|
|
{
|
|
|
path: "/AIDesign/history",
|
|
|
- component: () => import("../views/AIDesign/history.vue")
|
|
|
+ component: () => import("../views/AIDesign/history.vue"),
|
|
|
+ meta: { requiresAuth: true } // 标记需要登录的页面
|
|
|
},
|
|
|
//内墙-设计页
|
|
|
{
|
|
|
path: "/AIDesign/insideDesign",
|
|
|
- component: () => import("../views/AIDesign/insideDesign.vue")
|
|
|
+ component: () => import("../views/AIDesign/insideDesign.vue"),
|
|
|
+ meta: { requiresAuth: true } // 标记需要登录的页面
|
|
|
},
|
|
|
//一键诊断-生成页
|
|
|
{
|
|
|
path: "/AIDesign/diagnose",
|
|
|
- component: () => import("../views/AIDesign/diagnose.vue")
|
|
|
+ component: () => import("../views/AIDesign/diagnose.vue"),
|
|
|
+ meta: { requiresAuth: true } // 标记需要登录的页面
|
|
|
},
|
|
|
//一键诊断-历史页
|
|
|
{
|
|
|
path: "/AIDesign/diagnoseHistory",
|
|
|
- component: () => import("../views/AIDesign/diagnoseHistory.vue")
|
|
|
+ component: () => import("../views/AIDesign/diagnoseHistory.vue"),
|
|
|
+ meta: { requiresAuth: true } // 标记需要登录的页面
|
|
|
},
|
|
|
//一键诊断-结果页
|
|
|
{
|
|
|
@@ -81,6 +86,7 @@ const router = new VueRouter({
|
|
|
});
|
|
|
// 全局前置守卫:只对需要登录的页面进行登录校验
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
+ // console.log("-------页面链接=", window.location.href)
|
|
|
if (!to.meta || (to.meta && !to.meta.requiresAuth)) {
|
|
|
next();
|
|
|
return;
|
|
|
@@ -96,6 +102,7 @@ router.beforeEach((to, from, next) => {
|
|
|
if (code) {
|
|
|
doWecomLogin(code)
|
|
|
.then(() => {
|
|
|
+ next();
|
|
|
console.log(`登录成功,即将进入 ${to.path}`);
|
|
|
})
|
|
|
.catch(() => {
|