Commit 00db07f4 authored by 徐乐's avatar 徐乐

feat: 修改

parent 8703dbfb
......@@ -227,76 +227,6 @@ const renderSite = ({ data, config, loading, setLoading, action, actionRef, setM
);
};
// const renderIntegration = (inData, loginAction, props) => {
// const [visible, setVisible] = useState(false);
// if (inData.length <= 1) {
// return <></>
// }
// let choiceOne = inData?.find(function (a) {
// return a.url?.indexOf(window?.globalConfig?.client) >= 0
// })
// //切换集成站点
// const checkIntegration = (val, loginAction, props) => {
// if (val.subType == '外链') {
// window.open(val.url, "_blank");
// } else {
// let cli = val.url?.indexOf('client=') >= 0 ? val.url.split('client=')[1] : '';
// const config = props.global;
// config.uiwidgets = [];
// config.widgets = [];
// config.allWidgets = [];
// if (cli) {
// config.client = cli;
// }
// props.instance && props.instance.updateConfig(config);
// loginAction && loginAction.getUserInfoAndConfig('', true, val.type, cli);
// // props.history.push(`/?client=${cli}`);
// // props.updateCurrentIndex(0);
// // defaultApp();
// }
// }
// return (
// <>
// <Popover
// placement="bottomLeft"
// trigger="click"
// visible={visible}
// content={
// <div className={layoutStyles.integrationList}>
// {
// inData && inData.map((val) => (
// <p onClick={() => checkIntegration(val, loginAction, props)}>{val.name}</p>
// ))
// }
// </div>
// }
// arrowPointAtCenter
// overlayClassName={classNames(layoutStyles.stationsWrapper, layoutStyles.stationsTop2)}
// onVisibleChange={visible => setVisible(visible)}
// >
// {inData.length > 1 ? (
// <div className={layoutStyles.toggleSite}>
// <img src={require('../assets/basic/site.png')} className={layoutStyles.site} />
// <span className={layoutStyles.name}>{choiceOne?.name ?? ''}</span>
// <ArrowIcon
// className={layoutStyles.arrow}
// style={{
// transform: !visible ? `rotate(0deg)` : `rotate(180deg)`,
// }}
// />
// </div>
// ) : null}
// </Popover>
// </>
// )
// }
// import defaultProps from '../defaultProps';
const pickRoutes = memoized((routes, pathname, locale) => {
const matches = matchRoutes(routes, { pathname });
......@@ -561,7 +491,27 @@ const Layout = props => {
//切换集成站点
const checkIntegration = (val, loginAction, props) => {
if (val.subType == '外链') {
window.open(val.url, "_blank");
if (val.paramValue == 'ticket') {
//获取临时token
appService.getTicketByToken({ token: window.globalConfig?.token }).then(res => {
if (res.code === 0) {
setVisible(false);
let url = val.url + (val.url.indexOf('?') > 0 ? '&' : '?') + val.paramName + '=' + res.data;
window.open(url, "_blank");
} else {
setVisible(false);
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
} else {
setVisible(false);
let url = val.url + (val.url.indexOf('?') > 0 ? '&' : '?') + val.paramName + '=' + window.globalConfig?.token;
window.open(url, "_blank");
}
} else {
let cli = val.url?.indexOf('client=') >= 0 ? val.url.split('client=')[1] : '';
setIntegrationLoading(true);
......
......@@ -41,7 +41,24 @@ const Integration = props => {
}, 3000);
if (item.subType == '外链') {
window.open(item.url, "_blank");
if (item.paramValue == 'ticket') {
//获取临时token
appService.getTicketByToken({ token: window.globalConfig?.token }).then(res => {
if (res.code === 0) {
let url = item.url + (item.url.indexOf('?') > 0 ? '&' : '?') + item.paramName + '=' + res.data;
window.open(url, "_blank");
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
} else {
let url = item.url + (item.url.indexOf('?') > 0 ? '&' : '?') + item.paramName + '=' + window.globalConfig?.token;
window.open(url, "_blank");
}
} else {
let cli = item.url?.indexOf('client=') >= 0 ? item.url.split('client=')[1] : '';
setClient(cli);
......
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