You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dashboard/src/charts/Wechat_session.js

66 lines
2.1 KiB
JavaScript

import React, {Component} from 'react';
import {Row, Col, List, Avatar} from 'antd';
import {stores_Context} from '../config'
import {observer} from 'mobx-react';
import { toJS } from "mobx";
class Wechat_session extends Component {
static contextType = stores_Context;
constructor(props) {
super(props);
}
handleUserClick(user) {
///weixin/wxwork/get_externalcontact_list?userid=misscarol&searchstr=
const {wechatStore} = this.context;
wechatStore.fetchContactList(user);
}
render() {
const {wechatStore} = this.context;
const userList = wechatStore.userList;
const contactList = wechatStore.contactList;
return (
<div>
<Row>
<Col span={8}>
<List
itemLayout="horizontal"
dataSource={userList}
renderItem={(user) => (
<List.Item onClick={() => {this.handleUserClick(user)}}>
<List.Item.Meta
avatar={<Avatar src={user.avatar} />}
title={user.username}
description=""
/>
</List.Item>
)}
/>
</Col>
<Col span={8}>
<List
itemLayout="horizontal"
dataSource={contactList}
renderItem={(contact) => (
<List.Item onClick={() => {console.info(contact)}}>
<List.Item.Meta
avatar={<Avatar src={contact.avatar} />}
title={contact.username}
description=""
/>
</List.Item>
)}
/>
</Col>
</Row>
</div>
);
}
}
export default observer(Wechat_session);