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