From 4641a877cd6a94e4d35dca7f7f14bc1443e2d2ad Mon Sep 17 00:00:00 2001 From: luobisheng <727299681@qq.com> Date: 星期二, 29 十一月 2022 17:59:55 +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..5c21072 100644 --- a/src/main.js +++ b/src/main.js @@ -9,12 +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' -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(); + } +}) +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