Commit a9b87c90 authored by cellee's avatar cellee

解决编辑小区的时候重复添加到列表、图片返回值问题

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent b048b758
......@@ -105,13 +105,15 @@ const Adds = (props: any) => {
// 提交成功与否
useEffect(() => {
if (Result != null) {
// 更新本地小区
// 如果不是编辑的话就更新本地小区
if (!Data) {
dispatch({ type: 'Init/addCommunityget', playload: { Result: new Array(Result.data) } });
}
// 提示跳转
message.success(`Information saved successfully!`);
history.push('/CommunityManagement/CellList');
}
}, [Result]);
}, [Result, Data]);
// 监听编辑预览是否获取到地址以及发生改变
useEffect(() => {
......@@ -178,7 +180,8 @@ const Adds = (props: any) => {
onChange({ file }: any) {
file.status === 'uploading' ? setimgLoad(true) : setimgLoad(false);
if (file.status === 'done') {
setLouba(BackFormat(file.name, file.response.data));
let data = file.response.data;
setLouba(BackFormat(data.imageName, data.url));
setcodeStrat(true);
setTipMain('Binding Content Already Exists, Cannot Be Modified!');
}
......@@ -192,7 +195,8 @@ const Adds = (props: any) => {
onChange({ file, fileList }: any) {
file.status === 'uploading' ? setimgLoad(true) : setimgLoad(false);
if (file.status === 'done') {
setGuide(BackFormat(file.name, file.response.data));
let data = file.response.data;
setGuide(BackFormat(data.imageName, data.url));
setcodeStrat(true);
setTipMain('Binding Content Already Exists, Cannot Be Modified!');
}
......@@ -206,7 +210,8 @@ const Adds = (props: any) => {
onChange({ file }: any) {
file.status === 'uploading' ? setimgLoad(true) : setimgLoad(false);
if (file.status === 'done') {
setPeriod(BackFormat(file.name, file.response.data));
let data = file.response.data;
setPeriod(BackFormat(data.imageName, data.url));
setcodeStrat(true);
setTipMain('Binding Content Already Exists, Cannot Be Modified!');
}
......
......@@ -64,6 +64,7 @@ const Add = (props: any) => {
// 监听图片状态 ImgSrc
useEffect(() => {
if (ImgSrc) {
console.log(ImgSrc);
let a = ImgSrc.map((item: any) => {
let key = Object.keys(item)[0];
return {
......
......@@ -224,13 +224,14 @@ const ContractContent = (props: any) => {
if (file.status === 'done') {
message.success(file.name + ' Upload Successful !');
let data = file.response.data;
// 实现在线预览
let obj = {
uid: randomString(12),
name: file.name,
name: data.imageName,
status: 'done',
type: file.name.match(/\.([^\.]+)$/)[1].toLowerCase(),
url: file.response.data,
url: data.url,
};
// setFileList([...fileList, obj]);
......
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