Browse Source

优化编辑折叠警告与投票

pull/16/head
hole-thu 4 years ago
parent
commit
5ee8e57f0e
  1. 21
      src/Flows.js

21
src/Flows.js

@ -395,7 +395,7 @@ class FlowItem extends PureComponent {
{ info.poll && ( { info.poll && (
<div className={!do_vote ? "box-poll disabled" : "box-poll"}> <div className={!do_vote ? "box-poll disabled" : "box-poll"}>
<Poll <Poll
key={+new Date()} key={info.poll.vote || 'x'}
question={""} question={""}
answers={info.poll.answers} answers={info.poll.answers}
onVote={do_vote || (() => {})} onVote={do_vote || (() => {})}
@ -657,19 +657,24 @@ class FlowSidebar extends PureComponent {
return do_delete; return do_delete;
} }
make_do_edit_cw(token) { do_edit_cw(cw, id) {
const do_edit_cw = (cw, id) => { API.update_cw(cw, id, this.props.token)
API.update_cw(cw, id, token)
.then((json) => { .then((json) => {
alert('已更新\n刷新列表显示新版本'); this.setState({
info: Object.assign({}, this.state.info, { cw: cw }),
},
() => {
this.syncState({
info: this.state.info,
});
});
alert('已更新');
}) })
.catch((e) => { .catch((e) => {
alert('更新失败\n' + e); alert('更新失败\n' + e);
console.error(e); console.error(e);
}); });
} }
return do_edit_cw;
}
make_do_edit_score(token) { make_do_edit_score(token) {
const do_edit_score = (score, id) => { const do_edit_score = (score, id) => {
@ -729,7 +734,7 @@ class FlowSidebar extends PureComponent {
replies_cnt[DZ_NAME] > 1 ? this.set_filter_name.bind(this) : null replies_cnt[DZ_NAME] > 1 ? this.set_filter_name.bind(this) : null
} }
do_delete={this.make_do_delete(this.props.token, ()=>{window.location.reload();})} do_delete={this.make_do_delete(this.props.token, ()=>{window.location.reload();})}
do_edit_cw={this.make_do_edit_cw(this.props.token)} do_edit_cw={this.do_edit_cw.bind(this)}
do_edit_score={this.make_do_edit_score(this.props.token)} do_edit_score={this.make_do_edit_score(this.props.token)}
do_vote={this.do_vote.bind(this)} do_vote={this.do_vote.bind(this)}
do_block={() => {this.block( do_block={() => {this.block(

Loading…
Cancel
Save