|
@@ -31,11 +31,6 @@ Vue.use(resource)
|
|
|
import common from './script/common.js'
|
|
|
Vue.use(common)
|
|
|
Vue.prototype.clipboard = clipboard
|
|
|
-
|
|
|
-import { getWxOpenId } from './script/wxGetOpenId.js'
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
// 时间戳过滤器
|
|
|
Vue.filter('dateFormat', (dataStr) => {
|
|
|
var time = new Date(dataStr)
|
|
@@ -55,20 +50,27 @@ Vue.filter('dateFormat', (dataStr) => {
|
|
|
return y + '-' + timeAdd0(m) + '-' + timeAdd0(d) + ' ' + timeAdd0(h) + ':' + timeAdd0(mm) + ':' + timeAdd0(s)
|
|
|
})
|
|
|
|
|
|
+
|
|
|
+import { getWxOpenId } from './script/wxGetOpenId.js'
|
|
|
const whiteList = ['/Login']
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
// if (to.matched.some(record => record.meta.needLogin)) { // 判断该路由是否需要登录权限
|
|
|
if (!whiteList.includes(to.path)) {
|
|
|
- //登录判断
|
|
|
+ console.log('有登录权限')
|
|
|
if (!localStorage.getItem('userId')) { // 判断当前用户的登录信息userId是否存在
|
|
|
- next('/login')
|
|
|
+ console.log('无userId')
|
|
|
+ next('/Login')
|
|
|
} else if (!localStorage.getItem('openid')) {
|
|
|
+ console.log('无openId')
|
|
|
// overallExample.getOpenid()
|
|
|
getWxOpenId()
|
|
|
+ console.log('overallExample.getOpenid()走完了')
|
|
|
} else {
|
|
|
+ console.log('什么都有')
|
|
|
next()
|
|
|
}
|
|
|
} else {
|
|
|
+ console.log('无登录权限')
|
|
|
next();
|
|
|
}
|
|
|
})
|