From 50fcaf1e97fa07aa572e0ace26ecc60b4ea74610 Mon Sep 17 00:00:00 2001 From: xmcp Date: Sun, 26 Aug 2018 14:47:00 +0800 Subject: [PATCH] add show single in sidebar --- src/Flows.js | 192 ++++++++++++++++++++++++++++++++++------------- src/flows_api.js | 12 ++- 2 files changed, 150 insertions(+), 54 deletions(-) diff --git a/src/Flows.js b/src/Flows.js index cc12bef..7971bf0 100644 --- a/src/Flows.js +++ b/src/Flows.js @@ -17,6 +17,41 @@ const PREVIEW_REPLY_COUNT=10; window.LATEST_POST_ID=parseInt(localStorage['_LATEST_POST_ID'],10)||0; +function load_single_meta(show_sidebar,token) { + return (pid)=>{ + const color_picker=new ColorPicker(); + show_sidebar( + '帖子详情', +
+ 正在加载 #{pid} +
+ ); + Promise.all([ + API.get_single(pid,token), + API.load_replies(pid,token,color_picker), + ]) + .then((res)=>{ + const [single,replies]=res; + show_sidebar( + '帖子详情', + + ) + }) + .catch((e)=>{ + console.trace(e); + show_sidebar( + '帖子详情', +
+ load_single_meta(show_sidebar,token)}>重新加载 +
+ ); + }) + }; +} + function Reply(props) { return (
#{props.info.cid} 
- + ); } @@ -51,97 +86,94 @@ function FlowItem(props) { #{props.info.pid}