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

fix: '优化配置'

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