Browse Source

合并dongyuan

Rorschach 5 years ago
parent
commit
16cca34932

+ 2 - 1
app.json

@@ -20,7 +20,8 @@
     "pages/user/mycourse/mycourse",
     "pages/user/myread/myread",
     "pages/user/mycollection/mycollection",
-    "pages/user/walletDetails/walletDetails"
+    "pages/user/walletDetails/walletDetails",
+    "pages/user/myworks/myworks"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 18 - 14
pages/social/replyDetail/replyDetail.js

@@ -8,12 +8,16 @@ Page({
         classNormal: 'commentItem',
         postId: '',
         comment: [],
-        replyInfo: ''
+        replyInfo: '',
+        count: ''
     },
     onLoad: function (option) {
-        console.log(option)
+        // console.log(option)
         this.setData({
-            postId: option.id
+            postId: option.id,
+            count: option.count
+        },() => {
+          console.log(this.data.count);
         })
         wx.setNavigationBarTitle({
             // title: option.count + '条回复' //页面标题为路由参数
@@ -24,24 +28,24 @@ Page({
     },
     // 保存 回复的内容
     saveValue: function(e){
-     this.setData({
-       replyInfo: e.detail.value
-     },() => {
-       console.log(this.data.replyInfo);
-     });
+      this.setData({
+        replyInfo: e.detail.value
+      });
     },
     replyDone:function(){
       const data = {
         postsId: this.data.postId,
         content: this.data.replyInfo
       }
-      
-      httpRequestApi.postReplyComment(this.uid, data).success(res => {
-        this.setData({
-          replyModal: false
+      if(this.data.replyInfo){
+        httpRequestApi.postReplyComment(this.uid, data).success(res => {
+          this.setData({
+            replyModal: false,
+            replyInfo: ''
+          });
+          this.getReplyDetail();//更新 变化后的 replyTemp。
         });
-        this.getReplyDetail();//更新 变化后的 replyTemp。
-      });
+      }
     },
     // 查询回复详情
     getReplyDetail: function () {

+ 16 - 23
pages/social/replyDetail/replyDetail.wxml

@@ -1,27 +1,20 @@
 <view class="commentArea">
+  <view class='padding-bottom'>
     <view class="{{index === 0? class1 : classNormal}}" wx:for="{{comment}}" wx:key="{{index}}">
-        <image class="avatar" src="{{item.avatar}}" />
-        <view class="commentCore">
-            <text class="nickName">{{item.name}}</text>
-            <text class="time">{{item.time}}</text>
-            <text class="gut">{{item.text}}</text>
-        </view>
-        <view class="btnWrapper">
-            <image class="commentBtn" src="../../../static/image/comment.png" wx:if="{{index===0}}" bindtap="setSBId" />
-            <text class="commentText" wx:if="{{index===0}}">评论</text>
-            <!-- <image class="likeBtn" data-index="{{index}}" data-likes="{{item.likes}}" data-id="{{item.id}}" src="../../../static/image/like.png" bindtap="likeCommend" /> -->
-            <!-- <text class="likeText" >{{item.likes}}</text> -->
-        </view>
-    </view>
-    <!-- 评论框 -->
-    <view class="replySection" wx:if="{{replyModal}}">
-        <input bindblur="bindTextAreaBlur" bindconfirm="replySB" confirm-type="send" placeholder="回复" bindinput="inputSBValue" auto-focus auto-height />
-    </view>
-    <view class='reply-msg'>
-      <!-- <input name='reply' class='reply-input' placeholder='回复@{{ comment[0].name }}' confirm-type="send" bindinput='saveValue' auto-focus auto-height></input> -->
-
-      <input name='reply' class='reply-input' placeholder='回复@{{ comment[0].name }}' bindinput='saveValue'>
-      </input>
-      <text class='reply-btn' bindtap='replyDone'>回复</text>
+      <image class="avatar" src="{{item.avatar}}" />
+      <view class="commentCore">
+          <text class="nickName">{{item.name}}</text>
+          <text class="time">{{item.time}}</text>
+          <text class="gut">{{item.text}}</text>
+      </view>
     </view>
+  </view>
+  <view class='reply-all'>
+    全部回复({{ count }})
+  </view>
+  <view class='reply-msg'>
+    <input name='reply' class='reply-input' placeholder='回复@{{ comment[0].name }}' value='{{ replyInfo }}' bindinput='saveValue' confirm-type ="send">
+    </input>
+    <text class='reply-btn' bindtap='replyDone'>回复</text>
+  </view>
 </view>

+ 54 - 79
pages/social/replyDetail/replyDetail.wxss

@@ -1,105 +1,80 @@
 .commentArea {
   width: 100%;
-  margin-bottom: 92rpx;
+}
+
+.padding-bottom{
+  padding-bottom: 92rpx;
+  width: 100%;
 }
 
 .commentArea .commentItem {
-    width: 100%;
-    padding: 0 0 0 23rpx;
-    height: 100%;
-    border-bottom: solid 2rpx #979797;
-    /* margin: 0 auto 10; */
-    display: flex;
-    position: relative;
-    background: #f0f1f5;
+  width: 100%;
+  padding: 0 0 0 23rpx;
+  height: 100%;
+  border-bottom: solid 2rpx #979797;
+  display: flex;
+  position: relative;
+  background: #F0F1F5;
 }
+
 .commentArea  .commentItemFirst{
-    background: #fff;
-    border-bottom: none;
-    min-height: 200rpx;
+  background: #fff;
+  border-bottom: none;
+  height: 280rpx;
 }
+
 .commentItem .commentCore {
-    margin-left: 14rpx;
-    width: 600rpx;
-    height: 100%;
-    display: flex;
-    flex-direction: column;
+  margin-left: 14rpx;
+  width: 600rpx;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
 }
 
 .commentItem .avatar {
-    border-radius: 50%;
-    width: 96rpx;
-    height: 96rpx;
-    margin-top: 18rpx;
+  border-radius: 50%;
+  width: 96rpx;
+  height: 96rpx;
+  margin-top: 18rpx;
 }
 
 .commentItem .nickName {
-    margin-top: 18rpx;
-    height: 44rpx;
-    font-size: 32rpx;
-    color: #000;
-    font-family: PingFangSC-Regular;
+  margin-top: 18rpx;
+  height: 44rpx;
+  font-size: 32rpx;
+  color: #000;
+  font-family: PingFangSC-Regular;
 }
 
 .commentItem .time {
-    width: 200rpx;
-    height: 44rpx;
-    font-size: 32rpx;
-    color: #686868;
+  width: 200rpx;
+  height: 44rpx;
+  font-size: 32rpx;
+  color: #686868;
 }
 
 .commentItem .gut {
-    margin-top: 12rpx;
-    width: 420rpx;
-    /* height: 44rpx; */
-    line-height: 60rpx;
-    font-size: 32rpx;
-    color: #000;
-    /* overflow: hidden;
-    text-overflow: ellipsis;
-    white-space: nowrap; */
-}
-
-.commentItem .btnWrapper {
-    position: absolute;
-    top: 10rpx;
-    right: 30rpx;
-    display: flex;
-    align-items: center;
-}
-
-.btnWrapper .commentBtn {
-    width: 32rpx;
-    height: 30rpx;
-    margin-left: 8rpx;
-}
-
-.btnWrapper .commentText,
-.likeText {
-    width: 58rpx;
-    height: 40rpx;
-    color: #545454;
-    font-size: 28rpx;
-    line-height: 40rpx;
-    margin-left: 8rpx;
+  margin-top: 12rpx;
+  width: 420rpx;
+  /* height: 44rpx; */
+  line-height: 60rpx;
+  font-size: 32rpx;
+  color: #000;
+  /* overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap; */
 }
 
-.btnWrapper .likeBtn {
-    width: 32rpx;
-    height: 28rpx;
-    margin-left: 8rpx;
-}
-.replySection{
-    width: 100%;
-    height: 300rpx;
-    position: fixed;
-    bottom: 0;
-    background: #eee;
-}
-.replySection input{
-    width: 100%;
-    height: 300rpx;
-    text-indent: 4rpx;
+.reply-all{
+  position: absolute;
+  box-sizing: border-box;
+  padding: 16rpx 23rpx;
+  width: 674rpx;
+  border-top: 2rpx solid #F0F1F5;
+  left: 40rpx;
+  top: 200rpx;
+  font-size: 28rpx;
+  color: #000000;
 }
 
 .reply-msg{

+ 3 - 2
pages/user/myconcern/myconcern.js

@@ -10,9 +10,10 @@ Page({
       fanList:[]
   },
   toUserDetails: function(e){
-    let fanId = e.currentTarget.dataset.fanId;
+    let uid = e.currentTarget.dataset.uid;
+    console.log(uid);
     wx.navigateTo({
-      url: `../../social/works/works?fanId=${fanId}`
+      url: `../myworks/myworks?uid=${uid}`
     });
   },
   /**

+ 10 - 4
pages/user/myconcern/myconcern.wxml

@@ -1,14 +1,20 @@
 <wxs module="wxs">
   function formatDate(time) {
-    var timeTemp = getDate(time);
-    var timeString = timeTemp.toLocaleDateString() + timeTemp.toLocaleTimeString();
-    return timeString.replace('/','-').replace('/','-').replace('上午',' ').replace('下午',' ');
+    console.log(time);
+    var t = getDate(time); 
+    var tf = function(i){return (i < 10 ? '0' : '') + i};
+    var year = t.getFullYear();
+    var month = tf(t.getMonth() + 1);
+    var day = tf(t.getDate());
+    var hour = tf(t.getHours());
+    var minute = tf(t.getMinutes());
+    return month + '-' + day + ' ' + hour + ':' + minute;
   }
   module.exports.formatDate = formatDate;
 </wxs>
 <view class='my-concern'>
   <view class="concern-center">
-    <view class='concern-info' wx:for="{{ fanList }}" wx:key="{{ index }}" bindtap='toUserDetails' data-fanId='{{ item.fans.fanId }}'>
+    <view class='concern-info' wx:for="{{ fanList }}" wx:key="{{ index }}" bindtap='toUserDetails' data-uid='{{ item.user.uid }}' data-fanId='{{ item.fans.fanId }}'>
       <view class='avatar-box'>
         <image class='avatar-image' src="{{ item.user.avatar }}" />
       </view>

+ 174 - 0
pages/user/myworks/myworks.js

@@ -0,0 +1,174 @@
+// pages/user/myworks/myworks.js
+import APIClient from '../../../utils/APIClient.js'
+import { formatDate } from '../../../utils/util.js'
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    wareCards: [
+      {
+        title: "古诗词诵读(一)江南",
+        grade: "一年级(上学期)",
+        avatarUrl: '../../../static/image/timg.jpg',
+        previewUrl: "../../../static/image/timg.jpg",
+        plays: "17230",
+        likes: "71230",
+        classId: "1",
+        avatar: '../../static/image/timg.jpg',
+        nickName: '喔喔',
+        time: '10-18 09:56'
+      },
+      {
+        title: "古诗词诵读(一)江南",
+        grade: "一年级(上学期)",
+        avatarUrl: '../../../static/image/timg.jpg',
+        previewUrl: "../../../static/image/timg.jpg",
+        plays: "17230",
+        likes: "71230",
+        classId: "2",
+        avatar: '../../static/image/timg.jpg',
+        nickName: '喔喔',
+        time: '10-18 09:56'
+      },
+      {
+        title: "古诗词诵读(一)江南",
+        grade: "一年级(上学期)",
+        avatarUrl: '../../../static/image/timg.jpg',
+        previewUrl: "../../../static/image/timg.jpg",
+        plays: "17230",
+        likes: "71230",
+        classId: "3",
+        avatar: '../../static/image/timg.jpg',
+        nickName: '喔喔',
+        time: '10-18 09:56'
+      },
+      {
+        title: "古诗词诵读(一)江南",
+        grade: "一年级(上学期)",
+        avatarUrl: '../../../static/image/timg.jpg',
+        previewUrl: "../../../static/image/timg.jpg",
+        plays: "17230",
+        likes: "71230",
+        classId: "4",
+        avatar: '../../static/image/timg.jpg',
+        nickName: '喔喔',
+        time: '10-18 09:56'
+      },
+      {
+        title: "古诗词诵读(一)江南",
+        grade: "一年级(上学期)",
+        avatarUrl: '../../../static/image/timg.jpg',
+        previewUrl: "../../../static/image/timg.jpg",
+        plays: "17230",
+        likes: "71230",
+        classId: "5",
+        avatar: '../../static/image/timg.jpg',
+        nickName: '喔喔',
+        time: '10-18 09:56'
+      },
+      {
+        title: "古诗词诵读(一)江南",
+        grade: "一年级(上学期)",
+        avatarUrl: '../../../static/image/timg.jpg',
+        previewUrl: "../../../static/image/timg.jpg",
+        plays: "17230",
+        likes: "71230",
+        classId: "6",
+        avatar: '../../static/image/timg.jpg',
+        nickName: '喔喔',
+        time: '10-18 09:56'
+      }
+    ],
+    pageNo: 1,
+    totalNo: 0,
+    uid: ''
+  },
+  toMyWorks: function(e){
+    let id = e.currentTarget.dataset.id;
+    let title = e.currentTarget.dataset.title;
+    wx.navigateTo({
+      url: `../../social/works/works?id=${id}&title=${title}`
+    });
+  },
+  getResults(){
+    let pageNo = this.data.pageNo;
+    let pageSize = 3;
+    let uid = this.data.uid;
+    console.log('用户身份',uid);
+    APIClient.userWorks(uid, pageNo, pageSize).success(res => {
+      // debugger;
+      this.setData({
+        wareCards: res.data.data.list
+      });
+    }).fail(err => {
+      console.log(err);
+    });
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      uid: options.uid
+    },() => {
+      console.log(options.uid);
+    });
+    this.getResults();
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+    this.setData({
+      pageNo: this.data.pageNo + 1
+    })
+    if (this.data.pageNo <= this.data.totalNo) {
+      this.getResults();
+    }
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 1 - 0
pages/user/myworks/myworks.json

@@ -0,0 +1 @@
+{}

+ 51 - 0
pages/user/myworks/myworks.wxml

@@ -0,0 +1,51 @@
+<!--pages/user/myworks/myworks.wxml-->
+<wxs module="wxs">
+  function formatDate(time) {
+    console.log(time);
+    var t = getDate(time); 
+    var tf = function(i){return (i < 10 ? '0' : '') + i};
+    var year = t.getFullYear();
+    var month = tf(t.getMonth() + 1);
+    var day = tf(t.getDate());
+    var hour = tf(t.getHours());
+    var minute = tf(t.getMinutes());
+    return month + '-' + day + ' ' + hour + ':' + minute;
+  }
+  module.exports.formatDate = formatDate;
+</wxs>
+<view class='user-works'>
+  <view class='works-article' wx:for="{{ wareCards }}" wx:key="{{ index }}">
+    <view class='user-info'>
+      <view class='avatar-img'>
+        <image src='{{ item.user.avatar }}'></image>
+      </view>
+      <view>
+        <view class='user-name'>{{ item.user.wechatName }}</view>
+        <view class='user-time'>{{ wxs.formatDate(item.userRead.gmtCreated) }}</view>
+      </view>
+    </view>
+    <view class='video-preview' bindtap='toMyWorks' data-id='{{ item.userRead.id }}' data-title='{{ item.userRead.title }}'>
+      <image src='{{ item.userRead.iconImg }}'></image>
+    </view>
+    <view class='content-title'>
+      {{ item.userRead.title }}
+    </view>
+    <view class='content-detail'>
+      <view class='left'>{{ item.userRead.summary }}</view>
+      <view class='right'>
+        <view class='right-detail'>
+          <view class='play-img'>
+            <image src='../../../static/image/hotPlays.png'></image>
+          </view>
+          <text>{{ item.userRead.playAmount }}</text>
+        </view>
+        <view class='right-detail'>
+          <view class='point-img'>
+            <image src='../../../static/image/like.png'></image>
+          </view>
+          <text>{{ item.userRead.likeAmount }}</text>
+        </view>
+      </view>
+    </view>
+  </view>
+</view>

+ 108 - 0
pages/user/myworks/myworks.wxss

@@ -0,0 +1,108 @@
+/* pages/user/myworks/myworks.wxss */
+.user-works{
+  width: 750rpx;
+  background: #F0F1F5;
+}
+
+.works-article{
+  margin-top: 4rpx;
+  box-sizing: border-box;
+  width: 100%;
+  padding: 0 23rpx;
+  background: #FFFFFF;
+}
+
+.user-info{
+  width: 100%;
+  height: 120rpx;
+  font-size:32rpx;
+  display: flex;
+  align-items: center;
+}
+
+.avatar-img{
+  margin-right: 14rpx;
+  width: 96rpx;
+  height: 96rpx;
+  border-radius: 50%;
+}
+
+.avatar-img>image{
+  width: 100%;
+  height: 100%;
+  border-radius: 50%;
+}
+
+.user-name{
+  color: #000000;
+  font-weight: 500;
+}
+
+.user-time{
+  color: #686868;
+  font-weight: lighter;
+}
+
+.video-preview{
+  margin-top: 10rpx;
+  width: 100%;
+  height: 290rpx;
+  border-radius: 20rpx;
+}
+
+.video-preview>image{
+  width: 100%;
+  height: 100%;
+  border-radius: 20rpx;
+}
+
+.content-title{
+  margin-top: 10rpx;
+  width: 100%;
+  height: 40rpx;
+  font-size: 32rpx;
+  font-weight: 500;
+  color: #414141;
+}
+
+.content-detail{
+  margin-top: 30rpx;
+  width: 100%;
+  height: 50rpx;
+  display: flex;
+  justify-content: space-between;
+  font-size: 24rpx;
+}
+
+.left{
+  width: 200rpx;
+}
+
+.right{
+  width: 150rpx;
+  height: 100%;
+  display: flex;
+  justify-content: space-between;
+}
+
+.right image{
+  width: 100%;
+  height: 100%;
+}
+
+.play-img{
+  width: 20rpx;
+  height: 20rpx;
+}
+
+.point-img{
+  width: 26rpx;
+  height: 24rpx;
+}
+
+.right-detail{
+  width: 50rpx;
+  display: flex;
+  justify-content: space-between;
+  align-items: flex-start;
+}

+ 12 - 1
utils/APIClient.js

@@ -344,5 +344,16 @@ module.exports = {
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')
     }).url(url).send();
-  }
+  },
+  // 获取 用户朗读的作品
+  userWorks(followUid, pageNo, pageSize){
+    let url = getBaseUrl('wx/userRead');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).data({
+      uid: followUid,
+      pageNo: pageNo,
+      pageSize: pageSize
+    }).url(url).send();
+  },
 }