Browse Source

测试完善

sun2511 2 years ago
parent
commit
ab9d99ea27
5 changed files with 24 additions and 41 deletions
  1. 3 2
      component/readingTips/index.js
  2. 5 21
      pages/index/index.js
  3. 1 1
      pages/my/index.js
  4. 13 15
      pages/reading/reading.js
  5. 2 2
      pages/userWorks/index.js

+ 3 - 2
component/readingTips/index.js

@@ -68,6 +68,7 @@ Component({
         async setUserInfo() {
             let userInfo = await getUserInfo()
             let vipTime = await getVipInfo()
+            console.log(userInfo);
             this.getTasks()
             this.setData({
                 userInfo,
@@ -91,6 +92,7 @@ Component({
         async toBuy({
             currentTarget
         }) {
+            let that = this
             let productId = currentTarget.dataset.type
             wx.showLoading({
                 title: '提交中',
@@ -135,9 +137,8 @@ Component({
                         duration: 2500
                     })
                     setTimeout(() => {
-                        this.setUserInfo()
+                        that.setUserInfo()
                     }, 1500)
-
                 },
                 fail(res) {
                     wx.showToast({

+ 5 - 21
pages/index/index.js

@@ -194,6 +194,7 @@ Page({
                 isSwiper: false,
                 recommendTotalNo: 1
             })
+            console.log(this.data.myIndex, '崇拜你');
             httpRequestApi.getClassDetail(id).success(res => {
                 console.log('有一条数据', res)
                 let tempList = [];
@@ -428,7 +429,7 @@ Page({
             this.setData({
                 fromReading: false
             })
-            this.updateData(3)
+            this.updateData('0')
         }
         // 刷新课程资源的收藏数等
         if (this.data.myIndex === 2) {
@@ -501,7 +502,7 @@ Page({
             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.nickName;
+            temp.nickName = item.user.nickName || item.user.eid;
             temp.isLike = item.isLike;
             temp.isFans = item.isFans ? true : item.user.uid === this.uid ? true : false;
             temp.isFavorite = item.isFavorites;
@@ -626,22 +627,6 @@ Page({
                 this.getHotRecommend()
             })
         }
-
-        // // 当前在推荐页面 加载推荐
-        // if (this.data.myIndex === 1) {
-        //   console.log(this.data.recommendPageNo)
-        //   console.log(this.data.recommendTotalNo)
-        //   this.setData({
-        //     recommendPageNo: this.data.recommendPageNo + 1
-        //   })
-        //   if (this.data.recommendPageNo <= this.data.recommendTotalNo) {
-        //     this.getHotRecommendSecond(this.uid, this.data.recommendPageNo, 3);
-
-        //   } else {
-        //     console.log('没有更多')
-        //   }
-        // }
-
     },
     onPullDownRefresh: function() {
         //当前在团购页下拉加载
@@ -773,7 +758,6 @@ Page({
                 item.isActivity && (temp.activity = true);
                 myWorks.push(temp);
             });
-            console.log('myWorks', myWorks)
             if (this.data.myIndex === 3) {
                 this.setData({
                     videoList: myWorks,
@@ -1361,7 +1345,7 @@ Page({
                                                 canvas: canvas,
                                                 success(res) {
                                                     resolve({
-                                                        title: video.title,
+                                                        title: '请欣赏我的课文朗读作品,点赞+评论。',
                                                         path: `/pages/index/index?readId=${video.id}&uid=${wx.getStorageSync('uid')}`,
                                                         imageUrl: res.tempFilePath
                                                     })
@@ -1392,7 +1376,7 @@ Page({
         })
 
         return {
-            title: video.title,
+            title: '请欣赏我的课文朗读作品,点赞+评论。',
             path: `/pages/index/index?readId=${video.id}&uid=${wx.getStorageSync('uid')}`,
             imageUrl: video.coverImg,
             promise

+ 1 - 1
pages/my/index.js

@@ -165,7 +165,7 @@ Page({
     onShareAppMessage: function(res) {
         const user = wx.getStorageSync('user');
         return {
-            title: `邀请你一起来朗读课文`,
+            title: '课文朗读,从未如此有趣。',
             path: `/pages/index/index?uid=${user.uid}`,
             imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/shareContent.png'
         }

+ 13 - 15
pages/reading/reading.js

@@ -113,7 +113,7 @@ Page({
         }
     },
     onShow: function() {
-        this.getUserInfo()
+        // this.getUserInfo()
         this.videoCtx = wx.createVideoContext('myVideo', this);
         let data = requirePlugin("myPlugin");
         const obj = {
@@ -201,18 +201,16 @@ Page({
 
     },
     async getUserInfo() {
-        let userInfo = await getUserInfo()
-        let vip = await getVipInfo()
-        console.log(userInfo);
-        this.setData({
-            userInfo,
-            isVip: vip ? true : false
-        })
+        /*    let userInfo = await getUserInfo()
+           let vip = await getVipInfo()
+           console.log(userInfo);
+           this.setData({
+               userInfo,
+               isVip: vip ? true : false
+           }) */
     },
     ssRecorderCallback: function(type, data) {
-        console.log('录音测评监控回调', type)
-        console.log('录音测评监控回调', data)
-            /* 录音开始 */
+        /* 录音开始 */
         if (type === 'onStart') {
             this.setData({
                 btnImgFlag: true,
@@ -260,9 +258,10 @@ Page({
      *      2 录音结束
      ***/
     audioRecord: function() {
-        // 判断是否有权限朗读 不是vip并且没有朗读机会
-        const isVip = this.data.isVip
-        if (!isVip && this.data.userInfo.experienceAmount <= 0) {
+        let child = this.selectComponent('#readingTips').data
+            // 判断是否有权限朗读 不是vip并且没有朗读机会
+        const isVip = child.vipTime ? true : false
+        if (!isVip && child.userInfo.experienceAmount == 0) {
             this.selectComponent('#readingTips').showModal();
         } else {
             if (this.recorderManager) {
@@ -561,7 +560,6 @@ Page({
             success: (res) => {
                 const formateRes = JSON.parse(res.data);
                 let audioPath = formateRes.data;
-                console.log('音频上传成功')
                 this.shareWorks(audioPath);
             }
         })

+ 2 - 2
pages/userWorks/index.js

@@ -97,7 +97,7 @@ Page({
                                                 canvas: canvas,
                                                 success(res) {
                                                     resolve({
-                                                        title: video.userRead.title,
+                                                        title: '请欣赏我的课文朗读作品,点赞+评论。',
                                                         path: `/pages/index/index?readId=${video.userRead.id}`,
                                                         imageUrl: res.tempFilePath
                                                     })
@@ -157,7 +157,7 @@ Page({
         })
         console.log(video);
         return {
-            title: video.userRead.title,
+            title: '请欣赏我的课文朗读作品,点赞+评论。',
             path: `/pages/index/index?readId=${video.userRead.id}`,
             imageUrl: video.userRead.coverImg,
             promise