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'}]; }