From 275dc81283d0f80327f42e3adb2db5938d8b6ee5 Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Thu, 25 Apr 2024 19:42:06 +0800
Subject: [PATCH] 1
---
src/main.js | 41 +++++++++++++----------------------------
1 files changed, 13 insertions(+), 28 deletions(-)
diff --git a/src/main.js b/src/main.js
index 47d37b8..59231ea 100644
--- a/src/main.js
+++ b/src/main.js
@@ -33,6 +33,8 @@
import "lib-flexible";
// import md5 from 'js-md5'
import * as filters from "@/utils/utils";
+import * as filter from "@/utils/filter";
+import * as allocation from "@/utils/allocation";
import animated from "animate.css"; // npm install animate.css --save安装,在引入
import "../static/css/public2.css";
@@ -69,6 +71,12 @@
Vue.config.productionTip = false;
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key]);
+});
+Object.keys(filter).forEach(key => {
+ Vue.filter(key, filter[key]);
+});
+Object.keys(allocation).forEach(key => {
+ Vue.prototype[key] = allocation[key];
});
Vue.prototype.$state = state;
Vue.prototype.$setgoindex = function() {
@@ -124,37 +132,14 @@
}
}
};
-// router.beforeEach((to, from, next) => {
-// console.log(to.path)
-// store.state.select = to.path
-// document.title = to.meta.title || '亿点通'
-// // 判断是否登录
-// console.log(document.cookie)
-// // console.log(checkCookie(),'checkCookie()')
-// if(!to.meta.requireAuth){
-// next()
-// return
-// }
-// if (document.cookie && to.meta.requireAuth) {
-// if (to.path === '/login') {
-// next({ path: '/' })
-// } else {
-// if (!to.query.url && from.query.url) {
-// to.query.url = from.query.url
-// }
-// next()
-// }
-// }else{
-// if (to.path === '/login') {
-// next()
-// } else {
-// next({ path: '/login' })
-// }
-// }
-// })
+
router.beforeEach((to, from, next) => {
store.state.select = to.path;
document.title = to.meta.title;
+ console.log(store.state, "store.state", !!store.state.token);
+ if (to.meta.requireAuth && !!!store.state.token) {
+ next("/login");
+ }
// if (!to.query.url && from.query.url) {
// to.query.url = from.query.url
// }
--
Gitblit v1.9.3