|
@@ -51,17 +51,19 @@ Vue.prototype.$wx = wx
|
|
|
/* eslint-disable no-new */
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
if (to.matched.some(record => record.meta.needLogin)) { // 判断该路由是否需要登录权限
|
|
|
- if (localStorage.getItem('userId')) { // 判断当前用户的登录信息loginInfo是否存在
|
|
|
- next();
|
|
|
+ //登录判断
|
|
|
+ if (!localStorage.getItem('userId')) { // 判断当前用户的登录信息loginInfo是否存在
|
|
|
+ next('/login')
|
|
|
+ } else if (!localStorage.getItem('openid')) {
|
|
|
+ this.getOpenid()
|
|
|
} else {
|
|
|
- next({
|
|
|
- path: '/Login'
|
|
|
- })
|
|
|
+ next()
|
|
|
}
|
|
|
} else {
|
|
|
next();
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
new Vue({
|
|
|
el: '#app',
|
|
|
router,
|