From b7c8fdc40a108f8dfbb89ce13f4f5e94c557c303 Mon Sep 17 00:00:00 2001 From: fanxb Date: Sat, 1 Feb 2020 22:56:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/pages/manage/OverView/AddModal.jsx | 4 ++-- front/src/pages/manage/OverView/function.js | 6 +++--- front/src/pages/manage/OverView/index.jsx | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) 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();