|
@@ -209,7 +209,20 @@ wx.onSocketError(function (res) {
|
209
|
209
|
|
210
|
210
|
// 监听WebSocket接受到服务器的消息事件。
|
211
|
211
|
wx.onSocketMessage(function (res) {
|
212
|
|
- // console.log('没有回调之前的方法:' + res.data)
|
|
212
|
+
|
|
213
|
+ let data = JSON.parse(res.data);
|
|
214
|
+ console.log(data);
|
|
215
|
+ switch(data.type){
|
|
216
|
+ case 'resetChatTotal':
|
|
217
|
+ if (data.data.message_exists == true){
|
|
218
|
+ wx.setTabBarBadge({
|
|
219
|
+ index: 0,
|
|
220
|
+ text: ' 1'
|
|
221
|
+ })
|
|
222
|
+ }
|
|
223
|
+ break;
|
|
224
|
+ }
|
|
225
|
+ console.log('没有回调之前的方法:' + res.data)
|
213
|
226
|
webSocket.onSocketMessageCallback(res.data);
|
214
|
227
|
})
|
215
|
228
|
|