import React, {Component} from 'react'; import {Row, Col, List, Avatar, Space, Pagination} from 'antd'; import {stores_Context} from '../config' import {observer} from 'mobx-react'; import 'moment/locale/zh-cn'; class Wechat_session extends Component { static contextType = stores_Context; constructor(props) { super(props); } componentDidMount() { console.info('Wechat_session.componentDidMount'); const {wechatStore} = this.context; wechatStore.fetchWechatUserList(); } handleUserClick(user) { const {wechatStore} = this.context; wechatStore.fetchContactList(user); } handleContactClick(contact) { const {wechatStore} = this.context; wechatStore.fetchChatMsgList(contact, 0, 20); } handlePageChanged(page, pageSize) { const {wechatStore} = this.context; wechatStore.fetchChatMsgList(wechatStore.selectedContact, page, pageSize); } render() { const {wechatStore} = this.context; const userList = wechatStore.userList; const contactList = wechatStore.contactList; const chatMsgList = wechatStore.chatMsgList; const chatMsgPage = wechatStore.chatMsgPage; return ( <> ( {this.handleUserClick(user)}}> } title={user.username} /> )} /> ( {this.handleContactClick(contact)}}> } title={contact.username} /> )} /> ( } title={chatMsg.from_name} description={chatMsg.msgtime} /> {chatMsg.content.text} )} /> { this.handlePageChanged(page, pageSize)}} /> ); } } export default observer(Wechat_session);