Skip to content

Commit

Permalink
add: to all the page ,user must login
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarrettluo committed Jan 14, 2024
1 parent 49acaab commit f48f87e
Show file tree
Hide file tree
Showing 5 changed files with 389 additions and 1 deletion.
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"vue": "^2.6.11",
"vue-cropper": "^0.5.8",
"vue-demi": "^0.13.11",
"vue-jsmind": "^1.5.0",
"vue-router": "^3.2.0",
"xlsx": "^0.18.5"
},
Expand Down
7 changes: 7 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ Vue.component('tags-input', VoerroTagsInput);
Vue.use(VueRouter);
Vue.use(iView);

import jm from 'vue-jsmind'

Vue.use(jm)
if (window.jsMind) {
Vue.prototype.jsMind = window.jsMind
}

Vue.prototype.$axios = Api;

new Vue({
Expand Down
2 changes: 1 addition & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ router.beforeEach((to, from, next) => {
// to表示将要访问的地址
// from表示从哪个路径跳转而来
// next是放行函数 next()放行 next('/path')强制跳转
if (to.path === '/login') return next()
if (to.path === '/login' || to.path === "/registry") return next()
const tokenStr = localStorage.getItem('token')
if (!tokenStr) return next('/login')
next()
Expand Down
Loading

0 comments on commit f48f87e

Please sign in to comment.