From 80e0b9da4d4da98452f8930b148750763d85f090 Mon Sep 17 00:00:00 2001
From: “dzb” <2632970487@qq.com>
Date: 星期二, 27 九月 2022 23:12:14 +0800
Subject: [PATCH] 修改用户管理和角色管理部分问题

---
 src/main.js |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/main.js b/src/main.js
index 8ea7900..ee2faad 100644
--- a/src/main.js
+++ b/src/main.js
@@ -9,12 +9,25 @@
 import ElementUI from 'element-ui';
 import "element-ui/lib/theme-chalk/index.css";
 // 寮曞叆icons
-import './assets/icons' 
+import './assets/icons'
 // 寮曞叆鍏ㄥ眬鏍峰紡
-import '@/styles/index.scss' 
+import '@/styles/index.scss'
 import api from "./utils/request"
-Vue.prototype.$axios=api
-console.log(process.env.VUE_APP_BASE_API);
+Vue.prototype.$axios = api
+router.beforeEach((to, from, next) => {
+  if (to.meta.needLogin) {
+    const token = sessionStorage.getItem('token');
+    const tokenHead = sessionStorage.getItem('tokenHead');
+    if (token && tokenHead) {
+      next();
+    } else {
+      router.push("/login");
+    }
+  } else {
+    next();
+  }
+})
+// console.log(process.env.VUE_APP_BASE_API);
 Vue.use(ElementUI);
 new Vue({
   router,

--
Gitblit v1.8.0