|
@@ -10,7 +10,7 @@ import setPageTitle from "@/utils/set-page-title";
|
|
|
import usePermissionStore from '@/store/modules/permission';
|
|
|
|
|
|
NProgress.configure({ showSpinner: false });
|
|
|
-const whiteList = ['/login'];
|
|
|
+const whiteList = ['/login', '/yzy/callback'];
|
|
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
|
NProgress.start();
|
|
@@ -62,9 +62,21 @@ router.beforeEach(async (to, from, next) => {
|
|
|
// 在免登录白名单,直接进入
|
|
|
next();
|
|
|
} else {
|
|
|
- const redirect = encodeURIComponent(to.fullPath || '/');
|
|
|
- next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页
|
|
|
- NProgress.done();
|
|
|
+ if (/(wxworklocal)/i.test(navigator.userAgent)) {
|
|
|
+ let state_json = {
|
|
|
+ "redirect_url": to.fullPath || '/',
|
|
|
+ "rnd": Math.floor(Math.random() * 1000000)
|
|
|
+ };
|
|
|
+ const state = JSON.stringify(state_json);
|
|
|
+ let redirect_uri = encodeURIComponent(window.location.protocol + "//" + window.location.host + "/yjxp/#/yzy/callback")
|
|
|
+ let next_url = `https://open.weixin.qq.com/connect/Oauth2/authorize?appid=wld341060039&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&agentid=1004302&state=${state}#wechat_redirect`;
|
|
|
+ window.location.href = next_url; // 粤政易自动登录
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ const redirect = encodeURIComponent(to.fullPath || '/');
|
|
|
+ next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页
|
|
|
+ NProgress.done();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|