Your Name 5 years ago
parent
commit
47cb64b7e1

+ 27 - 26
pages/information/chat/chat.js

@@ -7,7 +7,8 @@ Page({
7
    * 页面的初始数据
7
    * 页面的初始数据
8
    */
8
    */
9
   data: {
9
   data: {
10
-    toView:'Stop',
10
+    hiddenName:true, // 加载更多显示隐藏
11
+    toView:'Stop',   //锚点
11
     scrollTopVal: 1,    //滚动条
12
     scrollTopVal: 1,    //滚动条
12
     menu: false, //菜单显示隐藏
13
     menu: false, //菜单显示隐藏
13
     Expression: false,  // 表情显示隐藏
14
     Expression: false,  // 表情显示隐藏
@@ -312,52 +313,46 @@ Page({
312
             arrData[index].isMy = false;   //他人
313
             arrData[index].isMy = false;   //他人
313
           }
314
           }
314
       
315
       
315
-        
316
+          that.ArrMsg.push(arrData[index]);   //每次接到的数据拼接
316
-          that.ArrMsg.push(arrData[index]);
317
         }
317
         }
318
 
318
 
319
-
319
+        for (var index in that.ArrMsg) {     //二次赋值   把所有的数据 hooks参数 清空
320
-        for (var index in that.ArrMsg) {     //二次赋值  
321
               if(that.ArrMsg[index].hooks){
320
               if(that.ArrMsg[index].hooks){
322
                 that.ArrMsg[index].hooks = '';
321
                 that.ArrMsg[index].hooks = '';
323
               }
322
               }
324
         }
323
         }
325
      
324
      
326
-
325
+        let Arrs1 = that.sortarr(that.ArrMsg);       //最后要展示的数据  第11条  加上 hooks= 'Stop'; 参数  用来做加载更多数据,描点到最后一条信息
327
-        // // 滚动条处理
328
-   
329
-        // that.ceshi();
330
-        let Arrs1 = that.sortarr(that.ArrMsg);
331
         if(Arrs1[10]){
326
         if(Arrs1[10]){
332
           Arrs1[10].hooks = 'Stop';
327
           Arrs1[10].hooks = 'Stop';
333
         }
328
         }
334
     
329
     
335
         console.log(Arrs1, 111112222);
330
         console.log(Arrs1, 111112222);
336
- 
331
+        
337
-
332
+        that.setData({   
338
-     
333
+          hiddenName: true,
334
+        });
339
 
335
 
340
-        if (that.data.limit_page == 1) {
341
 
336
 
337
+        if (that.data.limit_page == 1) {   //判断  分页 1 的时候 
342
           that.setData({
338
           that.setData({
343
             Receive_news: Arrs1,        //前台数据赋值 
339
             Receive_news: Arrs1,        //前台数据赋值 
344
             scrollTopVal: that.ArrMsg.length * 999,    // 滚动条赋值
340
             scrollTopVal: that.ArrMsg.length * 999,    // 滚动条赋值
345
-            toView: false,
341
+            toView: false,   //关闭锚点
346
           });
342
           });
347
 
343
 
348
-        }else{
344
+        }else{   
349
           that.setData({
345
           that.setData({
350
             Receive_news: Arrs1,        //前台数据赋值 
346
             Receive_news: Arrs1,        //前台数据赋值 
351
-            toView: 'Stop'
347
+            toView: 'Stop'      //开启锚点 赋值
352
           });
348
           });
353
         }
349
         }
354
 
350
 
355
 
351
 
356
-        that.setData({
352
+        that.setData({     //最后关闭锚点   方便每次进来  在开启 修复 描点会闪动
357
           toView: false,
353
           toView: false,
358
         });
354
         });
359
-
355
+    
360
-        // that.scrollbar(that.ArrMsg);      //调用页面滚动条处理  这里不对
361
         break;
356
         break;
362
 
357
 
363
 
358
 
@@ -475,15 +470,21 @@ Page({
475
   //  下拉加载聊天记录
470
   //  下拉加载聊天记录
476
   upper: function (e) {
471
   upper: function (e) {
477
     var that = this;
472
     var that = this;
478
-    console.log(e,'加载')
473
+    // console.log(e,'加载')
479
 
474
 
480
-    that.setData({
475
+    that.setData({   //  显示加载更多图片
481
-      limit_page: that.data.limit_page * 1 + 1
476
+          hiddenName:false,    
482
     })
477
     })
483
-    console.log(that.data.limit_page * 1 + 1)
484
-    that.SocketSend({ type: 'get_history', page: that.data.limit_page,limit:10})
485
 
478
 
486
-    console.log('执行')
479
+   setTimeout(function () {
480
+        that.setData({
481
+          limit_page: that.data.limit_page * 1 + 1
482
+        })
483
+        console.log(that.data.limit_page * 1 + 1)
484
+        that.SocketSend({ type: 'get_history', page: that.data.limit_page,limit:10})
485
+    }, 3000);
486
+
487
+    // console.log('执行')
487
   },
488
   },
488
 
489
 
489
 
490
 

+ 5 - 2
pages/information/chat/chat.wxml

@@ -5,8 +5,10 @@
5
     bindscroll="scroll" -->
5
     bindscroll="scroll" -->
6
    <!-- bindscroll="ceshi" -->
6
    <!-- bindscroll="ceshi" -->
7
 <scroll-view class="history"     scroll-top="{{scrollTopVal}}"    scroll-y="true"  bindtap="resetInputStatus"  bindscrolltoupper="upper"   scroll-into-view="{{toView}}">
7
 <scroll-view class="history"     scroll-top="{{scrollTopVal}}"    scroll-y="true"  bindtap="resetInputStatus"  bindscrolltoupper="upper"   scroll-into-view="{{toView}}">
8
-  <!-- <view style='height:1000px;'></view>
8
+
9
-     <view  id="red"  style='height:10px;'></view> -->
9
+          <view class='Load_img_box' hidden="{{hiddenName}}">
10
+               <view class='Load_img'><image src='/image/jz.png' mode="aspectFill"></image></view>
11
+           </view>
10
           <!-- 自己 -->
12
           <!-- 自己 -->
11
            <block  wx:for='{{Receive_news}}' wx:key="item">
13
            <block  wx:for='{{Receive_news}}' wx:key="item">
12
                 <view class='my_right c' wx:if="{{item.isMy === true}}" id="{{item.hooks}}">
14
                 <view class='my_right c' wx:if="{{item.isMy === true}}" id="{{item.hooks}}">
@@ -65,6 +67,7 @@
65
         </block>
67
         </block>
66
 
68
 
67
 
69
 
70
+
68
 </scroll-view>
71
 </scroll-view>
69
 
72
 
70
 
73
 

+ 3 - 1
pages/information/chat/chat.wxss

@@ -1,7 +1,9 @@
1
 page {background-color: #EDEDED; height: 100%;}  
1
 page {background-color: #EDEDED; height: 100%;}  
2
 /* .HGJKHJKHJK{height: 100%;} */
2
 /* .HGJKHJKHJK{height: 100%;} */
3
 
3
 
4
-
4
+.Load_img_box{padding:20rpx  0 ;}
5
+.Load_img{width:35rpx;height:35rpx;margin:auto;}
6
+.Load_img image{width:100%;height:100%; }
5
 
7
 
6
 .history { 
8
 .history { 
7
   /* border:1px solid; */
9
   /* border:1px solid; */