diff --git a/src/charts/Wechat_session.js b/src/charts/Wechat_session.js
index aadccf5..c3c9716 100644
--- a/src/charts/Wechat_session.js
+++ b/src/charts/Wechat_session.js
@@ -1,42 +1,34 @@
-import React, {useContext, useEffect} from 'react';
-import {Row, Col, List, Avatar, Table, Space, Radio, Tooltip} from 'antd';
-import {
- ContainerOutlined,
- SearchOutlined,
-} from '@ant-design/icons';
+import React, {Component} from 'react';
+import {Row, Col, List, Avatar} from 'antd';
import {stores_Context} from '../config'
-import {Line} from "@ant-design/charts";
import {observer} from 'mobx-react';
-import DatePickerCharts from '../charts/DatePickerCharts'
-import {NavLink, useParams} from "react-router-dom";
-import * as comm from "../utils/commons";
-import * as config from "../config";
-import SiteSelect from "../charts/SiteSelect";
-import GroupSelect from "../charts/GroupSelect";
-import {utils, writeFileXLSX} from "xlsx";
+import { toJS } from "mobx";
-const Wechat_session = () => {
+class Wechat_session extends Component {
- const {orders_store, date_picker_store, customer_store} = useContext(stores_Context);
- const inchina_data = customer_store.inchina_data;
+ static contextType = stores_Context;
+ constructor(props) {
+ super(props);
+ }
- useEffect(() => {
+ componentDidMount() {
+ const {wechatStore} = this.context;
+ wechatStore.fetchWechatUserList();
+ }
- }, [])
- const data = [
- {
- title: 'Ant Design Title 1',
- },
- {
- title: 'Ant Design Title 2',
- },
- {
- title: 'Ant Design Title 3',
- },
- {
- title: 'Ant Design Title 4',
- },
- ];
+ handleUserClick(user) {
+ const {wechatStore} = this.context;
+ wechatStore.fetchContactList(user);
+ }
+ handleContactClick(contact) {
+ const {wechatStore} = this.context;
+ wechatStore.fetchChatMsgList(contact);
+ }
+ render() {
+ const {wechatStore} = this.context;
+ const userList = wechatStore.userList;
+ const contactList = wechatStore.contactList;
+ const chatMsgList = wechatStore.chatMsgList;
return (
@@ -44,22 +36,53 @@ const Wechat_session = () => {
(
-
+ dataSource={userList}
+ renderItem={(user) => (
+ {this.handleUserClick(user)}}>
+ }
+ title={user.username}
+ description=""
+ />
+
+ )}
+ />
+
+
+ (
+ {this.handleContactClick(contact)}}>
}
- title={{item.title}}
+ avatar={}
+ title={contact.username}
description=""
/>
)}
/>
+
+ (
+
+ }
+ title={chatMsg.from_name}
+ description={chatMsg.content.text}
+ />
+
+ )}
+ />
+
);
+ }
}
export default observer(Wechat_session);
diff --git a/src/stores/Index.js b/src/stores/Index.js
index be0d252..dd027bb 100644
--- a/src/stores/Index.js
+++ b/src/stores/Index.js
@@ -6,6 +6,7 @@ import CustomerStore from "./CustomerStore";
import AuthStore from "./AuthStore";
import ChatSessionStore from "./ChatSessionStore";
import FinancialStore from "./FinancialStore";
+import WechatStore from "./Wechat";
class Index {
@@ -17,6 +18,7 @@ class Index {
this.auth_store = new AuthStore(this);
this.chat_session_store = new ChatSessionStore(this);
this.financial_store = new FinancialStore(this);
+ this.wechatStore = new WechatStore(this);
makeAutoObservable(this);
}
diff --git a/src/stores/Wechat.js b/src/stores/Wechat.js
new file mode 100644
index 0000000..296e6a6
--- /dev/null
+++ b/src/stores/Wechat.js
@@ -0,0 +1,72 @@
+import {makeAutoObservable, runInAction} from "mobx"
+import {
+ CaretUpOutlined,
+ CaretDownOutlined
+} from '@ant-design/icons';
+import {Tag} from 'antd';
+import * as config from "../config";
+import moment from "moment";
+import {NavLink} from "react-router-dom";
+import * as req from '../utils/request';
+
+
+class Wechat {
+
+ constructor(rootStore) {
+ this.rootStore = rootStore;
+ makeAutoObservable(this);
+
+ // req.fetchJSON(config.HT_HOST + '/weixin/wxwork/get_permit_user_list')
+ // .then(json => {
+ // runInAction(() => {
+ // this.userList = json.Result.filter(user => {
+ // return user.SMPlatform === 'weixin';
+ // });
+ // });
+ // });
+ }
+
+ fetchWechatUserList() {
+
+ req.fetchJSON(config.HT_HOST + '/weixin/wxwork/get_permit_user_list')
+ .then(json => {
+ runInAction(() => {
+ this.userList = json.Result.filter(user => {
+ return user.SMPlatform === 'weixin';
+ });
+ });
+ });
+ }
+
+ //
+
+ 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';
+ });
+ });
+ });
+ }
+
+ fetchChatMsgList(contact) {
+
+ req.fetchJSON(config.HT_HOST + '/weixin/wxwork/GetChatmsg?external_userid='+contact.userid+'&Page_count=20&curr_page=0')
+ .then(json => {
+ runInAction(() => {
+ console.info(json.chatmsg);
+ this.chatMsgList = json.chatmsg;
+ });
+ });
+ }
+ userList = [{username: '---', avatar: 'https://joeschmoe.io/api/v1/random'}];
+ contactList = [{username: '---', avatar: 'https://joeschmoe.io/api/v1/random'}];
+ chatMsgList = [{from_name: '---', from_avatar: 'https://joeschmoe.io/api/v1/random', content: {text: '---'}}];
+
+}
+
+
+export default Wechat;
\ No newline at end of file