From 12fd8f6b04b26ef02bccdf5fd0bcefb59541c7f6 Mon Sep 17 00:00:00 2001
From: “dzb” <2632970487@qq.com>
Date: 星期三, 02 十一月 2022 17:04:23 +0800
Subject: [PATCH] :预警研判

---
 src/main.js |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/main.js b/src/main.js
index 79b408f..cd55ca2 100644
--- a/src/main.js
+++ b/src/main.js
@@ -9,10 +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' 
-Vue.use(ElementUI)
+import '@/styles/index.scss'
+import api from "./utils/request"
+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