Commit 618fc7ed authored by 周宏民's avatar 周宏民

fix: 集成登录修改

parent 2fab4fee
Pipeline #94495 waiting for manual action with stages
...@@ -18,7 +18,10 @@ import imgLogo from '@/assets/bootPage/熊猫图标.png'; ...@@ -18,7 +18,10 @@ import imgLogo from '@/assets/bootPage/熊猫图标.png';
import styles from './index.less'; import styles from './index.less';
const Integration = props => { const Integration = props => {
const dataRef = useRef(); const dataRef = useRef();
let integrationClient = window?.globalConfig?.client || 'city'; // 集成登录client const integratedConfig = props.integratedConfig?.toObject
? props.integratedConfig.toObject()
: props.integratedConfig || {};
const integrationClient = integratedConfig?.client || window?.globalConfig?.client || 'city'; // 集成登录client
const [percentBottom, setPercentBottom] = useState(-40); const [percentBottom, setPercentBottom] = useState(-40);
const [currentType, setCurrentType] = useState(''); const [currentType, setCurrentType] = useState('');
...@@ -147,23 +150,26 @@ const Integration = props => { ...@@ -147,23 +150,26 @@ const Integration = props => {
// 获取集成站点数据 // 获取集成站点数据
useEffect(() => { useEffect(() => {
const cli = integratedConfig?.client || sessionStorage.getItem('client') || props?.global?.client || '';
localStorage.setItem('integrationClient', cli);
appService appService
.GetIntegrationConfig({ .GetIntegrationConfig({
type: '集成登录', type: '集成登录',
userId: window.globalConfig.userInfo?.OID ?? null, userId: window.globalConfig.userInfo?.OID ?? null,
isEnable: true, isEnable: true,
client: cli,
}) })
.then(res => { .then(res => {
const { code, data } = res; const { code, data = [] } = res;
if (code !== SERVICE_INTERFACE_SUCCESS_CODE) { if (code !== SERVICE_INTERFACE_SUCCESS_CODE) {
notification.error({ message: '提示', duration: 3, description: '集成站点配置错误' }); notification.error({ message: '提示', duration: 3, description: '集成站点配置错误' });
} else { } else {
setNum(data.length); setNum(data.length);
setDataList(data); setDataList(data.sort((a, b) => a.index - b.index));
const config = props.global; const config = props.global;
config.isIntegration = data.length; config.isIntegration = data.length;
props.updateConfig && props.updateConfig(config); props.updateConfig && props.updateConfig(config);
if (data.length == 1) { if (data.length === 1) {
handlePage(data[0], loginAction); handlePage(data[0], loginAction);
} }
} }
...@@ -171,17 +177,6 @@ const Integration = props => { ...@@ -171,17 +177,6 @@ const Integration = props => {
.catch(err => { .catch(err => {
notification.error({ message: '提示', duration: 3, description: '集成站点配置错误' }); notification.error({ message: '提示', duration: 3, description: '集成站点配置错误' });
}); });
appService
.GetIntegratedloginSetting({
ignoreSite: true,
})
.then(res => {
const { code, data } = res;
if (data.client) {
integrationClient = data.client;
localStorage.setItem('integrationClient', data.client);
}
});
}, []); }, []);
return ( return (
...@@ -264,6 +259,7 @@ const Integration = props => { ...@@ -264,6 +259,7 @@ const Integration = props => {
const mapStateToProps = state => ({ const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']), global: state.getIn(['global', 'globalConfig']),
instance: state.getIn(['global', 'instance']), instance: state.getIn(['global', 'instance']),
integratedConfig: state.getIn(['global', 'integratedConfig']),
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
updateConfig(config) { updateConfig(config) {
......
...@@ -103,7 +103,8 @@ const IntegrationNew = props => { ...@@ -103,7 +103,8 @@ const IntegrationNew = props => {
client, client,
}) })
.then(res1 => { .then(res1 => {
const list = res1.data || []; let list = res1.data || [];
list = list.sort((a, b) => a.index - b.index);
list.length && localStorage.setItem('integrationData', JSON.stringify(list)); list.length && localStorage.setItem('integrationData', JSON.stringify(list));
setIntegrationData(list); setIntegrationData(list);
}); });
......
...@@ -84,11 +84,19 @@ const Login = forwardRef((props, _ref) => { ...@@ -84,11 +84,19 @@ const Login = forwardRef((props, _ref) => {
action.events.on('loginVisible', status => { action.events.on('loginVisible', status => {
setVisible(status); setVisible(status);
}); });
action.events.on('loginHomePage', () => {
props.history.push(`/homePage`);
});
action.events.on('loginIndustry', () => {
props.history.push(`/industry`);
});
// } // }
return () => { return () => {
action && action.events && action.events.removeAllListeners('loginSuccess'); action && action.events && action.events.removeAllListeners('loginSuccess');
action && action.events && action.events.removeAllListeners('loginError'); action && action.events && action.events.removeAllListeners('loginError');
action && action.events && action.events.removeAllListeners('loginVisible'); action && action.events && action.events.removeAllListeners('loginVisible');
action && action.events && action.events.removeAllListeners('loginHomePage');
action && action.events && action.events.removeAllListeners('loginIndustry');
} }
}, [props.loginMode]); }, [props.loginMode]);
......
...@@ -79,10 +79,18 @@ const Login = forwardRef((props, _ref) => { ...@@ -79,10 +79,18 @@ const Login = forwardRef((props, _ref) => {
action.events.on('loginVisible', status => { action.events.on('loginVisible', status => {
setVisible(status); setVisible(status);
}); });
action.events.on('loginHomePage', () => {
props.history.push(`/homePage`);
});
action.events.on('loginIndustry', () => {
props.history.push(`/industry`);
});
return () => { return () => {
action && action.events && action.events.removeAllListeners('loginSuccess'); action && action.events && action.events.removeAllListeners('loginSuccess');
action && action.events && action.events.removeAllListeners('loginError'); action && action.events && action.events.removeAllListeners('loginError');
action && action.events && action.events.removeAllListeners('loginVisible'); action && action.events && action.events.removeAllListeners('loginVisible');
action && action.events && action.events.removeAllListeners('loginHomePage');
action && action.events && action.events.removeAllListeners('loginIndustry');
}; };
}, [props.loginMode]); }, [props.loginMode]);
......
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