mirror of
https://github.com/timepill/timepill-app.git
synced 2025-04-30 09:59:31 +08:00
修复bug:
1. 从日记本列表编辑当天日记崩溃问题 2. 日记修改所属日记本报错问题
This commit is contained in:
parent
f6e2b5d157
commit
01991e9293
3 changed files with 19 additions and 6 deletions
|
@ -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 (
|
||||
<DiaryBrief
|
||||
<DiaryBrief {...this.props}
|
||||
diary={rowData.item}
|
||||
showField={['createdTime']}
|
||||
expired={expired}
|
||||
|
|
|
@ -244,10 +244,18 @@ export default class WritePage extends Component {
|
|||
let photoUri = this.state.photoUri;
|
||||
let topic = this.props.topic ? 1 : 0;
|
||||
|
||||
let waitingToast = Msg.showMsg('正在保存中', {
|
||||
duration: 10000,
|
||||
position: -150,
|
||||
shadow: false,
|
||||
hideOnPress: false
|
||||
});
|
||||
|
||||
(this.diary
|
||||
? Api.updateDiary(this.diary.id, this.state.targetbookId, this.state.content)
|
||||
: Api.addDiary(this.state.targetbookId, this.state.content, photoUri, topic)
|
||||
).then(result => {
|
||||
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();
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in a new issue