|
@@ -40,35 +40,20 @@ import 'swiper/swiper.min.css' //样式文件
|
|
import wx from 'weixin-js-sdk'
|
|
import wx from 'weixin-js-sdk'
|
|
Vue.prototype.$wx = wx
|
|
Vue.prototype.$wx = wx
|
|
|
|
|
|
-//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 */
|
|
|
|
-let overallExample = new Vue({
|
|
|
|
- el: '#app',
|
|
|
|
- router,
|
|
|
|
- store: store,
|
|
|
|
- components: { App },
|
|
|
|
- template: '<App/>',
|
|
|
|
-
|
|
|
|
-})
|
|
|
|
|
|
+// import { getWxOpenId } from './script/wxGetOpenId.js'
|
|
|
|
+import { getWxOpenId } from './script/wxGetOpenId.js'
|
|
const whiteList = ['/Login']
|
|
const whiteList = ['/Login']
|
|
router.beforeEach((to, from, next) => {
|
|
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 (!whiteList.includes(to.path)) {
|
|
console.log('有登录权限')
|
|
console.log('有登录权限')
|
|
- //登录判断
|
|
|
|
if (!localStorage.getItem('userId')) { // 判断当前用户的登录信息userId是否存在
|
|
if (!localStorage.getItem('userId')) { // 判断当前用户的登录信息userId是否存在
|
|
console.log('无userId')
|
|
console.log('无userId')
|
|
next('/Login')
|
|
next('/Login')
|
|
} else if (!localStorage.getItem('openid')) {
|
|
} else if (!localStorage.getItem('openid')) {
|
|
console.log('无openId')
|
|
console.log('无openId')
|
|
- overallExample.getOpenid()
|
|
|
|
|
|
+ // overallExample.getOpenid()
|
|
|
|
+ getWxOpenId()
|
|
console.log('overallExample.getOpenid()走完了')
|
|
console.log('overallExample.getOpenid()走完了')
|
|
} else {
|
|
} else {
|
|
console.log('什么都有')
|
|
console.log('什么都有')
|
|
@@ -80,3 +65,12 @@ router.beforeEach((to, from, next) => {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+
|
|
|
|
+new Vue({
|
|
|
|
+ el: '#app',
|
|
|
|
+ router,
|
|
|
|
+ store: store,
|
|
|
|
+ components: { App },
|
|
|
|
+ template: '<App/>',
|
|
|
|
+
|
|
|
|
+})
|