Commit fa6eb9e9 authored by 周宏民's avatar 周宏民

pref: 修改 集成登录配置

parent d2045d42
Pipeline #93665 passed with stages
......@@ -162,6 +162,8 @@ const IntegrationNew = props => {
if (item?.openOpt === '当前页打开') {
props.history.push('/thirdParty', { linkUrl: apiPath });
} else {
setJumpLoading(false);
jumpProgressEnd();
window.open(apiPath, '_blank');
}
} else {
......@@ -178,7 +180,7 @@ const IntegrationNew = props => {
const toClient = async (item, loginA) => {
const token = props.global?.token || Cookies.get('token');
const cli = item.appKey;
const cli = item.client;
const res = await getWebSiteConfig({
identity: token,
client: cli,
......@@ -229,9 +231,9 @@ const IntegrationNew = props => {
props.logout();
return;
}
const { url, appKey } = item;
const { url, client } = item;
if (item.subType === '内链' && appKey) {
if (item.subType === '内链' && client) {
toClient(item, loginA);
} else {
if (!url) return;
......@@ -247,6 +249,8 @@ const IntegrationNew = props => {
if (item?.openOpt === '当前页打开') {
props.history.push('/thirdParty', { linkUrl: link });
} else {
setJumpLoading(false);
jumpProgressEnd();
window.open(link, '_blank');
}
}
......
......@@ -37,7 +37,6 @@ const AddModal = props => {
const [imageType, setImageType] = useState('');
const [previewModal, setPreviewModal] = useState(false);
const [keepImgeUrl, setKeepImgeUrl] = useState('');
const [fileList, setFileList] = useState([]);
const [isVisibleRoles, setIsVisibleRoles] = useState(false);
const [groupName, setGroupName] = useState('角色');
const [chooseGroupName, setChooseGroupName] = useState(['角色']);
......@@ -83,20 +82,6 @@ const AddModal = props => {
setLoading(true);
const obj = form.getFieldsValue();
let data = [];
if (obj.coordinate) {
data = obj.coordinate.split(',');
}
const dataList = [];
if (fileList.length > 0) {
fileList.map(i => {
if (i.submitUrl) {
dataList.push(i.submitUrl);
} else {
dataList.push(i.response.data);
}
});
}
if (!imageUrl) {
message.error('请选择图标!');
return;
......@@ -107,7 +92,7 @@ const AddModal = props => {
.SaveIntegrationConfig({
name: obj.name,
type: targetType,
url: obj.url,
url: obj.url || '',
roles: keepIds?.join(',') || '',
icon: imageUrl,
userId: window.globalConfig.userInfo.OID,
......@@ -120,6 +105,7 @@ const AddModal = props => {
openOpt: obj.openOpt || '',
backgroundImage: imageBgUrl,
subTitle: obj.subTitle || '',
client: obj.client || '',
})
.then(res => {
if (res.code === 0) {
......@@ -149,7 +135,7 @@ const AddModal = props => {
id: pickItem.id,
name: obj.name,
type: pickItem.type,
url: obj.url,
url: obj.url || '',
roles: keepIds === null ? pickItem.roles : keepIds.join(','),
icon: imageUrl,
userId: window.globalConfig.userInfo.OID,
......@@ -162,6 +148,7 @@ const AddModal = props => {
openOpt: obj.openOpt || '',
backgroundImage: imageBgUrl,
subTitle: obj.subTitle || '',
client: obj.client || '',
})
.then(res => {
if (res.code === 0) {
......@@ -270,7 +257,11 @@ const AddModal = props => {
setKeepImgeUrl(img);
setPreviewModal(true);
};
const onChangeSubType = e => {
if (e.target.value === '外链') {
form.setFieldsValue({ openOpt: pickItem.openOpt || '当前页打开' });
}
};
const onOkImg = val => {
if (val) {
if (imageType === 'backgroundImage') {
......@@ -347,6 +338,7 @@ const AddModal = props => {
openOpt = '',
backgroundImage,
subTitle,
client,
} = pickItem;
form.setFieldsValue({
paramName,
......@@ -362,12 +354,13 @@ const AddModal = props => {
openOpt: openOpt || '',
backgroundImage,
subTitle,
client,
});
setImageUrl(icon || '');
setImageBgUrl(backgroundImage || '');
} else {
form.setFieldsValue({
paramValue: 'ticket',
paramValue: '',
target: 0,
mapSetting: '',
coordinate: '',
......@@ -376,7 +369,6 @@ const AddModal = props => {
});
}
} else {
setFileList([]);
setImageUrl('');
setKeepImgeUrl('');
form.resetFields();
......@@ -545,20 +537,30 @@ const AddModal = props => {
</Item>
</Col>
</Row>
<Item label="链接类型" name="subType" initialValue="内链">
<Radio.Group>
<Item
label="链接类型"
name="subType"
initialValue="内链"
rules={[{ required: true, message: '请选择链接类型' }]}
>
<Radio.Group onChange={onChangeSubType}>
<Radio value="内链">站内跳转</Radio>
<Radio value="外链">站外跳转</Radio>
<Radio value="自定义">自定义</Radio>
{/* <Radio value="自定义">自定义</Radio> */}
</Radio.Group>
</Item>
{subTypes !== '内链' ? (
<>
{' '}
<Item label="跳转方式" name="openOpt" initialValue="打开新链接">
<Item
label="跳转方式"
name="openOpt"
initialValue="打开新链接"
rules={[{ required: true, message: '请选择打开新链接' }]}
>
<Radio.Group>
<Radio value="新窗口打开">新窗口打开</Radio>
<Radio value="当前页打开">当前页打开</Radio>
<Radio value="新窗口打开">新窗口打开</Radio>
</Radio.Group>
</Item>
<Item label="地址" name="url" rules={[{ required: true, message: '请输入站点路径' }]}>
......@@ -570,69 +572,109 @@ const AddModal = props => {
labelCol={{ span: 8 }}
label="参数名"
name="paramName"
tooltip={{
title: '直接跳转,不需要填该参数,若与每三方对接,需要该参数',
icon: <InfoCircleOutlined />,
}}
// rules={[{ required: true, message: '请输入参数' }]}
>
<Input allowClear placeholder="请填写站点参数" />
</Item>
</Col>
<Col span={10}>
<Item label="参数值" labelCol={{ span: 7 }} name="paramValue">
<Item
label="参数值"
labelCol={{ span: 7 }}
name="paramValue"
tooltip={{
title: '直接跳转,不需要填该参数,若与第三方对接,需要该参数,若跳转捷普营收,请选择ticket',
icon: <InfoCircleOutlined />,
}}
>
<Select placeholder="请选择参数值">
<Option value="ticket">ticket</Option>
<Option value="ticket" />
<Option value="token">token</Option>
</Select>
</Item>
</Col>
</Row>
{
<>
<Item
label="AppKey"
name="appKey"
className={styles.disabledInput}
// rules={[{ required: true, message: '请输入参数' }]}
>
<Input disabled={type === 'edit'} placeholder="请输入自定义的AppKey,提交后不可变更" />
</Item>
<Item
label="AppSecret"
name="appSecret"
className={styles.disabledInput}
// rules={[{ required: true, message: '请输入AppKey,或点击刷新按钮重新获取AppSecret' }]}
>
<Input
disabled
placeholder="请点击按钮生成AppSecret"
suffix={
<Tooltip title="点击按钮重新生成AppSecret">
<RedoOutlined
style={{ fontSize: 'bold', color: 'rgba(25,128,255,0.74)' }}
onClick={refreshAppSecret}
/>
</Tooltip>
}
/>
</Item>
</>
}
<Item label="白名单" name="whiteList">
{/* <Item
label="AppKey"
name="appKey"
className={styles.disabledInput}
// rules={[{ required: true, message: '请输入参数' }]}
>
<Input placeholder="请输入自定义的AppKey," />
</Item> */}
{/* <Item
label="AppSecret"
name="appSecret"
className={styles.disabledInput}
// rules={[{ required: true, message: '请输入AppKey,或点击刷新按钮重新获取AppSecret' }]}
>
<Input
disabled
placeholder="请点击按钮生成AppSecret"
suffix={
<Tooltip title="点击按钮重新生成AppSecret">
<RedoOutlined
style={{ fontSize: 'bold', color: 'rgba(25,128,255,0.74)' }}
onClick={refreshAppSecret}
/>
</Tooltip>
}
/>
</Item> */}
{/* <Item label="白名单" name="whiteList">
<TextArea rows={3} />
</Item>
</Item> */}
</>
) : (
<Item
label="AppKey"
name="appKey"
className={styles.disabledInput}
rules={[{ required: true, message: '请输入参数' }]}
>
<Input disabled={type === 'edit'} placeholder="请输入网站client,提交后不可变更" />
</Item>
<>
<Item label="client" name="client" rules={[{ required: true, message: '请输入网站client' }]}>
<Input placeholder="请输入网站client" />
</Item>
<Item
label="地址"
name="url"
tooltip={{
title: '默认访问功能地址,不填则默认跳转当前网站首页',
icon: <InfoCircleOutlined />,
}}
>
<AutoComplete placeholder="请输入默认访问功能地址" allowClear />
</Item>
{/* <Item
label="client"
name="appKey"
className={styles.disabledInput}
tooltip={{
title: '对应网站client',
icon: <InfoCircleOutlined />,
}}
rules={[{ required: true, message: '请输入参数' }]}
>
<Input placeholder="请输入网站client" />
</Item> */}
{/* <Item
label="地址"
name="url"
tooltip={{
title: '默认访问功能地址,不填则默认跳转当前网站首页',
icon: <InfoCircleOutlined />,
}}
>
<AutoComplete placeholder="请输入默认访问功能地址" allowClear />
</Item> */}
</>
)}
<Item
label="AppKey"
name="appKey"
tooltip={{
title: '自定义集成登录页中,对应关系使用',
icon: <InfoCircleOutlined />,
}}
>
<Input placeholder="请输入" />
</Item>
</Form>
<PreviewModal
visible={previewModal}
......
......@@ -76,7 +76,7 @@ const IntegratedLogin = props => {
dataIndex: 'icon',
key: 'icon',
align: 'center',
width: 120,
width: 100,
render: (text, record) => {
if (text) {
return (
......@@ -109,23 +109,31 @@ const IntegratedLogin = props => {
{
title: '链接类型',
dataIndex: 'subType',
width: 120,
width: 100,
align: 'center',
render: (text, record) => subTypeMap[text] || '',
render: (text, record) => {
if (text === '内链') {
return (
<>
<span style={{ color: '#1685ff' }}>{record.client || ''}</span>(站内)
</>
);
}
return '站外跳转';
},
},
{
title: 'APPKey',
dataIndex: 'appKey',
width: 120,
title: '地址',
dataIndex: 'url',
width: 250,
align: 'center',
},
{
title: '地址',
dataIndex: 'url',
width: 200,
title: 'AppKey',
dataIndex: 'appKey',
width: 100,
align: 'center',
},
{
title: '操作',
key: 'action',
......@@ -252,15 +260,15 @@ const IntegratedLogin = props => {
if (res.code === 0) {
const _allName = [];
const _groupList = [];
res.data.forEach(item => {
const data = res.data || [];
data.forEach(item => {
const _name = item.name;
_allName.push(_name);
_groupList.push({ value: _name, label: _name });
});
setGroupList(_groupList);
setKeepSystemName(_allName);
setTableData(res.data.sort((a, b) => a.index - b.index));
setTableData(data.sort((a, b) => a.index - b.index));
} else {
res.msg && message.error(res.msg);
}
......
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