Commit 02a9c759 authored by 张烨's avatar 张烨

fix: upload callback url to string

parent 7b1a217c
...@@ -26,7 +26,9 @@ const ListCardItem = props => { ...@@ -26,7 +26,9 @@ const ListCardItem = props => {
useEffect(() => { useEffect(() => {
if (isGroup) { if (isGroup) {
const keys = item.children const keys = item.children
.map(child => checkChildrenByCondition(child, c => getId(c), 'map')) .map(child =>
checkChildrenByCondition(child, c => getId(c), true, 'map'),
)
.flat(Infinity); .flat(Infinity);
setChildrenKeys(keys); setChildrenKeys(keys);
} else { } else {
......
...@@ -10,14 +10,21 @@ export const getId = item => ...@@ -10,14 +10,21 @@ export const getId = item =>
item.userID || item.roleID || item.stationID || item.id; item.userID || item.roleID || item.stationID || item.id;
export const checkIsGroup = node => export const checkIsGroup = node =>
['widgetGroup'].includes(node?.type || node) && node.children?.length > 0; ['widgetGroup'].includes(node?.type || node) && node.children?.length > 0;
export const checkChildrenByCondition = (item, fn, tag = 'every') => {
// 递归遍历节点的方法
export const checkChildrenByCondition = (
item,
fn,
withGroup = true,
method = 'every',
) => {
if (!checkIsGroup(item)) { if (!checkIsGroup(item)) {
return fn(item); return fn(item);
} }
return [ const childrenResults = item.children[method](t =>
getId(item), checkChildrenByCondition(t, fn, method),
...item.children[tag](t => checkChildrenByCondition(t, fn, tag)), );
]; return withGroup ? [fn(item), ...childrenResults] : [...childrenResults];
}; };
const ListCard = props => { const ListCard = props => {
......
...@@ -90,10 +90,10 @@ class PicturesWall extends React.Component<PicturesWallType> { ...@@ -90,10 +90,10 @@ class PicturesWall extends React.Component<PicturesWallType> {
uid: uuid(8, 16), uid: uuid(8, 16),
name: '熊猫运维中台系统', name: '熊猫运维中台系统',
status: 'done', status: 'done',
url: this.getImageUrl(this.state.curSelectedImg), url: this.state.curSelectedImg,
}, },
]; ];
this.props.onChange && this.props.onChange(fileList); this.props.onChange && this.props.onChange(this.props.maxLen === 1 ? fileList[0].url : fileList.map(f => f.url));
this.setState({ fileList, wallModalVisible: false }); this.setState({ fileList, wallModalVisible: false });
}; };
......
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