From 38c75abd2ca8a04cb470e6552f0fcbff3a848d15 Mon Sep 17 00:00:00 2001 From: LiaoYijun Date: Wed, 28 Sep 2022 15:27:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=AF=BB=E5=8F=96=E5=91=98?= =?UTF-8?q?=E5=B7=A5=E5=AF=B9=E5=BA=94=E7=9A=84=E8=81=94=E7=B3=BB=E4=BA=BA?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/charts/Wechat_session.js | 27 ++++++++++++++++++++++++--- src/stores/Wechat.js | 28 +++++++++++++++++++++------- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/charts/Wechat_session.js b/src/charts/Wechat_session.js index 7db438e..9ba1670 100644 --- a/src/charts/Wechat_session.js +++ b/src/charts/Wechat_session.js @@ -9,11 +9,17 @@ class Wechat_session extends Component { static contextType = stores_Context; constructor(props) { super(props); - this.stores = this.props.stores; + } + + handleUserClick(user) { + ///weixin/wxwork/get_externalcontact_list?userid=misscarol&searchstr= + const {wechatStore} = this.context; + wechatStore.fetchContactList(user); } render() { - const {wechatStore} = this.stores; + const {wechatStore} = this.context; const userList = wechatStore.userList; + const contactList = wechatStore.contactList; return (
@@ -23,7 +29,7 @@ class Wechat_session extends Component { itemLayout="horizontal" dataSource={userList} renderItem={(user) => ( - + {this.handleUserClick(user)}}> } title={user.username} @@ -33,6 +39,21 @@ class Wechat_session extends Component { )} /> + + ( + {console.info(contact)}}> + } + title={contact.username} + description="" + /> + + )} + /> +
diff --git a/src/stores/Wechat.js b/src/stores/Wechat.js index 39308c1..3e72868 100644 --- a/src/stores/Wechat.js +++ b/src/stores/Wechat.js @@ -17,14 +17,28 @@ class Wechat { makeAutoObservable(this); req.fetchJSON(config.HT_HOST + '/weixin/wxwork/get_permit_user_list') - .then(json => { - console.info(json); - runInAction(() => { - this.userList = json.Result; - }) - }); + .then(json => { + runInAction(() => { + this.userList = json.Result.filter(user => { + return user.SMPlatform === 'weixin'; + }); + }); + }); } - userList = [{username: '---', avatar: 'https://joeschmoe.io/api/v1/random'},{username: '---', avatar: 'https://joeschmoe.io/api/v1/random'}]; + + fetchContactList(user) { + + req.fetchJSON(config.HT_HOST + '/weixin/wxwork/get_externalcontact_list?userid='+user.userid) + .then(json => { + runInAction(() => { + this.contactList = json.Result.filter(user => { + return user.SMPlatform === 'weixin'; + }); + }); + }); + } + userList = [{username: '---', avatar: 'https://joeschmoe.io/api/v1/random'}]; + contactList = [{username: '---', avatar: 'https://joeschmoe.io/api/v1/random'}]; }