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

feat: 修改集成登录

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