Commit 7d920eea authored by 周宏民's avatar 周宏民

feat:弥勒集成登录 支持client

parent c5efa399
Pipeline #92457 waiting for manual action with stages
...@@ -188,8 +188,9 @@ export function updatePdCesiumView(data) { ...@@ -188,8 +188,9 @@ export function updatePdCesiumView(data) {
export function logout(data) { export function logout(data) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
createStoreage.remove('PANDA_STORE'); createStoreage.remove('PANDA_STORE');
const integrationClient = localStorage.getItem('integrationClient');
if (window.globalConfig) { if (window.globalConfig) {
Cookies.set(window.globalConfig.client, '', { Cookies.set(integrationClient || window.globalConfig.client, '', {
path: '/', path: '/',
}); });
window.globalConfig.token = null; window.globalConfig.token = null;
...@@ -198,6 +199,9 @@ export function logout(data) { ...@@ -198,6 +199,9 @@ export function logout(data) {
window.globalConfig.baseURI = window.location.origin; window.globalConfig.baseURI = window.location.origin;
window.globalConfig.hasGateWay = false; window.globalConfig.hasGateWay = false;
window.globalConfig.userInfo = null; window.globalConfig.userInfo = null;
if (integrationClient) {
window.globalConfig.client = integrationClient;
}
window.qiankunIsCache = null; window.qiankunIsCache = null;
window.qiankunStarted = false; window.qiankunStarted = false;
// window.globalConfig.hasGateWay = ; // window.globalConfig.hasGateWay = ;
...@@ -220,6 +224,11 @@ export function logout(data) { ...@@ -220,6 +224,11 @@ export function logout(data) {
Cookies.set('singleToken', '', { Cookies.set('singleToken', '', {
path: '/', path: '/',
}); });
// 如果有集成登录client,则 client 切换成集成登录
if (integrationClient) {
sessionStorage.setItem('client', integrationClient);
}
localStorage.removeItem('integrationClient');
localStorage.removeItem('access_token'); localStorage.removeItem('access_token');
localStorage.removeItem('password_token'); localStorage.removeItem('password_token');
localStorage.removeItem('password_pwdRegex'); localStorage.removeItem('password_pwdRegex');
......
...@@ -326,6 +326,8 @@ const Layout = props => { ...@@ -326,6 +326,8 @@ const Layout = props => {
!_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined'
? `&generateType=${generateType}` ? `&generateType=${generateType}`
: ''; : '';
const integrationClient = localStorage.getItem('integrationClient');
if(integrationClient) client = integrationClient
if (!isLogin) { if (!isLogin) {
history.push(`/user/login?client=${client}${generateType}`, { reload: true }); history.push(`/user/login?client=${client}${generateType}`, { reload: true });
clear(); clear();
...@@ -385,11 +387,14 @@ const Layout = props => { ...@@ -385,11 +387,14 @@ const Layout = props => {
const GetIntegrationConfig = () => { const GetIntegrationConfig = () => {
if (first) { if (first) {
const integrationClient = localStorage.getItem('integrationClient');
appService appService
.GetIntegrationConfig({ .GetIntegrationConfig({
type: '集成登录', type: '集成登录',
userId: window.globalConfig.userInfo?.OID ?? null, userId: window.globalConfig.userInfo?.OID ?? null,
isEnable: true, isEnable: true,
client: integrationClient || '' // 只有指定client才能获取集成登录信息
}) })
.then(res => { .then(res => {
setFirst(false); setFirst(false);
......
...@@ -33,28 +33,28 @@ ...@@ -33,28 +33,28 @@
"english": "Monitoring Center", "english": "Monitoring Center",
"label": "", "label": "",
"url": "", "url": "",
"client": "" "client": "scada"
}, },
{ {
"name": "控漏管控", "name": "控漏管控",
"english": "Leakage control", "english": "Leakage control",
"label": "", "label": "",
"url": "", "url": "",
"client": "" "client": "DMA"
}, },
{ {
"name": "业务中心", "name": "业务中心",
"english": "Business center", "english": "Business center",
"label": "", "label": "",
"url": "", "url": "",
"client": "" "client": "business"
}, },
{ {
"name": "工单中心", "name": "工单中心",
"english": "Ticket center", "english": "Ticket center",
"label": "", "label": "",
"url": "", "url": "",
"client": "" "client": "work"
} }
], ],
"标题": "弥勒自来水公司信息化平台", "标题": "弥勒自来水公司信息化平台",
......
...@@ -36,15 +36,13 @@ const boxHeight = 930; ...@@ -36,15 +36,13 @@ const boxHeight = 930;
const IntegrationMile = props => { const IntegrationMile = props => {
const [ref, isFullscreen, handleFullScreen, handleExitFullScreen] = useFullScreen(false); const [ref, isFullscreen, handleFullScreen, handleExitFullScreen] = useFullScreen(false);
const history = useHistory(); const history = useHistory();
const globalClient = window?.globalConfig?.client || 'city'; let integrationClient = window?.globalConfig?.client || 'city'; // 集成登录client
const timer2 = useRef(null); const timer2 = useRef(null);
const timer3 = useRef(null); const timer3 = useRef(null);
const timer4 = useRef(null); const timer4 = useRef(null);
const progressRef2 = useRef(0); const progressRef2 = useRef(0);
const [loginAction, setAction] = useState(() => new LoginAction(props)); const [loginAction, setAction] = useState(() => new LoginAction(props));
const [dataList, setDataList] = useState([]); // 集成登录详情
const [currentType, setCurrentType] = useState('');
const [mClient, setMClient] = useState(''); const [mClient, setMClient] = useState('');
const { clear } = useAliveController(); const { clear } = useAliveController();
...@@ -60,6 +58,8 @@ const IntegrationMile = props => { ...@@ -60,6 +58,8 @@ const IntegrationMile = props => {
scale: 1, scale: 1,
boxHeight: 930, boxHeight: 930,
}); });
const [integrationData, setIntegrationData] = useState({});
const [linkUrl, setLinkUrl] = useState(''); const [linkUrl, setLinkUrl] = useState('');
const [jumpLoading, setJumpLoading] = useState(false); const [jumpLoading, setJumpLoading] = useState(false);
const [progressValue2, setProgressValue2] = useState(0); const [progressValue2, setProgressValue2] = useState(0);
...@@ -103,6 +103,35 @@ const IntegrationMile = props => { ...@@ -103,6 +103,35 @@ const IntegrationMile = props => {
setConfigData(data); setConfigData(data);
} }
}); });
appService
.GetIntegratedloginSetting({
ignoreSite: true,
})
.then(res => {
const { code, data } = res;
if (data.client) {
integrationClient = data.client;
localStorage.setItem('integrationClient', data.client);
if (integrationClient) {
if (!data.client) return;
appService
.GetIntegrationConfig({
type: '集成登录',
userId: window.globalConfig.userInfo?.OID ?? null,
isEnable: true,
client: data.client || '',
})
.then(res1 => {
const list = res1.data || [];
const obj = {};
list.forEach(d => {
obj[d.name] = true;
});
setIntegrationData(obj);
});
}
}
});
}; };
const onResize = () => { const onResize = () => {
if (ref?.current) { if (ref?.current) {
...@@ -193,6 +222,10 @@ const IntegrationMile = props => { ...@@ -193,6 +222,10 @@ const IntegrationMile = props => {
}, time * 1000); }, time * 1000);
}; };
const onLink = (item, loginA) => { const onLink = (item, loginA) => {
if (!integrationData[item.name]) {
message.warning('当前账号没有权限,请联系管理人员配置');
return;
}
const { url, client } = item; const { url, client } = item;
if (!url && !client) return message.warning('未配置功能路径'); if (!url && !client) return message.warning('未配置功能路径');
if (url) { if (url) {
...@@ -222,7 +255,6 @@ const IntegrationMile = props => { ...@@ -222,7 +255,6 @@ const IntegrationMile = props => {
sessionStorage.setItem(currentProductNew, 0); sessionStorage.setItem(currentProductNew, 0);
setMClient(client); setMClient(client);
const config = props.global; const config = props.global;
window.qiankunStarted = false; window.qiankunStarted = false;
if (client) { if (client) {
config.client = client; config.client = client;
...@@ -231,7 +263,7 @@ const IntegrationMile = props => { ...@@ -231,7 +263,7 @@ const IntegrationMile = props => {
const token = props.global?.token || Cookies.get('token'); const token = props.global?.token || Cookies.get('token');
if (!token) { if (!token) {
history.push(`/user/login?client=${globalClient}`, { reload: true }); history.push(`/user/login?client=${integrationClient}`, { reload: true });
clear(); clear();
props.logout(); props.logout();
} else { } else {
...@@ -280,6 +312,7 @@ const IntegrationMile = props => { ...@@ -280,6 +312,7 @@ const IntegrationMile = props => {
} }
} }
}; };
useEffect(() => { useEffect(() => {
getData(); getData();
window.addEventListener('resize', debounce(onResize, 300)); window.addEventListener('resize', debounce(onResize, 300));
...@@ -299,7 +332,7 @@ const IntegrationMile = props => { ...@@ -299,7 +332,7 @@ const IntegrationMile = props => {
timer4.current = null; timer4.current = null;
} }
timer4.current = setTimeout(() => { timer4.current = setTimeout(() => {
if ($('.CarouselRipples')) { if ($('.CarouselRipples')?.ripples) {
$('.CarouselRipples').ripples({ $('.CarouselRipples').ripples({
resolution: 800, resolution: 800,
dropRadius: 20, // px dropRadius: 20, // px
...@@ -400,17 +433,17 @@ const IntegrationMile = props => { ...@@ -400,17 +433,17 @@ const IntegrationMile = props => {
: null} : null}
</div> </div>
</div> </div>
{linkUrl && showBackBtn ? ( {showBackBtn ? (
<div <div
className={classNames(styles.iframeExit, 'animate__animated', 'animate__fadeIn')} className={classNames(styles.iframeExit, 'animate__animated', 'animate__fadeIn')}
onClick={() => setLinkUrl('')} onClick={() => props.logout()}
> >
<div className={styles.iframeBackLeft}> <div className={styles.iframeBackLeft}>
<img src={arrowLeftImg} alt="返回" /> <img src={arrowLeftImg} alt="返回" />
</div> </div>
<div className={styles.iframeExitIcon}> <div className={styles.iframeExitIcon}>
<img src={backImg} alt="返回" /> <img src={backImg} alt="返回" />
返回 退出
</div> </div>
</div> </div>
) : null} ) : null}
...@@ -432,6 +465,9 @@ const mapDispatchToProps = dispatch => ({ ...@@ -432,6 +465,9 @@ const mapDispatchToProps = dispatch => ({
updateCurrentIndex(index) { updateCurrentIndex(index) {
dispatch(actionCreators.updateCurrentIndex(index)); dispatch(actionCreators.updateCurrentIndex(index));
}, },
logout() {
dispatch(actionCreators.logout());
},
}); });
export default connect( export default connect(
mapStateToProps, mapStateToProps,
......
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
.iframeExitIcon { .iframeExitIcon {
position: absolute; position: absolute;
top: 0; top: 0;
left: -45px; right: -45px;
display: flex; display: flex;
height: 44px; height: 44px;
width: 44px; width: 44px;
background: rgba(28, 94, 180, 0.95); background: rgba(28, 94, 180, 0.95);
border-radius: 0 7px 7px 0; border-radius: 7px 0px 0px 7px;
flex-direction: column; flex-direction: column;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
...@@ -30,11 +30,11 @@ ...@@ -30,11 +30,11 @@
.iframeExit:hover { .iframeExit:hover {
.iframeExitIcon { .iframeExitIcon {
left: 0; right: 0;
} }
.iframeBackLeft { .iframeBackLeft {
left: -15px; right: -15px;
} }
} }
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
.iframeBackLeft { .iframeBackLeft {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; right: 0;
width: 14px; width: 14px;
height: 44px; height: 44px;
background: rgba(28, 94, 180, 0.95); background: rgba(28, 94, 180, 0.95);
border-radius: 0 7px 7px 0; border-radius: 7px 0 0 7px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
...@@ -62,8 +62,8 @@ ...@@ -62,8 +62,8 @@
width: 44px; width: 44px;
height: 44px; height: 44px;
position: absolute; position: absolute;
top: 4px; top: 50px;
left: 0; right: 0;
color: #FFF; color: #FFF;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
......
...@@ -141,7 +141,7 @@ const IntegratedLogin = props => { ...@@ -141,7 +141,7 @@ const IntegratedLogin = props => {
<EditTwoTone onClick={() => edit(record)} style={{ fontSize: '16px' }} /> <EditTwoTone onClick={() => edit(record)} style={{ fontSize: '16px' }} />
</Tooltip> </Tooltip>
{!record.isEnable ? ( {!record.isEnable ? (
<Tooltip title="用"> <Tooltip title="点击启用">
<Popconfirm <Popconfirm
placement="left" placement="left"
title={ title={
...@@ -158,7 +158,7 @@ const IntegratedLogin = props => { ...@@ -158,7 +158,7 @@ const IntegratedLogin = props => {
</Popconfirm> </Popconfirm>
</Tooltip> </Tooltip>
) : ( ) : (
<Tooltip title="用"> <Tooltip title="点击停用">
<Popconfirm <Popconfirm
placement="left" placement="left"
title={ title={
......
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