|
@@ -22,15 +22,6 @@ Page({
|
22
|
22
|
let that = this;
|
23
|
23
|
// emojiChar: "☺-😋-😌-😍-😏-😜-😝-😞-😔-😪-😭-😁-😂-😃-😅-😆-👿-😒-😓-😔-😏-😖-😘-😚-😒-😡-😢-😣-😤-😢-😨-😳-😵-😷-😸-😻-😼-😽-😾-😿-🙊-🙋-🙏-✈-🚇-🚃-🚌-🍄-🍅-🍆-🍇-🍈-🍉-🍑-🍒-🍓-🐔-🐶-🐷-👦-👧-👱-👩-👰-👨-👲-👳-💃-💄-💅-💆-💇-🌹-💑-💓-💘-🚲",
|
24
|
24
|
|
25
|
|
- app.postRequest('my/images/headurl', {}, function (res){
|
26
|
|
- if (res.code == 201) {
|
27
|
|
- console.log(res);
|
28
|
|
- that.setData({
|
29
|
|
- myheadurl: res.data.img,
|
30
|
|
- // optioninfocode: res,
|
31
|
|
- })
|
32
|
|
- }
|
33
|
|
- })
|
34
|
25
|
|
35
|
26
|
|
36
|
27
|
|
|
@@ -39,6 +30,13 @@ Page({
|
39
|
30
|
// console.log(e);
|
40
|
31
|
// return ;
|
41
|
32
|
let _that = this;
|
|
33
|
+ for (var index in _that.data.conversations){
|
|
34
|
+ if (_that.data.conversations[index].to_id == e.currentTarget.dataset.item.to_id){
|
|
35
|
+ _that.data.conversations[index].count = 0;
|
|
36
|
+ }
|
|
37
|
+ }
|
|
38
|
+ // wx.setStorageSync('','');
|
|
39
|
+ wx.setStorageSync('chat_to_id', e.currentTarget.dataset.item.to_id)
|
42
|
40
|
wx.navigateTo({
|
43
|
41
|
url: '../chat/chat?to_id=' + e.currentTarget.dataset.item.to_id + '&headUrl=' + e.currentTarget.dataset.item.img + '&myheadurl='+_that.data.myheadurl
|
44
|
42
|
});
|
|
@@ -46,9 +44,35 @@ Page({
|
46
|
44
|
/**
|
47
|
45
|
* 生命周期函数--监听页面显示
|
48
|
46
|
*/
|
49
|
|
- onShow() {
|
|
47
|
+ onShow(e) {
|
50
|
48
|
var _this = this;
|
|
49
|
+ try {
|
|
50
|
+ let value = wx.getStorageSync('chat_to_id')
|
|
51
|
+ if (value) {
|
|
52
|
+ for (var index in _this.data.conversations) {
|
|
53
|
+ if (_this.data.conversations[index].to_id == value) {
|
|
54
|
+ _this.data.conversations[index].count = 0;
|
|
55
|
+ }
|
|
56
|
+ }
|
|
57
|
+ }
|
|
58
|
+ } catch (e) {
|
|
59
|
+
|
|
60
|
+ }
|
|
61
|
+ console.log(e,111111222222);
|
|
62
|
+
|
51
|
63
|
console.log(11);
|
|
64
|
+
|
|
65
|
+ app.postRequest('my/images/headurl', {}, function (res) {
|
|
66
|
+ if (res.code == 201) {
|
|
67
|
+ console.log(res);
|
|
68
|
+ _this.setData({
|
|
69
|
+ myheadurl: res.data.img,
|
|
70
|
+ // optioninfocode: res,
|
|
71
|
+ })
|
|
72
|
+ }
|
|
73
|
+ })
|
|
74
|
+
|
|
75
|
+ console.log(getApp().UserId());
|
52
|
76
|
webSocket.sendSocketMessage({
|
53
|
77
|
msg: JSON.stringify({ form_id: getApp().UserId(), type: 'Chat_list' }),
|
54
|
78
|
success: function (res) {
|
|
@@ -101,12 +125,12 @@ Page({
|
101
|
125
|
case 'chat_list_message':
|
102
|
126
|
let dataArr = _this.data.conversations;
|
103
|
127
|
let idData = [];
|
104
|
|
- console.log(data.data);
|
|
128
|
+ console.log(data.data,'chat_list_message');
|
105
|
129
|
|
106
|
130
|
for (var index in dataArr){
|
107
|
131
|
// idData.push(String(dataArr[index].to_id));
|
108
|
|
- idData.push(String(dataArr[index].to_id)); //统一转换成string
|
109
|
|
- if (dataArr[index].to_id == data.data.to_id)
|
|
132
|
+ idData.push(String(dataArr[index].to_str)); //统一转换成string
|
|
133
|
+ if (dataArr[index].to_str == data.data.to_str)
|
110
|
134
|
{
|
111
|
135
|
dataArr[index].count = data.data.count;
|
112
|
136
|
dataArr[index].content = data.data.content;
|
|
@@ -120,7 +144,7 @@ Page({
|
120
|
144
|
}
|
121
|
145
|
|
122
|
146
|
//新增一列
|
123
|
|
- if (idData.indexOf(String(data.data.to_id)) == '-1'){
|
|
147
|
+ if (idData.indexOf(String(data.data.to_str)) == '-1'){
|
124
|
148
|
dataArr.push(data.data);
|
125
|
149
|
}
|
126
|
150
|
_this.setData({
|