Commit 7c2c8f2f authored by 皮倩雯's avatar 皮倩雯

fix: '修复图片库交互bug'

parent 604c08f5
Pipeline #54554 waiting for manual action with stages
...@@ -15,6 +15,7 @@ const AddModal = props => { ...@@ -15,6 +15,7 @@ const AddModal = props => {
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
const [form] = Form.useForm(); const [form] = Form.useForm();
const [imageUrl, setImageUrl] = useState(); const [imageUrl, setImageUrl] = useState();
const [im, setIm] = useState();
const [previewModal, setPreviewModal] = useState(false); const [previewModal, setPreviewModal] = useState(false);
const [keepImgeUrl, setKeepImgeUrl] = useState(''); const [keepImgeUrl, setKeepImgeUrl] = useState('');
...@@ -38,16 +39,19 @@ const AddModal = props => { ...@@ -38,16 +39,19 @@ const AddModal = props => {
// setImageUrl(`http://192.168.12.116:8017/${pickItem.iconUrl}`); // setImageUrl(`http://192.168.12.116:8017/${pickItem.iconUrl}`);
// } else { // } else {
setImageUrl(window.location.origin + `/${pickItem.iconUrl}`); setImageUrl(window.location.origin + `/${pickItem.iconUrl}`);
setIm(pickItem.iconUrl);
// } // }
} else { } else {
form.setFieldsValue({ iconUrl: '' }); form.setFieldsValue({ iconUrl: '' });
setImageUrl(''); setImageUrl('');
setIm('');
} }
} else { } else {
// form.setFieldsValue({ method: 'Get' }); // form.setFieldsValue({ method: 'Get' });
} }
} else { } else {
setImageUrl(''); setImageUrl('');
setIm('');
setKeepImgeUrl(''); setKeepImgeUrl('');
form.resetFields(); form.resetFields();
} }
...@@ -152,6 +156,8 @@ const AddModal = props => { ...@@ -152,6 +156,8 @@ const AddModal = props => {
}; };
const handleChange = info => { const handleChange = info => {
setKeepImgeUrl('');
setIm('');
if (info.file.status === 'uploading') { if (info.file.status === 'uploading') {
setLoading(true); setLoading(true);
return; return;
...@@ -193,6 +199,7 @@ const AddModal = props => { ...@@ -193,6 +199,7 @@ const AddModal = props => {
console.log(props.path); console.log(props.path);
console.log(process.env.PROXY); console.log(process.env.PROXY);
setImageUrl(window.location.origin + `/${props.path}`); setImageUrl(window.location.origin + `/${props.path}`);
setIm(props.path);
setKeepImgeUrl(props.path); setKeepImgeUrl(props.path);
form.setFieldsValue({ iconUrl: `${props.path}` }); form.setFieldsValue({ iconUrl: `${props.path}` });
} }
...@@ -314,7 +321,7 @@ const AddModal = props => { ...@@ -314,7 +321,7 @@ const AddModal = props => {
onCancel={() => { onCancel={() => {
setPreviewModal(false); setPreviewModal(false);
}} }}
imageUrl={type == 'edit' ? pickItem.iconUrl : ''} imageUrl={im}
keepImgeUrl={keepImgeUrl} keepImgeUrl={keepImgeUrl}
callBackSubmit={onOk} callBackSubmit={onOk}
/> />
......
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
/* eslint-disable react/jsx-boolean-value */ /* eslint-disable react/jsx-boolean-value */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, notification, Button, message, Upload, Select, Col, Row } from 'antd'; import { Form, Modal, Input, notification, Button, message, Upload, Select, Col, Row } from 'antd';
import { AddIntegratedLogin, EditIntegratedLogin } from '@/services/integratedLogin/api'; import {
AddIntegratedLogin,
EditIntegratedLogin,
SaveSystemInfo,
} from '@/services/integratedLogin/api';
import { PlusOutlined, LoadingOutlined } from '@ant-design/icons'; import { PlusOutlined, LoadingOutlined } from '@ant-design/icons';
import { get, PUBLISH_SERVICE } from '@/services'; import { get, PUBLISH_SERVICE } from '@/services';
import PreviewModal from './PreviewModal'; import PreviewModal from './PreviewModal';
...@@ -33,9 +37,11 @@ const Master = props => { ...@@ -33,9 +37,11 @@ const Master = props => {
const [imgBed, setImgBed] = useState(); const [imgBed, setImgBed] = useState();
const [imageUrl, setImageUrl] = useState(); const [imageUrl, setImageUrl] = useState();
const [previewModal, setPreviewModal] = useState(false); const [previewModal, setPreviewModal] = useState(false);
const [keepImgeUrl, setKeepImgeUrl] = useState('');
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
// SaveSystemInfo({})
form.setFieldsValue({ form.setFieldsValue({
primaryColor: '#0087F7', primaryColor: '#0087F7',
}); });
...@@ -44,9 +50,20 @@ const Master = props => { ...@@ -44,9 +50,20 @@ const Master = props => {
// 提交 // 提交
const onSubmit = () => { const onSubmit = () => {
let obj = form.getFieldsValue();
console.log(obj);
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
setLoading(true); // setLoading(true);
SaveSystemInfo({
configName: '集成登录网站配置',
configValue: JSON.stringify(obj),
}).then(res => {
if (res.data == 0) {
console.log(res.data);
}
});
// if (obj.iconUrl.file) { // if (obj.iconUrl.file) {
// obj.iconUrl = obj.iconUrl.file.response.data; // obj.iconUrl = obj.iconUrl.file.response.data;
// } // }
...@@ -169,7 +186,15 @@ const Master = props => { ...@@ -169,7 +186,15 @@ const Master = props => {
setPreviewModal(true); setPreviewModal(true);
}; };
const onOk = () => {}; const onOk = props => {
if (props) {
console.log(props.path);
console.log(process.env.PROXY);
setImageUrl(window.location.origin + `/${props.path}`);
setKeepImgeUrl(props.path);
form.setFieldsValue({ logo: `${props.path}` });
}
};
return ( return (
<Modal <Modal
......
...@@ -33,30 +33,30 @@ const PreviewModal = props => { ...@@ -33,30 +33,30 @@ const PreviewModal = props => {
GetIntegratedloginIcon() GetIntegratedloginIcon()
.then(res => { .then(res => {
if (res.code === 0) { if (res.code === 0) {
setImgData(res.data); let bb = [];
res.data.map(i => {
if (i.files.length > 0) {
bb.push(i);
}
});
setImgData(bb);
let aa = []; let aa = [];
res.data.map(i => { res.data.map(i => {
aa.push(i.groupName); aa.push(i.groupName);
i.files.map((j, index) => { i.files.map((j, index) => {
if (keepImgeUrl) { if (keepImgeUrl) {
if (j.path == keepImgeUrl) { if (j.path == keepImgeUrl) {
console.log(keepImgeUrl);
console.log(8);
setKeepItem(i.groupName); setKeepItem(i.groupName);
setPickItem(index); setPickItem(index);
} }
} else { } else {
if (j.path == imageUrl) { if (j.path == imageUrl) {
console.log(imageUrl);
console.log(9);
setKeepItem(i.groupName); setKeepItem(i.groupName);
setPickItem(index); setPickItem(index);
} }
} }
}); });
}); });
console.log(aa);
setKeepGroupName(aa); setKeepGroupName(aa);
} else { } else {
notification.error({ notification.error({
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: * @Description:
* @Author: leizhe * @Author: leizhe
* @Date: 2022-06-09 10:01:10 * @Date: 2022-06-09 10:01:10
* @LastEditTime: 2022-07-01 11:21:53 * @LastEditTime: 2022-07-04 18:05:57
* @LastEditors: leizhe * @LastEditors: leizhe
*/ */
import { get, post, PUBLISH_SERVICE, CITY_SERVICE } from '@/services/index'; import { get, post, PUBLISH_SERVICE, CITY_SERVICE } from '@/services/index';
...@@ -22,3 +22,5 @@ export const DelIntegratedLogin = param => get(`${PUBLISH_SERVICE}/DelIntegrated ...@@ -22,3 +22,5 @@ export const DelIntegratedLogin = param => get(`${PUBLISH_SERVICE}/DelIntegrated
// 集成登录-获取集成登录项目下的默认图标 // 集成登录-获取集成登录项目下的默认图标
export const GetIntegratedloginIcon = param => export const GetIntegratedloginIcon = param =>
get(`${PUBLISH_SERVICE}/GetIntegratedloginIcon`, param); get(`${PUBLISH_SERVICE}/GetIntegratedloginIcon`, param);
export const SaveSystemInfo = param => get(`${PUBLISH_SERVICE}/HostManager/SaveSystemInfo`, 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