diff --git a/front/src/pages/manage/OverView/AddModal.jsx b/front/src/pages/manage/OverView/AddModal.jsx index 61607da..f4eb7f8 100644 --- a/front/src/pages/manage/OverView/AddModal.jsx +++ b/front/src/pages/manage/OverView/AddModal.jsx @@ -4,7 +4,7 @@ import httpUtil from "../../../util/httpUtil"; import * as action from "../../../redux/action/BookmarkTreeOverview"; import { connect } from "react-redux"; -import { addNode } from "../../../util/cacheUtil"; +import { addNode, getBookmarkList } from "../../../util/cacheUtil"; function mapStateToProps(state) { return state[action.DATA_NAME]; @@ -173,7 +173,7 @@ class AddModal extends React.Component { if (!currentAddFolder) { treeData.push(res); } - updateTreeData(treeData); + updateTreeData([...getBookmarkList("")]); closeModal(); this.setState({ isLoading: false }); } diff --git a/front/src/pages/manage/OverView/function.js b/front/src/pages/manage/OverView/function.js index 1ff5ffc..11fa24a 100644 --- a/front/src/pages/manage/OverView/function.js +++ b/front/src/pages/manage/OverView/function.js @@ -4,7 +4,7 @@ import { Modal, Button, Tree, message, Menu, Dropdown } from "antd"; import styles from "./index.module.less"; import IconFont from "../../../components/IconFont"; import { stopTransfer } from "../../../util/eventUtil"; -import { deleteNodes, moveNode } from "../../../util/cacheUtil"; +import { deleteNodes, moveNode, getBookmarkList } from "../../../util/cacheUtil"; const { TreeNode } = Tree; function menuVisible(item, visible) { @@ -175,7 +175,7 @@ function deleteBookmark(nodeList) { treeData.splice(treeData.indexOf(item), 1); }); changeCheckedKeys([], null); - updateTreeData([...treeData]); + updateTreeData([...getBookmarkList("")]); resolve(); }) .catch(() => reject()); @@ -207,7 +207,7 @@ export async function onDrop(info) { .post("/bookmark/moveNode", body) .then(res => { message.success("移动完成"); - updateTreeData([...treeData]); + updateTreeData([...getBookmarkList("")]); this.setState({ isLoading: false }); }) .catch(() => { diff --git a/front/src/pages/manage/OverView/index.jsx b/front/src/pages/manage/OverView/index.jsx index 3c7dc6c..0942f28 100644 --- a/front/src/pages/manage/OverView/index.jsx +++ b/front/src/pages/manage/OverView/index.jsx @@ -50,7 +50,7 @@ class OverView extends React.Component { async componentDidMount() { this.props.refresh(); await cacheBookmarkData(); - this.props.updateTreeData([...getBookmarkList("")]); + this.props.updateTreeData(getBookmarkList("")); this.props.changeIsInit(true); } @@ -58,12 +58,12 @@ class OverView extends React.Component { * 异步加载 */ loadData = e => { - const { loadedKeys, treeData } = this.props; + const { loadedKeys } = this.props; return new Promise(resolve => { const item = e.props.dataRef; const newPath = item.path + "." + item.bookmarkId; item.children = getBookmarkList(newPath); - this.props.updateTreeData([...treeData]); + this.props.updateTreeData([...getBookmarkList("")]); loadedKeys.push(item.bookmarkId.toString()); this.props.changeLoadedKeys(loadedKeys); resolve();