Browse Source

添加首页

zero 1 month ago
parent
commit
48bee63704
2 changed files with 8 additions and 4 deletions
  1. 5 4
      src/router/index.ts
  2. 3 0
      src/stores/permission.ts

+ 5 - 4
src/router/index.ts

@@ -27,7 +27,7 @@ const routes = [
     component: () => import('@/views/login/index.vue'),
   },
   {
-    path: '/news',
+    path: '/home',
     component: () => import('@/views/layout/index.vue'),
     children: [
       {
@@ -91,7 +91,8 @@ router.beforeEach((to, form, next) => {
   if (to.meta.notLogin) {
     if (to.path == '/login') {
       Cookies.remove('token')
-      permissionStore.updataPermissionList(null)
+      permissionStore.updataPermissionList([])
+      permissionStore.updataLoad(false)
     }
     next()
   } else {
@@ -110,7 +111,7 @@ router.beforeEach((to, form, next) => {
             .getPersonPermission()
             .then((response) => {
               if (permissionSign && !hasPermission.hasPermission(permissionSign)) {
-                next({ path: '/news' })
+                next({ path: '/home' })
               } else {
                 next()
               }
@@ -120,7 +121,7 @@ router.beforeEach((to, form, next) => {
             })
         } else {
           if (permissionSign && !hasPermission.hasPermission(permissionSign)) {
-            next({ path: '/news' })
+            next({ path: '/home' })
           } else {
             next()
           }

+ 3 - 0
src/stores/permission.ts

@@ -12,6 +12,9 @@ export const userPermission = defineStore('permission', {
     updataPermissionList(arr: any) {
       this.permissionList = arr
     },
+    updataLoad(arr: any) {
+      this.load = arr
+    },
     async getPersonPermission() {
       const userinfo = await permissionApi.getUserInfo()
       if (userinfo.code == 200) {