Commit 71d18457 authored by 李纪文's avatar 李纪文

feat: 修改集成登录

parent c5bd603a
Pipeline #89926 waiting for manual action with stages
......@@ -48,7 +48,11 @@ const IntegratedSwitch = props => {
appService.getTicketByToken({ token: window.globalConfig?.token }).then(res => {
if (res.code === 0) {
const url = `${item.url + (item.url.indexOf('?') > 0 ? '&' : '?') + item.paramName}=${res.data}`;
window.open(url, '_blank');
if (item?.openOpt === '当前页打开') {
history.push('/thirdParty', { linkUrl: url });
} else {
window.open(url, '_blank');
}
} else {
notification.error({
message: '提示',
......@@ -59,7 +63,11 @@ const IntegratedSwitch = props => {
});
} else {
const url = `${item.url + (item.url.indexOf('?') > 0 ? '&' : '?') + item.paramName}=${window.globalConfig?.token}`;
window.open(url, '_blank');
if (item?.openOpt === '当前页打开') {
history.push('/thirdParty', { linkUrl: url });
} else {
window.open(url, '_blank');
}
}
} else if (item.subType === '内链') {
if (window.qiankunIsCache) {
......@@ -103,7 +111,11 @@ const IntegratedSwitch = props => {
dataType: 'json',
}).then(res => {
if (res?.data?.code === 0) {
history.push('/thirdParty', { linkUrl: res.data?.data });
if (item?.openOpt === '当前页打开') {
history.push('/thirdParty', { linkUrl: res.data?.data });
} else {
window.open(res.data?.data, '_blank');
}
}
});
}
......
......@@ -744,7 +744,8 @@ const Layout = props => {
headerSiteRender={() =>
window?.globalConfig?.isIntegration >= 1
?
renderIntegration(integrationData, loginAction, props)
// renderIntegration(integrationData, loginAction, props)
null
:
renderSite({
data: cityData,
......
......@@ -43,13 +43,17 @@ const Integration = props => {
}, 0);
}, 3000);
if (item.subType == '外链') {
if (item.paramValue == 'ticket') {
if (item.subType === '外链') {
if (item.paramValue === 'ticket') {
// 获取临时token
appService.getTicketByToken({ token: window.globalConfig?.token }).then(res => {
if (res.code === 0) {
const url = `${item.url + (item.url.indexOf('?') > 0 ? '&' : '?') + item.paramName}=${res.data}`;
window.open(url, '_blank');
if (item?.openOpt === '当前页打开') {
props.history.push('/thirdParty', { linkUrl: url });
} else {
window.open(url, '_blank');
}
} else {
notification.error({
message: '提示',
......@@ -62,9 +66,13 @@ const Integration = props => {
const url = `${item.url + (item.url.indexOf('?') > 0 ? '&' : '?') + item.paramName}=${
window.globalConfig?.token
}`;
window.open(url, '_blank');
if (item?.openOpt === '当前页打开') {
props.history.push('/thirdParty', { linkUrl: url });
} else {
window.open(url, '_blank');
}
}
} else if (item.subType == '内链') {
} else if (item.subType === '内链') {
if (window.qiankunIsCache) {
store.set('event:dropCache');
}
......@@ -108,7 +116,11 @@ const Integration = props => {
}).then(res => {
if (res?.data?.code === 0) {
// window.location.href = res.data?.data;
props.history.push('/thirdParty', { linkUrl: res.data?.data });
if (item?.openOpt === '当前页打开') {
props.history.push('/thirdParty', { linkUrl: res.data?.data });
} else {
window.open(res.data?.data, '_blank');
}
}
});
}
......
......@@ -33,6 +33,7 @@ const AddModal = props => {
const [radio, setRadio] = useState();
const [identity, setIdentity] = useState(0);
const [form] = Form.useForm();
const subTypes = Form.useWatch('subType', form);
const [imageUrl, setImageUrl] = useState();
const [im, setIm] = useState();
const [previewModal, setPreviewModal] = useState(false);
......@@ -60,7 +61,19 @@ const AddModal = props => {
setRadio(pickItem.target != 0);
setIdentity(pickItem.siteType);
setAccount(pickItem.accountType);
const { paramName, paramValue, url, name, icon, roles, appKey, appSecret, whiteList, subType } = pickItem;
const {
paramName,
paramValue,
url,
name,
icon,
roles,
appKey,
appSecret,
whiteList,
subType,
openOpt = '',
} = pickItem;
form.setFieldsValue({
paramName,
paramValue,
......@@ -72,6 +85,7 @@ const AddModal = props => {
appKey,
appSecret,
whiteList,
openOpt: openOpt || '',
});
if (pickItem.images && pickItem.images.length > 0) {
const arr = [];
......@@ -138,7 +152,8 @@ const AddModal = props => {
const data = pickItem.roles.split(',');
const newData = [];
data.forEach(item => {
newData.push(aa.角色.find(i => i.value == item).label);
const list = aa.角色.find(i => i.value === item);
if (list) newData.push(list.label);
});
form.setFieldsValue({ roles: newData.toString() });
}
......@@ -236,6 +251,7 @@ const AddModal = props => {
appSecret: obj.appSecret,
whiteList: obj.whiteList,
subType: obj.subType,
openOpt: obj.openOpt || '',
})
.then(res => {
if (res.code === 0) {
......@@ -275,6 +291,7 @@ const AddModal = props => {
appKey: obj.appKey,
appSecret: obj.appSecret,
subType: obj.subType,
openOpt: obj.openOpt || '',
})
.then(res => {
if (res.code === 0) {
......@@ -557,6 +574,14 @@ const AddModal = props => {
<Radio value="自定义">自定义</Radio>
</Radio.Group>
</Item>
{subTypes !== '内链' ? (
<Item label="跳转方式" name="openOpt" initialValue="打开新链接">
<Radio.Group>
<Radio value="新窗口打开">新窗口打开</Radio>
<Radio value="当前页打开">当前页打开</Radio>
</Radio.Group>
</Item>
) : null}
<Item label="地址" name="url" rules={[{ required: true, message: '请输入站点路径' }]}>
<AutoComplete placeholder="请输入可以访问的链接,需要与下方的链接类型对应" allowClear />
</Item>
......
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