diff --git a/src/lycomponents/iHeader/index.vue b/src/lycomponents/iHeader/index.vue
index 4500b55..8c7b1b8 100644
--- a/src/lycomponents/iHeader/index.vue
+++ b/src/lycomponents/iHeader/index.vue
@@ -47,10 +47,10 @@
-
- 个人中心
+
+ 个人中心
-
+
退出
@@ -163,6 +163,12 @@ export default {
sEndTime: val[1]
}
this.setCommTime(obj);
+ },
+ // 退出的方法
+ layout() {
+ this.setToken("");
+ this.setUser({});
+ this.$router.replace("/login");
}
},
};
diff --git a/src/permission.js b/src/permission.js
index 33807cf..10ae497 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -1,11 +1,25 @@
+/*
+ * @Author: your name
+ * @Date: 2021-10-08 09:26:42
+ * @LastEditTime: 2021-10-23 17:40:41
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /data-show/src/permission.js
+ */
import router from "@/router"
import NProgress from "nprogress"
import "nprogress/nprogress.css"
+const whitePath = ['/', '/login', '/industryDataExport','/index']
+const token = sessionStorage.getItem('token');
router.beforeEach((to, from, next) => {
- // console.log(to,from, next)
- NProgress.start()
- next()
+ if(!token && !whitePath.includes(to.path)) {
+ next('/login');
+ } else {
+ NProgress.start()
+ next()
+ }
+
})
router.afterEach(() => {