|
@@ -49,13 +49,22 @@ Vue.prototype.$wx = wx
|
|
|
|
|
|
|
|
|
|
|
|
+let overallExample = new Vue({
|
|
|
+ el: '#app',
|
|
|
+ router,
|
|
|
+ store: store,
|
|
|
+ components: { App },
|
|
|
+ template: '<App/>',
|
|
|
+
|
|
|
+})
|
|
|
+
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
if (to.matched.some(record => record.meta.needLogin)) {
|
|
|
|
|
|
- if (!localStorage.getItem('userId')) {
|
|
|
+ if (!localStorage.getItem('userId')) {
|
|
|
next('/login')
|
|
|
} else if (!localStorage.getItem('openid')) {
|
|
|
- this.getOpenid()
|
|
|
+ overallExample.getOpenid()
|
|
|
} else {
|
|
|
next()
|
|
|
}
|
|
@@ -64,31 +73,3 @@ router.beforeEach((to, from, next) => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-new Vue({
|
|
|
- el: '#app',
|
|
|
- router,
|
|
|
- store: store,
|
|
|
- components: {
|
|
|
- App
|
|
|
- },
|
|
|
- template: '<App/>'
|
|
|
-})
|
|
|
-
|
|
|
- if (to.meta.needLogin) {
|
|
|
-
|
|
|
- if (sessionStorage.getItem("userId")) {
|
|
|
-
|
|
|
- next();
|
|
|
- } else {
|
|
|
-
|
|
|
- next({
|
|
|
- path: "Login"
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
-
|
|
|
- next();
|
|
|
- }
|
|
|
-}); */
|
|
|
-
|
|
|
-
|