Browse Source

获取 用户信息 接口调用

dongyuan0658 6 years ago
parent
commit
ce511d4a41

+ 13 - 4
pages/social/replyDetail/replyDetail.wxml

@@ -1,6 +1,17 @@
 <view class="commentArea">
 <view class="commentArea">
   <view class='padding-bottom'>
   <view class='padding-bottom'>
-    <view class="{{index === 0? class1 : classNormal}}" wx:for="{{comment}}" wx:key="{{index}}">
+    <view class="{{class1}}" wx:key="{{index}}">
+      <image class="avatar" src="{{comment[0].avatar}}" />
+      <view class="commentCore">
+          <text class="nickName">{{comment[0].name}}</text>
+          <text class="time">{{comment[0].time}}</text>
+          <text class="gut">{{comment[0].text}}</text>
+      </view>
+    </view>
+<view class='reply-all'>
+    全部回复({{ count }})
+  </view>
+    <view class="{{classNormal}}" wx:for="{{comment}}" wx:key="{{index}}" wx:if="{{index !== 0}}">
       <image class="avatar" src="{{item.avatar}}" />
       <image class="avatar" src="{{item.avatar}}" />
       <view class="commentCore">
       <view class="commentCore">
           <text class="nickName">{{item.name}}</text>
           <text class="nickName">{{item.name}}</text>
@@ -9,9 +20,7 @@
       </view>
       </view>
     </view>
     </view>
   </view>
   </view>
-  <view class='reply-all'>
-    全部回复({{ count }})
-  </view>
+  
   <view class='reply-msg'>
   <view class='reply-msg'>
     <input name='reply' class='reply-input' placeholder='回复@{{ comment[0].name }}' value='{{ replyInfo }}' bindinput='saveValue' confirm-type ="send">
     <input name='reply' class='reply-input' placeholder='回复@{{ comment[0].name }}' value='{{ replyInfo }}' bindinput='saveValue' confirm-type ="send">
     </input>
     </input>

+ 4 - 4
pages/social/replyDetail/replyDetail.wxss

@@ -20,7 +20,7 @@
 .commentArea  .commentItemFirst{
 .commentArea  .commentItemFirst{
   background: #fff;
   background: #fff;
   border-bottom: none;
   border-bottom: none;
-  height: 280rpx;
+  min-height: 280rpx;
 }
 }
 
 
 .commentItem .commentCore {
 .commentItem .commentCore {
@@ -66,13 +66,13 @@
 }
 }
 
 
 .reply-all{
 .reply-all{
-  position: absolute;
+  /* position: absolute; */
   box-sizing: border-box;
   box-sizing: border-box;
   padding: 16rpx 23rpx;
   padding: 16rpx 23rpx;
   width: 674rpx;
   width: 674rpx;
   border-top: 2rpx solid #F0F1F5;
   border-top: 2rpx solid #F0F1F5;
-  left: 40rpx;
-  top: 200rpx;
+  /* left: 40rpx; */
+  /* top: 200rpx; */
   font-size: 28rpx;
   font-size: 28rpx;
   color: #000000;
   color: #000000;
 }
 }

+ 4 - 2
pages/social/works/works.js

@@ -24,7 +24,7 @@ Page({
         replyModal: false,
         replyModal: false,
         totalRead: 0,
         totalRead: 0,
         pageNo: 1,
         pageNo: 1,
-        pageSize: 2,
+        pageSize: 3,
         goBackHome: false
         goBackHome: false
         // shareFlag: false
         // shareFlag: false
     },
     },
@@ -312,7 +312,9 @@ Page({
             httpRequestApi.postReply(this.uid, data).success(res => {
             httpRequestApi.postReply(this.uid, data).success(res => {
                 console.log(res);
                 console.log(res);
                 this.setData({
                 this.setData({
-                    inputValue: ''
+                    inputValue: '',
+                  pageNo: 1,
+                  replyList: [],
                 })
                 })
                 this.getReply();
                 this.getReply();
             });
             });

+ 2 - 2
pages/social/works/works.wxml

@@ -41,8 +41,8 @@
                 </view>
                 </view>
             </view>
             </view>
             <view class="btnWrapper">
             <view class="btnWrapper">
-                <image class="commentBtn" src="../../../static/image/comment.png" bindtap="setSBId" data-id="{{item.id}}" data-index="{{index}}" />
-                <text class="commentText" bindtap="setSBId" data-id="{{item.id}}" data-index="{{index}}">评论</text>
+                <image class="commentBtn" src="../../../static/image/comment.png" bindtap="goToDetail" data-id="{{item.id}}" data-index="{{index}}" />
+                <text class="commentText" bindtap="goToDetail" data-id="{{item.id}}" data-index="{{index}}">评论</text>
                 <image class="likeBtn" src="../../../static/image/like.png" data-index="{{index}}" data-likes="{{item.likes}}" data-id="{{item.id}}" bindtap="likeCommend" />
                 <image class="likeBtn" src="../../../static/image/like.png" data-index="{{index}}" data-likes="{{item.likes}}" data-id="{{item.id}}" bindtap="likeCommend" />
                 <text class="likeText" data-index="{{index}}" data-likes="{{item.likes}}" data-id="{{item.id}}" bindtap="likeCommend">{{item.likes}}</text>
                 <text class="likeText" data-index="{{index}}" data-likes="{{item.likes}}" data-id="{{item.id}}" bindtap="likeCommend">{{item.likes}}</text>
             </view>
             </view>

+ 2 - 1
pages/user/mycourse/mycourse.wxss

@@ -1,12 +1,13 @@
 .my-course {
 .my-course {
   margin-top: 44rpx;
   margin-top: 44rpx;
   display: flex;
   display: flex;
-  justify-content: space-around;
+  /* justify-content: space-around; */
   flex-direction: row;
   flex-direction: row;
   flex-wrap: wrap;
   flex-wrap: wrap;
 }
 }
 
 
 .book-item{
 .book-item{
+  margin-left: 20rpx;
   margin-bottom: 20rpx;
   margin-bottom: 20rpx;
   width: 214rpx;
   width: 214rpx;
 }
 }

+ 10 - 4
pages/user/myworks/myworks.js

@@ -7,10 +7,11 @@ Page({
    * 页面的初始数据
    * 页面的初始数据
    */
    */
   data: {
   data: {
-    wareCards: [],
+    wareCards: {},
     pageNo: 1,
     pageNo: 1,
     totalNo: 0,
     totalNo: 0,
-    uid: ''
+    uid: '',
+    worksList: []
   },
   },
   toMyWorks: function(e){
   toMyWorks: function(e){
     let id = e.currentTarget.dataset.id;
     let id = e.currentTarget.dataset.id;
@@ -24,10 +25,15 @@ Page({
     let pageSize = 3;
     let pageSize = 3;
     let uid = this.data.uid;
     let uid = this.data.uid;
     console.log('用户身份',uid);
     console.log('用户身份',uid);
+    APIClient.getUserMsg(uid, pageNo, pageSize).success(res => {
+      this.setData({
+        wareCards: res.data.data
+      })
+    });
     APIClient.userWorks(uid, pageNo, pageSize).success(res => {
     APIClient.userWorks(uid, pageNo, pageSize).success(res => {
-      console.log(res.data.data.list);
+      console.log(res.data.data);
       this.setData({
       this.setData({
-        wareCards: res.data.data.list
+        worksList: res.data.data.list
       });
       });
     }).fail(err => {
     }).fail(err => {
       console.log(err);
       console.log(err);

+ 12 - 12
pages/user/myworks/myworks.wxml

@@ -26,28 +26,28 @@
     <view class='follow-info'>
     <view class='follow-info'>
       <view class='avatar-bg'>
       <view class='avatar-bg'>
         <view class='avatar-box'>
         <view class='avatar-box'>
-          <image class='avatar-image' src='{{ wareCards[0].user.avatar }}'></image>
+          <image class='avatar-image' src='{{ wareCards.user.avatar }}'></image>
         </view>
         </view>
-        <view class='occupation-title'>{{ wareCards[0].user.profession }}</view>
+        <view class='occupation-title'>{{ wareCards.user.profession }}</view>
       </view>
       </view>
       <view class='avatar-msg'>
       <view class='avatar-msg'>
         <view class='avatar-nickname'>
         <view class='avatar-nickname'>
-          <text>{{ wareCards[0].user.wechatName }}</text>
-          <view class='flowers-box' wx:if='{{ wareCards[0].user.gender === 2 }}'>
+          <text>{{ wareCards.user.wechatName }}</text>
+          <view class='flowers-box' wx:if='{{ wareCards.user.gender === 2 }}'>
             <image src='../../../static/image/flowers.png'></image>
             <image src='../../../static/image/flowers.png'></image>
           </view>
           </view>
-          <view class='flowers-box' wx:elif='{{ wareCards[0].user.gender === 1 }}'>
+          <view class='flowers-box' wx:elif='{{ wareCards.user.gender === 1 }}'>
             <image src='../../../static/image/boy.png'></image>
             <image src='../../../static/image/boy.png'></image>
           </view>
           </view>
           <view wx:else class='gender-size'>未知</view>
           <view wx:else class='gender-size'>未知</view>
         </view>
         </view>
-        <view class='avatar-birthday'>{{ wxs.getBirthday(wareCards[0].user.birthday) }}</view>
-        <view class='avatar-address'>{{ wareCards[0].user.schoolName }}</view>
+        <view class='avatar-birthday'>{{ wxs.getBirthday(wareCards.user.birthday) }}</view>
+        <view class='avatar-address'>{{ wareCards.user.schoolName }}</view>
       </view>
       </view>
     </view>
     </view>
     <view class='mine-category'>
     <view class='mine-category'>
         <view class='play-count'>
         <view class='play-count'>
-          <view>{{ wareCards[0].userRead.playAmount }}</view>
+          <view>{{ wareCards.playAmount || 0 }}</view>
           <view class='border-right'>
           <view class='border-right'>
             <view class='play-img'>
             <view class='play-img'>
               <image src='../../../static/image/play.png'></image>
               <image src='../../../static/image/play.png'></image>
@@ -56,7 +56,7 @@
           </view>
           </view>
         </view>
         </view>
         <view class='follow-count'>
         <view class='follow-count'>
-          <view class='color'>{{ wareCards[0].userRead.fansAmount || 0 }}</view>
+          <view class='color'>{{ wareCards.fansAmount || 0 }}</view>
           <view class='border-right'>
           <view class='border-right'>
             <view class='play-img'>
             <view class='play-img'>
               <image src='../../../static/image/follow.png'></image>
               <image src='../../../static/image/follow.png'></image>
@@ -65,7 +65,7 @@
           </view>
           </view>
         </view>
         </view>
         <view class='point-count'>
         <view class='point-count'>
-          <view class='color'>{{ wareCards[0].userRead.likeAmount || 0 }}</view>
+          <view class='color'>{{ wareCards.likeAmount || 0 }}</view>
           <view class='border-right'>
           <view class='border-right'>
             <view class='play-img'>
             <view class='play-img'>
               <image src='../../../static/image/point.png'></image>
               <image src='../../../static/image/point.png'></image>
@@ -74,7 +74,7 @@
           </view>
           </view>
         </view>
         </view>
         <view class='flower-count'>
         <view class='flower-count'>
-          <view class='color'>{{ wareCards[0].userRead.pointAmount || 0 }}</view>
+          <view class='color'>{{ wareCards.pointAmount || 0 }}</view>
           <view class='border-right'>
           <view class='border-right'>
             <view class='play-img'>
             <view class='play-img'>
               <image src='../../../static/image/flower.png'></image>
               <image src='../../../static/image/flower.png'></image>
@@ -84,7 +84,7 @@
         </view>
         </view>
       </view>
       </view>
   </view>
   </view>
-  <view class='works-article' wx:for="{{ wareCards }}" wx:key="{{ index }}">
+  <view class='works-article' wx:for="{{ worksList }}" wx:key="{{ index }}">
     <view class='user-info'>
     <view class='user-info'>
       <view class='user-img'>
       <view class='user-img'>
         <image src='{{ item.user.avatar }}'></image>
         <image src='{{ item.user.avatar }}'></image>

+ 3 - 2
pages/user/myworks/myworks.wxss

@@ -224,6 +224,7 @@ image{
 .right-detail{
 .right-detail{
   width: 90rpx;
   width: 90rpx;
   display: flex;
   display: flex;
+  font-size: 22rpx;
 }
 }
 
 
 .user-time{
 .user-time{
@@ -266,14 +267,14 @@ image{
 }
 }
 
 
 .play-img{
 .play-img{
-  margin-bottom: 12rpx;
+  margin-bottom: 10rpx;
   width: 20rpx;
   width: 20rpx;
   height: 20rpx;
   height: 20rpx;
 }
 }
 
 
 .point-img{
 .point-img{
   margin-right: 6rpx;
   margin-right: 6rpx;
-  margin-bottom: 10rpx;
+  margin-top: 2rpx;
   width: 26rpx;
   width: 26rpx;
   height: 24rpx;
   height: 24rpx;
 }
 }

+ 11 - 0
utils/APIClient.js

@@ -356,4 +356,15 @@ module.exports = {
       pageSize: pageSize
       pageSize: pageSize
     }).url(url).send();
     }).url(url).send();
   },
   },
+  //  获取用户信息
+  getUserMsg(followUid, pageNo, pageSize){
+    let url = getBaseUrl('wx/user/info');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).data({
+      uid: followUid,
+      pageNo: pageNo,
+      pageSize: pageSize
+    }).url(url).send();
+  },
 }
 }