diff --git a/src/Flows.js b/src/Flows.js index 7609afa..7affa12 100644 --- a/src/Flows.js +++ b/src/Flows.js @@ -22,14 +22,15 @@ window.LATEST_POST_ID=parseInt(localStorage['_LATEST_POST_ID'],10)||0; const DZ_NAME='洞主'; function load_single_meta(show_sidebar,token) { - return (pid)=>{ + return (pid,replace=false)=>{ let color_picker=new ColorPicker(); let title_elem='树洞 #'+pid; show_sidebar( title_elem,
正在加载 #{pid} -
+ , + replace?'replace':'push' ); API.get_single(pid,token) .then((single)=>{ @@ -57,7 +58,7 @@ function load_single_meta(show_sidebar,token) { show_sidebar( title_elem,
-

load_single_meta(show_sidebar,token)(pid)}>重新加载

+

load_single_meta(show_sidebar,token)(pid,true)}>重新加载

{''+e}

, 'replace' @@ -450,6 +451,7 @@ class FlowItemRow extends PureComponent { this.state={ replies: [], reply_status: 'done', + reply_error: null, info: Object.assign({},props.info,{variant: {}}), attention: false, }; @@ -466,6 +468,7 @@ class FlowItemRow extends PureComponent { console.log('fetching reply',this.state.info.pid); this.setState({ reply_status: 'loading', + reply_error: null, }); API.load_replies_with_cache(this.state.info.pid,this.props.token,this.color_picker,parseInt(this.state.info.reply)) .then((json)=>{ @@ -479,6 +482,7 @@ class FlowItemRow extends PureComponent { }), attention: !!json.attention, reply_status: 'done', + reply_error: null, }),callback); }) .catch((e)=>{ @@ -486,6 +490,7 @@ class FlowItemRow extends PureComponent { this.setState({ replies: [], reply_status: 'failed', + reply_error: ''+e, },callback); }); } @@ -535,7 +540,10 @@ class FlowItemRow extends PureComponent {
{this.state.reply_status==='loading' &&
加载中
} {this.state.reply_status==='failed' && -
{this.load_replies()}}>重新加载
+
+

{this.load_replies()}}>重新加载评论

+

{this.state.reply_error}

+
} {this.state.replies.slice(0,PREVIEW_REPLY_COUNT).map((reply)=>(