Rorschach %!s(int64=6) %!d(string=hai) anos
pai
achega
0254ff29d3

+ 99 - 68
component/hot/hot.js

@@ -14,99 +14,130 @@ export const hotInit = (that) => {
         duration: 700,
         circular: true,
         hotWareCardFirst: 'hotWareCardFirst',
-        hotWareCard : 'hotWareCard',
+        hotWareCard: 'hotWareCard',
         hotSearch: '鹅鹅鹅',
-        wareCards:[
-          {
-            title:"铺满色巴掌的水泥道1",
-            grade:"一年级 上学期",
-            img: "../../static/image/timg.jpg",
-            plays: "1",
-            likes: "2",
-            classId: "1001"
-          },
-          {
-            title:"铺满金色巴掌的水泥道2",
-            grade:"一年级 上学期",
-            img: "../../static/image/timg.jpg",
-            plays: "12345",
-            likes: "54321",
-            classId: "1002"
-          },
-          {
-            title:"铺满金色巴掌的水泥道3",
-            grade:"一年级 上学期",
-            img: "../../static/image/timg.jpg",
-            plays: "12345",
-            likes: "54321",
-            classId: "1003"
-          },
-        ]
+        banner: [],
+        recommend: [],
+        hotWorks: [],
       }
     }),
     // 搜索方法
     that.searchHandler = () => {
-      console.log('搜索按钮')
-      console.log(that.data.hotInput);
-      if(that.data.hotInput.lenght !== 0){
+      if (that.data.hotInput.lenght !== 0) {
         wx.navigateTo({
           url: `../main/searchResult/searchResult?keyWords=${that.data.hotInput}`
         })
       }
-      
+
     },
     // 输入框输入
     that.inputHandler = (e) => {
       that.setData({
         hotInput: e.detail.value
       });
-      console.log(that.data.hotInput)
     }
-    // 打开课程页面
-    that.openBooks = (e) =>{
+  // 打开课程页面
+  that.openBooks = (e) => {
+    wx.navigateTo({
+      url: `../main/books/books`
+    })
+  }
+
+  // 打开课程页面
+  that.openClass = (e, lessonId) => {
+    if (lessonId) {
       wx.navigateTo({
-        url: `../main/books/books`
+        url: `../main/class/class?id=${lessonId}`
       })
-    }
-    
-    // 打开课程页面
-    that.openClass = (e) =>{
+    } else {
       let id = e.currentTarget.dataset.classid;
       let title = e.currentTarget.dataset.title;
       wx.navigateTo({
         url: `../main/class/class?id=${id}&title=${title}`
       })
     }
-    // 打开用户作品页面
-    that.openWorks = (e) =>{
-      let uid = e.currentTarget.dataset.uid;
-      let title = e.currentTarget.dataset.title;
-      wx.navigateTo({
-        url: `../social/works/works?id=${uid}&title=${title}`
-      })
-    }
-    that.getIndex = (uid)=>{
-      httpRequestApi.getIndex({
-        uid
-      }).success((res)=>{
-        console.log(res);
-      })
-    }
-    that.getHotRecommend = (uid,pageNo,pageSize)=>{
-      httpRequestApi.getHotRecommend(
-        uid,
-        pageNo,
-        pageSize
-      ).success((res)=>{
-        console.log(res);
+  }
+  // 打开用户作品页面
+  that.openWorks = (e) => {
+    let readId = e.currentTarget.dataset.readid;
+    let title = e.currentTarget.dataset.title;
+    wx.navigateTo({
+      url: `../social/works/works?id=${readId}&title=${title}`
+    })
+  }
+  that.getIndex = () => {
+    const uid = wx.getStorageSync('uid');
+    httpRequestApi.getIndex(
+      uid
+    ).success((res) => {
+    
+      const banner = res.data.data.banner;
+      const recommend = res.data.data.recommendLesson;
+      const bannerTemp = [];
+      banner.forEach(item => {
+        const temp = {};
+        temp.url = item.boothContent;
+        temp.type = item.operationType;
+        temp.id = item.operationContent;
+    
+        bannerTemp.push(temp);
+      });
+      const recommendTemp = [];
+      recommend.forEach(item => {
+        const oTemp = {};
+        oTemp.img = item.boothContent;
+        oTemp.classId = item.operationContent;
+        oTemp.title = item.title;
+        oTemp.grade = item.summary;
+        recommendTemp.push(oTemp);
+      });
+      let bannerIndex = 'hotData.banner';
+      let recommendIndex = 'hotData.recommend';
+      that.setData({
+        [bannerIndex]: bannerTemp,
+        [recommendIndex]: recommendTemp
       })
-    }
-    // 去全部课本
-    that.goToBooks = () =>{
-      wx.navigateTo({
-        url: `../main/books/books`
+    })
+  }
+  that.getHotRecommend = (uid, pageNo, pageSize) => {
+    httpRequestApi.getHotRecommend(
+      uid,
+      pageNo,
+      pageSize
+    ).success((res) => {
+      const recommendRes = res.data.data.list;
+      const recommendWorks = [];
+      recommendRes.forEach(item => {
+        const temp = {};
+        temp.title = item.userRead.title;
+        temp.grade = item.userRead.title;
+        temp.img = item.userRead.iconImg;
+        temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
+        temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
+        temp.classId = item.userRead.id;
+        recommendWorks.push(temp);
+      });
+      const hotStr = 'hotData.hotWorks'
+      that.setData({
+        [hotStr]: recommendWorks
       })
+    })
+  }
+  // 去全部课本
+  that.goToBooks = () => {
+    wx.navigateTo({
+      url: `../main/books/books`
+    })
+  }
+  that.bannerTap = (e) => {
+    const type = e.currentTarget.dataset.type;
+    const id = e.currentTarget.dataset.id;
+    switch (type) {
+      case 'LESSON':
+        that.openClass('tap',id);
+        break;
     }
-    that.getIndex(1);
-    that.getHotRecommend(1,1,3) 
+  }
+  that.getIndex();
+  that.getHotRecommend(1, 1, 3)
 }

+ 4 - 4
component/hot/hot.wxml

@@ -1,8 +1,8 @@
 <template name="hot">
     <swiper indicator-dots="{{hotData.indicatorDots}}" autoplay="{{hotData.autoplay}}" interval="{{hotData.interval}}" duration="{{hotData.duration}}" circular="{{hotData.circular}}">
-        <block wx:for="{{hotData.imgUrls}}" wx:key="{{index}}">
+        <block wx:for="{{hotData.banner}}" wx:key="{{index}}">
             <swiper-item>
-                <image src="{{item}}" class="slide-image" width="750" height="318" />
+                <image src="{{item.url}}" data-type="{{item.type}}" data-id="{{item.id}}" bindtap="bannerTap" class="slide-image" width="750" height="318" />
             </swiper-item>
         </block>
     </swiper>
@@ -22,7 +22,7 @@
             <view class="moreBtn" bindtap="openBooks">更多></view>
         </view>
         <view class="hotWares" style="flex-direction:row;">
-            <view wx:for="{{hotData.wareCards}}" wx:key="{{index}}" class="hotWareCard" bindtap="openClass" data-classId="{{item.classId}}" data-title="{{item.title}}">
+            <view wx:for="{{hotData.recommend}}" wx:key="{{index}}" class="hotWareCard" bindtap="openClass" data-classId="{{item.classId}}" data-title="{{item.title}}">
                 <image class="wareCardImg" src="{{item.img}}" />
                 <text class="wareCardTitle">{{item.title}}</text>
                 <view class="bottomData">
@@ -47,7 +47,7 @@
             </view>
         </view>
         <view class="hotWares" style="flex-direction:row;">
-            <view wx:for="{{hotData.wareCards}}" wx:key="{{index}}" class="hotWareCard" bindtap="openWorks" data-uid="{{item.classId}}" data-title="{{item.title}}">
+            <view wx:for="{{hotData.hotWorks}}" wx:key="{{index}}" class="hotWareCard" bindtap="openWorks" data-readId="1541489786444388" data-title="{{item.title}}">
                 <image class="wareCardImg" src="{{item.img}}" />
                 <text class="wareCardTitle">{{item.title}}</text>
                 <view class="bottomData">

+ 12 - 6
component/hot/hot.wxss

@@ -51,10 +51,10 @@ swiper {
 }
 
 .searchSection .allBooks {
-    font-size: 28rpx;
+    font-size: 32rpx;
     color: #61ca54;
     font-family: PingFangSC-regular;
-    width: 112rpx;
+    width: 128rpx;
     margin-left: 56rpx;
 }
 
@@ -69,18 +69,22 @@ swiper {
     display: flex;
     align-items: center;
     justify-content: space-between;
-    margin: 8rpx 20rpx 20rpx 8rpx;
+    padding: 30rpx 22rpx 20rpx;
+
 }
-.hotSection .leftWrapper{
-    display:flex;
-align-items:center;
+
+.hotSection .leftWrapper {
+    display: flex;
+    align-items: center;
 
 }
+
 .hotSection .title image {
     width: 54rpx;
     height: 60rpx;
     margin-left: 14rpx;
 }
+
 .hotSection .title .recommendTag {
     width: 38rpx;
     height: 34rpx;
@@ -105,6 +109,7 @@ align-items:center;
     font-size: 28rpx;
     color: #6e6e6e;
 }
+
 .hotWares {
     display: flex;
     flex-wrap: wrap;
@@ -141,6 +146,7 @@ align-items:center;
     letter-spacing: 4rpx;
     font-family: MicrosoftYaHei;
 }
+
 .hotWareCard .bottomData {
     height: 34rpx;
     margin-top: 10rpx;

+ 0 - 2
pages/index/index.js

@@ -48,7 +48,6 @@ Page({
     hide: true
   },
   jurisdiction: function () {
-    console.log(1)
     //隐藏弹框
     this.setData({
       hide: !this.data.hide
@@ -95,7 +94,6 @@ Page({
   onShow: function () {
     // this.init();
     getOpenidSessionKey((res) => {
-      console.log(res);
     }, (error) => {
       // console.log(error)
       this.setData({

+ 1 - 1
pages/main/books/books.wxss

@@ -13,7 +13,7 @@
 .book image{
     display: block;
     width: 214rpx;
-    height: 190rpx;
+    height: 290rpx;
 }
 .book text{
     margin-top: 20rpx;

+ 48 - 74
pages/main/class/class.js

@@ -1,4 +1,5 @@
 import httpRequestApi from '../../../utils/APIClient';
+import {formatDate} from '../../../utils/util';
 Page({
   data: {
     fullScreenBtn: false,
@@ -7,73 +8,8 @@ Page({
     videoUrl: '',
     title: '',
     poster: '',
-    works: [{
-        nickName: '萝莉小猫咪',
-        time: '10-18 09:56',
-        avatar: '../../../static/image/timg.jpg',
-        likes: '1123',
-        uid: '1'
-      },
-      {
-        nickName: '萝莉小猫咪',
-        time: '10-18 09:56',
-        avatar: '../../../static/image/timg.jpg',
-        likes: '1123',
-        uid: '1'
-      },
-      {
-        nickName: '萝莉小猫咪',
-        time: '10-18 09:56',
-        avatar: '../../../static/image/timg.jpg',
-        likes: '1123',
-        uid: '1'
-      },
-      {
-        nickName: '萝莉小猫咪',
-        time: '10-18 09:56',
-        avatar: '../../../static/image/timg.jpg',
-        likes: '1123',
-        uid: '1'
-      },
-      {
-        nickName: '萝莉小猫咪',
-        time: '10-18 09:56',
-        avatar: '../../../static/image/timg.jpg',
-        likes: '1123',
-        uid: '1'
-      },
-      {
-        nickName: '萝莉小猫咪',
-        time: '10-18 09:56',
-        avatar: '../../../static/image/timg.jpg',
-        likes: '1123',
-        uid: '1'
-      },
-      {
-        nickName: '萝莉小猫咪',
-        time: '10-18 09:56',
-        avatar: '../../../static/image/timg.jpg',
-        likes: '1123',
-        uid: '1'
-      },
-      {
-        nickName: '萝莉小猫咪',
-        time: '10-18 09:56',
-        avatar: '../../../static/image/timg.jpg',
-        likes: '1123',
-        uid: '1'
-      },
-      {
-        nickName: '萝莉小猫咪',
-        time: '10-18 09:56',
-        avatar: '../../../static/image/timg.jpg',
-        likes: '1123',
-        uid: '1'
-      },
-
-
-
-    ]
+    works: [],
+    total: ''
   },
   onLoad: function (option) {
     console.log(option);
@@ -84,14 +20,15 @@ Page({
       title: option.title,
       id: option.id
     })
-    let uid = 1;
+    let uid = wx.getStorageSync('uid');;
 
     httpRequestApi.getClassDetail(uid, option.id).success(res => {
-        console.log(res);
-        this.setData({
-          title: res.data.data.title,
-          videoUrl:res.data.data.playUrl
-        })
+      console.log(res);
+      this.setData({
+        title: res.data.data.title,
+        videoUrl: res.data.data.playUrl
+      })
+      this.getReadInfo(1,10);
     })
   },
 
@@ -99,15 +36,52 @@ Page({
     let id = this.data.id;
     let title = this.data.title;
     wx.navigateTo({
-      url: `../../main/reading/reading?id=${id}&title=${this.data.title}&img=${this.data.img}`
+      url: `../../main/reading/reading?id=${id}&title=${this.data.title}&img=${this.data.img}&video=${this.data.videoUrl}`
     })
   },
   goToWorks: function (e) {
+    this.videoCtx = wx.createVideoContext('myVideo', this);
+    this.videoCtx.stop();
     console.log(e);
     let readId = e.target.dataset.uid;
     let title = this.data.title;
     wx.navigateTo({
       url: `../../social/works/works?id=${readId}&tilte=${title}`
     })
+  },
+  collect: function (e) {
+    let uid =  wx.getStorageSync('uid');
+    let data = {
+      
+    }
+    httpRequestApi.collectBook(uid, data).success(res => {
+      console.log(res);
+    })
+  },
+  getReadInfo: function(pageNo,pageSize){
+    const uid =  wx.getStorageSync('uid');
+    const data = {
+      lessonId: 1 ,
+      pageNo: pageNo,
+      pageSize: pageSize
+    };
+    httpRequestApi.getClassRead(uid,data).success(res=>{
+      const readInfo = res.data.data.list;
+      const readTemp = [];
+      readInfo.forEach(item => {
+        const temp = {};
+        temp.nickName = item.user.wechatName;
+        temp.time = formatDate(item.userRead.gmtCreated, 3);
+        temp.avatar = item.user.avatar;
+        temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
+        temp.uid = item.userRead.uid;
+        temp.id = item.userRead.id;
+        readTemp.push(temp);
+      });
+      this.setData({
+        total: res.data.data.totalSize,
+        works: readTemp
+      })
+    });
   }
 })

+ 2 - 2
pages/main/class/class.wxml

@@ -1,9 +1,9 @@
 <view class="classPage">
-    <video class="videoSection" src="{{videoUrl}}" controls show-fullscreen-btn="{{fullScreenBtn}}" show-play-btn="{{playBtn}}"></video>
+    <video id="classVideo" class="videoSection" src="{{videoUrl}}" controls show-fullscreen-btn="{{fullScreenBtn}}" show-play-btn="{{playBtn}}"></video>
     <view class="readWorksSection">
         <view class="peopleNum">
             <image class="peoplesIcon" src="../../../static/image/peoples.png" />
-            <view class="title">共有12345人完成了录音</view>
+            <view class="title">共有{{total}}人完成了录音</view>
         </view>
         <view class="workCard" wx:for="{{works}}" wx:key="{{index}}" bindtap="goToWorks" data-uid="{{item.uid}}">
             <image class="avatar" src="{{item.avatar}}" />

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 26 - 12
pages/main/reading/reading.js


+ 2 - 2
pages/main/reading/reading.wxml

@@ -9,7 +9,7 @@
   muted="{{muted}}"
   enable-progress-gesture="{{gesture}}"
   bindwaiting="{{videoWaiting}}"
-  bindended="{{videoCtr}}"
+  bindended="recordingVideoEnd"
   ></video>
 
   <!-- <audio name="123" author="123" src="{{recordSource}}" id="myAudio" controls loop></audio> -->
@@ -25,7 +25,7 @@
             <text>试听</text>
         </view>
         <view class="readingBtn footerBtn" bindtap="audioRecord">
-            <image class="microphone" src="{{recordFlag === 1 ? recordingGif :microphonePng}}" />
+            <image class="microphone" src="{{btnImgFlag ? recordingGif :microphonePng}}" />
             <text>我要朗读</text>
         </view>
         <view class="shareBtn footerBtn" wx:if="{{btnFlag}}" bindtap="upload">

+ 1 - 0
pages/main/singleBook/singleBook.js

@@ -10,6 +10,7 @@ Page({
         wx.setNavigationBarTitle({
             title: options.title
         })
+        const uid= wx.getStorageSync('uid');
         httpRequestApi.getBookDetail(1, options.id).success((res) => {
             console.log(res.data.data)
             const bookInfo = res.data.data.product;

+ 2 - 0
pages/main/singleBook/singleBook.wxml

@@ -6,6 +6,8 @@
     </view>
     <view class="dirTag">
         <!-- <image src="" /> -->
+        <image src="../../../static/image/menu_wrapper.png" />
+        <text >课文目录</text>
     </view>
     <view class="listSection">
         <view class="classItem" wx:for="{{lessonList}}" wx:key="{{index}}" data-id="{{item.id}}" data-title="{{item.title}}" bindtap="goToClass">

+ 18 - 0
pages/main/singleBook/singleBook.wxss

@@ -30,6 +30,24 @@
     height: 100rpx;
     margin-top: 12rpx;
     background: #fff;
+    position: relative;
+
+}
+.dirTag image{
+    position: absolute;
+    left: 42rpx;
+    top: 22rpx;
+    width: 206rpx;
+    height: 42rpx;
+}
+.dirTag text{
+    position: absolute;
+    left: 56rpx;
+    top: 22rpx;
+    width: 150rpx;
+    height: 42rpx;
+    font-size: 32rpx;
+    color: #fff;
 }
 .listSection{
     width: 100%;

+ 35 - 73
pages/social/replyDetail/replyDetail.js

@@ -1,89 +1,51 @@
 import httpRequestApi from '../../../utils/APIClient';
+import {formatDate} from '../../../utils/util';
 Page({
     data: {
         class1: 'commentItem commentItemFirst',
         classNormal: 'commentItem',
-        comment:[
-            {
-                name: '阿尔萨斯',
-                text: '总有一天我将死去而你我儿子啊将加冕为王加冕为王加冕为王加冕为王加冕为王加冕为王加冕为王',
-                time: '10-18 09:56',
-                likes: '165',
-                avatar: '../../../static/image/timg.jpg'
-            },
-            {
-                name: '古尔丹',
-                text: '你读的是个求',
-                time: '10-18 09:56',
-                likes: '165',
-                avatar: '../../../static/image/timg.jpg'
-            },
-            {
-                name: '阿尔萨斯',
-                text: '圣光将照耀我',
-                time: '10-18 09:56',
-                likes: '165',
-                avatar: '../../../static/image/timg.jpg'
-            },
-        ]
+        postId: '',
+        comment:[]
         
     },
     onLoad: function (option) {
         console.log(option)
-
-        wx.setNavigationBarTitle({
-            title: option.num + '条回复'//页面标题为路由参数
-        })
-
-
-    },
-    goToReading: function () {
-        let id = this.data.id;
-        let title = this.data.title;
-        wx.navigateTo({
-            url: `../../main/reading/reading?id=${id}&title=${title}`
+        this.setData({
+            postId: option.id
         })
-    },
-    onShareAppMessage: function (res) {
-        if (res.from === 'button') {
-            // 来自页面内转发按钮
-            console.log(res.target)
-        }
-        return {
-            title: '测试',
-            path: '/pages/social/works/works'
-        }
-    },
-    follow: function () {
-        let uid = 1;
-        let followUid = 2;
-        httpRequestApi.followUser(uid, followUid).success((res) => {
-            console.log(res)
-        });
-    },
-    // 去其他用户的作品页
-    goToOthers: function (e) {
-        wx.navigateTo({
-            url: `../../main/reading/reading?id=${id}&title=${title}`
+        wx.setNavigationBarTitle({
+            title: option.count + '条回复'//页面标题为路由参数
         })
+        this.getReplyDetail();
     },
-    // 查询回复
-    getReply: function () {
-        let uid = 1;
-        let columnId = 1001;
-        let pageNo = 1;
-        let pageSize = 10;
-        httpRequestApi.getReply(uid, columnId, pageNo, pageSize).success((res) => {
+    // 查询回复详情
+    getReplyDetail: function () {
+        let uid = wx.getStorageSync('uid');
+        httpRequestApi.getReplyComment(uid, this.data.postId).success((res) => {
             console.log(res);
+            const replyList = res.data.data.replyVOList;
+            const replied = res.data.data;
+            const replyTemp = [];
+            const authorDetail = {};
+            authorDetail.name = replied.user.wechatName;
+            authorDetail.text = replied.detailDesc;
+            authorDetail.time = formatDate(replied.gmtCreated,3);
+            authorDetail.likes = replied.postsAttributeInfo.favors;
+            authorDetail.avatar = replied.user.avatar;
+            replyTemp.push(authorDetail);
+            replyList.forEach(item => {
+                const temp = {};
+                temp.name = item.user.wechatName;
+                temp.text = item.content;
+                temp.time = formatDate(item.gmtCreated,3);
+                temp.likes = 0;
+                temp.avatar = item.user.avatar;
+                replyTemp.push(temp);
+                console.log(replyTemp);
+            });
+            this.setData({
+                comment: replyTemp
+            })
         });
-    },
-    // 打开回复详情页
-    goToDetail: function (e) {
-        let id = e.currentTarget.dataset.id;
-        let num = e.currentTarget.dataset.num;
-        console.log(e);
-        wx.navigateTo({
-            url: `../../social/replyDetail/replyDetail?id=${id}&num=${num}`
-        })
     }
 })

+ 70 - 71
pages/social/works/works.js

@@ -1,63 +1,19 @@
 import httpRequestApi from '../../../utils/APIClient';
+import {formatDate} from '../../../utils/util';
 Page({
     data: {
         fullScreenBtn: false,
         playBtn: false,
         gesture: true,
-        user: [{
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            },
-            {
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            },
-            {
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            },
-            {
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            },
-            {
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            },
-            {
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            },
-            {
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            },
-            {
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            },
-            {
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            },
-            {
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            },
-            {
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            },
-            {
-                nickName: '萝莉小猫咪',
-                image: '../../../static/image/timg.jpg',
-            }
-        ],
+        author: '',
+        videoSrc: '',
+        total: '',
+        authorAvatar: '',
+        user: [],
         inputValue: 'smdx',
-        text: '总有一天我将实质性操作死去而你我的\xa0\xa0\xa0\xa0\xa0\xa0\xa0儿子自行车在啊实打实大苏打撒旦将加冕为王'
+        replyList: [],
     },
     onLoad: function (option) {
-        console.log(option)
         if (option.title) {
             wx.setNavigationBarTitle({
                 title: option.title //页面标题为路由参数
@@ -67,12 +23,46 @@ Page({
                 id: option.id
             })
         }
-        let uid = 1;
-        httpRequestApi.getWorksDetail(uid, option.id).success((res) => {
-            console.log(res);
+        let uid = wx.getStorageSync('uid');
+        this.getWorks(uid, option.id);
+    },
+    getWorks: function (uid, id) {
+        httpRequestApi.getWorksDetail(uid, id).success((res) => {
+            const others = res.data.data.otherRead;
+            const author = res.data.data.user;
+            const works = res.data.data.userRead;
+            const othersTemp = [];
+            others.forEach((item) => {
+                const temp = {};
+                temp.image = item.user.avatar;
+                temp.nickName = item.user.wechatName;
+                othersTemp.push(temp);
+            });
+            this.setData({
+                user: othersTemp,
+                author: author.wechatName,
+                authorAvatar: author.avatar,
+                videoSrc: works.originVideo,
+                audioSrc: works.audioPath
+            })
+            // 设置音频路径
+            this.innerAudioContext = wx.createInnerAudioContext();
+            this.innerAudioContext.onError((res) => {
+                // 播放音频失败的回调
+            })
+            this.innerAudioContext.src = this.data.audioSrc; // 这里可以是录音的临时路径
             this.getReply();
         });
     },
+    videoPlay: function () {
+        this.innerAudioContext.play();
+    },
+    videoEnd: function () {
+        this.innerAudioContext.stop();
+    },
+    videoPause: function () {
+        this.innerAudioContext.pause();
+    },
     goToReading: function () {
         let id = this.data.id;
         let title = this.data.title;
@@ -91,7 +81,7 @@ Page({
         }
     },
     follow: function () {
-        let uid = 1;
+        let uid = wx.getStorageSync('uid');
         let followUid = 2;
         httpRequestApi.followUser(uid, followUid).success((res) => {
             console.log(res)
@@ -105,21 +95,38 @@ Page({
     },
     // 查询回复
     getReply: function () {
-        let uid = 1;
-        let columnId = 1001;
+        let uid = wx.getStorageSync('uid');
+        let columnId = this.data.id;
         let pageNo = 1;
         let pageSize = 10;
         httpRequestApi.getReply(uid, columnId, pageNo, pageSize).success((res) => {
-            console.log(res);
+            console.log(res.data.data.list);
+            const replyList = res.data.data.list;
+            const replyTemp = [];
+            replyList.forEach((item)=>{
+                const temp = {};
+                temp.nickName = item.user.wechatName;
+                temp.avatar = item.user.avatar;
+                temp.text = item.detailDesc;
+                temp.id = item.id;
+                temp.replyCount=item.replyCount;
+                temp.time = formatDate(item.gmtCreated,3);
+                console.log(temp.time)
+                replyTemp.push(temp); 
+            });
+            this.setData({
+                replyList: replyTemp,
+                total: res.data.data.totalSize
+            })
         });
     },
     // 打开回复详情页
     goToDetail: function (e) {
         let id = e.currentTarget.dataset.id;
-        let num = e.currentTarget.dataset.num;
+        let count = e.currentTarget.dataset.count;
         console.log(e);
         wx.navigateTo({
-            url: `../../social/replyDetail/replyDetail?id=${id}&num=${num}`
+            url: `../../social/replyDetail/replyDetail?id=${id}&count=${count}`
         })
     },
     //  绑定输入框内容
@@ -132,18 +139,10 @@ Page({
     sendHandler: function () {
         console.log(this.data.inputValue);
         if (this.data.inputValue !== '') {
-            // let uid = 1;
-            // let data = {
-            //     "postId": 1,
-            //     "content": this.data.inputValue
-            // }
-            // httpRequestApi.postReplyComment(uid, data).success(res => {
-            //     console.log(res);
-            // });
-            let uid = 1;
+            let uid = wx.getStorageSync('uid');
             let data = {
-                "columnId": '1541403885738293',
-                colunmNames: '金色巴掌',
+                "columnId": this.data.id,
+                colunmNames: 'what',
                 "detailDesc": this.data.inputValue
             }
             httpRequestApi.postReply(uid, data).success(res => {

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

@@ -1,8 +1,8 @@
 <view>
-    <video class="videoSection" src="http://efunvideo.ai160.com/vs2m/001/00103075/00103075012/00103075012.m3u8" controls show-fullscreen-btn="{{fullScreenBtn}}" show-play-btn="{{playBtn}}"></video>
+    <video class="videoSection" src="{{videoSrc}}" bindplay="videoPlay" bindended="videoEnd" bindpause="videoPause" muted="true" controls="false" show-fullscreen-btn="{{fullScreenBtn}}" show-play-btn="{{playBtn}}"></video>
     <view class="readAuthorSection">
-        <image class="avatar" src="../../../static/image/timg.jpg" />
-        <text class="nickName">萝莉小猫咪</text>
+        <image class="avatar" src="{{authorAvatar}}" />
+        <text class="nickName">{{author}}</text>
         <view class="like">
             <image src="../../../static/image/liked.png" />
             <text class="likeBtn">点赞</text>
@@ -25,17 +25,17 @@
         </scroll-view>
     </view>
     <view class="commentSection">
-        <view class="title">评论(38)</view>
+        <view class="title">评论({{total}})</view>
         <input class="commentInput" bindconfirm="sendHandler" confirm-type="send" placeholder="听了这么多,说点什么吧" bindinput="inputValue"></input>
     </view>
     <view class="commentArea">
-        <view class="commentItem" >
-            <image class="avatar" src="../../../static/image/timg.jpg" />
+        <view class="commentItem" wx:for="{{replyList}}" wx:key="{{index}}" >
+            <image class="avatar" src="{{item.avatar}}" />
             <view class="commentCore">
-                <text class="nickName">阿尔萨斯</text>
-                <text class="time">10-18 09:56</text>
-                <text class="gut">{{text}}</text>
-                <view class="commentAll" bindtap="goToDetail" data-id="1" data-num="8">共有123条评论</view>
+                <text class="nickName">{{item.nickName}}</text>
+                <text class="time">{{item.time}}</text>
+                <text class="gut">{{item.text}}</text>
+                <view class="commentAll" bindtap="goToDetail" data-id="{{item.id}}" data-count="{{item.replyCount}}">共有{{item.replyCount}}条评论</view>
             </view>
             <view class="btnWrapper">
                 <image class="commentBtn" src="../../../static/image/comment.png" />

+ 3 - 2
pages/social/works/works.wxss

@@ -59,7 +59,7 @@
     border-radius: 30rpx;
     text-align: center;
     line-height: 60rpx;
-    color: #259b24;
+    color: #539bee;
 }
 
 .userSection {
@@ -143,13 +143,14 @@
 
 .commentArea {
     width: 100%;
+    margin-bottom: 160rpx;
 }
 
 .commentArea .commentItem {
     width: 704rpx;
     height: 240rpx;
     border-bottom: solid 2rpx #f0f1f5;
-    margin: 0 auto 200rpx;
+    margin: 0 auto 20rpx;
     display: flex;
     position: relative;
 }

BIN=BIN
static/image/menu_wrapper.png


+ 22 - 1
utils/APIClient.js

@@ -61,6 +61,13 @@ module.exports = {
 			uid
 		}).url(url).send();
 	},
+	// 获取单课朗读信息
+	getClassRead(uid,data){
+		let url = getBaseUrl(`wx/userRead`);
+		return request.getInstance().header({
+			uid
+		}).data(data).url(url).send();
+	},
 	// 发布作品
 	postWork(uid, data) {
 		console.log(data);
@@ -121,6 +128,13 @@ module.exports = {
 			pageSize: pageSize
 		}).send();
 	},
+	// 获取回复(楼中楼)
+	getReplyComment(uid, postId){
+		let url = getBaseUrl(`wx/posts/one/${postId}`);
+		return request.getInstance().header({
+			uid
+		}).url(url).send();
+	},
 	// 发布回复(楼中楼)
 	postReplyComment(uid, data){
 		let url = getBaseUrl(`wx/reply`);
@@ -157,5 +171,12 @@ module.exports = {
 		}).url(url).data({
 			orderId
 		}).method('POST').send();
-	}
+	},
+	// 收藏课程
+	collectBook(uid, data){
+		let url = getBaseUrl(`wx/favorites`);
+		return request.getInstance().header({
+			uid
+		}).url(url).data(data).method('POST').send();
+	},
 }

+ 20 - 2
utils/util.js

@@ -13,7 +13,25 @@ const formatNumber = n => {
   n = n.toString()
   return n[1] ? n : '0' + n
 }
-
+//时间戳转时间
+function formatDate(time, flag) {
+	const t = new Date(time); 
+	const tf = function(i){return (i < 10 ? '0' : '') + i};
+	const year = t.getFullYear();
+	const month = tf(t.getMonth() + 1);
+	const day = tf(t.getDate());
+	const hour = tf(t.getHours());
+	const minute = tf(t.getMinutes());
+	//console.log( month + '月' + day + '日' + hour + ':' + minute);
+	if(flag == 1) {
+		return  month + '月' + day + '日' + ' ' + hour + ':' + minute;
+	}else if(flag == 2) {
+		return year + '-' + month + '-' + day
+	}else if(flag == 3){
+		return month + '-' + day + ' ' + hour + ':' + minute;
+	}
+}
 module.exports = {
-  formatTime: formatTime
+  formatTime: formatTime,
+  formatDate
 }