From 5d54147c7ddf48acc1a492d098d1ea511252bcee Mon Sep 17 00:00:00 2001 From: xmcp Date: Mon, 24 Jun 2019 20:37:33 +0800 Subject: [PATCH] add dz_only --- src/Flows.js | 13 ++++++++++++- src/flows_api.js | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Flows.js b/src/Flows.js index 14243c84..bbdfafd1 100644 --- a/src/Flows.js +++ b/src/Flows.js @@ -171,6 +171,7 @@ class FlowSidebar extends PureComponent { replies: props.replies, loading_status: 'done', error_msg: null, + dz_only: false, }; this.color_picker=props.color_picker; this.syncState=props.sync_state||(()=>{}); @@ -284,6 +285,12 @@ class FlowSidebar extends PureComponent { } } + toggle_dz_only() { + this.setState((prevState)=>({ + dz_only: !prevState.dz_only, + })); + } + show_reply_bar(name,event) { if(this.reply_ref.current && !event.target.closest('a')) { let text=this.reply_ref.current.get(); @@ -303,6 +310,8 @@ class FlowSidebar extends PureComponent { let show_pid=load_single_meta(this.props.show_sidebar,this.props.token,this.props.parents.concat([this.state.info.pid])); + let replies_to_show=this.state.dz_only ? this.state.replies.filter((r)=>r.islz) : this.state.replies; + return (
@@ -313,6 +322,8 @@ class FlowSidebar extends PureComponent { } 刷新回复 +  /  + {this.state.dz_only ? '查看全部' : '只看洞主'} {!!this.props.token &&  /  @@ -344,7 +355,7 @@ class FlowSidebar extends PureComponent { {parseInt(this.state.info.reply)-this.state.replies.length} 条回复被删除
} - {this.state.replies.map((reply)=>( + {replies_to_show.map((reply)=>( {this.show_reply_bar(reply.name,e);}}> { if(json.code!==0) { - if(json.msg && json.msg==='已经关注过辣') {} + if(json.msg && json.msg==='已经关注过了') {} else { if(json.msg) alert(json.msg); throw new Error(JSON.stringify(json));