From 01991e929317e527b847fa8a600d69e40b3330d3 Mon Sep 17 00:00:00 2001 From: xuwenyang Date: Thu, 11 Jul 2019 20:49:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug:=201.=20=E4=BB=8E?= =?UTF-8?q?=E6=97=A5=E8=AE=B0=E6=9C=AC=E5=88=97=E8=A1=A8=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=BD=93=E5=A4=A9=E6=97=A5=E8=AE=B0=E5=B4=A9=E6=BA=83=E9=97=AE?= =?UTF-8?q?=E9=A2=98=202.=20=E6=97=A5=E8=AE=B0=E4=BF=AE=E6=94=B9=E6=89=80?= =?UTF-8?q?=E5=B1=9E=E6=97=A5=E8=AE=B0=E6=9C=AC=E6=8A=A5=E9=94=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/notebook/notebookDiaryList.js | 7 +++---- src/page/WritePage.js | 9 +++++++++ src/util/msg.js | 9 +++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/component/notebook/notebookDiaryList.js b/src/component/notebook/notebookDiaryList.js index 8e2b564..2a9e018 100644 --- a/src/component/notebook/notebookDiaryList.js +++ b/src/component/notebook/notebookDiaryList.js @@ -86,10 +86,10 @@ export default class NotebookDiaryList extends Component { } refreshOne(index, diary) { - console.log('index, diary:', index, diary); if(diary) { let list = this.state.rawlist; diary.user = list[index].user; + list[index] = diary; this.setState({ @@ -188,8 +188,7 @@ export default class NotebookDiaryList extends Component { diary: diary, showField: ['createdTime'], - expired: this.notebook.isExpired, - refreshBack: this.refreshOne.bind(this, index) + expired: this.notebook.isExpired } } }); @@ -215,7 +214,7 @@ export default class NotebookDiaryList extends Component { renderItem={(rowData) => { return ( - { + Msg.hideMsg(waitingToast); Msg.showMsg('日记保存完成'); DeviceEventEmitter.emit(Event.updateDiarys); @@ -271,6 +279,7 @@ export default class WritePage extends Component { } }) .catch(e => { + Msg.hideMsg(waitingToast); Msg.showMsg('保存失败'); }) .done(); diff --git a/src/util/msg.js b/src/util/msg.js index c6c4b49..846ab66 100644 --- a/src/util/msg.js +++ b/src/util/msg.js @@ -14,9 +14,14 @@ function showMsg(msg, option) { } } - Toast.show(msg, option); + return Toast.show(msg, option); +} + +function hideMsg(toast) { + Toast.hide(toast); } export default { - showMsg + showMsg, + hideMsg } \ No newline at end of file