|
@@ -12,28 +12,7 @@ Page({
|
|
|
imgPath: app.globalData.imgPath,
|
|
|
cursor: null,
|
|
|
limit: 10,
|
|
|
- list: [{
|
|
|
- id: 1,
|
|
|
- username: '李袁青',
|
|
|
- photo: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fup.enterdesk.com%2Fedpic_source%2Fc0%2F8e%2F28%2Fc08e28eb52da5a2b5b451ad6272a8197.jpg&refer=http%3A%2F%2Fup.enterdesk.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1652429449&t=63437c824c18680ecb5e5f27d06f941b',
|
|
|
- time: '12:30',
|
|
|
- content: '好的',
|
|
|
- num: 1
|
|
|
- }, {
|
|
|
- id: 2,
|
|
|
- username: '刘东航',
|
|
|
- photo: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fup.enterdesk.com%2F2021%2Fedpic%2F01%2F4b%2F7d%2F014b7d465ef76e7a3477e749f7be6fc2_1.jpg&refer=http%3A%2F%2Fup.enterdesk.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1652429449&t=a4ba7f978addbb539b819ee2a329b9d8',
|
|
|
- time: '11:30',
|
|
|
- content: '下次会议时间:2022年4月13日下次会议时间:2022年4月13日',
|
|
|
- num: 2
|
|
|
- }, {
|
|
|
- id: 3,
|
|
|
- username: '尚渊明',
|
|
|
- photo: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fup.enterdesk.com%2Fedpic_source%2F95%2Fe2%2F09%2F95e20960f6bcb6d444dfa59d142e9300.jpg&refer=http%3A%2F%2Fup.enterdesk.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1652429449&t=6323d7ec61e98f009818468c239f9bbf',
|
|
|
- time: '10:30',
|
|
|
- content: '是的我在办公室',
|
|
|
- num: 0
|
|
|
- }],
|
|
|
+ list: [],
|
|
|
search_btn: true,
|
|
|
search_chats: false,
|
|
|
show_mask: false,
|
|
@@ -52,41 +31,9 @@ Page({
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
// let that = this;
|
|
|
- // util.post({
|
|
|
- // url: '/api/easemob/getToken',
|
|
|
- // success: (res) => {
|
|
|
- // wx.hideLoading({
|
|
|
- // success: (res) => {},
|
|
|
- // })
|
|
|
- // console.info(res);
|
|
|
- // }
|
|
|
- // });
|
|
|
-
|
|
|
- // util.post({
|
|
|
- // url: '/api/easemob/queryUserPage',
|
|
|
- // header: {
|
|
|
- // 'content-type': 'application/x-www-form-urlencoded'
|
|
|
- // },
|
|
|
- // data: {
|
|
|
- // cursor: that.data.cursor,
|
|
|
- // limit: that.data.limit
|
|
|
- // },
|
|
|
- // success: (res) => {
|
|
|
- // wx.hideLoading();
|
|
|
- // console.info(res);
|
|
|
- // that.setData({
|
|
|
- // arr: res.data.data.entities
|
|
|
- // });
|
|
|
- // }
|
|
|
- // });
|
|
|
-
|
|
|
-
|
|
|
// this.getRoster();
|
|
|
- this.getChatList();
|
|
|
-
|
|
|
- // if (wx.canIUse('hideHomeButton')) {
|
|
|
- // wx.hideHomeButton()
|
|
|
- // }
|
|
|
+ this.listGroups();
|
|
|
+ // this.getChatList();
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -147,7 +94,7 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- getRoster() {
|
|
|
+ getRoster: function () {
|
|
|
let me = this;
|
|
|
let rosters = {
|
|
|
success(roster) {
|
|
@@ -180,7 +127,7 @@ Page({
|
|
|
WebIM.conn.getRoster(rosters);
|
|
|
},
|
|
|
|
|
|
- listGroups() {
|
|
|
+ listGroups: function () {
|
|
|
var me = this;
|
|
|
return WebIM.conn.getGroup({
|
|
|
limit: 50,
|
|
@@ -199,7 +146,7 @@ Page({
|
|
|
key: "listGroup",
|
|
|
data: res.data
|
|
|
});
|
|
|
- me.getChatList()
|
|
|
+ me.getChatList();
|
|
|
},
|
|
|
error: function (err) {
|
|
|
console.log(err)
|
|
@@ -208,7 +155,7 @@ Page({
|
|
|
},
|
|
|
|
|
|
// 包含陌生人版本
|
|
|
- getChatList() {
|
|
|
+ getChatList: function () {
|
|
|
var myName = wx.getStorageSync("myUsername");
|
|
|
var array = [];
|
|
|
const me = this
|
|
@@ -251,7 +198,7 @@ Page({
|
|
|
let timeArr = lastChatMsg.time.split(' ')[1].split(':')
|
|
|
let month = dateArr[2] < 10 ? '0' + dateArr[2] : dateArr[2]
|
|
|
lastChatMsg.dateTimeNum = `${dateArr[1]}${month}${timeArr[0]}${timeArr[1]}${timeArr[2]}`
|
|
|
- lastChatMsg.time = `${dateArr[1]}月${dateArr[2]}日 ${timeArr[0]}时${timeArr[1]}分`
|
|
|
+ lastChatMsg.time = `${dateArr[1]}/${dateArr[2]} ${timeArr[0]}:${timeArr[1]}`
|
|
|
newChatMsgKeys.splice(index, 1)
|
|
|
} else {
|
|
|
let historyChatMsgs = wx.getStorageSync(historyChatMsgKeys[i]);
|
|
@@ -261,7 +208,7 @@ Page({
|
|
|
let timeArr = lastChatMsg.time.split(' ')[1].split(':')
|
|
|
let month = dateArr[2] < 10 ? '0' + dateArr[2] : dateArr[2]
|
|
|
lastChatMsg.dateTimeNum = `${dateArr[1]}${month}${timeArr[0]}${timeArr[1]}${timeArr[2]}`
|
|
|
- lastChatMsg.time = `${dateArr[1]}月${dateArr[2]}日 ${timeArr[0]}时${timeArr[1]}分`
|
|
|
+ lastChatMsg.time = `${dateArr[1]}/${dateArr[2]} ${timeArr[0]}:${timeArr[1]}`
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -272,9 +219,8 @@ Page({
|
|
|
let timeArr = lastChatMsg.time.split(' ')[1].split(':')
|
|
|
let month = dateArr[2] < 10 ? '0' + dateArr[2] : dateArr[2]
|
|
|
lastChatMsg.dateTimeNum = `${dateArr[1]}${month}${timeArr[0]}${timeArr[1]}${timeArr[2]}`
|
|
|
- lastChatMsg.time = `${dateArr[1]}月${dateArr[2]}日 ${timeArr[0]}时${timeArr[1]}分`
|
|
|
+ lastChatMsg.time = `${dateArr[1]}/${dateArr[2]} ${timeArr[0]}:${timeArr[1]}`
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
if (lastChatMsg.chatType == 'groupchat' || lastChatMsg.chatType == 'chatRoom') {
|
|
|
lastChatMsg.groupName = me.data.groupName[lastChatMsg.info.to]
|
|
@@ -294,7 +240,7 @@ Page({
|
|
|
let timeArr = lastChatMsg.time.split(' ')[1].split(':')
|
|
|
let month = dateArr[2] < 10 ? '0' + dateArr[2] : dateArr[2]
|
|
|
lastChatMsg.dateTimeNum = `${dateArr[1]}${month}${timeArr[0]}${timeArr[1]}${timeArr[2]}`
|
|
|
- lastChatMsg.time = `${dateArr[1]}月${dateArr[2]}日 ${timeArr[0]}时${timeArr[1]}分`
|
|
|
+ lastChatMsg.time = `${dateArr[1]}/${dateArr[2]} ${timeArr[0]}:${timeArr[1]}`
|
|
|
if (lastChatMsg.chatType == 'groupchat' || lastChatMsg.chatType == 'chatRoom') {
|
|
|
lastChatMsg.groupName = me.data.groupName[lastChatMsg.info.to]
|
|
|
}
|
|
@@ -304,7 +250,7 @@ Page({
|
|
|
|
|
|
array.sort((a, b) => {
|
|
|
return b.dateTimeNum - a.dateTimeNum
|
|
|
- })
|
|
|
+ });
|
|
|
console.info(array)
|
|
|
this.setData({
|
|
|
arr: array
|
|
@@ -413,6 +359,7 @@ Page({
|
|
|
|
|
|
into_chatRoom: function (event) {
|
|
|
let detail = event.currentTarget.dataset.item;
|
|
|
+ console.info('detail:' + detail);
|
|
|
//群聊的chatType居然是singlechat?脏数据? 等sdk重写后整理一下字段
|
|
|
if (detail.chatType == 'groupchat' || detail.chatType == 'chatRoom' || detail.groupName) {
|
|
|
this.into_groupChatRoom(detail)
|