1
zzzz
2024-04-25 275dc81283d0f80327f42e3adb2db5938d8b6ee5
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
  // }