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

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

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