Просмотр исходного кода

Merge branch 'master' of gitpfg.pinfangw.com:gaofangming/yhb

Your Name лет назад: 5
Родитель
Сommit
dff0e31539

+ 1 - 1
app.js

@@ -7,7 +7,7 @@ App({
7 7
   },
8 8
 
9 9
   judge_Land() {
10
-
10
+    
11 11
     try {
12 12
       console.log(wx.getStorageSync('access_token'), '注册');
13 13
       console.log(wx.getStorageSync('wx_id'), '授权');

+ 1 - 2
pages/index/index.js

@@ -78,8 +78,7 @@ Page({
78 78
     } 
79 79
     app.globalData.trigger = false;
80 80
 
81
-    
82
-    
81
+
83 82
   },
84 83
  
85 84
  

+ 13 - 8
pages/information/chat/chat.js

@@ -591,14 +591,19 @@ Page({
591 591
     }
592 592
   }, 
593 593
   onUnload: function (e) {
594
-    let url = 'imsocket/imchatmessage/clearunreadmsg';
595
-    let datas = {
596
-      to_id: this.data.to_id, form_id: getApp().UserId()
597
-    };
598
-    //清除未读信息
599
-    getApp().postRequest(url, datas, function (res) {
600
-      console.log(res, 11111);
601
-    })
594
+    let _that = this;
595
+    _that.SocketSend({
596
+      type: 'clearChatTotal'
597
+      });
598
+
599
+    // let url = 'imsocket/imchatmessage/clearunreadmsg';
600
+    // let datas = {
601
+    //   to_id: this.data.to_id, form_id: getApp().UserId()
602
+    // };
603
+    // //清除未读信息
604
+    // getApp().postRequest(url, datas, function (res) {
605
+    //   console.log(res, 11111);
606
+    // })
602 607
     console.log('销毁页面');
603 608
   },
604 609
   // ceshi: function (e) {

+ 2 - 2
pages/personal_core/home_list/home_list.js

@@ -98,8 +98,8 @@ Page({
98 98
       },
99 99
       // 验证成功后触发
100 100
       success: function (data) {
101
-        console.log('收到验证成功的回调')
102
-        console.log(data);
101
+        // console.log('收到验证成功的回调')
102
+        // console.log(data);
103 103
         let optioninfo_url = 'my/faceid/biztokenresult';
104 104
         let optioninfo_data = {biz_token:data.BizToken};
105 105
         app.postRequest(optioninfo_url, optioninfo_data, function (res) {

+ 27 - 1
utils/websocket.js

@@ -145,6 +145,12 @@ var webSocket = {
145 145
     if (!heart) {
146 146
       return;
147 147
     }
148
+
149
+    self.sendSocketMessage({
150
+      msg: JSON.stringify({
151
+        form_id: getApp().UserId(),
152
+        type: 'resetChatTotal'})})
153
+
148 154
     self.sendSocketMessage({
149 155
       msg: JSON.stringify({
150 156
         form_id: getApp().UserId(),
@@ -209,7 +215,27 @@ wx.onSocketError(function (res) {
209 215
 
210 216
 // 监听WebSocket接受到服务器的消息事件。
211 217
 wx.onSocketMessage(function (res) {
212
-  //  console.log('没有回调之前的方法:' + res.data)
218
+   
219
+  let data = JSON.parse(res.data);
220
+  console.log(data);
221
+  switch(data.type){
222
+    case 'resetChatTotal':
223
+      if (data.data.message_exists == true){
224
+        wx.setTabBarBadge({
225
+          index: 0,
226
+          text: '1'
227
+        })  
228
+      }else{
229
+        wx.removeTabBarBadge({
230
+          index: 0,
231
+        });
232
+        // wx.setTabBarBadge({
233
+        //   index: 0
234
+        // })  
235
+      }
236
+    break;
237
+  }
238
+   console.log('没有回调之前的方法:' + res.data)
213 239
   webSocket.onSocketMessageCallback(res.data);
214 240
 })
215 241
 

BIN
verify_mpsdk/templates/success.zip