Commit a79fdbe7 authored by 周宏民's avatar 周宏民

fix: 修改登录页跳转到引导页判断,

parent 1f6b92e1
Pipeline #90195 passed with stages
......@@ -15,6 +15,7 @@ import {
DEFAULT_TCP_PORT,
DEFAULT_PARSE_LEVEL,
} from '@wisdom-utils/components/lib/AppLayout/notifier/constants';
import { guidePage } from '@/pages/bootpage/template/constants';
// eslint-disable-next-line no-undef
const Logger = logger('login');
......@@ -132,7 +133,13 @@ class Login {
gztransformLoginHander(response, isRememberPWD, pwd) {
const self = this;
// eslint-disable-next-line prettier/prettier
const token = response && (response.token ? response.token : response.access_token !== null && response.user_token !== null ? response.user_token : '');
const token =
response &&
(response.token
? response.token
: response.access_token !== null && response.user_token !== null
? response.user_token
: '');
if (token) {
const exp = 86400000;
self.globalConfig.token = token;
......@@ -361,30 +368,23 @@ class Login {
}
});
}
// 根据配置信息里的 displayMode 判断显示哪个引导页,如果是集成登录页,则要判断集成登录配置的数量大于1
if (
!flag &&
this.isSignIn &&
this.globalConfig.displayMode &&
this.globalConfig.displayMode !== 'default' &&
!window.qiankunStarted
) {
this.createContext(this);
this.updateConfig && this.updateConfig(this.globalConfig);
this.events && this.events.emit('loginIndustry');
return false;
}
// 跳转到集成登录引导页_xule_2023-08-28
if (
!flag &&
this.isSignIn &&
this.globalConfig.isIntegration >= 1 &&
this.integratedNum >= 2 &&
!window.qiankunStarted
) {
this.events && this.events.emit('loginIndustry');
return false;
if (!flag && this.isSignIn && !window.qiankunStarted) {
const item = guidePage.find(g => g.value === this.globalConfig.displayMode);
// 到引导页
if (this.globalConfig.displayMode !== 'default' && item) {
this.createContext(this);
this.updateConfig && this.updateConfig(this.globalConfig);
this.events && this.events.emit('loginIndustry');
return false;
}
// this.globalConfig.isIntegration 为系统配置表里 是否集成登录
// integratedNum 为当前站点配置的集成登录数量,
if (this.globalConfig.isIntegration >= 1 && this.integratedNum >= 2) {
this.events && this.events.emit('loginIndustry');
return false;
}
}
this.initGateWay(token, getIndustry);
}
......@@ -415,7 +415,14 @@ class Login {
.getWateWayConfig(gateWayParam)
.then(res => {
// eslint-disable-next-line prettier/prettier, no-undef
const hasGateWay = !res || !res.data ? false : _.isString(res.data) ? JSON.parse(res.data) : typeof res.data === 'boolean' ? res.data : false;
const hasGateWay =
!res || !res.data
? false
: _.isString(res.data)
? JSON.parse(res.data)
: typeof res.data === 'boolean'
? res.data
: false;
self.globalConfig.hasGateWay = hasGateWay;
self.globalConfig.apiGatewayDomain = `${window.location.origin}${hasGateWay ? '/PandaCore/GateWay' : ''}`;
if (hasGateWay) {
......@@ -554,7 +561,11 @@ class Login {
const homeType = config.productType || 'civweb4';
// 产品类型和首页路径同时有才行
// eslint-disable-next-line prettier/prettier
const homepage = params.getParams('homepage') ? params.getParams('homepage') : homeType && config.homepage ? `${homeType}/${params.getParams('homepage') || config.homepage}` : '';
const homepage = params.getParams('homepage')
? params.getParams('homepage')
: homeType && config.homepage
? `${homeType}/${params.getParams('homepage') || config.homepage}`
: '';
window.qiankunIsCache =
window.location.origin.replace(/^(http|https):\/\//, '') === 'panda-water.cn'
? false
......@@ -1180,15 +1191,15 @@ class Login {
if (industry) {
let userInfo =
self.globalConfig.userInfo &&
self.globalConfig.userInfo.Groups &&
self.globalConfig.userInfo.Groups instanceof Array
self.globalConfig.userInfo.Groups &&
self.globalConfig.userInfo.Groups instanceof Array
? self.globalConfig.userInfo.Groups.find(enter => {
if(toSite){
return enter.site === toSite
}else{
return enter.industry === industry
}
})
if (toSite) {
return enter.site === toSite;
} else {
return enter.industry === industry;
}
})
: null;
if (industry === '熊猫新产品' && site) {
......@@ -1211,8 +1222,8 @@ class Login {
site: decodeURIComponent(decode(site)),
Groups:
self.globalConfig.userInfo &&
self.globalConfig.userInfo.Groups &&
self.globalConfig.userInfo.Groups instanceof Array
self.globalConfig.userInfo.Groups &&
self.globalConfig.userInfo.Groups instanceof Array
? self.globalConfig.userInfo.Groups
: null,
};
......@@ -1300,8 +1311,8 @@ class Login {
(response.token
? response.token
: response.access_token !== null && response.user_token !== null
? response.user_token
: '');
? response.user_token
: '');
if (token) {
const exp = 86400000;
self.globalConfig.token = token;
......@@ -1359,7 +1370,11 @@ class Login {
.authorizationToken({
loginName: usr,
// password: pwd ? (params.getParams('generateType') ? pwd : sha1(pwd).toUpperCase()) : '',
password: pwd ? (params.getParams('generateType') ? pwd : encipher(pwd, this.globalConfig.encrypt).toUpperCase()) : '',
password: pwd
? params.getParams('generateType')
? pwd
: encipher(pwd, this.globalConfig.encrypt).toUpperCase()
: '',
type: mode,
generateType: params.getParams('generateType') || '',
})
......@@ -1373,7 +1388,7 @@ class Login {
token: data.user_token,
}),
);
if(res.msg === '密码过期') {
if (res.msg === '密码过期') {
localStorage.setItem('password_needChange', true);
} else {
localStorage.removeItem('password_needChange');
......@@ -1401,7 +1416,11 @@ class Login {
client: 'referer',
username: usr,
// password: pwd ? (params.getParams('generateType') ? pwd : sha1(pwd).toUpperCase()) : '',
password: pwd ? (params.getParams('generateType') ? pwd : encipher(pwd, this.globalConfig.encrypt).toUpperCase()) : '',
password: pwd
? params.getParams('generateType')
? pwd
: encipher(pwd, this.globalConfig.encrypt).toUpperCase()
: '',
referer: this.globalConfig.client,
skipMenuTest: 1,
userPhone,
......@@ -1411,7 +1430,7 @@ class Login {
generateType: params.getParams('generateType') || '',
})
.then(response => {
if(response?.msg === '密码过期') {
if (response?.msg === '密码过期') {
localStorage.setItem('password_needChange', true);
} else {
localStorage.removeItem('password_needChange');
......@@ -1524,4 +1543,4 @@ class Login {
}
}
export default Login;
\ No newline at end of file
export default Login;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment