From feebf68645a0c91e07c7eadeb04ae970001f1fc1 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 31 十月 2022 22:53:44 +0800
Subject: [PATCH] 单兵设备、音柱

---
 src/main.js |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/main.js b/src/main.js
index 9a5d68f..cd55ca2 100644
--- a/src/main.js
+++ b/src/main.js
@@ -9,13 +9,27 @@
 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.use(ElementUI)
+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");
+      next();
+    }
+  } else {
+    next();
+  }
+})
+// console.log(process.env.VUE_APP_BASE_API);
+Vue.use(ElementUI);
 new Vue({
   router,
   store,

--
Gitblit v1.8.0