Parcourir la source

开发联调找朋友页面完成

bayi il y a 2 ans
Parent
commit
c71fe730d2

+ 3 - 1
pages/index/index.js

@@ -152,7 +152,9 @@ Page({
     this.resetData()
     this.getCategoryList()
     this.getBannerList()
-    this.selectComponent('#activityList').getActivities()
+    if (this.data.currentType == 7) {
+      this.selectComponent('#activityList').getActivities()
+    }
   },
   selectType({
     target

+ 19 - 17
pages/reading/index.js

@@ -452,25 +452,27 @@ Page({
   },
   // 字体换行
   startRecording() {
-    if (this.data.currentRow == null) {
-      this.setData({
-        currentRow: 0
-      })
-    }
-    let row = this.data.article[this.data.currentRow]
-    if (!row.readTime) {
-      return
-    }
-    this.setTimeoutObj = setTimeout(() => {
-        this.setData({
-          currentRow: ++this.data.currentRow
-        })
+    setTimeout(() => {
+      if (this.data.currentRow == null) {
         this.setData({
-          scrollTop: this.rowH * this.data.currentRow
+          currentRow: 0
         })
-        this.startRecording()
-      },
-      row.readTime);
+      }
+      let row = this.data.article[this.data.currentRow]
+      if (!row.readTime) {
+        return
+      }
+      this.setTimeoutObj = setTimeout(() => {
+          this.setData({
+            currentRow: ++this.data.currentRow
+          })
+          this.setData({
+            scrollTop: this.rowH * this.data.currentRow
+          })
+          this.startRecording()
+        },
+        row.readTime);
+    }, 100)
   },
   // 视频播放结束
   videoEnd() {

+ 5 - 11
pages/searchFriend/index.js

@@ -17,21 +17,15 @@ Page({
       text: detail.value
     })
   },
-  async search() {
+  loadMore() {
     if (!this.data.text) {
       return
     }
-    let list = await getOtherUser({
+    this.getData(getOtherUser, {
       query: this.data.text,
-      pageNo: 1,
-      pageSize: 20
     })
-    console.log(list);
-    /*  this.setData({
-       list
-     }) */
-  },
-  loadMore() {
-    this.getData(getSelfRead)
   },
+  onReachBottom() {
+    this.loadMore()
+  }
 })

+ 3 - 1
pages/searchFriend/index.json

@@ -1,4 +1,6 @@
 {
-  "usingComponents": {},
+  "usingComponents": {
+    "emptyBg": "/components/empty/index"
+  },
   "navigationBarTitleText": "找朋友"
 }

+ 77 - 67
pages/searchFriend/index.less

@@ -1,12 +1,15 @@
 .searchFriend {
+
   .searchBox {
     position: fixed;
     top: 0px;
     left: 0px;
     width: 100%;
-    padding: 4rpx 20rpx;
+    padding: 0rpx 28rpx;
     box-sizing: border-box;
     z-index: 9;
+    overflow: hidden;
+    background-color: #F2F6FC;
 
     .input {
       background-color: white;
@@ -17,8 +20,9 @@
 
     .searchBtn {
       position: absolute;
-      right: 40rpx;
-      top: 12rpx;
+      right: 50rpx;
+      top: 50%;
+      transform: translateY(-50%);
       padding: 6rpx 40rpx;
       background: #00C657;
       border-radius: 40rpx;
@@ -30,83 +34,89 @@
     }
   }
 
-  .follow {
-    margin-top: 20rpx;
-    box-sizing: border-box;
-    width: 100%;
-    background-color: white;
-    border-radius: 10rpx;
-    margin-bottom: 20rpx;
-    padding: 20rpx;
-    display: flex;
-    align-items: center;
-    justify-content: space-between;
-
-    .userInfo {
-      flex: 1;
-      display: flex;
-
-      .avatar {
-        position: relative;
+  .box {
+    padding-bottom: 20rpx;
+    margin-top: 100rpx;
 
-        .avatar-image {
-          width: 96rpx;
-          height: 96rpx;
-          background-color: wheat;
-          border-radius: 50%;
-          border: 4rpx solid #61CA54;
-        }
+    .follow {
+      margin: 0rpx 30rpx 20rpx 30rpx;
+      box-sizing: border-box;
+      background-color: white;
+      border-radius: 10rpx;
+      padding: 20rpx;
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
 
-        .user-profession {
-          position: absolute;
-          bottom: -4rpx;
-          left: 17rpx;
-          width: 68rpx;
-          height: 24rpx;
-          background: rgba(97, 202, 84, 1);
-          border-radius: 50rpx;
-          border: 2rpx solid rgba(255, 255, 255, 1);
-          font-size: 16rpx;
-          color: rgba(255, 255, 255, 1);
-          line-height: 24rpx;
-          text-align: center;
+      .userInfo {
+        flex: 1;
+        display: flex;
 
+        .avatar {
+          position: relative;
+
+          .avatar-image {
+            width: 96rpx;
+            height: 96rpx;
+            background-color: wheat;
+            border-radius: 50%;
+            border: 4rpx solid #61CA54;
+          }
+
+          .user-profession {
+            position: absolute;
+            bottom: -4rpx;
+            left: 17rpx;
+            width: 68rpx;
+            height: 24rpx;
+            background: rgba(97, 202, 84, 1);
+            border-radius: 50rpx;
+            border: 2rpx solid rgba(255, 255, 255, 1);
+            font-size: 16rpx;
+            color: rgba(255, 255, 255, 1);
+            line-height: 24rpx;
+            text-align: center;
+
+          }
         }
-      }
 
-      .infoBox {
-        display: flex;
-        flex-direction: column;
-        justify-content: space-around;
-        margin-left: 14rpx;
-        margin-top: 2rpx;
-
-        .gmtCreated {
-          font-size: 26rpx;
-          color: #888;
+        .infoBox {
+          display: flex;
+          flex-direction: column;
+          justify-content: space-around;
+          margin-left: 14rpx;
+          margin-top: 2rpx;
+
+          .gmtCreated {
+            font-size: 26rpx;
+            color: #888;
+          }
         }
       }
-    }
 
-    .state {
-      text-align: center;
+      .state {
+        text-align: center;
 
-      .stateText {
-        width: 160rpx;
-        padding: 16rpx 0rpx;
-        border-radius: 50rpx;
-        font-size: 24rpx;
-      }
+        .stateText {
+          width: 160rpx;
+          padding: 16rpx 0rpx;
+          border-radius: 50rpx;
+          font-size: 24rpx;
+        }
 
-      .already {
-        background-color: #E4EDFB;
-      }
+        .already {
+          background-color: #E4EDFB;
+        }
 
-      .yet {
-        background-color: #1BC665;
-        color: white;
+        .yet {
+          background-color: #1BC665;
+          color: white;
+        }
       }
     }
   }
 
+  .empty {
+    margin-top: 200rpx;
+  }
 }

+ 21 - 18
pages/searchFriend/index.wxml

@@ -1,30 +1,33 @@
 <view class="searchFriend">
   <view class="searchBox">
     <input class="input" placeholder="查找昵称/学号/手机号" bindblur="setSearch" />
-    <view class="searchBtn" catchtap="search">
+    <view class="searchBtn" catchtap="resetData">
       <image src="/static/search-2.png" class="img" />
     </view>
   </view>
-  <view class="follow" wx:for="{{list}}" wx:key="index">
-    <view class="userInfo" bindtap="jumpUserInfo" data-uid='{{item.user.uid}}'>
-      <view class='avatar'>
-        <image class='avatar-image' src="{{ item.user.avatar }}" />
-        <view class="user-profession">{{item.user.profession}}</view>
-      </view>
-      <view class="infoBox">
-        <view class="nickName">
-          {{item.user.nickName||item.user.eid}}
+  <view class="box">
+    <view class="follow" wx:for="{{list}}" wx:key="index">
+      <view class="userInfo" bindtap="jumpUserInfo" data-uid='{{item.uid}}'>
+        <view class='avatar'>
+          <image class='avatar-image' src="{{ item.avatar }}" />
+          <view class="user-profession">{{item.profession}}</view>
+        </view>
+        <view class="infoBox">
+          <view class="nickName">
+            {{item.nickName||item.eid}}
+          </view>
+          <view class="gmtCreated">{{filters.formatDate(item.gmtCreated,4)}}</view>
         </view>
-        <view class="gmtCreated">{{filters.formatDate(item.fans.gmtCreated,4)}}</view>
-      </view>
-    </view>
-    <view class="state" data-uid='{{item.user.uid}}' data-isEachOther="{{item.isEachOther}}" bindtap="setFans">
-      <view class="stateText already" wx:if="{{currentType==1}}">
-        {{item.isEachOther?'互相关注':'已关注'}}
       </view>
-      <view class="stateText {{item.isEachOther?'already':'yet'}}" wx:else>
-        {{item.isEachOther?'互相关注':'回关'}}
+      <view class="state" data-uid='{{item.uid}}' data-isEachOther="{{item.isEachOther}}" bindtap="setFans">
+        <view class="stateText already" wx:if="{{currentType==1}}">
+          {{item.isEachOther?'互相关注':'已关注'}}
+        </view>
+        <view class="stateText {{item.isEachOther?'already':'yet'}}" wx:else>
+          {{item.isEachOther?'互相关注':'回关'}}
+        </view>
       </view>
     </view>
   </view>
+  <emptyBg wx:if="{{nullList}}" message='没有找到小伙伴哦~' />
 </view>

+ 25 - 17
pages/searchFriend/index.wxss

@@ -3,9 +3,11 @@
   top: 0px;
   left: 0px;
   width: 100%;
-  padding: 4rpx 20rpx;
+  padding: 0rpx 28rpx;
   box-sizing: border-box;
   z-index: 9;
+  overflow: hidden;
+  background-color: #F2F6FC;
 }
 .searchFriend .searchBox .input {
   background-color: white;
@@ -15,8 +17,9 @@
 }
 .searchFriend .searchBox .searchBtn {
   position: absolute;
-  right: 40rpx;
-  top: 12rpx;
+  right: 50rpx;
+  top: 50%;
+  transform: translateY(-50%);
   padding: 6rpx 40rpx;
   background: #00C657;
   border-radius: 40rpx;
@@ -25,33 +28,35 @@
   width: 24rpx;
   height: 24rpx;
 }
-.searchFriend .follow {
-  margin-top: 20rpx;
+.searchFriend .box {
+  padding-bottom: 20rpx;
+  margin-top: 100rpx;
+}
+.searchFriend .box .follow {
+  margin: 0rpx 30rpx 20rpx 30rpx;
   box-sizing: border-box;
-  width: 100%;
   background-color: white;
   border-radius: 10rpx;
-  margin-bottom: 20rpx;
   padding: 20rpx;
   display: flex;
   align-items: center;
   justify-content: space-between;
 }
-.searchFriend .follow .userInfo {
+.searchFriend .box .follow .userInfo {
   flex: 1;
   display: flex;
 }
-.searchFriend .follow .userInfo .avatar {
+.searchFriend .box .follow .userInfo .avatar {
   position: relative;
 }
-.searchFriend .follow .userInfo .avatar .avatar-image {
+.searchFriend .box .follow .userInfo .avatar .avatar-image {
   width: 96rpx;
   height: 96rpx;
   background-color: wheat;
   border-radius: 50%;
   border: 4rpx solid #61CA54;
 }
-.searchFriend .follow .userInfo .avatar .user-profession {
+.searchFriend .box .follow .userInfo .avatar .user-profession {
   position: absolute;
   bottom: -4rpx;
   left: 17rpx;
@@ -65,30 +70,33 @@
   line-height: 24rpx;
   text-align: center;
 }
-.searchFriend .follow .userInfo .infoBox {
+.searchFriend .box .follow .userInfo .infoBox {
   display: flex;
   flex-direction: column;
   justify-content: space-around;
   margin-left: 14rpx;
   margin-top: 2rpx;
 }
-.searchFriend .follow .userInfo .infoBox .gmtCreated {
+.searchFriend .box .follow .userInfo .infoBox .gmtCreated {
   font-size: 26rpx;
   color: #888;
 }
-.searchFriend .follow .state {
+.searchFriend .box .follow .state {
   text-align: center;
 }
-.searchFriend .follow .state .stateText {
+.searchFriend .box .follow .state .stateText {
   width: 160rpx;
   padding: 16rpx 0rpx;
   border-radius: 50rpx;
   font-size: 24rpx;
 }
-.searchFriend .follow .state .already {
+.searchFriend .box .follow .state .already {
   background-color: #E4EDFB;
 }
-.searchFriend .follow .state .yet {
+.searchFriend .box .follow .state .yet {
   background-color: #1BC665;
   color: white;
 }
+.searchFriend .empty {
+  margin-top: 200rpx;
+}