|
@@ -32,6 +32,8 @@ import common from './script/common.js'
|
|
|
Vue.use(common)
|
|
|
Vue.prototype.clipboard = clipboard
|
|
|
|
|
|
+import { getWxOpenId } from './script/wxGetOpenId.js'
|
|
|
+
|
|
|
|
|
|
|
|
|
// 时间戳过滤器
|
|
@@ -53,36 +55,16 @@ Vue.filter('dateFormat', (dataStr) => {
|
|
|
return y + '-' + timeAdd0(m) + '-' + timeAdd0(d) + ' ' + timeAdd0(h) + ':' + timeAdd0(mm) + ':' + timeAdd0(s)
|
|
|
})
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-// Vue.prototype.common = common
|
|
|
-// Vue.http.options.emulateJSON = true;
|
|
|
-// Vue.http.options.headers = {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'};
|
|
|
-
|
|
|
-// Vue.http.interceptors.push((request, next) => {
|
|
|
-// next((response) => {}
|
|
|
-
|
|
|
-// })
|
|
|
-/* eslint-disable no-new */
|
|
|
-// 判断userid和openid,userid没有的情况下让他直接去登录,openid没有的情况下让他只走授权
|
|
|
-// 路由前置守卫
|
|
|
-
|
|
|
-let overallExample = new Vue({
|
|
|
- el: '#app',
|
|
|
- router,
|
|
|
- store: store,
|
|
|
- components: { App },
|
|
|
- template: '<App/>',
|
|
|
-
|
|
|
-})
|
|
|
-
|
|
|
+const whiteList = ['/Login']
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
- if (to.matched.some(record => record.meta.needLogin)) { // 判断该路由是否需要登录权限
|
|
|
+ // if (to.matched.some(record => record.meta.needLogin)) { // 判断该路由是否需要登录权限
|
|
|
+ if (!whiteList.includes(to.path)) {
|
|
|
//登录判断
|
|
|
if (!localStorage.getItem('userId')) { // 判断当前用户的登录信息userId是否存在
|
|
|
next('/login')
|
|
|
} else if (!localStorage.getItem('openid')) {
|
|
|
- overallExample.getOpenid()
|
|
|
+ // overallExample.getOpenid()
|
|
|
+ getWxOpenId()
|
|
|
} else {
|
|
|
next()
|
|
|
}
|
|
@@ -92,3 +74,12 @@ router.beforeEach((to, from, next) => {
|
|
|
})
|
|
|
|
|
|
|
|
|
+new Vue({
|
|
|
+ el: '#app',
|
|
|
+ router,
|
|
|
+ store: store,
|
|
|
+ components: { App },
|
|
|
+ template: '<App/>',
|
|
|
+
|
|
|
+})
|
|
|
+
|