Commit e3d514ba authored by 张烨's avatar 张烨

fix: 修复upload组件更新

parent ae01a0cf
...@@ -61,9 +61,9 @@ class PicturesWall extends React.Component<PicturesWallType> { ...@@ -61,9 +61,9 @@ class PicturesWall extends React.Component<PicturesWallType> {
}] as UploadFile<any>[] : [], }] as UploadFile<any>[] : [],
}; };
getDerivedStateFromProps = (props, state) => { static getDerivedStateFromProps = (props, state) => {
const fileList = state.fileList; const fileList = state.fileList;
if(fileList.length === 0){ if(fileList.length === 0 && props.value){
return { return {
fileList: Array.isArray(props.value) ? props.value.map((v) => ({ fileList: Array.isArray(props.value) ? props.value.map((v) => ({
url: v, url: v,
......
import BaseForm from '@/components/BaseForm'; import BaseForm from '@/components/BaseForm';
import React, { useState } from 'react'; import React, { useEffect, useState } from 'react';
import { import {
getLoginPage, getLoginPage,
getMapCofigs, getMapCofigs,
...@@ -20,6 +20,12 @@ const WebConfigForm = props => { ...@@ -20,6 +20,12 @@ const WebConfigForm = props => {
setForm(f); setForm(f);
}; };
useEffect(() => {
if (form) {
form.setFieldsValue(config);
}
}, [config]);
const onGetThemes = () => { const onGetThemes = () => {
if (webThemes.length === 0) { if (webThemes.length === 0) {
getWebThemes().then(res => setWebThemes(res)); getWebThemes().then(res => setWebThemes(res));
......
...@@ -40,7 +40,11 @@ const WebConfigPage = props => { ...@@ -40,7 +40,11 @@ const WebConfigPage = props => {
useEffect(() => { useEffect(() => {
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
curWeb && getWebconfig(curWeb.text).then(res => setConfigObj(res)); curWeb &&
getWebconfig(curWeb.text).then(res => {
setConfigObj(res);
setToEdit(res);
});
}, [curWeb]); }, [curWeb]);
const renderTabPane = tabPaneItem => ( const renderTabPane = tabPaneItem => (
......
...@@ -100,11 +100,7 @@ export const request = (config, ctx) => { ...@@ -100,11 +100,7 @@ export const request = (config, ctx) => {
requestOptions = bizRequestAdapter(requestOptions); requestOptions = bizRequestAdapter(requestOptions);
} }
return axios(requestOptions).then(r => { return axios(requestOptions).then(raw => raw && raw.data)
console.log(r)
return r
})
.then(raw => raw && raw.data)
.then( .then(
res => res =>
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
......
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