mirror of
https://github.com/timepill/timepill-app.git
synced 2025-04-30 18:09: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) {
|
refreshOne(index, diary) {
|
||||||
console.log('index, diary:', index, diary);
|
|
||||||
if(diary) {
|
if(diary) {
|
||||||
let list = this.state.rawlist;
|
let list = this.state.rawlist;
|
||||||
diary.user = list[index].user;
|
diary.user = list[index].user;
|
||||||
|
|
||||||
list[index] = diary;
|
list[index] = diary;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -188,8 +188,7 @@ export default class NotebookDiaryList extends Component {
|
||||||
diary: diary,
|
diary: diary,
|
||||||
showField: ['createdTime'],
|
showField: ['createdTime'],
|
||||||
|
|
||||||
expired: this.notebook.isExpired,
|
expired: this.notebook.isExpired
|
||||||
refreshBack: this.refreshOne.bind(this, index)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -215,7 +214,7 @@ export default class NotebookDiaryList extends Component {
|
||||||
|
|
||||||
renderItem={(rowData) => {
|
renderItem={(rowData) => {
|
||||||
return (
|
return (
|
||||||
<DiaryBrief
|
<DiaryBrief {...this.props}
|
||||||
diary={rowData.item}
|
diary={rowData.item}
|
||||||
showField={['createdTime']}
|
showField={['createdTime']}
|
||||||
expired={expired}
|
expired={expired}
|
||||||
|
|
|
@ -244,10 +244,18 @@ export default class WritePage extends Component {
|
||||||
let photoUri = this.state.photoUri;
|
let photoUri = this.state.photoUri;
|
||||||
let topic = this.props.topic ? 1 : 0;
|
let topic = this.props.topic ? 1 : 0;
|
||||||
|
|
||||||
|
let waitingToast = Msg.showMsg('正在保存中', {
|
||||||
|
duration: 10000,
|
||||||
|
position: -150,
|
||||||
|
shadow: false,
|
||||||
|
hideOnPress: false
|
||||||
|
});
|
||||||
|
|
||||||
(this.diary
|
(this.diary
|
||||||
? Api.updateDiary(this.diary.id, this.state.targetbookId, this.state.content)
|
? Api.updateDiary(this.diary.id, this.state.targetbookId, this.state.content)
|
||||||
: Api.addDiary(this.state.targetbookId, this.state.content, photoUri, topic)
|
: Api.addDiary(this.state.targetbookId, this.state.content, photoUri, topic)
|
||||||
).then(result => {
|
).then(result => {
|
||||||
|
Msg.hideMsg(waitingToast);
|
||||||
Msg.showMsg('日记保存完成');
|
Msg.showMsg('日记保存完成');
|
||||||
DeviceEventEmitter.emit(Event.updateDiarys);
|
DeviceEventEmitter.emit(Event.updateDiarys);
|
||||||
|
|
||||||
|
@ -271,6 +279,7 @@ export default class WritePage extends Component {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
Msg.hideMsg(waitingToast);
|
||||||
Msg.showMsg('保存失败');
|
Msg.showMsg('保存失败');
|
||||||
})
|
})
|
||||||
.done();
|
.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 {
|
export default {
|
||||||
showMsg
|
showMsg,
|
||||||
|
hideMsg
|
||||||
}
|
}
|
Loading…
Reference in a new issue