From 58aebf343084d71f0db27287c645c14400f8cb6d Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期二, 20 十二月 2022 17:44:04 +0800
Subject: [PATCH] fix:密码校验
---
src/main.js | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/main.js b/src/main.js
index 8ea7900..5c21072 100644
--- a/src/main.js
+++ b/src/main.js
@@ -9,15 +9,29 @@
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");
+ next();
+ }
+ } else {
+ next();
+ }
+})
Vue.use(ElementUI);
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
+// Vue.config.devtools=true
\ No newline at end of file
--
Gitblit v1.8.0