Rorschach 4 years ago
parent
commit
ae28351f75

+ 1 - 1
app.json

@@ -2,6 +2,7 @@
   "pages": [
     "pages/index/index",
     "pages/login/login",
+    "pages/reading/reading",
     "pages/social/works/works",
     "pages/social/insideMessage/insideMessage",
     "pages/social/replyDetail/replyDetail",
@@ -10,7 +11,6 @@
     "pages/main/class/class",
     "pages/main/books/books",
     "pages/main/week/week",
-    "pages/main/reading/reading",
     "pages/main/searchResult/searchResult",
     "pages/user/myEdit/myEdit",
     "pages/user/myconcern/myconcern",

+ 47 - 4
component/video-swiper/index.js

@@ -8,6 +8,10 @@ Component({
         pureDataPattern: /^_/
     },
     properties: {
+        showMyBtn: {
+            type: Boolean,
+            value: false
+        },
         ifHeadTap: {
             type: Boolean,
             value: true
@@ -96,7 +100,7 @@ Component({
             this.playCurrent(current);
             this.triggerEvent('change', {
                 activeId: curQueue[current].id,
-                index:current,
+                index: current,
                 _last,
                 nextQueue,
             });
@@ -152,13 +156,21 @@ Component({
             });
         },
         onPlay: function onPlay(e) {
-            this.trigger(e, 'play');
+            console.log('播放记录',e)
+            httpRequestApi.playLogReport({
+                readId: e.currentTarget.dataset.id,
+                playStopTime: 1000
+            }).success(res=>{
+                console.log('播放记录',res)
+            })
+            // this.trigger(e, 'play');
         },
         onPause: function onPause(e) {
             this.trigger(e, 'pause');
         },
         onEnded: function onEnded(e) {
-            this.trigger(e, 'ended');
+            console.log('播放结束',e)
+            // this.trigger(e, 'ended');
         },
         onError: function onError(e) {
             this.trigger(e, 'error');
@@ -194,8 +206,15 @@ Component({
             // this.trigger(e, 'headTap')
             console.log('点击头像', e)
             wx.navigateTo({
-                url: `../../pages/user/myworks/myworks?uid=${uid}`
+                url: `../../pages/user/myworks/myworks?uid=${uid}`,
+                fail: (err) => {
+                    console.log('跳转错误', err)
+                    wx.navigateTo({
+                        url: `../../../pages/user/myworks/myworks?uid=${uid}`
+                    });
+                }
             });
+
         },
         // 去朗读
         goToReading: function goToReading(e) {
@@ -250,7 +269,31 @@ Component({
             });
 
         },
+        delete: function (e) {
+            console.log('删除', e)
+            let data = {
+                id: e.currentTarget.dataset.id,
+                status: 'DEL'
+            }
+            httpRequestApi.putWork(data).success(res => {
+                console.log('已删除', res)
+                this.triggerEvent('delHideMyWork');
+            })
+        },
+        hide: function (e) {
+            console.log('隐藏', e)
+            const status = e.currentTarget.dataset.status ? e.currentTarget.dataset.status : e.target.dataset.status
+            console.log('当前状态', status)
+            let data = {
+                id: e.currentTarget.dataset.id,
+                status: status === 'NORMAL' ? 'DISABLE' : 'NORMAL'
+            }
+            httpRequestApi.putWork(data).success(res => {
+                console.log('已隐藏', res)
+                this.triggerEvent('delHideMyWork');
 
+            })
+        },
         trigger: function trigger(e, type) {
             if (!wx.getStorageSync('user').wechatName) {
                 wx.navigateTo({

+ 43 - 2
component/video-swiper/index.less

@@ -61,6 +61,48 @@
                 font-size: 26rpx;
                 color: rgba(0, 0, 0, 0.60);
             }
+
+            .my_btn {
+                display: flex;
+                align-items: center;
+
+                
+                .delete {
+                    display: flex;
+                    flex-direction: column;
+                    align-items: center;
+                    margin-right: 45rpx;
+
+                    .delete_image {
+                        width: 25rpx;
+                        height: 33rpx;
+                        margin-bottom: 2rpx;
+                    }
+
+                    .delete_text {
+                        font-size: 26rpx;
+                        color: rgba(0, 0, 0, 0.60);
+                    }
+                }
+                .hide {
+                    display: flex;
+                    flex-direction: column;
+                    align-items: center;
+                    margin-right: 23rpx;
+                    padding-top: 3rpx;
+                    box-sizing: border-box;
+                    .hide_image {
+                        width: 32rpx;
+                        height: 27rpx;
+                        margin-bottom: 5rpx;
+                    }
+
+                    .hide_text {
+                        font-size: 26rpx;
+                        color: rgba(0, 0, 0, 0.60);
+                    }
+                }
+            }
         }
 
         .video_item {
@@ -158,5 +200,4 @@
 
 
 
-}
-
+}

+ 33 - 10
component/video-swiper/index.wxml

@@ -20,9 +20,19 @@
           </view>
             
         </view>
-          <view class="time">
+          <view wx:if="{{!item.showMyBtn}}" class="time">
             <text>发布时间:{{item.time}}</text>
           </view>
+          <view wx:if="{{item.showMyBtn}}" class="my_btn">
+            <view catchtap="delete" data-id="{{item.id}}">
+              <image src="../../static/index/star.png" />
+              <text >删除</text>
+            </view>
+            <view catchtap="hide" data-status="{{item.status}}"  data-id="{{item.id}}">
+              <image src="../../static/index/star.png" />
+              <text >隐藏</text>
+            </view>
+          </view>
       </view>
       <video 
         id="video_{{index}}" 
@@ -35,6 +45,9 @@
         src="{{item.url}}" 
         object-fit="contain"
         data-index="{{index}}"
+        data-id="{{item.id}}"
+        bindplay="onPlay"
+        bindended="onEnded"
       >
       <!--   bindplay="onPlay"
         bindpause="onPause"
@@ -87,16 +100,26 @@
   <!-- // 非swiper -->
   <view wx:if="{{!isSwiper}}" class="swiper_item no_swiper" wx:for="{{videoList}}"  data-id="{{item.id}}"  wx:key="*this">
       <view class="head_box">
-        <view class="user_box" catchtap="headTap" data-id="{{item.uid}}">
+        <view class="user_box" catchtap="{{ifHeadTap ? 'headTap' : null}}" data-id="{{item.uid}}">
           <image class="avatar" lazy-load="true" src="{{item.avatar}}" />
           <view class="user_right">
             <view class="nickname">{{item.nickName}}</view>
           </view>
             
         </view>
-          <view class="time">
+          <view wx:if="{{!item.showMyBtn}}" class="time">
             <text>发布时间:{{item.time}}</text>
           </view>
+          <view wx:if="{{item.showMyBtn}}" class="my_btn">
+            <view class="delete" catchtap="delete" data-id="{{item.id}}">
+              <image class="delete_image" src="../../static/index/star.png" />
+              <text class="delete_text" >删除</text>
+            </view>
+            <view class="hide" catchtap="hide" data-status="{{item.status}}" data-id="{{item.id}}">
+              <image class="hide_image" src="../../static/index/star.png" />
+              <text class="hide_text" >{{item.status === 'DISABLE' ? '打开' : '隐藏'}}</text>
+            </view>
+          </view>
       </view>
       <video 
         id="video_{{index}}" 
@@ -128,8 +151,8 @@
         
       <view class="foot_box"> 
         <view class="foot_left">
-          <view class="btn collect_btn" catchtap="collectTap" data-id="{{item.id}}" data-type="{{item.type}}">
-              <image class="collect_btn_icon" src="../../static/index/star.png" />
+          <view class="btn collect_btn" catchtap="collectTap" data-index="{{index}}" data-id="{{item.id}}" data-type="{{item.type}}">
+              <image class="collect_btn_icon" src="{{item.isFavorite ? '../../static/index/star_colored.png' : '../../static/index/star.png'}}" />
               <text>收藏</text>
           </view>
           <view class="btn share_btn" catchtap="likeTap" data-index="{{index}}" data-id="{{item.id}}" data-type="{{item.type}}">
@@ -137,14 +160,14 @@
               <text>分享</text>
           </view>
         </view>
-        <view class="foot_right">
-          <view class="btn flower_btn" catchtap="likeTap" data-index="{{index}}" data-id="{{item.id}}" data-type="{{item.type}}">
-              <image class="flower_btn_icon" src="../../static/index/flower.png"  />
+          <view class="foot_right">
+          <view class="btn flower_btn" catchtap="{{item.isLike ?  null : 'likeTap'}}" data-index="{{index}}" data-id="{{item.id}}" data-islike="{{item.isLike}}">
+              <image class="flower_btn_icon" src="{{item.isLike ? '../../static/index/flower_colored.png' : '../../static/index/flower.png'}}" />
               <text>{{item.likes}}</text>
           </view>
           <view class="btn comment_btn" catchtap="openComment" data-id="{{item.id}}">
-              <image class="comment_btn_icon" src="../../static/index/comment.png" />
-              <text>{{item.likes}}123</text>
+              <image class="comment_btn_icon" src="../../static/index/comment.png" lazy-load="true" />
+              <text>{{item.commentAmount}}</text>
           </view>
         </view>
             

+ 36 - 0
component/video-swiper/index.wxss

@@ -49,6 +49,42 @@
   font-size: 26rpx;
   color: rgba(0, 0, 0, 0.6);
 }
+.swiper_container .swiper_item .head_box .my_btn {
+  display: flex;
+  align-items: center;
+}
+.swiper_container .swiper_item .head_box .my_btn .delete {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  margin-right: 45rpx;
+}
+.swiper_container .swiper_item .head_box .my_btn .delete .delete_image {
+  width: 25rpx;
+  height: 33rpx;
+  margin-bottom: 2rpx;
+}
+.swiper_container .swiper_item .head_box .my_btn .delete .delete_text {
+  font-size: 26rpx;
+  color: rgba(0, 0, 0, 0.6);
+}
+.swiper_container .swiper_item .head_box .my_btn .hide {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  margin-right: 23rpx;
+  padding-top: 3rpx;
+  box-sizing: border-box;
+}
+.swiper_container .swiper_item .head_box .my_btn .hide .hide_image {
+  width: 32rpx;
+  height: 27rpx;
+  margin-bottom: 5rpx;
+}
+.swiper_container .swiper_item .head_box .my_btn .hide .hide_text {
+  font-size: 26rpx;
+  color: rgba(0, 0, 0, 0.6);
+}
 .swiper_container .swiper_item .video_item {
   width: 100%;
   height: 422rpx;

+ 94 - 106
pages/index/index.js

@@ -51,7 +51,8 @@ Page({
     winH: 568,
     myIndex: 0,
     followData: [],
-    recommendPageNo: 0,
+    recommendPageNo: 1,
+    recommendPageSize: 6,
     recommendTotalNo: 1,
     myData: {},
     templates: '',
@@ -72,7 +73,9 @@ Page({
     commentNum: 0,
     followPageNo: 1,
     followPageSize: 6,
-    coursesData: []
+    coursePageNo: 1,
+    coursesData: [],
+
   },
   jurisdiction: function () {
     //隐藏弹框
@@ -131,7 +134,9 @@ Page({
     if (myIndex == 2) {
       this.setData({
         videoList: [],
-        templates: 'courses'
+        coursesData: [],
+        templates: 'courses',
+        coursePageNo: 1
       }, () => {
         this.getCoursesList();
       })
@@ -235,8 +240,28 @@ Page({
 
   },
   onShow: function (e) {
+    console.log('this.data.workId', this.data.workId)
+    if (this.data.workId) {
+      // 需要在推荐第一个上插入一条分享或者刚朗读完数据
+      this.setData({
+        myIndex: 0,
+        videoList: [],
+        isSwiper: true,
+        recommendTotalNo:1
+      })
+      httpRequestApi.getClassDetail(this.data.workId).success(res => {
+        console.log('有一条数据', res)
+        let tempList = [];
+        tempList.push(res.data.data);
+        this.formatWorksList(tempList, true);
+        this.getHotRecommend()
+
+      })
+    }
     console.log('页面显示', e)
-    this.getUserWorksInfo(1)
+    if (this.data.myIndex === 3) {
+      this.getUserWorksInfo(1)
+    }
     wx.setNavigationBarTitle({
       title: '小学语文朗读配音'
     })
@@ -260,75 +285,49 @@ Page({
   },
   /* 两个接口维护同一个数组,手动的结束后添加算法的 */
   // 推荐页信息 获取消息和手动推荐内容
-  getHotRecommend: function (uid) {
-    httpRequestApi.getHotRecommend(
-      uid
-    ).success((res) => {
-      // 点击切换按钮时 只刷新我的课程和未读消息 官方推荐和热门不加载
-      /*      const recommendRes = res.data.data;
-           console.log(res)
-           recommendRes.hotReader.forEach(item => {
-             const temp = {};
-             temp.title = item.userRead ? 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.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
-             temp.classId = item.userRead.lessonId;
-             temp.time = formatDate(item.userRead.gmtCreated, 3);
-             temp.avatar = item.user ? item.user.avatar : '';
-             temp.uid = item.user ? item.user.uid : '';
-             temp.url = item.userRead.originVideo;
-             temp.type = item.userRead.type;
-             // temp.avatar = item.user.avatar;
-             temp.nickName = item.user ? item.user.wechatName : '';
-             temp.id = item.userRead.id;
-             temp.isLike = item.isLike;
-             temp.isFavorite = item.isFavorites;
-             this.data.videoList.push(temp);
-           });
-           this.setData({
-             videoList: this.data.videoList
-           }) */
-      this.getHotRecommendSecond(1, 5)
-    })
-  },
   // 获取热门作品 算法出来的
-  getHotRecommendSecond: function (pageNo, pageSize) {
+  getHotRecommend: function () {
     let grade = wx.getStorageSync('grade')
+    let pageNo = this.data.recommendPageNo;
+    let pageSize = this.data.recommendPageSize;
     httpRequestApi.getHotRecommendSecond(grade, pageNo, pageSize).success(res => {
       console.log(res)
       const recommendRes = res.data.data.list;
       if (recommendRes.length === 0) return;
       // const recommendWorks = [];
-      recommendRes.forEach(item => {
-        const temp = {};
-        temp.title = item.userRead.title;
-        temp.summary = item.userRead.summary;
-        temp.img = item.userRead.iconImg;
-        temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
-        temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
-        temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
-        temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
-        temp.time = formatDate(item.userRead.gmtCreated, 3);
-        temp.avatar = item.user.avatar;
-        temp.profession = item.user.profession;
-        temp.uid = item.user.uid;
-        temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
-        temp.id = item.userRead.id;
-        temp.type = item.userRead.type;
-        // temp.avatar = item.user.avatar;
-        temp.nickName = item.user.wechatName;
-        temp.isLike = item.isLike;
-        temp.isFavorite = item.isFavorites;
-        // recommendWorks.push(temp);
-        this.data.videoList.push(temp);
+      this.formatWorksList(recommendRes);
 
-      });
+    })
+  },
+  // 组装list
+  formatWorksList(list, notSet) {
+    list.forEach(item => {
+      const temp = {};
+      temp.title = item.userRead.title;
+      temp.summary = item.userRead.summary;
+      temp.img = item.userRead.iconImg;
+      temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
+      temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
+      temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
+      temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
+      temp.time = formatDate(item.userRead.gmtCreated, 3);
+      temp.avatar = item.user.avatar;
+      temp.profession = item.user.profession;
+      temp.uid = item.user.uid;
+      temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
+      temp.id = item.userRead.id;
+      temp.type = item.userRead.type;
+      temp.nickName = item.user.wechatName;
+      temp.isLike = item.isLike;
+      temp.isFavorite = item.isFavorites;
+      this.data.videoList.push(temp);
+    });
+    if (!notSet) {
       this.setData({
         videoList: this.data.videoList
       })
-    })
+    }
+
   },
   // 获取用户信息
   getUserWorksInfo: function (flag) {
@@ -398,20 +397,20 @@ Page({
   // 触底加载
   onReachBottom: function () {
     console.log('到了底部到了底部', this.data.myIndex)
-    // if (this.data.myIndex === 0) {
-    //   this.setData({
-    //     followPageNo: this.data.followPageNo + 1
-    //   })
-    //   if (this.data.followPageNo <= this.data.followPageTotalNo) {
-    //     this.getFollowWorks(this.data.followPageNo, 3);
-
-    //   } else {
-    //     console.log('没有更多')
-    //     this.setData({
-    //       ifHaveMore: false
-    //     })
-    //   }
-    // }
+    if (this.data.myIndex === 2) {
+      this.setData({
+        coursePageNo: this.data.coursePageNo + 1
+      }, () => {
+        this.getCoursesList()
+      })
+    }
+    if (this.data.myIndex === 0) {
+      this.setData({
+        recommendPageNo: this.data.recommendPageNo + 1
+      }, () => {
+        this.getHotRecommend()
+      })
+    }
     // // 当前在推荐页面 加载推荐
     // if (this.data.myIndex === 1) {
     //   console.log(this.data.recommendPageNo)
@@ -503,6 +502,9 @@ Page({
       }
     })
   },
+  delHideMyWork:function(){
+    this.getMyRead()
+  },
   // 获取我的朗读
   getMyRead: function () {
     httpRequestApi.myRead().success(res => {
@@ -511,29 +513,29 @@ Page({
       const myList = res.data.data;
       if (myList.length === 0) return;
       // const recommendWorks = [];
+      const myWorks = [];
       myList.forEach(item => {
-        console.log('mydata', this.data.myData)
-        console.log('mydata', this.data.myData.userInfo.user)
-
         const temp = {};
         temp.title = item.title;
         temp.summary = item.summary;
         temp.img = item.iconImg;
         temp.plays = item.playAmount;
         temp.likes = item.likeAmount;
+        temp.commentAmount = item.commentAmount;
         temp.classId = item.exampleId ? item.exampleId : 1605097720036046;
         temp.time = formatDate(item.gmtCreated, 3);
         temp.avatar = this.data.myData.userInfo.avatar;
         temp.uid = this.uid;
         temp.url = item.videoPath;
         temp.id = item.id;
-        // temp.avatar = item.user.avatar;
+        temp.showMyBtn = true;
         temp.nickName = this.data.myData.userInfo.wechatName;
-        // recommendWorks.push(temp);
-        this.data.videoList.push(temp);
+        temp.status = item.status
+        myWorks.push(temp);
       });
+      console.log('myWorks',myWorks)
       this.setData({
-        videoList: this.data.videoList
+        videoList: myWorks
       })
     })
   },
@@ -644,25 +646,8 @@ Page({
       }
       console.log('关注列表', res)
       const followData = res.data.data.list;
-      const videoList = [];
-      followData.forEach(item => {
-        const temp = {};
-        temp.title = item.userRead ? 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.exampleId ? item.userRead.exampleId : 1605097720036046;
-        temp.time = formatDate(item.userRead.gmtCreated, 3);
-        temp.avatar = item.user ? item.user.avatar : '';
-        temp.uid = item.user ? item.user.uid : '';
-        temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
-        temp.nickName = item.user ? item.user.wechatName : '';
-        temp.id = item.userRead.id;
-        videoList.push(temp);
-      });
-      this.setData({
-        videoList: videoList
-      })
+      // const videoList = [];
+      this.formatWorksList(followData);
     });
   },
   // 点击用户头像区域
@@ -677,13 +662,16 @@ Page({
   getCoursesList: function () {
     const grade = wx.getStorageSync('grade');
     const data = {
+      pageNo: this.data.coursePageNo,
+      pageSize: 6,
       grade,
       type: 'EXAMPLE'
-    }
+    };
+    console.log('资源', data)
     httpRequestApi.getClassRead(data).success(res => {
-      console.log('资源', res)
+      console.log('资源', this.data.coursesData)
       this.setData({
-        coursesData: res.data.data.list
+        coursesData: this.data.coursesData.concat(res.data.data.list)
       }, () => {
         console.log(this.data.coursesData)
       })
@@ -693,7 +681,7 @@ Page({
     console.log('去朗读', e)
     const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
     wx.navigateTo({
-      url: `../../pages/main/reading/reading?id=${id}`
+      url: `../../pages/reading/reading?id=${id}`
     });
   },
 

+ 1 - 1
pages/index/index.wxml

@@ -30,7 +30,7 @@
   </view>
   <!-- 调用组件 -->
   <template is="{{templates}}" wx:if="{{myIndex === 3 || myIndex === 2}}" data="{{myData: myData,coursesData:coursesData}}"></template>
-  <VideoSwiper wx:if="{{videoList.length > 0}}" class="video-swiper" video-list="{{videoList}}" nextMargin="{{nextMargin}}" isSwiper="{{isSwiper}}" ifHeadTap="{{true}}" bindopenComment="openComment" bindheadTap="headTapHandler" bindgoToReading="goToReading" bindchange="videoChange">
+  <VideoSwiper wx:if="{{videoList.length > 0}}" class="video-swiper" video-list="{{videoList}}" nextMargin="{{nextMargin}}" isSwiper="{{isSwiper}}" ifHeadTap="{{true}}" bindopenComment="openComment" bindheadTap="headTapHandler" bindgoToReading="goToReading" binddelHideMyWork="delHideMyWork" bindchange="videoChange">
     <!-- bindplay="onPlay"
   bindpause="onPause"
   bindtimeupdate="onTimeUpdate"

+ 38 - 23
pages/main/reading/reading.js

@@ -1,7 +1,7 @@
-import httpRequestApi from '../../../utils/APIClient';
+import httpRequestApi from '../../utils/APIClient';
 import {
     formatDate
-} from '../../../utils/util';
+} from '../../utils/util';
 Page({
     data: {
         title: '',
@@ -18,8 +18,8 @@ Page({
         videoCtr: 'recordingVideoEnd',
         btnFlag: false,
         btnImgFlag: false,
-        microphonePng: '../../../static/image/microphone.png',
-        recordingGif: '../../../static/image/readingNow.gif',
+        microphonePng: '../../static/image/microphone.png',
+        recordingGif: '../../static/image/readingNow.gif',
         videoUrl: '',
         readingText: '',
         videoList: [],
@@ -42,18 +42,18 @@ Page({
         this.videoCtx = null;
         const uid = wx.getStorageSync('uid')
         httpRequestApi.getClassDetail(option.id).success(res => {
-            console.log(res)
+            console.log('课程信息', res)
             let reg = /\\n/g
             this.setData({
-                title: res.data.data.title,
-                videoUrl: res.data.data.originVideo || res.data.data.playUrl,
-                originVideo: res.data.data.originVideo,
-                img: res.data.data.iconImg,
-                id: res.data.data.id,
-                readingText: res.data.data.lessonText,
-                grade: res.data.data.grade,
-                exampleId: res.data.data.exampleId,
-                summary: res.data.data.summary
+                title: res.data.data.userRead.title,
+                videoUrl: res.data.data.userRead.videoPath,
+                originVideo: res.data.data.userRead.originVideo,
+                img: res.data.data.userRead.iconImg,
+                id: res.data.data.userRead.id,
+                readingText: res.data.data.userRead.lessonText,
+                grade: res.data.data.userRead.grade,
+                exampleId: res.data.data.userRead.exampleId,
+                summary: res.data.data.userRead.summary
                 // productId: res.data.data.product.id
 
             })
@@ -61,7 +61,7 @@ Page({
             console.log(this.data.img)
             this.getReadInfo(option.id)
 
-            httpRequestApi.userIntoPage('pages/main/reading/reading', '朗读页面').success((res) => {
+            httpRequestApi.userIntoPage('pages/reading/reading', '朗读页面').success((res) => {
 
             })
         })
@@ -222,13 +222,16 @@ Page({
         }
         this.ss.startRecord({
             coreType: 'cn.sent.score', //测评题型    
-            evalTime: 240000, //测评的录音时间,时间到自动停止测评    
+            evalTime: 300000, //测评的录音时间,时间到自动停止测评    
             refText: this.data.readingText, //测评文本  
             warrantId: 'c11163aa6c834a028da4a4b30955be96', //鉴权id
         })
     },
     // 录音结束
     recordStop: function () {
+        this.setData({
+            muted: false
+        })
         this.ss.stopRecord();
         console.log('录音结束')
         wx.hideLoading()
@@ -283,7 +286,7 @@ Page({
         this.videoCtx.seek(0)
         const recordSource = this.data.recordSource
         wx.uploadFile({
-            url: 'https://reader.lingjiao.cn/readerBase/file/upload',
+            url: 'https://reader-test.efunbox.cn/readerBase/file/upload',
             filePath: recordSource,
             name: '朗读录音',
             header: {
@@ -311,7 +314,8 @@ Page({
             videoUrl: this.data.originVideo,
             centerBtn: false,
             playBtn: false,
-            isVideoListShow: false
+            isVideoListShow: false,
+            muted: true
         }, () => {
             this.videoCtx.play();
             this.recordStart();
@@ -339,7 +343,7 @@ Page({
         } else {
             const recordSource = this.data.recordSource;
             wx.uploadFile({
-                url: 'https://reader.lingjiao.cn/readerBase/file/upload',
+                url: 'https://reader-test.efunbox.cn/readerBase/file/upload',
                 filePath: recordSource,
                 name: '朗读录音',
                 header: {
@@ -349,6 +353,7 @@ Page({
                     const formateRes = JSON.parse(res.data);
                     let audioPath = formateRes.data;
                     this.shareWorks(audioPath);
+
                 }
 
             })
@@ -376,7 +381,7 @@ Page({
                         icon: 'success',
                         duration: 1000,
                         success: () => {
-                            console.log(res);
+                            console.log('上传成功', res);
                             const _data = this.data;
                             const scoreData = {
                                 "userReadId": res.data.data.id,
@@ -386,11 +391,21 @@ Page({
                                 "intonation": _data.tone,
                                 "score": _data.overall
                             }
+                            // 上传评分
                             httpRequestApi.postWorksScore(scoreData).success(res => {
                                 console.log(res)
-                            })
-                            wx.redirectTo({
-                                url: `../../social/works/works?id=${res.data.data.id}&flowerCount=${res.data.count}`
+                            });
+                            const pages = getCurrentPages();
+                            const prevPage = pages[pages.length - 2];
+                            console.log('上一个页面',prevPage);
+                            console.log('上一个页面', res.data.data.id);
+                            prevPage.setData({
+                                workId: res.data.data.id, // 有id就塞到第一位
+                            }, () => {
+                            console.log('上一个页面',prevPage);
+                                wx.navigateBack({
+                                    delta: 1
+                                })
                             })
                         }
                     })

pages/main/reading/reading.json → pages/reading/reading.json


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

@@ -7,9 +7,9 @@
   bindplay="videoPlay" -->
     <!-- <audio name="123" author="123" src="{{recordSource}}" id="myAudio" controls loop></audio> -->
     <view class="footSection">
-        <image class="blackbord" src="../../../static/image/blackbord.png" />
+        <image class="blackbord" src="../../static/image/blackbord.png" />
         <view class="collectBtn footerBtn" wx:if="{{btnFlag}}" bindtap="audioPlay">
-            <image src="../../../static/image/listen.png" />
+            <image src="../../static/image/listen.png" />
             <text>试听</text>
         </view>
         <!-- <view class="readingBtn footerBtn" bindtap="audioRecord">
@@ -23,7 +23,7 @@
             </view>
         </view>
         <view class="shareBtn footerBtn" wx:if="{{btnFlag}}" bindtap="upload">
-            <image src="../../../static/image/upload.png" />
+            <image src="../../static/image/upload.png" />
             <text>上传</text>
         </view>
     </view>
@@ -39,7 +39,7 @@
     <view class="score_section" wx:if="{{ifScoreShow}}">
         <view class="title">测评报告</view>
         <view class="star_row">
-            <image class="star" wx:for="{{star}}" src="{{item? '../../../static/index/star_colored.png': '../../../static/index/star.png'}}" />
+            <image class="star" wx:for="{{star}}" src="{{item? '../../static/index/star_colored.png': '../../static/index/star.png'}}" />
         </view>
         <view class="score_item">
             <text class="score_square"></text>
@@ -67,7 +67,7 @@
     <view class="score_section">
         <view class="title">测评报告</view>
         <view class="star_row">
-            <image class="star" wx:for="{{star}}" src="{{item? '../../../static/index/star_colored.png': '../../../static/index/star.png'}}" />
+            <image class="star" wx:for="{{star}}" src="{{item? '../../static/index/star_colored.png': '../../static/index/star.png'}}" />
         </view>
         <view class="score_item">
             <text class="score_square"></text>
@@ -87,6 +87,6 @@
         </view>
     </view>
     <view class="close" bindtap="closeScoreDialog">
-        <image class="close_icon" src="../../../static/index/close.png" />
+        <image class="close_icon" src="../../static/index/close.png" />
     </view>
 </view>

pages/main/reading/reading.wxss → pages/reading/reading.wxss


+ 1 - 1
pages/social/works/works.js

@@ -415,7 +415,7 @@ Page({
                             // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
                             console.log('成功')
                             wx.navigateTo({
-                                url: `../../main/reading/reading?id=${classId}`
+                                url: `../../reading/reading?id=${classId}`
                             })
                         },
                         fail() {

+ 2 - 5
pages/user/myEdit/myEdit.js

@@ -71,7 +71,7 @@ Page({
         // tempFilePath可以作为img标签的src属性显示图片
         const localImage = res.tempFilePaths[0];
         wx.uploadFile({
-          url: 'https://reader.lingjiao.cn/readerBase/file/upload',
+          url: 'https://reader-test.efunbox.cn/readerBase/file/upload',
           filePath: localImage,
           name: '头像',
           header: {
@@ -98,12 +98,8 @@ Page({
     // const uid = wx.getStorageSync('uid');
     const data = {
       nickName: e.detail.value.nickname || '',
-      mobile: '',
       gender: e.detail.value.radioGroup1,
-      schoolProvince: '',
-      schoolCity: '',
       schoolName: e.detail.value.address || '',
-      profession: e.detail.value.radioGroup2 || '',
       birthday: e.detail.value.picker || '',
       avatar: this.data.user.avatar,
       grade: this.data.gradeCode
@@ -114,6 +110,7 @@ Page({
       //   url: '/pages/index/index?index=3'
       // });
       wx.setStorageSync('user', res.data.data);
+      wx.setStorageSync('grade', res.data.data.grade);
       wx.navigateBack({
         delta: 1
       })

+ 8 - 0
utils/APIClient.js

@@ -100,6 +100,14 @@ module.exports = {
       uid: wx.getStorageSync('uid')
     }).url(url).data(data).method('POST').send();
   },
+  // 修改作品状态
+  putWork(data) {
+    console.log(data);
+    let url = getBaseUrl(`wx/userRead`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data(data).method('PUT').send();
+  },
   // 视频评测数据
   postWorksScore(data){
     let url = getBaseUrl(`wx/assessment`);