chenxiaofeng 5 年之前
父节点
当前提交
1b5277a1fd
共有 4 个文件被更改,包括 15 次插入23 次删除
  1. 3 10
      pages/chat-list/chat-list.js
  2. 11 0
      pages/information/chat/chat.js
  3. 0 11
      pages/personal_core/Album/Album.js
  4. 1 2
      pages/personal_core/home/home.js

+ 3 - 10
pages/chat-list/chat-list.js

@@ -1,6 +1,7 @@
1
 // pages/chat-list/chat-list.js
1
 // pages/chat-list/chat-list.js
2
 // import Times from "../../utils/time";
2
 // import Times from "../../utils/time";
3
 const webSocket = require('../../utils/websocket.js');
3
 const webSocket = require('../../utils/websocket.js');
4
+const timefunc = require('../../utils/time.js');
4
 const app = getApp();
5
 const app = getApp();
5
 /**
6
 /**
6
  * 会话列表页面
7
  * 会话列表页面
@@ -24,8 +25,6 @@ Page({
24
       timestamp = timestamp / 1000;
25
       timestamp = timestamp / 1000;
25
       console.log("当前时间戳为:" + timestamp);  
26
       console.log("当前时间戳为:" + timestamp);  
26
   
27
   
27
-
28
-
29
       //获取自己的头像
28
       //获取自己的头像
30
       app.postRequest('my/images/headurl', {}, function (res) {
29
       app.postRequest('my/images/headurl', {}, function (res) {
31
         if (res.code == 201) {
30
         if (res.code == 201) {
@@ -37,11 +36,6 @@ Page({
37
         }
36
         }
38
       })
37
       })
39
 
38
 
40
-    // emojiChar: "☺-😋-😌-😍-😏-😜-😝-😞-😔-😪-😭-😁-😂-😃-😅-😆-👿-😒-😓-😔-😏-😖-😘-😚-😒-😡-😢-😣-😤-😢-😨-😳-😵-😷-😸-😻-😼-😽-😾-😿-🙊-🙋-🙏-✈-🚇-🚃-🚌-🍄-🍅-🍆-🍇-🍈-🍉-🍑-🍒-🍓-🐔-🐶-🐷-👦-👧-👱-👩-👰-👨-👲-👳-💃-💄-💅-💆-💇-🌹-💑-💓-💘-🚲",
41
-
42
-
43
-   
44
-
45
     },
39
     },
46
   toChat(e) { //跳转进入聊天页面
40
   toChat(e) { //跳转进入聊天页面
47
     // console.log(e);
41
     // console.log(e);
@@ -129,6 +123,7 @@ Page({
129
             // console.log(112233);
123
             // console.log(112233);
130
             dataAtt[index].count = 0;
124
             dataAtt[index].count = 0;
131
           }
125
           }
126
+          dataAtt[index].timeStr = timefunc.TimeFormatting(dataAtt[index].create_at)
132
           if (dataAtt[index].type == 2) {
127
           if (dataAtt[index].type == 2) {
133
             dataAtt[index].content = '[图片]'
128
             dataAtt[index].content = '[图片]'
134
           }
129
           }
@@ -148,11 +143,11 @@ Page({
148
         for (var index in dataArr){
143
         for (var index in dataArr){
149
           // idData.push(String(dataArr[index].to_id));
144
           // idData.push(String(dataArr[index].to_id));
150
           idData.push(String(dataArr[index].to_str)); //统一转换成string
145
           idData.push(String(dataArr[index].to_str)); //统一转换成string
146
+          dataArr[index].timeStr = timefunc.TimeFormatting(data.data.create_at); 
151
           if (dataArr[index].to_str == data.data.to_str)
147
           if (dataArr[index].to_str == data.data.to_str)
152
             {
148
             {
153
               dataArr[index].count = data.data.count;
149
               dataArr[index].count = data.data.count;
154
               dataArr[index].content = data.data.content;
150
               dataArr[index].content = data.data.content;
155
-              dataArr[index].timeStr = data.data.timeStr;
156
               dataArr[index].create_at = data.data.create_at;
151
               dataArr[index].create_at = data.data.create_at;
157
             }
152
             }
158
 
153
 
@@ -168,9 +163,7 @@ Page({
168
          _this.setData({
163
          _this.setData({
169
            conversations: _this.sortarr(dataArr)
164
            conversations: _this.sortarr(dataArr)
170
          })
165
          })
171
-    
172
       break;  
166
       break;  
173
-        break;
174
     }
167
     }
175
   },
168
   },
176
     sortarr:function(arr){//冒泡排序
169
     sortarr:function(arr){//冒泡排序

+ 11 - 0
pages/information/chat/chat.js

@@ -594,6 +594,17 @@ Page({
594
         _width: 447,   // input宽度
594
         _width: 447,   // input宽度
595
       })
595
       })
596
     }
596
     }
597
+  }, 
598
+  onUnload: function (e) {
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
+    })
607
+    console.log('销毁页面');
597
   },
608
   },
598
   // ceshi: function (e) {
609
   // ceshi: function (e) {
599
   //   var that = this;
610
   //   var that = this;

+ 0 - 11
pages/personal_core/Album/Album.js

@@ -2,10 +2,7 @@
2
 var uploadPicture = require('../Album/common.js')
2
 var uploadPicture = require('../Album/common.js')
3
 const app = getApp()
3
 const app = getApp()
4
 Page({
4
 Page({
5
-
6
-
7
   //获取应用实例
5
   //获取应用实例
8
-
9
   data: {
6
   data: {
10
     // 上传的案例图片集合
7
     // 上传的案例图片集合
11
     uploadImages: [],
8
     uploadImages: [],
@@ -34,23 +31,15 @@ Page({
34
     let initial_data = {
31
     let initial_data = {
35
     };
32
     };
36
     app.postRequest(initial_url, initial_data, function (res) {
33
     app.postRequest(initial_url, initial_data, function (res) {
37
-
38
-
39
       that.setData({
34
       that.setData({
40
         initialcode: res.code,    //获取未上传状态
35
         initialcode: res.code,    //获取未上传状态
41
       });
36
       });
42
-      
43
-
44
       // console.log(res.data[0].img)
37
       // console.log(res.data[0].img)
45
       if (res.code == 201) {
38
       if (res.code == 201) {
46
         console.log(res.data)
39
         console.log(res.data)
47
         that.setData({
40
         that.setData({
48
           initial: res.data,   // 初始数
41
           initial: res.data,   // 初始数
49
           imglength: res.data.length,
42
           imglength: res.data.length,
50
-
51
-        
52
-  
53
-
54
         })
43
         })
55
        
44
        
56
 
45
 

+ 1 - 2
pages/personal_core/home/home.js

@@ -87,7 +87,6 @@ Page({
87
     var that = this;
87
     var that = this;
88
     var code = '';
88
     var code = '';
89
     // getApp().showLoading();   //提示加载中
89
     // getApp().showLoading();   //提示加载中
90
-
91
     //  头部信息
90
     //  头部信息
92
     let datum_url = 'my/other/share';
91
     let datum_url = 'my/other/share';
93
     let datum_data = {
92
     let datum_data = {
@@ -111,7 +110,7 @@ Page({
111
       console.log("来自右上角转发菜单")
110
       console.log("来自右上角转发菜单")
112
     }
111
     }
113
     return {
112
     return {
114
-      title: '妹子图片',
113
+      title: 'jia',
115
       // path: '/pages/share/share?code=' + _that.data.code + '',
114
       // path: '/pages/share/share?code=' + _that.data.code + '',
116
       success: (res) => {
115
       success: (res) => {
117
         console.log("转发成功", res);
116
         console.log("转发成功", res);