|
@@ -169,7 +169,20 @@ Page({
|
|
|
|
|
|
},
|
|
|
|
|
|
+ /**
|
|
|
+ * 点击地图隐藏底部用户信息块
|
|
|
+ */
|
|
|
+ mapTap: function () {
|
|
|
+ this.setData({
|
|
|
+ show: false
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 点击其他用户定位
|
|
|
+ */
|
|
|
markerTap: function (e) {
|
|
|
+ let that = this;
|
|
|
console.info(e);
|
|
|
let id = e.markerId;
|
|
|
|
|
@@ -178,6 +191,16 @@ Page({
|
|
|
success: (res) => {
|
|
|
wx.hideLoading();
|
|
|
console.info(res);
|
|
|
+ if (res.data.code != 200) {
|
|
|
+ util.toast(res.data.msg);
|
|
|
+ } else {
|
|
|
+ that.setData({
|
|
|
+ show: true,
|
|
|
+ userPhoto: res.data.data.data.avatarurl,
|
|
|
+ nickname: res.data.data.data.nickname,
|
|
|
+ username: id,
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -227,7 +250,7 @@ Page({
|
|
|
// 对成功的相关定义,sdk会将消息id登记到日志进行备份处理
|
|
|
success: function () {
|
|
|
console.log('send room text success');
|
|
|
- // disp.fire('em.chat.sendSuccess', id, 'location');
|
|
|
+ disp.fire('em.chat.sendSuccess', id, 'location');
|
|
|
},
|
|
|
// 对失败的相关定义,sdk会将消息id登记到日志进行备份处理
|
|
|
fail: function () {
|
|
@@ -246,7 +269,9 @@ Page({
|
|
|
let myName = wx.getStorageSync("myUsername");
|
|
|
console.info(groupId, myName);
|
|
|
let historyChatMsgs = wx.getStorageSync("rendered_" + groupId + myName) || [];
|
|
|
+ console.info('chatMsg:', historyChatMsgs);
|
|
|
let chatMsg = wx.getStorageSync(groupId + myName) || [];
|
|
|
+ console.info('chatMsg:', chatMsg);
|
|
|
chatMsg = historyChatMsgs.concat(chatMsg);
|
|
|
if (!chatMsg.length) return;
|
|
|
chatMsg = chatMsg.slice(-20);
|
|
@@ -271,6 +296,21 @@ Page({
|
|
|
markers: markerList,
|
|
|
});
|
|
|
}
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 打开聊天
|
|
|
+ */
|
|
|
+ intoChatRoom: function () {
|
|
|
+ let that = this;
|
|
|
+ let myName = wx.getStorageSync("myUsername");
|
|
|
+ let nameInfo = {
|
|
|
+ myName: myName,
|
|
|
+ your: that.data.username.toString()
|
|
|
+ };
|
|
|
+ wx.navigateTo({
|
|
|
+ url: "../chat-detail/chat-detail?username=" + JSON.stringify(nameInfo)
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
})
|