|
@@ -86,35 +86,53 @@
|
|
|
if (ua.indexOf("wxwork") > 0) {
|
|
|
this.isCorpWX = true;
|
|
|
}
|
|
|
- if (localStorage.userInfo != null) {
|
|
|
- var user = JSON.parse(localStorage.userInfo);
|
|
|
- if (user.company.packageSimple == 1) {
|
|
|
- //简易模式,直接进入工时统计表
|
|
|
- this.$router.push({ path: '/simple' });
|
|
|
+ if (this.isCorpWX) {
|
|
|
+ //企业微信环境下,尝试自动登录
|
|
|
+ let href = window.location.href;
|
|
|
+ //判断企业微信,是否存在授权
|
|
|
+ //尝试自动登录
|
|
|
+ if (href.indexOf('hasTriedAutoLogin') == -1) {
|
|
|
+ this.tryAutoLogin();
|
|
|
+ } else if (href.indexOf("userId") > 0) {
|
|
|
+ //后台经过验证后,重定向过来带上了userId
|
|
|
+ var loginUserId = href.substring(href.indexOf("userId=")+"userId=".length);
|
|
|
+ if (loginUserId.includes('#/')) {
|
|
|
+ loginUserId = loginUserId.substring(0, loginUserId.indexOf('#/'));
|
|
|
+ }
|
|
|
+ var path = null;
|
|
|
+ if (href.indexOf('path') > 0) {
|
|
|
+ path = href.split('path=')[1].split('&')[0];
|
|
|
+ }
|
|
|
+ this.loginByUserId(loginUserId, path);
|
|
|
} else {
|
|
|
- if(user.moduleList.length > 0) {
|
|
|
- this.$router.push({ path: user.moduleList[0].path })
|
|
|
+ if (localStorage.userInfo != null) {
|
|
|
+ var user = JSON.parse(localStorage.userInfo);
|
|
|
+ if (user.company.packageSimple == 1) {
|
|
|
+ //简易模式,直接进入工时统计表
|
|
|
+ this.$router.push({ path: '/simple' });
|
|
|
+ } else {
|
|
|
+ if(user.moduleList.length > 0) {
|
|
|
+ this.$router.push({ path: user.moduleList[0].path })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (href.indexOf('errorMsg=') > 0) {
|
|
|
+ var errorMsg = href.split('errorMsg=')[1].split('#')[0];
|
|
|
+ this.$message({
|
|
|
+ message: errorMsg,
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- if (this.isCorpWX) {
|
|
|
- //企业微信环境下,尝试自动登录
|
|
|
- let href = window.location.href;
|
|
|
- //判断企业微信,是否存在授权
|
|
|
- //尝试自动登录
|
|
|
- if (href.indexOf('hasTriedAutoLogin') == -1) {
|
|
|
- this.tryAutoLogin();
|
|
|
- } else if (href.indexOf("userId") > 0) {
|
|
|
- //后台经过验证后,重定向过来带上了userId
|
|
|
- var loginUserId = href.substring(href.indexOf("userId=")+"userId=".length);
|
|
|
- if (loginUserId.includes('#/')) {
|
|
|
- loginUserId = loginUserId.substring(0, loginUserId.indexOf('#/'));
|
|
|
- }
|
|
|
- var path = null;
|
|
|
- if (href.indexOf('path') > 0) {
|
|
|
- path = href.split('path=')[1].split('&')[0];
|
|
|
+ if (localStorage.userInfo != null) {
|
|
|
+ var user = JSON.parse(localStorage.userInfo);
|
|
|
+ if (user.company.packageSimple == 1) {
|
|
|
+ //简易模式,直接进入工时统计表
|
|
|
+ this.$router.push({ path: '/simple' });
|
|
|
+ } else {
|
|
|
+ if(user.moduleList.length > 0) {
|
|
|
+ this.$router.push({ path: user.moduleList[0].path })
|
|
|
}
|
|
|
- this.loginByUserId(loginUserId, path);
|
|
|
}
|
|
|
} else {
|
|
|
//检查环境,如果是钉钉有$CORPID$
|
|
@@ -145,6 +163,7 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
let urls = window.location.href
|
|
|
console.log(urls, '连接')
|
|
|
if(urls.indexOf('english=1') != '-1' && localStorage.getItem('lang') != 'en') {
|