bayi пре 2 година
родитељ
комит
477594d7fc

+ 2 - 0
api/user.js

@@ -25,6 +25,8 @@ module.exports = {
   getFansList: data => request('/fans/myFriend', 'get', data),
   // 加关注请求类型为post,取消关注为put
   setFans: (data, method = 'post') => request('/fans', method, data),
+  // 搜索用户
+  getOtherUser: data => request('/v3/user/query', 'get', data),
   // 获取收藏列表
   getFavoritesList: data => request('/favorites', 'get', data),
   // 用code获取手机号

+ 4 - 1
pages/friend/index.js

@@ -86,5 +86,8 @@ Page({
     wx.navigateTo({
       url: '/pages/searchFriend/index',
     })
-  }
+  },
+  onReachBottom() {
+    this.loadMore()
+  },
 })

+ 2 - 1
pages/match/index.js

@@ -29,7 +29,8 @@ Page({
     bannerList: [],
     myActivityUser: {},
     explain: '',
-    activityId: ''
+    activityId: '',
+    bannerList: []
   },
   /**
    * 生命周期函数--监听页面加载

+ 1 - 0
pages/match/index.json

@@ -1,6 +1,7 @@
 {
   "usingComponents": {
     "worksList": "/components/worksList/index",
+    "banner": "/components/banner/index",
     "navigationBar": "/components/navigationBar/index"
   },
   "navigationBarTitleText": "朗读比赛"

+ 2 - 0
pages/match/index.wxml

@@ -2,6 +2,8 @@
 <navigationBar bind:reload='reload' showNav="{{false}}"></navigationBar>
 <view class="matchBox">
   <image src="{{explain}}" class="headerImg" />
+  <!-- <banner bannerList="{{bannerList}}" /> -->
+
   <view class="modelText">
     <view class="header">
       <image src="/static/modelBg.png" class="bg" />

+ 31 - 60
pages/searchFriend/index.js

@@ -1,66 +1,37 @@
-// pages/searchFriend/index.js
+import {
+  getOtherUser
+} from '~/api/user'
+import reachBottom from '~/mixins/reachBottom'
 Page({
-
-  /**
-   * 页面的初始数据
-   */
+  behaviors: [reachBottom],
   data: {
-
+    text: ''
   },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
   onLoad(options) {
-
+    list: []
+  },
+  setSearch({
+    detail
+  }) {
+    this.setData({
+      text: detail.value
+    })
+  },
+  async search() {
+    if (!this.data.text) {
+      return
+    }
+    let list = await getOtherUser({
+      query: this.data.text,
+      pageNo: 1,
+      pageSize: 20
+    })
+    console.log(list);
+    /*  this.setData({
+       list
+     }) */
+  },
+  loadMore() {
+    this.getData(getSelfRead)
   },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload() {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh() {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom() {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
-
-  }
 })

+ 112 - 0
pages/searchFriend/index.less

@@ -0,0 +1,112 @@
+.searchFriend {
+  .searchBox {
+    position: fixed;
+    top: 0px;
+    left: 0px;
+    width: 100%;
+    padding: 4rpx 20rpx;
+    box-sizing: border-box;
+    z-index: 9;
+
+    .input {
+      background-color: white;
+      border-radius: 50rpx;
+      padding: 12rpx 30rpx;
+      padding-right: 140rpx;
+    }
+
+    .searchBtn {
+      position: absolute;
+      right: 40rpx;
+      top: 12rpx;
+      padding: 6rpx 40rpx;
+      background: #00C657;
+      border-radius: 40rpx;
+
+      .img {
+        width: 24rpx;
+        height: 24rpx;
+      }
+    }
+  }
+
+  .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;
+
+        .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;
+        }
+      }
+    }
+
+    .state {
+      text-align: center;
+
+      .stateText {
+        width: 160rpx;
+        padding: 16rpx 0rpx;
+        border-radius: 50rpx;
+        font-size: 24rpx;
+      }
+
+      .already {
+        background-color: #E4EDFB;
+      }
+
+      .yet {
+        background-color: #1BC665;
+        color: white;
+      }
+    }
+  }
+
+}

+ 30 - 2
pages/searchFriend/index.wxml

@@ -1,2 +1,30 @@
-<!--pages/searchFriend/index.wxml-->
-<text>pages/searchFriend/index.wxml</text>
+<view class="searchFriend">
+  <view class="searchBox">
+    <input class="input" placeholder="查找昵称/学号/手机号" bindblur="setSearch" />
+    <view class="searchBtn" catchtap="search">
+      <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>
+        <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>
+    </view>
+  </view>
+</view>

+ 94 - 1
pages/searchFriend/index.wxss

@@ -1 +1,94 @@
-/* pages/searchFriend/index.wxss */
+.searchFriend .searchBox {
+  position: fixed;
+  top: 0px;
+  left: 0px;
+  width: 100%;
+  padding: 4rpx 20rpx;
+  box-sizing: border-box;
+  z-index: 9;
+}
+.searchFriend .searchBox .input {
+  background-color: white;
+  border-radius: 50rpx;
+  padding: 12rpx 30rpx;
+  padding-right: 140rpx;
+}
+.searchFriend .searchBox .searchBtn {
+  position: absolute;
+  right: 40rpx;
+  top: 12rpx;
+  padding: 6rpx 40rpx;
+  background: #00C657;
+  border-radius: 40rpx;
+}
+.searchFriend .searchBox .searchBtn .img {
+  width: 24rpx;
+  height: 24rpx;
+}
+.searchFriend .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;
+}
+.searchFriend .follow .userInfo {
+  flex: 1;
+  display: flex;
+}
+.searchFriend .follow .userInfo .avatar {
+  position: relative;
+}
+.searchFriend .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 {
+  position: absolute;
+  bottom: -4rpx;
+  left: 17rpx;
+  width: 68rpx;
+  height: 24rpx;
+  background: #61ca54;
+  border-radius: 50rpx;
+  border: 2rpx solid #ffffff;
+  font-size: 16rpx;
+  color: #ffffff;
+  line-height: 24rpx;
+  text-align: center;
+}
+.searchFriend .follow .userInfo .infoBox {
+  display: flex;
+  flex-direction: column;
+  justify-content: space-around;
+  margin-left: 14rpx;
+  margin-top: 2rpx;
+}
+.searchFriend .follow .userInfo .infoBox .gmtCreated {
+  font-size: 26rpx;
+  color: #888;
+}
+.searchFriend .follow .state {
+  text-align: center;
+}
+.searchFriend .follow .state .stateText {
+  width: 160rpx;
+  padding: 16rpx 0rpx;
+  border-radius: 50rpx;
+  font-size: 24rpx;
+}
+.searchFriend .follow .state .already {
+  background-color: #E4EDFB;
+}
+.searchFriend .follow .state .yet {
+  background-color: #1BC665;
+  color: white;
+}

+ 2 - 2
utils/request.js

@@ -10,8 +10,8 @@ if (envVersion == 'develop') {
   baseUrl = 'https://reader-api.efunbox.cn/wx'
   oldUrl = 'https://reader-api.efunbox.cn'
 } else {
-  baseUrl = 'https://reader-api.ai160.com/wx'
-  oldUrl = 'https://reader-api.ai160.com'
+baseUrl = 'https://reader-api.ai160.com/wx'
+oldUrl = 'https://reader-api.ai160.com'
 }
 
 function request(url, method, data, oldBaseUrl = false) {