|
|
@@ -190,7 +190,12 @@ router.beforeEach((to, from, next) => {
|
|
|
if (res.status === 200) {
|
|
|
if (res.data.success) {
|
|
|
if (!res.data.data) {
|
|
|
- next('/login');
|
|
|
+ if (isWeiXin) {
|
|
|
+ window.open('http://xjw.izouma.com/wx/auth?redirectUri=' + to.name);
|
|
|
+ } else {
|
|
|
+ next('/login')
|
|
|
+ }
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
store.commit('updateUserInfo', res.data.data);
|
|
|
@@ -198,9 +203,15 @@ router.beforeEach((to, from, next) => {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- next('/login');
|
|
|
+ // next('/login');
|
|
|
+ if (isWeiXin) {
|
|
|
+ window.open('http://xjw.izouma.com/wx/auth?redirectUri=' + to.name);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ next('/login')
|
|
|
+ }
|
|
|
}).catch(() => {
|
|
|
- next('/login');
|
|
|
+ // next('/login');
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -208,6 +219,17 @@ router.beforeEach((to, from, next) => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+function isWeiXin() {
|
|
|
+ //window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息,这个属性可以用来判断浏览器类型
|
|
|
+ var ua = window.navigator.userAgent.toLowerCase();
|
|
|
+ //通过正则表达式匹配ua中是否含有MicroMessenger字符串
|
|
|
+ if (ua.match(/MicroMessenger/i) == 'micromessenger') {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
router.afterEach(function(to) {
|
|
|
if (window.cordova && cordova.plugins && cordova.plugins.navigationbar) {
|
|
|
cordova.plugins.navigationbar.create();
|