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

fix: 修改集成登录跳转的问题,在子站是否开启缓存一至的情况,跳转成功

parent e0f95ca1
Pipeline #96568 passed with stages
......@@ -215,7 +215,7 @@ const IntegratedSwitch = props => {
}
// props.instance && props.instance.updateConfig(config);
loginAction && loginAction.getUserInfoAndConfig('', true, item.type);
loginAction && loginAction.getUserInfoAndConfig('', true, 'industrySwitch');
});
} else {
setJumpLoading(true);
......@@ -246,30 +246,27 @@ const IntegratedSwitch = props => {
useEffect(() => {
const handleToggleIndustry = event => {
setJumpLoading(false);
jumpProgressEnd();
let url = '';
const { pathname } = window.location;
if (window.clientInfo?.url && window.clientInfo.subType === '内链') {
if (pathname.indexOf('/civbase/thirdParty') === -1) {
// 上一个也是站内跳转,则可直接用 BasicLayout 里的跳转
return;
}
// 上个子站不是站外链接,可直接用跳转
url = searchUrl(window.clientInfo.url);
window.clientInfo = null;
}
history.push(`/?client=${clientRef.current || props.global.client || ''}`);
props.updateCurrentIndex(0);
props.updateCurrentIndex && props.updateCurrentIndex(0);
defaultApp(url);
setJumpLoading(false);
jumpProgressEnd();
};
const handleError = () => {
setJumpLoading(false);
jumpProgressEnd();
};
loginAction.events.on('toggleIndustry', handleToggleIndustry);
loginAction.events.on('industrySwitchSuccess', handleToggleIndustry);
loginAction.events.on('loginError', handleError);
return () => {
loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
loginAction.events.removeListener('industrySwitchSuccess', handleToggleIndustry);
loginAction && loginAction.events && loginAction.events.removeListener('loginError', handleError);
};
}, [loginAction.events, props]);
......
......@@ -511,7 +511,7 @@ const Layout = props => {
// 至少2个行业才能回到引导页
const Industries = props.global.get('userInfo.Industries');
if (Industries && Industries.length > 1) {
window.qiankunIsCache = false;
// window.qiankunIsCache = false;
history.push('/industry');
}
};
......
......@@ -64,8 +64,8 @@ const IntegrationNew = props => {
const [integrationData, setIntegrationData] = useState([]); // 所有子站
const [linkUrl, setLinkUrl] = useState('');
// 解决 切换 client 时,updateConfig时,页会刷新,loading会重置
const [jumpLoading, setJumpLoading] = useState(!!window.jumpLoadingProgress);
const [progressValue2, setProgressValue2] = useState(window.jumpLoadingProgress || 0);
const [jumpLoading, setJumpLoading] = useState(false);
const [progressValue2, setProgressValue2] = useState(0);
const [showBackBtn, setShowBackBtn] = useState(true); // 是否显示iframe 返回按钮,三维平台用
const jumpProgressStart = () => {
......@@ -226,12 +226,12 @@ const IntegrationNew = props => {
setJumpLoading(true);
jumpProgressStart();
startTiming(loadingTime);
window.jumpLoadingProgress = 99;
// window.jumpLoadingProgress = 99;
// if (loginA.globalConfig?.size === 0 && window.globalConfig) {
// loginA.updateConfig(window.globalConfig);
// }
loginA && loginA.getUserInfoAndConfig('', true, item.type);
loginA && loginA.getUserInfoAndConfig('', true);
};
const onLink = (item, loginA) => {
const token = props.global?.token || Cookies.get('token');
......@@ -387,11 +387,11 @@ const IntegrationNew = props => {
jumpProgressEnd();
window.jumpLoadingProgress = 0;
};
loginAction.events.on('toggleIndustry', handleToggleIndustry);
loginAction.events.on('loginSuccess', handleToggleIndustry);
loginAction.events.on('loginError', handleError);
return () => {
loginAction && loginAction.events && loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
loginAction && loginAction.events && loginAction.events.removeListener('loginSuccess', handleToggleIndustry);
loginAction && loginAction.events && loginAction.events.removeListener('loginError', handleError);
};
}, [loginAction.events, props]);
......
......@@ -218,7 +218,7 @@ const IntegrationJianshi = props => {
jumpProgressStart();
startTiming(loadingTime);
window.jumpLoadingProgress = 99;
loginA && loginA.getUserInfoAndConfig('', true, item.type);
loginA && loginA.getUserInfoAndConfig('', true);
};
const onLink = (item, loginA) => {
if (!item) return message.info('未配置权限,请联系管理人员');
......@@ -272,8 +272,6 @@ const IntegrationJianshi = props => {
}, []);
useEffect(() => {
const handleToggleIndustry = event => {
setJumpLoading(false);
jumpProgressEnd();
window.jumpLoadingProgress = 0;
let url = '';
if (window.clientInfo?.url && window.clientInfo.subType === '内链') {
......@@ -283,17 +281,19 @@ const IntegrationJianshi = props => {
props.history.push(`/?client=${clientRef.current || props.global.client}`);
props.updateCurrentIndex && props.updateCurrentIndex(0);
defaultApp(url);
setJumpLoading(false);
jumpProgressEnd();
};
const handleError = () => {
setJumpLoading(false);
jumpProgressEnd();
};
loginAction.events.on('toggleIndustry', handleToggleIndustry);
loginAction.events.on('loginSuccess', handleToggleIndustry);
loginAction.events.on('loginError', handleError);
return () => {
loginAction && loginAction.events && loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
loginAction && loginAction.events && loginAction.events.removeListener('loginSuccess', handleToggleIndustry);
loginAction && loginAction.events && loginAction.events.removeListener('loginError', handleError);
};
}, [loginAction.events, props]);
......
......@@ -71,8 +71,8 @@ const IntegrationQinzhou = props => {
boxHeight: 930,
});
const [linkUrl, setLinkUrl] = useState('');
const [jumpLoading, setJumpLoading] = useState(!!window.jumpLoadingProgress);
const [progressValue2, setProgressValue2] = useState(window.jumpLoadingProgress || 0);
const [jumpLoading, setJumpLoading] = useState(false);
const [progressValue2, setProgressValue2] = useState(0);
const [showBackBtn, setShowBackBtn] = useState(false); // 是否显示iframe 返回按钮,三维平台用
const [loginAction, setAction] = useState(() => new LoginAction(props));
......@@ -174,7 +174,7 @@ const IntegrationQinzhou = props => {
const toRevenue = async item => {
setJumpLoading(true);
jumpProgressStart();
startTiming(6);
startTiming(10);
window.jumpLoadingProgress = 99;
try {
const res = await appService.getTicketByToken({ token: window.globalConfig?.token });
......@@ -243,8 +243,11 @@ const IntegrationQinzhou = props => {
setJumpLoading(true);
jumpProgressStart();
startTiming(loadingTime);
window.jumpLoadingProgress = 99;
loginA && loginA.getUserInfoAndConfig('', true, item.type);
// window.jumpLoadingProgress = 99;
// if (loginA.globalConfig?.size === 0 && window.globalConfig) {
// loginA.updateConfig(window.globalConfig);
// }
loginA && loginA.getUserInfoAndConfig('', true);
};
const onLink = (item, loginA) => {
if (!item) return;
......@@ -317,10 +320,8 @@ const IntegrationQinzhou = props => {
}, []);
useEffect(() => {
const handleToggleIndustry = event => {
setJumpLoading(false);
jumpProgressEnd();
window.jumpLoadingProgress = 0;
window.jumpLoadingProgress = 0;
let url = '';
if (window.clientInfo?.url && window.clientInfo.subType === '内链') {
url = searchUrl(window.clientInfo.url);
......@@ -328,22 +329,24 @@ const IntegrationQinzhou = props => {
}
props.history.push(`/?client=${clientRef.current || props.global.client}`);
props.updateCurrentIndex && props.updateCurrentIndex(0);
defaultApp(url);
setJumpLoading(false);
jumpProgressEnd();
};
const handleError = () => {
window.jumpLoadingProgress = 0;
setJumpLoading(false);
jumpProgressEnd();
};
loginAction.events.on('toggleIndustry', handleToggleIndustry);
loginAction.events.on('loginSuccess', handleToggleIndustry);
loginAction.events.on('loginError', handleError);
return () => {
loginAction && loginAction.events && loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
loginAction && loginAction.events && loginAction.events.removeListener('loginSuccess', handleToggleIndustry);
loginAction && loginAction.events && loginAction.events.removeListener('loginError', handleError);
};
}, [loginAction.events, props]);
}, []);
return (
<div className={classNames(styles.integrationQinzhou, 'integrationQinzhou')} style={{ background: `url(${BGIcon}) center/100% 100% no-repeat` }} ref={ref} >
......
......@@ -338,12 +338,12 @@ class Login {
}
writeLogs() {
if (this.globalConfig.userInfo.UserImge === '') {
if (this.globalConfig?.userInfo?.UserImge === '') {
// _config.userInfo.UserImge = __webpack_public_path__ + "assets/images/icon/熊猫新2.png";
this.globalConfig.userInfo.UserImge = 'https://panda-water.cn/web4/assets/images/icon/熊猫新2.png';
}
if (this.globalConfig.userInfo.site) {
if (this.globalConfig?.userInfo?.site) {
// eslint-disable-next-line no-undef
appService
.writeLogs({
......@@ -401,7 +401,6 @@ class Login {
return false;
}
}
this.initGateWay(token, getIndustry);
}
......@@ -767,7 +766,12 @@ class Login {
finish(self, getIndustry) {
window.finishRender = true;
getIndustry ? self.events.emit('toggleIndustry') : self.events.emit('loginSuccess');
if (getIndustry === 'industrySwitch') {
// 组件中 站点跳转
self.events.emit('industrySwitchSuccess');
} else {
getIndustry ? self.events.emit('toggleIndustry') : self.events.emit('loginSuccess');
}
window.share.event = self.events;
self.callback && self.callback();
}
......
......@@ -19,7 +19,7 @@ import { actionCreators } from './containers/App/store';
import { defaultApp, findMenuPath } from './micro';
import Login from './pages/user/login/login';
import store from './stores';
import { getToken } from './utils/utils';
import { getToken, searchUrl } from './utils/utils';
const { getThemeVariables } = require('antd/dist/theme');
const defaultSetting = require('../config/defaultSetting');
......@@ -45,7 +45,7 @@ function getStyle(prefixCls, theme) {
`.trim();
}
const registerTheme = function (prefixCls, theme) {
const registerTheme = function(prefixCls, theme) {
const style = getStyle(prefixCls, theme);
if (canUseDom()) {
updateCSS(style, `${dynamicStyleMark}-dynamic-theme`);
......@@ -149,6 +149,10 @@ export const AppInitState = () => {
if (data.webState === '1' || data.webState === '3') {
data.isIntegration = '1';
}
window.qiankunIsCache =
window.location.origin.replace(/^(http|https):\/\//, '') === 'panda-water.cn'
? false
: data.isCache || false;
const serverRes = await appService.getMainServer();
const serverData = serverRes?.data || [];
const mainserverConf = serverData.find(item => item.name === 'mainserver');
......@@ -259,7 +263,7 @@ export const AppInitState = () => {
const initMessageVoice = () => {
if (!window.speechSynthesis) return;
const rawSpeak = window.speechSynthesis.speak;
window.speechSynthesis.speak = function (...args) {
window.speechSynthesis.speak = function(...args) {
if (
window.globalConfig &&
// eslint-disable-next-line no-prototype-builtins
......@@ -286,9 +290,9 @@ export const AppInitState = () => {
return true;
};
store.subscribe(
(function () {
(function() {
const preVariableTheme = store.getState().toJS().global?.globalConfig?.variableTheme;
return function () {
return function() {
// if (!preVariableTheme)
const variableTheme = store.getState().toJS().global?.globalConfig?.variableTheme;
if (!hasThemeChanged(preVariableTheme, variableTheme)) return false;
......
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