From 6d1c826ab6bb3f2cc7cd598a8317b40e403d898f Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期三, 27 八月 2025 09:23:24 +0800
Subject: [PATCH] 测试完成

---
 src/permission.js |   80 +++++++++++++++++++++++-----------------
 1 files changed, 46 insertions(+), 34 deletions(-)

diff --git a/src/permission.js b/src/permission.js
index c36698f..91b16b0 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -1,55 +1,67 @@
-import router from './router'
-import store from './store'
-import { Message } from 'element-ui'
-import NProgress from 'nprogress'
-import 'nprogress/nprogress.css'
-import { getToken } from '@/utils/auth'
-import { isRelogin } from '@/utils/request'
+import router from "./router";
+import store from "./store";
+import { Message } from "element-ui";
+import NProgress from "nprogress";
+import "nprogress/nprogress.css";
+import { getToken } from "@/utils/auth";
+import { isRelogin } from "@/utils/request";
 
-NProgress.configure({ showSpinner: false })
+NProgress.configure({ showSpinner: false });
 
-const whiteList = ['/login', '/auth-redirect', '/bind', '/register','/wt','/xj','/sf', '/outsideChain','/outsideChainwt','/outsideChainxj']
+const whiteList = [
+  "/login",
+  "/auth-redirect",
+  "/bind",
+  "/register",
+  "/wt",
+  "/xj",
+  "/sf",
+  "/satisfaction",
+];
 router.beforeEach((to, from, next) => {
-  NProgress.start()
+  NProgress.start();
   if (getToken()) {
-    to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
+    to.meta.title && store.dispatch("settings/setTitle", to.meta.title);
     /* has token*/
-    if (to.path === '/login') {
-      next({ path: '/' })
-      NProgress.done()
+    if (to.path === "/login") {
+      next({ path: "/" });
+      NProgress.done();
     } else {
       if (store.getters.roles.length === 0) {
-        isRelogin.show = true
+        isRelogin.show = true;
         // 鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁宸叉媺鍙栧畬user_info淇℃伅
-        store.dispatch('GetInfo').then(() => {
-          isRelogin.show = false
-          store.dispatch('GenerateRoutes').then(accessRoutes => {
-            // 鏍规嵁roles鏉冮檺鐢熸垚鍙闂殑璺敱琛�
-            router.addRoutes(accessRoutes) // 鍔ㄦ�佹坊鍔犲彲璁块棶璺敱琛�
-            next({ ...to, replace: true }) // hack鏂规硶 纭繚addRoutes宸插畬鎴�
+        store
+          .dispatch("GetInfo")
+          .then(() => {
+            isRelogin.show = false;
+            store.dispatch("GenerateRoutes").then((accessRoutes) => {
+              // 鏍规嵁roles鏉冮檺鐢熸垚鍙闂殑璺敱琛�
+              router.addRoutes(accessRoutes); // 鍔ㄦ�佹坊鍔犲彲璁块棶璺敱琛�
+              next({ ...to, replace: true }); // hack鏂规硶 纭繚addRoutes宸插畬鎴�
+            });
           })
-        }).catch(err => {
-            store.dispatch('LogOut').then(() => {
-              Message.error(err)
-              next({ path: '/' })
-            })
-          })
+          .catch((err) => {
+            store.dispatch("LogOut").then(() => {
+              Message.error(err);
+              next({ path: "/" });
+            });
+          });
       } else {
-        next()
+        next();
       }
     }
   } else {
     // 娌℃湁token
     if (whiteList.indexOf(to.path) !== -1) {
       // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆
-      next()
+      next();
     } else {
-      next(`/login?redirect=${to.fullPath}`) // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
-      NProgress.done()
+      next(`/login?redirect=${to.fullPath}`); // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
+      NProgress.done();
     }
   }
-})
+});
 
 router.afterEach(() => {
-  NProgress.done()
-})
+  NProgress.done();
+});

--
Gitblit v1.9.3