完成微信聊天记录分页
parent
c701e1cbbc
commit
5d276c7441
@ -1,72 +1,63 @@
|
|||||||
import {makeAutoObservable, runInAction} from "mobx"
|
import {makeAutoObservable, runInAction} from "mobx"
|
||||||
import {
|
|
||||||
CaretUpOutlined,
|
|
||||||
CaretDownOutlined
|
|
||||||
} from '@ant-design/icons';
|
|
||||||
import {Tag} from 'antd';
|
|
||||||
import * as config from "../config";
|
import * as config from "../config";
|
||||||
import moment from "moment";
|
|
||||||
import {NavLink} from "react-router-dom";
|
|
||||||
import * as req from '../utils/request';
|
import * as req from '../utils/request';
|
||||||
|
|
||||||
|
|
||||||
class Wechat {
|
class Wechat {
|
||||||
|
|
||||||
constructor(rootStore) {
|
constructor(rootStore) {
|
||||||
this.rootStore = rootStore;
|
this.rootStore = rootStore;
|
||||||
makeAutoObservable(this);
|
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() {
|
fetchWechatUserList() {
|
||||||
|
|
||||||
req.fetchJSON(config.HT_HOST + '/weixin/wxwork/get_permit_user_list')
|
req.fetchJSON(config.HT_HOST + '/weixin/wxwork/get_permit_user_list')
|
||||||
.then(json => {
|
.then(json => {
|
||||||
|
if (json.errcode === 0) {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
this.userList = json.Result.filter(user => {
|
this.userList = json.Result.filter(user => {
|
||||||
return user.SMPlatform === 'weixin';
|
return user.SMPlatform === 'weixin';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
fetchContactList(user) {
|
fetchContactList(user) {
|
||||||
|
|
||||||
req.fetchJSON(config.HT_HOST + '/weixin/wxwork/get_externalcontact_list?userid='+user.userid)
|
req.fetchJSON(config.HT_HOST + '/weixin/wxwork/get_externalcontact_list?userid='+user.userid)
|
||||||
.then(json => {
|
.then(json => {
|
||||||
|
if (json.errcode === 0) {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
this.contactList = json.Result.filter(user => {
|
this.contactList = json.Result.filter(user => {
|
||||||
return user.SMPlatform === 'weixin';
|
return user.SMPlatform === 'weixin';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchChatMsgList(contact) {
|
fetchChatMsgList(contact, page, pageSize) {
|
||||||
|
runInAction(() => {
|
||||||
req.fetchJSON(config.HT_HOST + '/weixin/wxwork/GetChatmsg?external_userid='+contact.userid+'&Page_count=20&curr_page=0')
|
this.selectedContact = contact;
|
||||||
|
});
|
||||||
|
req.fetchJSON(config.HT_HOST + '/weixin/wxwork/GetChatmsg?external_userid='+this.selectedContact.userid+'&Page_count='+pageSize+'&curr_page='+page)
|
||||||
.then(json => {
|
.then(json => {
|
||||||
|
if (json.errcode === 0) {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
console.info(json.chatmsg);
|
|
||||||
this.chatMsgList = json.chatmsg;
|
this.chatMsgList = json.chatmsg;
|
||||||
|
this.chatMsgPage = json.chatpage;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
userList = [{username: '---', avatar: 'https://joeschmoe.io/api/v1/random'}];
|
userList = [{username: '---', avatar: 'https://joeschmoe.io/api/v1/random'}];
|
||||||
contactList = [{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: '---'}}];
|
chatMsgList = [{from_name: '---', from_avatar: 'https://joeschmoe.io/api/v1/random', content: {text: '---'}}];
|
||||||
|
chatMsgPage = {currpage: 1, totalpage: 1};
|
||||||
|
selectedContact = this.contactList[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default Wechat;
|
export default Wechat;
|
Loading…
Reference in New Issue