智慧保安互联网APP
zengh
2022-06-21 4efeb31d5b4921d7e851c256009486ad86bc70e2
pages/groupChat/groupChat.vue
@@ -4,82 +4,92 @@
      <!-- 自定义顶部导航栏 -->
      <!-- <navBarTop :title="'聊天室'"></navBarTop> -->
      <view style="height:205rpx;"></view>
      <view class="tab" style="position: fixed;top: 0;width: 100%;height: 205rpx;z-index: 100;">
         <u-navbar style="position: relative;" :is-fixed="false" :border-bottom="false" :is-back="false" title="好友"
            :background="{ background: '#0BB9C8' }" title-color="#fff">
            <u-icon @click="addFriend" slot="right" class="message-icon" mode="widthFix" name="plus" color="#fff">
            </u-icon>
            <!-- <image  src="../../static/add.png" ></image> -->
         </u-navbar>
      <u-navbar style="position: relative;" :is-fixed="false" :border-bottom="false" :is-back="false" title="好友"
         :background="{ background: '#0BB9C8' }" title-color="#fff">
         <u-icon @click="addFriend" slot="right" class="message-icon" mode="widthFix" name="plus" color="#fff">
         </u-icon>
      </u-navbar>
      <view class="tab">
         <u-tabs :list="list" :is-scroll="false" :current="current" active-color="#14B9C8" inactive-color="#595959"
            height="100" @change="change" style="background-color:rgba(255,255,255,0.8); "></u-tabs>
            height="100" @change="change"></u-tabs>
      </view>
      <swiper id="swiperBoxPeo" :style="{ height: swiperHeight + 'px' }" :current="current" @change="tabsChange">
         <swiper-item class="swiper-item" v-for="(item, indexs) in list" :key="indexs">
            <view v-if="indexs == 0" class="main">
               <div>
                  <div class="m-main">
                     <!-- <view class="inTitle">{{Task}}</view> -->
                     <view class="inTmain">
                        <contacts v-for="(item,index) in dataListP" :key="index" :Pdata="item" :fromW="indexs"
                           @refreshTask="refreshTask"></contacts>
                     </view>
                  </div>
               </div>
            </view>
            <view v-if="indexs == 1" class="main">
               <div>
                  <div class="m-main">
                     <!-- <view class="inTitle">{{Task}}</view> -->
                     <view class="applys" @click="toFriendRequest">
                        <view class="head-wrap">
                           <image src="../../static/apply.png" class="head" />
                           <view v-if=false class="tip">233</view>
                        </view>
                        <view class="content-wrap">
                           <text class="name">好友申请</text>
                           <text class="mess">若人生只如初见</text>
                        </view>
                        <view class="data-wrap">
                           <text class="data"></text>
                        </view>
                     </view>
                     <view class="inTmain">
                        <contacts v-for="(item,index) in dataListTXL" :key="index" :Pdata="item" :fromW="indexs"
                           @refreshTask="refreshTask"></contacts>
                     </view>
                  </div>
               </div>
            </view>
            <view v-if="indexs == 2" class="main">
               <div>
                  <div class="m-main">
                     <view class="applys" @click="newGroup">
                        <view class="head-wraps">
                           <image src="../../static/qunzhu.png" class="head" />
                           <view v-if=false class="tip">233</view>
                        </view>
                        <view class="content-wrap">
                           <text class="name">群组创建</text>
                           <text class="mess">何事秋风悲画扇</text>
                        </view>
                        <view class="data-wrap">
                           <text class="data"></text>
                        </view>
                     </view>
            <scroll-view scroll-y :scroll-top="scrollTop" style="width: 100%;height: 100%;"
               :refresher-enabled="refresherFlag" :refresher-threshold="threshold" :refresher-triggered="triggered"
               @refresherrefresh="refreshing" @refresherrestore="refresherrestore">
                     <!-- <view class="inTitle">{{Task}}</view> -->
                     <view class="inTmain">
                        <contacts v-for="(item,index) in dataListQZ" :key="index" :Pdata="item" :fromW="indexs"
                           @refreshTask="refreshTask"></contacts>
                     </view>
               <view v-if="indexs == 0" class="main">
                  <div>
                     <div class="m-main">
                        <!-- <view class="inTitle">{{Task}}</view> -->
                        <view class="inTmain">
                           <contacts v-for="(item,index) in dataListP" :key="index" :Pdata="item"
                              :fromW="indexs" @refreshTask="refreshTask"></contacts>
                        </view>
                     </div>
                  </div>
               </div>
            </view>
               </view>
               <view v-if="indexs == 1" class="main">
                  <div>
                     <div class="m-main">
                        <!-- <view class="inTitle">{{Task}}</view> -->
                        <view class="applys" @click="toFriendRequest">
                           <view class="head-wrap">
                              <image src="../../static/apply.png" class="head" />
                              <view v-if=false class="tip">233</view>
                           </view>
                           <view class="content-wrap">
                              <text class="name">好友申请</text>
                              <text class="mess">若人生只如初见</text>
                           </view>
                           <view class="data-wrap">
                              <text class="data"></text>
                           </view>
                        </view>
                        <view class="inTmain">
                           <contacts v-for="(item,index) in dataListTXL" :key="index" :Pdata="item"
                              :fromW="indexs" @refreshTask="refreshTask"></contacts>
                        </view>
                     </div>
                  </div>
               </view>
               <view v-if="indexs == 2" class="main">
                  <div>
                     <div class="m-main">
                        <view class="applys" @click="newGroup">
                           <view class="head-wraps">
                              <image src="../../static/qunzhu.png" class="head" />
                              <view v-if=false class="tip">233</view>
                           </view>
                           <view class="content-wrap">
                              <text class="name">群组创建</text>
                              <text class="mess">何事秋风悲画扇</text>
                           </view>
                           <view class="data-wrap">
                              <text class="data"></text>
                           </view>
                        </view>
                        <!-- <view class="inTitle">{{Task}}</view> -->
                        <view class="inTmain">
                           <contacts v-for="(item,index) in dataListQZ" :key="index" :Pdata="item"
                              :fromW="indexs" @refreshTask="refreshTask"></contacts>
                        </view>
                     </div>
                  </div>
               </view>
            </scroll-view>
         </swiper-item>
      </swiper>
   </view>
@@ -121,6 +131,11 @@
            titleTop: '', //
            hello: false,
            userName: '',
            scrollTop: 0,
            threshold: 50,
            triggered: false,
            isRefreshing: false, // 是否在刷新中
            refresherFlag: true,
         }
      },
      activated() {
@@ -131,6 +146,7 @@
         let that = this;
         uni.getSystemInfo({
            success(e) {
               console.log(e);
               let {
                  windowWidth,
                  windowHeight,
@@ -141,23 +157,40 @@
                  .select('#swiperBoxPeo')
                  .boundingClientRect(data => {
                     that.swiperHeight = safeArea.bottom - data.top;
                     that.swiperHeight = (safeArea.bottom - data.top);
                  })
                  .exec();
            }
         });
      },
      onPullDownRefresh: function() {
         setTimeout(() => {
            this.getdataList()
         }, 1000)
      },
      methods: {
         refreshing() {
            if (this.isRefreshing) {
               return;
            }
            this.isRefreshing = true;
            //界面下拉触发,triggered可能不是true,要设为true
            if (!this.triggered) {
               this.triggered = true;
            }
            this.dataListP = [];
            this.dataListQZ = [];
            this.dataListTXL = [];
            this.getdataList()
         },
         refresherrestore() {
         },
         change(index) {
            this.current = index;
         },
@@ -190,12 +223,18 @@
                     var resdata = res.data.data;
                     for (var i = 0; i < resdata.length; i++) {
                        if (resdata[i].avatar == null || resdata[i].avatar == "") {
                           resdata[i].avatar = "http://s16s652780.51mypc.cn/img/bg/img-logo.png";
                           resdata[i].avatar = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20191109%2F1d3d4d82715444c4b8284f65e3feed10.jpeg&refer=http%3A%2F%2F5b0988e595225.cdn.sohucs.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1632484198&t=1f4086a5894cbf83b311fa37c276405c";
                        }
                     }
                     that.dataListP = resdata;
                     uni.stopPullDownRefresh();
                     that.scrollTop = 0;
                     setTimeout(() => {
                        that.triggered = false; //触发onRestore,并关闭刷新图标 正常应该放在请求成功得接口里
                        that.isRefreshing = false;
                     }, 1000)
                  }
               });
            } else if (this.current == 1) {
@@ -210,13 +249,19 @@
                     for (var i = 0; i < resdata.length; i++) {
                        if (resdata[i].avatar == null || resdata[i].avatar == "") {
                           resdata[i].avatar = "http://s16s652780.51mypc.cn/img/bg/img-logo.png";
                           resdata[i].avatar = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20191109%2F1d3d4d82715444c4b8284f65e3feed10.jpeg&refer=http%3A%2F%2F5b0988e595225.cdn.sohucs.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1632484198&t=1f4086a5894cbf83b311fa37c276405c";
                        }
                     }
                     that.dataListTXL = resdata;
                     uni.stopPullDownRefresh();
                     that.scrollTop = 0;
                     setTimeout(() => {
                        that.triggered = false; //触发onRestore,并关闭刷新图标 正常应该放在请求成功得接口里
                        that.isRefreshing = false;
                     }, 1000)
                  }
               })
            } else if (this.current == 2) {
@@ -232,12 +277,18 @@
                     var resdata = res.data.data;
                     for (var i = 0; i < resdata.length; i++) {
                        if (resdata[i].avatar == null || resdata[i].avatar == "") {
                           resdata[i].avatar = "http://s16s652780.51mypc.cn/img/bg/qunz.png";
                           resdata[i].avatar = "../../static/images/people.png";
                        }
                     }
                     that.dataListQZ = resdata;
                     uni.stopPullDownRefresh();
                     that.scrollTop = 0;
                     setTimeout(() => {
                        that.triggered = false; //触发onRestore,并关闭刷新图标 正常应该放在请求成功得接口里
                        that.isRefreshing = false;
                     }, 1000)
                  }
               });
            }
@@ -262,9 +313,12 @@
         }
      },
      mounted() {
      },
      onShow() {
         this.beginObj();
         this.getdataList(0);
      },
      onPageScroll(e) {
         this.rect = e.scrollTop
@@ -499,4 +553,8 @@
   .swiper-item {
      overflow-y: auto !important;
   }
   .tab {
      margin-bottom: 10rpx;
   }
</style>