Commit e3d514ba authored by 张烨's avatar 张烨

fix: 修复upload组件更新

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