Commit 58da0b31 authored by 皮倩雯's avatar 皮倩雯

fix: '优化配置'

parent 77b109b9
Pipeline #77735 passed with stages
......@@ -4,18 +4,25 @@ import Iframe from 'react-iframe';
import { appService } from '@/api';
import Empty from '@wisdom-components/empty';
import axios from 'axios';
import { Spin, notification } from 'antd';
import { Message, Spin, notification } from 'antd';
import styles from './index.less';
const IntegratedLogin = props => {
const { sysName } = props.params;
const [linkUrl, setLinkUrl] = useState('');
const [loading, setLoading] = useState(false);
const ticketData = useRef();
const getTicket = () => {
appService.getTicketByToken({ token: window.globalConfig.token }).then(res => {
if (res.code === 0) {
return res.data;
ticketData.current = res.data;
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
};
......@@ -29,12 +36,14 @@ const IntegratedLogin = props => {
}
return false;
})
.catch(error => false);
.catch(error => {
return false;
});
};
const getUrlParam = url => {
let arrObj = url.split('?');
const params = Object.create(null);
let params = Object.create(null);
if (arrObj.length > 1) {
arrObj = arrObj[1].split('&');
arrObj.forEach(item => {
......@@ -46,12 +55,17 @@ const IntegratedLogin = props => {
};
const getSiteConfig = () => {
if (linkUrl) {
return;
}
let ticket = '';
setLoading(true);
appService.getIntegratedLoginbyName({ sysName }).then(res => {
appService
.getIntegratedLoginbyName({ sysName })
.then(res => {
if (res.code === 0) {
if (res.data.AccountParam[0].value === 1) {
ticket = getTicket();
ticket = ticketData.current;
}
const parma = res.data.AccountParam[0].value === 1 ? ticket : window.globalConfig.token;
if (res.data.siteType === 1) {
......@@ -83,7 +97,7 @@ const IntegratedLogin = props => {
if (res.data.IntranetAddress) {
url = res.data.IntranetAddress;
} else {
this.$message.error('请配置内网地址');
Message.error('请配置内网地址');
url = res.data.InternetAddress;
return;
}
......@@ -108,16 +122,19 @@ const IntegratedLogin = props => {
} else {
setLoading(false);
notification.error({
message: '提交失败',
description: res.message,
message: '提示',
duration: 3,
description: res.msg,
});
}
});
})
.catch(error => {});
};
useEffect(() => {
getTicket();
getSiteConfig();
}, [getSiteConfig]);
}, []);
return (
<div className={styles.IntegratedLogin}>
......
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