From 9ff66017debadfc89bc0c1b796684a4d1dbe2bc3 Mon Sep 17 00:00:00 2001 From: fangyuan <527392886@qq.com> Date: 星期五, 16 十二月 2022 10:00:02 +0800 Subject: [PATCH] 已上报到市批量操作按钮隐藏 --- 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