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