Commit 9c19b664 authored by 皮倩雯's avatar 皮倩雯

fix: '集成登录网站配置'

parent 7c2c8f2f
Pipeline #54560 passed with stages
......@@ -185,7 +185,7 @@ const AddModal = props => {
marginTop: 8,
}}
>
Upload
上传
</div>
</div>
);
......
......@@ -302,7 +302,7 @@ const Integrate = () => {
新增
</Button>
</div>
{/* <Button
<Button
type="primary"
onClick={masterStation}
style={{
......@@ -310,8 +310,8 @@ const Integrate = () => {
verticalAlign: 'middle',
}}
>
网站配置
</Button> */}
集成登录网站配置
</Button>
</div>
<Spin spinning={loading} tip="loading">
<div className={styles.table}>
......
......@@ -3,9 +3,8 @@
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, notification, Button, message, Upload, Select, Col, Row } from 'antd';
import {
AddIntegratedLogin,
EditIntegratedLogin,
SaveSystemInfo,
AddIntegratedloginSetting,
GetIntegratedloginSetting,
} from '@/services/integratedLogin/api';
import { PlusOutlined, LoadingOutlined } from '@ant-design/icons';
import { get, PUBLISH_SERVICE } from '@/services';
......@@ -36,16 +35,30 @@ const Master = props => {
const [form] = Form.useForm();
const [imgBed, setImgBed] = useState();
const [imageUrl, setImageUrl] = useState();
const [im, setIm] = useState();
const [previewModal, setPreviewModal] = useState(false);
const [keepImgeUrl, setKeepImgeUrl] = useState('');
useEffect(() => {
if (visible) {
// SaveSystemInfo({})
GetIntegratedloginSetting().then(res => {
if (res.code === 0) {
console.log(res.data);
form.setFieldsValue(res.data);
setImageUrl(window.location.origin + `/${res.data.logo}`);
setIm(res.data.logo);
} else {
form.setFieldsValue({
primaryColor: '#0087F7',
});
}
});
} else {
setImageUrl('');
setIm('');
setKeepImgeUrl('');
form.resetFields();
}
}, [visible]);
// 提交
......@@ -54,75 +67,29 @@ const Master = props => {
console.log(obj);
form.validateFields().then(validate => {
if (validate) {
// setLoading(true);
SaveSystemInfo({
configName: '集成登录网站配置',
configValue: JSON.stringify(obj),
}).then(res => {
if (res.data == 0) {
console.log(res.data);
AddIntegratedloginSetting({
...obj,
})
.then(res => {
if (res.code === 0) {
onCancel();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: res.msg || '操作成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg || '操作失败',
});
}
})
.catch(err => {
console.log(err);
});
// if (obj.iconUrl.file) {
// obj.iconUrl = obj.iconUrl.file.response.data;
// }
// if (type === 'add') {
// AddIntegratedLogin({
// ...obj,
// accountType: 'Panda',
// })
// .then(res => {
// if (res.code === 0) {
// onCancel();
// setLoading(false);
// callBackSubmit();
// notification.success({
// message: '提示',
// duration: 3,
// description: res.msg || '新增成功',
// });
// } else {
// setLoading(false);
// notification.error({
// message: '提示',
// duration: 3,
// description: res.msg || '新增失败',
// });
// }
// })
// .catch(err => {
// setLoading(false);
// });
// } else {
// EditIntegratedLogin({
// ...obj,
// accountType: 'Panda',
// id: pickItem.ID,
// })
// .then(res => {
// if (res.code === 0) {
// onCancel();
// setLoading(false);
// callBackSubmit();
// notification.success({
// message: '提示',
// duration: 3,
// description: res.msg || '编辑成功',
// });
// } else {
// setLoading(false);
// notification.error({
// message: '提示',
// duration: 3,
// description: res.msg || '编辑失败',
// });
// }
// })
// .catch(err => {
// setLoading(false);
// });
// }
}
});
};
......@@ -150,6 +117,8 @@ const Master = props => {
};
const handleChange = info => {
setKeepImgeUrl('');
setIm('');
if (info.file.status === 'uploading') {
setLoading(true);
return;
......@@ -177,7 +146,7 @@ const Master = props => {
marginTop: 8,
}}
>
Upload
上传
</div>
</div>
);
......@@ -191,6 +160,7 @@ const Master = props => {
console.log(props.path);
console.log(process.env.PROXY);
setImageUrl(window.location.origin + `/${props.path}`);
setIm(props.path);
setKeepImgeUrl(props.path);
form.setFieldsValue({ logo: `${props.path}` });
}
......@@ -198,7 +168,7 @@ const Master = props => {
return (
<Modal
title="站配置"
title="集成登录网站配置"
style={{ top: '150px' }}
width="700px"
destroyOnClose
......@@ -223,7 +193,16 @@ const Master = props => {
>
<Input placeholder="请输入标题" autoComplete="off" />
</Item>
<Item label="副标题" name="subtitle">
<Item
label="副标题"
name="subtitle"
rules={[
{
required: true,
message: '标题为必填项',
},
]}
>
<Input placeholder="请输入副标题" autoComplete="off" />
</Item>
<Row>
......@@ -296,6 +275,8 @@ const Master = props => {
onCancel={() => {
setPreviewModal(false);
}}
imageUrl={im}
keepImgeUrl={keepImgeUrl}
callBackSubmit={onOk}
/>
</Modal>
......
......@@ -2,7 +2,7 @@
* @Description:
* @Author: leizhe
* @Date: 2022-06-09 10:01:10
* @LastEditTime: 2022-07-04 18:05:57
* @LastEditTime: 2022-07-05 10:26:56
* @LastEditors: leizhe
*/
import { get, post, PUBLISH_SERVICE, CITY_SERVICE } from '@/services/index';
......@@ -24,3 +24,11 @@ export const GetIntegratedloginIcon = param =>
get(`${PUBLISH_SERVICE}/GetIntegratedloginIcon`, param);
export const SaveSystemInfo = param => get(`${PUBLISH_SERVICE}/HostManager/SaveSystemInfo`, param);
// 集成登录-添加集成登录网站配置
export const AddIntegratedloginSetting = param =>
post(`${PUBLISH_SERVICE}/AddIntegratedloginSetting`, param);
// 集成登录-获取集成登录网站配置
export const GetIntegratedloginSetting = param =>
get(`${PUBLISH_SERVICE}/GetIntegratedloginSetting`, param);
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