dongyuan0658 6 yıl önce
ebeveyn
işleme
29732af3eb
53 değiştirilmiş dosya ile 1677 ekleme ve 1336 silme
  1. 1 0
      .gitignore
  2. 2 1
      app.json
  3. 1 0
      component/follow/follow.js
  4. 1 1
      component/follow/follow.wxml
  5. 3 1
      component/group/group.js
  6. 3 3
      component/group/group.wxml
  7. 9 4
      component/hot/hot.js
  8. 3 3
      component/hot/hot.wxml
  9. 60 79
      component/my/my.js
  10. 7 7
      component/my/my.wxml
  11. 3 3
      component/popup/popup.wxml
  12. 276 124
      component/share/share.js
  13. 1 1
      component/share/share.wxml
  14. 19 9
      pages/groupPage/collage-details/collage-details.js
  15. 5 5
      pages/groupPage/collage-details/collage-details.wxml
  16. 115 76
      pages/groupPage/grade-details/grade-details.js
  17. 6 13
      pages/groupPage/grade-details/grade-details.wxml
  18. 227 139
      pages/groupPage/group-details/group-details.js
  19. 3 2
      pages/groupPage/group-details/group-details.wxml
  20. 6 0
      pages/groupPage/my-group/my-group.js
  21. 2 2
      pages/groupPage/my-group/my-group.wxml
  22. 3 2
      pages/groupPage/my-group/my-group.wxss
  23. 52 18
      pages/index/index.js
  24. 3 2
      pages/main/books/books.js
  25. 36 8
      pages/main/class/class.js
  26. 6 1
      pages/main/class/class.json
  27. 4 2
      pages/main/class/class.wxml
  28. 42 12
      pages/main/reading/reading.js
  29. 31 0
      pages/main/week/week.js
  30. 1 0
      pages/main/week/week.json
  31. 11 0
      pages/main/week/week.wxml
  32. 53 0
      pages/main/week/week.wxss
  33. 68 36
      pages/social/works/works.js
  34. 8 6
      pages/social/works/works.wxml
  35. 87 47
      pages/user/myEdit/myEdit.js
  36. 4 4
      pages/user/myEdit/myEdit.wxml
  37. 3 2
      pages/user/myEdit/myEdit.wxss
  38. 1 1
      pages/user/myWallet/myWallet.js
  39. 24 84
      pages/user/mycollection/mycollection.js
  40. 3 26
      pages/user/mycollection/mycollection.wxml
  41. 1 1
      pages/user/mycollection/mycollection.wxss
  42. 3 78
      pages/user/myconcern/myconcern.js
  43. 16 8
      pages/user/myconcern/myconcern.wxml
  44. 9 8
      pages/user/myconcern/myconcern.wxss
  45. 9 1
      pages/user/mycourse/mycourse.js
  46. 1 1
      pages/user/mycourse/mycourse.wxml
  47. 83 74
      pages/user/myread/myread.js
  48. 13 14
      pages/user/myread/myread.wxml
  49. 28 36
      pages/user/walletDetails/walletDetails.wxml
  50. 6 89
      project.config.json
  51. 312 302
      utils/APIClient.js
  52. 1 0
      utils/httpUtil.js
  53. 2 0
      utils/util.js

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
 /.idea/
+/.idea
 
 /.idea

+ 2 - 1
app.json

@@ -5,6 +5,7 @@
     "pages/social/replyDetail/replyDetail",
     "pages/main/class/class",
     "pages/main/books/books",
+    "pages/main/week/week",
     "pages/main/singleBook/singleBook",
     "pages/main/reading/reading",
     "pages/main/searchResult/searchResult",
@@ -24,7 +25,7 @@
   "window": {
     "backgroundTextStyle": "light",
     "navigationBarBackgroundColor": "#61CA54",
-    "navigationBarTitleText": "小学语文课文朗读",
+    "navigationBarTitleText": "小学语文朗读配音",
     "navigationBarTextStyle": "white",
     "backgroundColor": "#61CA54",
     "onReachBottomDistance": 50

+ 1 - 0
component/follow/follow.js

@@ -58,6 +58,7 @@ export const followInit = (that) => {
         temp.img = item.userRead.iconImg;
         temp.id = item.userRead.id;
         temp.title = item.userRead.title;
+        temp.summary = item.userRead.summary;
         temp.time = formatDate(item.userRead.gmtCreated, 3);
         // 还差一些字段
         that.data.followData.push(temp);

+ 1 - 1
component/follow/follow.wxml

@@ -11,7 +11,7 @@
       <image class="wareCardImg" src="{{item.img}}" />
       <text class="wareCardTitle">{{item.title}}</text>
       <view class="bottomData">
-        <text class="wareCardTip">{{item.grade}}</text>
+        <text class="wareCardTip">{{item.summary}}</text>
         <view class="wareCardPlays">
             <image class="wareCardPlaysImg" src="../../static/image/hotPlays.png" />
             <text>{{item.plays}}</text>

+ 3 - 1
component/group/group.js

@@ -22,6 +22,7 @@ export const groupInit = (that) => {
     httpRequestApi.getAllBooks(1, 10).success((res) => {
       console.log('全部课',res.data.data.list)
       that.data.groupData.bookList = res.data.data.list;
+      console.log(that.data.groupData.bookList)
       res.data.data.list.forEach(element => {
         that.data.groupData.selectFlag.push(true);
       });
@@ -104,8 +105,9 @@ export const groupInit = (that) => {
     console.log(e.currentTarget.dataset)
     let id = e.currentTarget.dataset.id;
     let title = e.currentTarget.dataset.title;
+    console.log(id)
     wx.navigateTo({
-        url: `/pages/main/singleBook/singleBook?id=${id}&title=${title}`
+        url: `/pages/groupPage/grade-details/grade-details?productId=${id}&title=${title}`
       })
   }
 }

+ 3 - 3
component/group/group.wxml

@@ -33,8 +33,8 @@
             <block wx:for="{{groupData.bookList}}" wx:key="{{index}}">
               <view class="group-item" data-id="{{item.id}}" data-title="{{item.title}}" bindtap="goToBook">
                 <image class="item-img" src="{{item.iconImg}}"></image>
-                <view id="grade">一年级</view>
-              </view>    
+                <view id="grade">{{item.subTitle}}</view>
+              </view>
             </block>          
           </view>
         </view>
@@ -58,7 +58,7 @@
           <block wx:for="{{groupData.bookList}}" wx:key="{{index}}">
               <view class="group-item" catchtap="selectImg" data-ind="{{index}}">
                 <image class="item-img" src="{{item.iconImg}}"></image>
-                <view id="grade">一年级</view>
+                <view id="grade">{{item.subTitle}}</view>
                 <image class="select-img" src="../../static/groupImg/{{groupData.selectFlag[index] ? 'bai' : 'lan'}}.png"></image>
               </view> 
           </block>

+ 9 - 4
component/hot/hot.js

@@ -37,13 +37,18 @@ export const hotInit = (that) => {
         hotInput: e.detail.value
       });
     }
-  // 打开课程页面
+  // 打开全部课本
   that.openBooks = (e) => {
     wx.navigateTo({
       url: `../main/books/books`
     })
   }
-
+  // 打开更多页面
+  that.openMore = () => {
+    wx.navigateTo({
+      url: `../main/week/week`
+    })
+  }
   // 打开课程页面
   that.openClass = (e, lessonId) => {
     if (lessonId) {
@@ -89,7 +94,7 @@ export const hotInit = (that) => {
         oTemp.img = item.boothContent;
         oTemp.classId = item.operationContent;
         oTemp.title = item.title;
-        oTemp.grade = item.summary;
+        oTemp.summary = item.summary;
         recommendTemp.push(oTemp);
       });
       let bannerIndex = 'hotData.banner';
@@ -112,7 +117,7 @@ export const hotInit = (that) => {
         recommendRes.forEach(item => {
           const temp = {};
           temp.title = item.userRead.title;
-          temp.grade = 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;

+ 3 - 3
component/hot/hot.wxml

@@ -19,14 +19,14 @@
                 <image class="recommendTag" src="../../static/image/course.png" alt="" />
                 <text>本周课程推荐</text>
             </view>
-            <view class="moreBtn" bindtap="openBooks">更多></view>
+            <view class="moreBtn" bindtap="openMore">更多></view>
         </view>
         <view class="hotWares" style="flex-direction:row;">
             <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">
-                    <text class="wareCardTip">{{item.grade}}</text>
+                    <text class="wareCardTip">{{item.summary}}</text>
                     <!-- <view class="wareCardPlays">
                         <image class="wareCardPlaysImg" src="../../static/image/hotPlays.png" />
                         <text>{{item.plays}}</text>
@@ -51,7 +51,7 @@
                 <image class="wareCardImg" src="{{item.img}}" />
                 <text class="wareCardTitle">{{item.title}}</text>
                 <view class="bottomData">
-                    <text class="wareCardTip">{{item.grade}}</text>
+                    <text class="wareCardTip">{{item.summary}}</text>
                     <view class="wareCardPlays">
                         <image class="wareCardPlaysImg" src="../../static/image/hotPlays.png" />
                         <text>{{item.plays}}</text>

+ 60 - 79
component/my/my.js

@@ -1,89 +1,70 @@
 import APIClient from '../../utils/APIClient.js'
-export const myInit =  (that) => {
+export const myInit = (that) => {
   that.setData({
     myData: {
-        title: '修改资料',
-        concern: '我的关注',
-        course: '我的课程',
-        read: '我的朗读',
-        keep: '我的收藏',
-        collage: '我的拼团',
-        wallet: '我的钱包',
-        address:['北京海淀','中关村','三小'],
-        schoolCity: '青岛市',
-        schoolName: '黄岛区志贤中学',
-        playNum: 31549,
-        attentionCount: 10254,
-        point: 6317,
-        flowerNum: 56245,
-        user: {}
+      title: '修改资料',
+      concern: '我的关注',
+      course: '我的课程',
+      read: '我的朗读',
+      keep: '我的收藏',
+      collage: '我的拼团',
+      wallet: '我的钱包',
+      address: ['北京海淀', '中关村', '三小'],
+      schoolCity: '',
+      schoolName: '',
+      playNum: 31549,
+      attentionCount: 10254,
+      point: 6317,
+      flowerNum: 56245,
+      user: {}
     }
   });
+  that.getUserWorksInfo();
   that.toMyEdit = (e) => {
-    let title = e.currentTarget.dataset.title;
-    wx.navigateTo({
-      url: `../user/myEdit/myEdit?title=${title}`
-    });
-  },
-  that.toMyConcern = e => {
-    let title = e.currentTarget.dataset.title;
-    wx.navigateTo({
-      url: `../user/myconcern/myconcern?title=${title}`
-    });
-  }
+      let title = e.currentTarget.dataset.title;
+      wx.navigateTo({
+        url: `../user/myEdit/myEdit?title=${title}`
+      });
+    },
+    that.toMyConcern = e => {
+      let title = e.currentTarget.dataset.title;
+      wx.navigateTo({
+        url: `../user/myconcern/myconcern?title=${title}`
+      });
+    }
   that.toMyWallet = e => {
-    let title = e.currentTarget.dataset.title;
-    wx.navigateTo({
-      url: `../user/myWallet/myWallet?title=${title}`
-    });
-  },
-  that.toMyCourse = e => {
-    let title = e.currentTarget.dataset.title;
-    wx.navigateTo({
-      url: `../user/mycourse/mycourse?title=${title}`
-    });
-  },
-  that.toMyRead = e => {
-    let title = e.currentTarget.dataset.title;
-    wx.navigateTo({
-      url: `../user/myread/myread?title=${title}`
-    });
-  },
-  that.toMyKeep = e => {
-    let title = e.currentTarget.dataset.title;
-    wx.navigateTo({
-      url: `../user/mycollection/mycollection?title=${title}`
-    });
-  },
-  that.toMyCollage = e => {
-    let title = e.currentTarget.dataset.title;
-    wx.navigateTo({
-      url: `../../pages/groupPage/my-group/my-group?title=${title}`
-    });
-      // debugger
-      APIClient.myWallet().success(res => {
-          // debugger
-          console.log(res.data.data.data);
+      let title = e.currentTarget.dataset.title;
+      wx.navigateTo({
+        url: `../user/myWallet/myWallet?title=${title}`
+      });
+    },
+    that.toMyCourse = e => {
+      let title = e.currentTarget.dataset.title;
+      wx.navigateTo({
+        url: `../user/mycourse/mycourse?title=${title}`
       });
-  },
-  that.userInfo = function () {
-      const userInfo = wx.getStorageSync('user');
-      console.log(userInfo.data.data.data);
-      that.data.myData.user = userInfo.data.data.data;//直接赋值 给 myData的user对象。
-      that.setData({
-          myData: that.data.myData,
-      },()=>{
-          console.log('myData的user对象,赋值成功')
-          console.log(that.data.myData);
+    },
+    that.toMyRead = e => {
+      let title = e.currentTarget.dataset.title;
+      wx.navigateTo({
+        url: `../user/myread/myread?title=${title}`
+      });
+    },
+    that.toMyKeep = e => {
+      let title = e.currentTarget.dataset.title;
+      wx.navigateTo({
+        url: `../user/mycollection/mycollection?title=${title}`
+      });
+    },
+    that.toMyCollage = e => {
+      let title = e.currentTarget.dataset.title;
+      wx.navigateTo({
+        url: `../../pages/groupPage/my-group/my-group?title=${title}`
+      });
+      debugger
+      APIClient.myWallet().success(res => {
+        debugger
+        console.log(res.data.data.data);
       });
-    // APIClient.getOpenidSessionKey(res => {
-    //   console.log(res.data.data.data);
-    //   that.data.myData.user = res.data.data.data;//挂载user对象。
-    //   that.setData({
-    //     myData: that.data.myData
-    //   },() => {
-    //     console.log(that.data.myData)
-    //   });
-    // });
-  }()
+    } 
 }

+ 7 - 7
component/my/my.wxml

@@ -4,7 +4,7 @@
       <view class='mine-info'>
         <view class='mine-bg'>
           <view class='mine-avatar'>
-            <image class='avatar-image' src='{{ myData.user.avatar }}'></image>
+            <image class='avatar-image' src='{{ myData.user.user.avatar }}'></image>
           </view>
         </view>
         <view class='mine-edit' bindtap='toMyEdit' data-title='{{ myData.title }}'>
@@ -15,13 +15,13 @@
         </view>
       </view>
       <view class='mine-detail'>
-        <text class='mine-title'>{{ myData.user.wechatName }}</text>
-        <view class='mine-address'>{{ myData.schoolCity }},{{ myData.schoolName }}</view>
+        <text class='mine-title'>{{ myData.user.user.wechatName }}</text>
+        <view class='mine-address'>{{ myData.user.user.schoolName }}</view>
         <view class='mine-line'></view>
       </view>
       <view class='mine-category'>
         <view class='play-count'>
-          <view>3232</view>
+          <view>{{ myData.user.playAmount }}</view>
           <view class='border-right'>
             <view class='play-img'>
               <image src='../../static/image/play.png'></image>
@@ -30,7 +30,7 @@
           </view>
         </view>
         <view class='follow-count'>
-          <view class='color'>5200</view>
+          <view class='color'>{{ myData.user.fansAmount }}</view>
           <view class='border-right'>
             <view class='play-img'>
               <image src='../../static/image/follow.png'></image>
@@ -39,7 +39,7 @@
           </view>
         </view>
         <view class='point-count'>
-          <view class='color'>300</view>
+          <view class='color'>{{ myData.user.likeAmount }}</view>
           <view class='border-right'>
             <view class='play-img'>
               <image src='../../static/image/point.png'></image>
@@ -48,7 +48,7 @@
           </view>
         </view>
         <view class='flower-count'>
-          <view class='color'>100</view>
+          <view class='color'>{{ myData.user.pointAmount }}</view>
           <view class='border-right'>
             <view class='play-img'>
               <image src='../../static/image/flower.png'></image>

+ 3 - 3
component/popup/popup.wxml

@@ -19,10 +19,10 @@
                 <text style="color: {{item.color}};">{{item.text}}</text>
             </block>
         </view>
-        <view class="send-btn" bindtap="launchGroup">
+        <!-- <view class="send-btn" bindtap="launchGroup">
             <image src="../../static/groupImg/Invitation.png"></image>
             <text>发起团购</text>
-        </view>
+        </view> -->
     </view>
     <!--失败 -->
     <view class="popup-container"  wx:if="{{typeOf == 'error' ? true : false}}">
@@ -38,7 +38,7 @@
         <view class="content" style="margin-top: 30rpx;">    
             <text style="color: #000;">您可以继续发起新的团购,</text>
             <text style="color: #FF9B00;">不再需要支付本课程费用,拼团成功,</text>
-            <text style="color: #FF0000;">您将得到xxx元奖励。</text>
+            <!-- <text style="color: #FF0000;">您将得到xxx元奖励。</text> -->
         </view>
         <view class="send-btn">
             <image src="../../static/groupImg/Invitation.png"></image>

+ 276 - 124
component/share/share.js

@@ -8,6 +8,10 @@ Component({
     shareType: {
       type: 'String',
       value: ''
+    },
+    shareId: {
+      type: 'String',
+      value: ''
     }
   },
 
@@ -15,13 +19,16 @@ Component({
    * 组件的初始数据
    */
   data: {
-    shareFlag: true,
+    shareFlag: false,
     imgUrls: '',
     avatar: '',
     author: '',
     iconImg: '',
     title: '',
-    path: ''
+    path: '',
+    QRCodeImagePath:'',
+    QRCodeImageLocalPath:'',
+    groupPurchaseInfo:{}
   },
 
   /**
@@ -31,39 +38,236 @@ Component({
     poster: function () {
       const that = this;
       const ctx = wx.createCanvasContext('myCanvas');
-      ctx.rect(0, 0, 370, 507)
-      ctx.setFillStyle('#fff')
-      ctx.fill()
-      ctx.save()
-      ctx.beginPath()
-      ctx.setFillStyle('#fff')
-      ctx.fill()
-      ctx.arc(185, 48, 37, 0, 2 * Math.PI, false)
-      ctx.clip(); //画了圆 再剪切  原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内  
-      // wx.downloadFile({
-      //   url: this.data.avatar,
-      //   success(res) {
-      //     ctx.drawImage(res.tempFilePath, 148, 8, 100, 100);
-      //   }
-      // });
-      ctx.drawImage(this.data.avatar, 148, 8, 100, 100); //插入图片  
-      ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
-      ctx.setFontSize(20)
-      ctx.setFillStyle('#535353')
-      ctx.fillText(this.data.author, (370 - ctx.measureText(this.data.author).width) / 2, 115)
-      ctx.setFillStyle('#FF4400')
+      // 先画背景
+      this.drawBg(ctx)
+        .then(() => {
+          // 下载保存图片
+          console.log('背景画完');
+          return this.saveImg(ctx);
+        })
+        .then(() => {
+          // 画头像和作者||发起者
+          console.log('头像画完');
+          return this.drawAuthor(ctx);
+        })
+        .then(() => {
+          console.log(this.data.shareType)
+          if (this.data.shareType === 'works') {
+            // 分享作品的主题内容
+            console.log('主题画完');
+            return this.drawWorksGut(ctx)
+          } else {
+            return this.drawGroupGut(ctx)
+          }
+        })
+        .then(() => {
+          debugger;
+          wx.getImageInfo({
+            src: this.data.QRCodeImagePath,//服务器返回的图片地址
+            success: function (res) {
+              //res.path是网络图片的本地地址
+              ctx.drawImage(res.path, 227, 364, 135, 135);
+
+
+
+
+              ctx.draw(true, function (res) {
+                wx.canvasToTempFilePath({
+                  x: 0,
+                  y: 0,
+                  width: 370,
+                  height: 507,
+                  destWidth: 370,
+                  destHeight: 507,
+                  canvasId: 'myCanvas',
+                  success: (res) => {
+                    console.log(res.tempFilePath)
+                    wx.saveImageToPhotosAlbum({
+                      filePath: res.path,
+                      success(res) {
+                        console.log(res);
+                      }
+                    })
+                    that.setData({
+                      imgUrls: res.tempFilePath
+                    }, () => {
+                      wx.hideLoading();
+                    })
+                  },
+                  fail: (res) => {
+                    console.log(res)
+                  }
+                })
+              })
+
+
+
+            },
+            fail: function (res) {
+              //失败回调
+            }
+          });
+        })
+
+
+
+
+    },
+    share: function (data) {
+      debugger;
       if (this.data.shareType === 'works') {
+
+        this.setData({
+          shareFlag: !this.data.shareFlag,
+          avatar: data.avatar,
+          author: data.author,
+          iconImg: data.iconImg,
+          title: data.title,
+          // path: data.path,
+          QRData:{
+            page: data.path,
+            scene: data.scene,
+            qrCodeId: this.data.shareId
+          }
+        })
+
+      }
+      if (this.data.shareType === 'group') {
+        console.log('团购分享')
+        this.setData({
+          shareFlag: !this.data.shareFlag,
+          avatar: data.avatar,
+          author: data.author,
+          iconImg: data.iconImg,
+          title: data.title,
+          // path: data.path,
+          QRData:{
+            page: data.path,
+            scene: data.scene,
+            qrCodeId: this.data.shareId
+          },
+          groupPurchaseInfo: data.groupPurchaseInfo
+        })
+      }
+      if (this.data.shareType === 'class') {
+        console.log('课程分享')
+        this.setData({
+          shareFlag: !this.data.shareFlag
+        })
+      }
+    },
+    // 保存图片到本地
+    saveImg: function () {
+      console.log('yibuububu')
+      let download = new Promise((resolve, reject) => {
+        let QRCode = () => {
+          // 生成二维码并下载
+          debugger;
+          httpRequestApi.createQRCode(this.data.QRData).success(res => {
+            // let base64 = wx.arrayBufferToBase64(res.data);
+            // console.log(a)
+            this.setData({
+              QRCodeImagePath: res.data.data
+            })
+            // wx.downloadFile({
+            //   url: res,
+            //   success: (res) => {
+            //     console.log(res)
+            //     console.log('下载二维码成功')
+            //     // this.setData({
+            //     //   avatar: res.tempFilePath
+            //     // }, () => {
+
+            //     // })
+  
+            //   }
+            // });
+            console.log(this.data.QRCodeImagePath)
+            console.log(res)
+            resolve();
+          })
+        }
+        let downAvatar = () => {
+          wx.downloadFile({
+            url: this.data.avatar,
+            success: (res) => {
+              console.log('下载头像成功')
+              console.log(this.data.avatar)
+              this.setData({
+                avatar: res.tempFilePath
+              }, () => {
+                QRCode();
+              })
+
+            }
+          });
+        }
+
+        // resolve(()=>{
+        // 下载icon
+        wx.downloadFile({
+          url: this.data.iconImg,
+          success: (res) => {
+            console.log('下载icon成功')
+            console.log(this.data.iconImg)
+            this.setData({
+              iconImg: res.tempFilePath
+            }, () => {
+              // 下载头像
+              downAvatar();
+            })
+
+          }
+        });
+      })
+      return download;
+    },
+    // 先画出背景
+    drawBg: function (ctx) {
+      let background = new Promise((resolve, reject) => {
+        wx.showLoading({
+          title: '海报生成中',
+          mask: true
+        })
+        console.log('开始画背景')
+        ctx.rect(0, 0, 370, 507)
+        ctx.setFillStyle('#fff')
+        ctx.fill()
+        ctx.save()
+        ctx.beginPath()
+        ctx.setFillStyle('#fff')
+        ctx.fill()
+        ctx.arc(185, 48, 37, 0, 2 * Math.PI, false)
+        ctx.clip(); //画
+        resolve();
+      });
+      return background;
+    },
+    // 画头像和作者||发起者
+    drawAuthor: function (ctx) {
+
+      let author = new Promise((resolve, reject) => {
+        // resolve(() => {
+        console.log('开始画头像')
+        ctx.drawImage(this.data.avatar, 148, 8, 100, 100); //插入图片  
+        ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
+        ctx.setFontSize(20)
+        ctx.setFillStyle('#535353')
+        ctx.fillText(this.data.author, (370 - ctx.measureText(this.data.author).width) / 2, 115)
+        ctx.setFillStyle('#FF4400')
+        // })
+        resolve();
+      })
+      return author;
+    },
+    // 分享作品的主题内容
+    drawWorksGut: function (ctx) {
+      let works = new Promise((resolve, reject) => {
+        // resolve(() => {
+        console.log('开始画内容')
         ctx.fillText('已使出洪荒之力,声情并茂的为', (370 - ctx.measureText('已使出洪荒之力,声情并茂的为').width) / 2, 138)
         ctx.fillText(`《${this.data.title}》`, (370 - ctx.measureText(`《${this.data.title}》`).width) / 2, 160)
         ctx.fillText(`配了一段惊世之作`, (370 - ctx.measureText(`配了一段惊世之作`).width) / 2, 182)
-        // 保存图片到本地
-        // wx.downloadFile({
-        //   url: this.data.iconImg,
-        //   success(res) {
-        //     console.log(res)
-        //     ctx.drawImage(res.tempFilePath, 9, 205, 352, 145);
-        //   }
-        // });
         ctx.drawImage(this.data.iconImg, 9, 205, 352, 145);
         ctx.setFontSize(18)
         ctx.setFillStyle('#000')
@@ -74,103 +278,51 @@ Component({
         ctx.setFontSize(18)
         ctx.setFillStyle('#000')
         ctx.fillText('长按识别二维码,快去听听', 9, 493)
-
-      } else {
-        ctx.fillText('郎朗读书声是世上最美的声音', 50, 138)
-        ctx.drawImage('../../../static/groupImg/Combined Shape.png', 11, 348, 196, 65);
-        ctx.drawImage('../../../static/groupImg/Rectangle 41.png', 134, 358, 59, 20);
-        ctx.setFontSize(14)
-        ctx.setFillStyle('#fff')
-        ctx.fillText('五人团', 149, 373)
-        ctx.setFontSize(16)
-        ctx.setFillStyle('#A95A00')
-        ctx.fillText('原价', 24, 373)
-        ctx.setStrokeStyle('red')
-        ctx.moveTo(64, 368)
-        ctx.lineTo(114, 368)
-        ctx.stroke()
-        ctx.fillText('¥99元', 64, 373)
-        ctx.setFontSize(18)
-        ctx.fillText('团购价仅需', 20, 403)
-        ctx.fillText('元', 144, 403)
-        ctx.setFontSize(20)
-        ctx.setFillStyle('red')
-        ctx.fillText('¥1', 109, 403)
-        ctx.drawImage('../../../static/groupImg/share_bottom.png', 3, 419, 370, 192);
-        ctx.setFontSize(20)
-        ctx.setFillStyle('red')
-        ctx.fillText('名额有限,售完截止', 9, 467)
-        ctx.setFontSize(18)
-        ctx.setFillStyle('#000')
-        ctx.fillText('长按识别二维码参加团购', 9, 493)
-      }
-      ctx.drawImage('../../../static/groupImg/code.png', 217, 374, 135, 135);
-      console.log(ctx)
-      ctx.draw(true, function (res) {
-        wx.canvasToTempFilePath({
-          x: 0,
-          y: 0,
-          width: 370,
-          height: 507,
-          destWidth: 370,
-          destHeight: 507,
-          canvasId: 'myCanvas',
-          success: (res) => {
-            console.log(res.tempFilePath)
-            wx.saveImageToPhotosAlbum({
-              filePath: res.path,
-              success(res) {
-                console.log(res);
-              }
-            })
-            that.setData({
-              imgUrls: res.tempFilePath
-            })
-          },
-          fail: (res) => {
-            console.log(res)
-          }
-        })
+        // })
+        resolve();
       })
+      return works;
     },
-    share: function (data) {
-      console.log(this.data)
-      console.log(data)
-      // 下载icon
-      wx.downloadFile({
-        url: data.iconImg,
-        success: (res) => {
-          this.setData({
-            iconImg: res.tempFilePath
-          })
-        }
-      });
-      // 下载头像
-      wx.downloadFile({
-        url: data.avatar,
-        success: (res) => {
-          this.setData({
-            avatar: res.tempFilePath
-          })
-        }
-      });
-      // 生成二维码并下载
-      httpRequestApi.createQRCode({
-        page: data.path,
-        scene: "par=no"
-      }).success(res => {
-        console.log(data.path)
-        console.log(res)
-      })
-      this.setData({
-        shareFlag: !this.data.shareFlag,
-        // avatar: data.avatar,
-        author: data.author,
-        // iconImg: data.iconImg,
-        title: data.title,
-        path: data.path
+
+    // 分享团购的主体内容
+    drawGroupGut: function (ctx) {
+      let group = new Promise((resolve, reject) => {
+        //resolve(() => {
+          ctx.fillText('郎朗读书声是世上最美的声音', 50, 138)
+        ctx.drawImage(this.data.groupPurchaseInfo.bgImg, 9, 205, 352, 145);
+          ctx.drawImage('../../../static/groupImg/Rectangle 41.png', 134, 358, 59, 20);
+          ctx.setFontSize(14)
+          ctx.setFillStyle('#fff')
+          ctx.fillText(`${this.data.groupPurchaseInfo.headcount}人团`, 149, 373)
+          ctx.setFontSize(16)
+          ctx.setFillStyle('#A95A00')
+          ctx.fillText('原价', 20, 373)
+          ctx.setStrokeStyle('red')
+          ctx.moveTo(64, 368)
+          ctx.lineTo(114, 368)
+          ctx.stroke()
+          ctx.fillText(`¥${parseFloat(this.data.groupPurchaseInfo.originPrice / 100).toFixed(2)}元`, 64, 373)
+          ctx.setFontSize(18)
+          ctx.fillText('团购价仅需', 20, 403)
+          ctx.fillText('元', 174, 403)
+          ctx.setFontSize(20)
+          ctx.setFillStyle('red')
+          ctx.fillText(`¥${parseFloat(this.data.groupPurchaseInfo.price / 100).toFixed(2)}`, 109, 403)
+          ctx.drawImage('../../../static/groupImg/share_bottom.png', 3, 419, 370, 192);
+          ctx.setFontSize(20)
+          ctx.setFillStyle('red')
+          ctx.fillText('名额有限,售完截止', 9, 467)
+          ctx.setFontSize(18)
+          ctx.setFillStyle('#000')
+          ctx.fillText('长按识别二维码参加团购', 9, 493)
+        //})
+        resolve();
       })
+      return group;
     },
+
+
+    // 保存最终图片
     PreservationImg: function () {
       wx.saveImageToPhotosAlbum({
         filePath: this.data.imgUrls,

+ 1 - 1
component/share/share.wxml

@@ -1,4 +1,4 @@
-<view class="share" bindtap="share" hidden="{{shareFlag}}">
+<view class="share" bindtap="share" wx:if="{{shareFlag}}">
    <view class="btn" wx:if="{{!imgUrls}}">
        <image class="bg" src="../../static/groupImg/share.png"></image>
        <view class="share-btn">

+ 19 - 9
pages/groupPage/collage-details/collage-details.js

@@ -8,6 +8,8 @@ Page({
    */
   data: {
     hideFlag: true,
+    groupPurchaseInfo: {},
+    organizer: {},
     surplusNum: '',
     joinUserList: [],
     surplusList: [],
@@ -31,11 +33,6 @@ Page({
     ]
   },
 
-  //分享好友触发事件
-  eventListener: function () {
-    //console.log(1);
-  },
-
   //规则页显示和隐藏
   hide: function () {
     this.setData({
@@ -43,14 +40,25 @@ Page({
     })
   },
   //显示分享页 
-  share: function () {
-    console.log(this.shareDialog)
-    this.shareDialog.share();
+  openShare: function () {
+    this.shareDialog = this.selectComponent("#share-dialog");
+    const data = {
+      avatar: this.data.organizer.avatar,
+      author: this.data.organizer.wechatName,
+      iconImg: this.data.groupPurchaseInfo.bgImg,
+      title: this.data.groupPurchaseInfo.productTitle,
+      path: `pages/groupPage/collage-details/collage-details`,
+      scene: `QR${this.data.orderId}`,
+      groupPurchaseInfo: this.data.groupPurchaseInfo
+    }
+    this.shareDialog.share(data);
   },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    options.scene = 'QR1541862338777268';
+    debugger;
     wx.setNavigationBarTitle({
       title: '拼团详情'
     })
@@ -58,7 +66,7 @@ Page({
     if(!options.orderId) {
       return false;
     }
-    const orderId = options.orderId;
+    const orderId = options.orderId ? options.orderId : options.scene.replace('QR', '');
     this.setData({
       orderId
     })
@@ -72,6 +80,8 @@ Page({
       //时间转换
       const timeList = util.formatTime(res.data.data.groupPurchaseOrder.closeTime - res.data.data.groupPurchaseOrder.gmtModified);
       this.setData({
+        groupPurchaseInfo: res.data.data.groupPurchaseInfo,
+        organizer: res.data.data.organizer,
         surplusNum,
         joinUserList: res.data.data.joinUserList,
         surplusList: this.data.surplusList,

+ 5 - 5
pages/groupPage/collage-details/collage-details.wxml

@@ -22,8 +22,8 @@
             </block>                   
         </view>
         <view class="shengyu">
-            <view class="shengyu-num">仅剩<text>{{surplusNum}}</text>个名额就拼团成功了</view>
-            <view class="shengyu-time">
+            <view class="shengyu-num" >仅剩<text>{{surplusNum}}</text>个名额就拼团成功了</view>
+            <view class="shengyu-time" >
                 剩余时间:
                 <view class="time">
                     <image src="../../../static/groupImg/Rectangle_31.png"></image>
@@ -46,7 +46,7 @@
             </view>
         </view>
-        <view class="invitation-btn" bindtap="share">
+        <view class="invitation-btn" bindtap="openShare">
             <image src="../../../static/groupImg/Invitation.png"></image>
             <text>邀请朋友参加</text>
         </view>
@@ -57,11 +57,11 @@
     </view>  
     <view class="explain" hidden="{{hideFlag}}">
         <text>拼团规则</text>
-        * 转发给自己的朋友们,分享好课, 追随您一起学习进步。您的魅力不是吹的! * 在限定时间内内成功拼团,您将得到xx元的奖励金哦。 * 如果拼团失败,您预付的课程费将在48小时内退回您的账户。
+        * 转发给自己的朋友们,分享好课, 追随您一起学习进步。您的魅力不是吹的! * 如果拼团失败,您预付的课程费将在48小时内退回您的账户。
     </view>
 </view> 
 <canvas canvas-id="myCanvas" style="width:370px; height: 507px; position: absolute; left: -99rpx; top: -999rpx;"></canvas>
-<shareDialog id="share-dialog" bindcustomevent="eventListener"/>
+<shareDialog id="share-dialog" shareType='group' shareId="{{orderId}}"/>
 
 <popup
     typeOf="sendSuccess"

+ 115 - 76
pages/groupPage/grade-details/grade-details.js

@@ -11,74 +11,105 @@ Page({
     title: '',
     bookInfo: '',
     lessonList: [],
-    content: [
-      {
-          text: "转发给自己的朋友们,分享好课,",
-          color: "#000"
+    content: [{
+        text: "转发给自己的朋友们,分享好课,",
+        color: "#000"
       },
       {
-          text: " 追随您一起学习进步。您的魅力不是吹的!",
-          color: "#000"
+        text: " 追随您一起学习进步。您的魅力不是吹的!",
+        color: "#000"
       },
       {
-          text: "在限定时间内内成功拼团,您将得到xx元的奖励金哦。",
-          color: "#FF4600"
+        text: `在限定时间内成功拼团,您将得到xx元的奖励金哦。`,
+        color: "#FF4600"
       }
-    ]
+    ],
+
   },
   //获取团购信息并掉起支付
-  pay: function ({ currentTarget }) {
+  pay: function ({
+    currentTarget
+  }) {
     const productId = this.data.productId;
     const groupId = currentTarget.dataset.id;
     //开始发起团购
-      httpRequestApi.SendGroupPurchas({
-        productId,
-        groupId
-      }).success( (res) =>{
-        console.log('发起团购',res);
-        // wx.navigateTo({
-        //   url: `/pages/groupPage/collage-details/collage-details`
-        // })
-        if(res.data.message) {
-          wx.showModal({
-            title: '提示',
-            content: res.data.message,
-            success (res) {
-              if (res.confirm) {
-                console.log('用户点击确定')
-              } else if (res.cancel) {
-                console.log('用户点击取消')
-              }
+    httpRequestApi.SendGroupPurchas({
+      productId,
+      groupId
+    }).success((res) => {
+      console.log('发起团购', res);
+      // wx.navigateTo({
+      //   url: `/pages/groupPage/collage-details/collage-details`
+      // })
+      if (res.data.message) {
+        wx.showModal({
+          title: '提示',
+          content: res.data.message,
+          success(res) {
+            if (res.confirm) {
+              console.log('用户点击确定')
+            } else if (res.cancel) {
+              console.log('用户点击取消')
             }
-          })
-          return false;
-        }
-        //掉起支付
-        this.prePayMap(res.data.data.prePayMap, res.data.data.groupPurchaseOrder.id);
-      }).fail( (error) => {
-        
+          }
+        })
+        return false;
+      }
+      this.data.content[2].text = res.data.data.groupPurchaseOrder.organizerPrice === 0 ? '' : `在限定时间内内成功拼团,您将得到${res.data.data.groupPurchaseOrder.organizerPrice}元的奖励金哦。`
+      this.setData({
+        content: this.data.content
       })
+      // 如果已经拥有当前课程,则无需支付,直接进入拼团成功页面
+      if (res.data.data.groupPurchaseOrder.group === 'PROMOTION') {
+        wx.showModal({
+          title: '重新发起团购',
+          content: '您会获得奖励哦',
+          success(res) {
+            console.log(res)
+            that.popup.close();
+            if (res.data.data.groupPurchaseOrder.headCount !== 1) {
+              setTimeout(() => {
+                wx.navigateTo({
+                  url: `/pages/groupPage/collage-details/collage-details?orderId=${res.data.data.groupPurchaseOrder.id}`
+                })
+                wx.setNavigationBarTitle({
+                  title: '拼团详情'
+                })
+              }, 3000)
+            }
+
+          }
+        })
+      } else {
+        //掉起支付
+        this.prePayMap(res.data.data.prePayMap, res.data.data.groupPurchaseOrder.id, res.data.data.groupPurchaseOrder.headCount);
+      }
+
+    }).fail((error) => {
+
+    })
   },
   //支付
-  prePayMap: function (prePayMap, orderId) {
+  prePayMap: function (prePayMap, orderId, num) {
     console.log(prePayMap)
     const that = this;
     //console.log(new Date().getTime())
-    wx.requestPayment(
-      {
-        'appId': prePayMap.appId,
-        'timeStamp': prePayMap.timeStamp,
-        'nonceStr': prePayMap.nonceStr,
-        'package': prePayMap.package,
-        'signType': 'MD5',
-        'paySign': prePayMap.sign,
-        'success':function(res){
-          console.log('支付成功')
-          wx.showModal({
-            title: '提示',
-            content: '支付成功',
-            success (res) {
-              that.popup.close();
+    wx.requestPayment({
+      'appId': prePayMap.appId,
+      'timeStamp': prePayMap.timeStamp,
+      'nonceStr': prePayMap.nonceStr,
+      'package': prePayMap.package,
+      'signType': 'MD5',
+      'paySign': prePayMap.sign,
+      'success': function (res) {
+        console.log('支付成功')
+        wx.showModal({
+          title: '提示',
+          content: '支付成功',
+          success(res) {
+            console.log(res)
+            that.popup.close();
+            if (num !== 1) {
               setTimeout(() => {
                 wx.navigateTo({
                   url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
@@ -86,15 +117,17 @@ Page({
                 wx.setNavigationBarTitle({
                   title: '拼团详情'
                 })
-              }, 1000)
+              }, 3000)
             }
-          })
 
-        },
-        'fail':function(res){
-          console.log('支付失败', res)
-        }
-      })
+          }
+        })
+
+      },
+      'fail': function (res) {
+        console.log('支付失败', res)
+      }
+    })
   },
 
 
@@ -103,49 +136,55 @@ Page({
    */
   onLoad: function (options) {
     wx.setNavigationBarTitle({
-        title: options.title
+      title: options.title
     })
     const productId = options.productId;
-    if(productId) {
+    if (productId) {
       this.setData({
         productId
       })
     }
     //课本详情
-    httpRequestApi.getBookDetail(wx.getStorageSync('uid'),productId).success( (res) =>{
-      console.log('课本详情',res.data.data);
+    httpRequestApi.getBookDetail(wx.getStorageSync('uid'), productId).success((res) => {
+      console.log('课本详情', res.data.data);
       const bookInfo = res.data.data.product;
       const lessonList = res.data.data.lessonList;
       this.setData({
-          titleIcon: bookInfo.bgImg,
-          title: bookInfo.title,
-          bookInfo: bookInfo.description
+        titleIcon: bookInfo.bgImg,
+        title: bookInfo.title,
+        bookInfo: bookInfo.description
       })
       const lessonTemp = [];
       lessonList.forEach(item => {
-          const temp = {};
-          temp.id = item.id;
-          temp.title = item.title;
-          temp.readNum = item.readCount;
-          lessonTemp.push(temp);
+        const temp = {};
+        temp.id = item.id;
+        temp.title = item.title;
+        temp.readNum = item.readCount;
+        lessonTemp.push(temp);
       });
       this.setData({
-          lessonList: lessonTemp
+        lessonList: lessonTemp
       });
-    }).fail( (error) => {
+    }).fail((error) => {
 
     })
     //支付详情
-    httpRequestApi.getGroupPurchaseInfo(productId).success( (res) =>{
-      console.log('支付详情',res.data.data);
+    httpRequestApi.getGroupPurchaseInfo(productId).success((res) => {
+      console.log('支付详情', res.data.data);
       this.setData({
         payList: res.data.data
       })
-    }).fail( (error) => {
+    }).fail((error) => {
 
     })
   },
-
+  goToClass: function (e) {
+    let id = e.currentTarget.dataset.id;
+    let title = e.currentTarget.dataset.title;
+    wx.navigateTo({
+      url: `../../main/class/class?id=${id}&title=${title}`
+    })
+  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 6 - 13
pages/groupPage/grade-details/grade-details.wxml

@@ -1,4 +1,4 @@
-<!--pages/grade-details/grade-details.wxml-->
+<!-- pages/grade-details/grade-details.wxml -->
 <view class="group-details">
     <scroll-view scroll-y="{{true}}">
         <view class="grade-details">
@@ -8,19 +8,19 @@
         </view>
         <view class="catalog">
             <image src="../../../static/groupImg/Rectangle 34@2x.png"></image>
-            <text>文目录</text>
+            <text>文目录</text>
         </view>
         <view class="catalog-list">
-            <view class="catalog-item" wx:for="{{lessonList}}" wx:key="{{index}}" data-id="{{item.id}}" data-title="{{item.title}}">
+            <view class="catalog-item" wx:for="{{lessonList}}" wx:key="{{index}}" data-id="{{item.id}}" data-title="{{item.title}}" bindtap="goToClass">
                 <text class="left">{{item.title}}</text>
                 <text class="right">{{item.readingNum}}朗读 ></text>
-            </view>        
+            </view>
         </view>
     </scroll-view>
     <view class="group-btn">
         <image class="bg1" src="../../../static/groupImg/Rectangle_9.png"></image>
         <image class="bg2" src="../../../static/groupImg/Rectangle_9.png"></image>
-        <block wx:for="{{payList}}" wx:key="{{index}}" >
+        <block wx:for="{{payList}}" wx:key="{{index}}">
             <view class="Price" bindtap="pay" data-id="{{item.id}}">
                 <text>¥{{item.price / 100}}</text>
                 <text>{{item.headcount}}人团</text>
@@ -28,11 +28,4 @@
         </block>
     </view>
 </view>
-
-<popup
-    id="popup"
-    typeOf="sendSuccess"
-    title="报告团长"
-    headTextOne="您发起的团购已经成立,订单号:12345"
-    content="{{content}}"
-></popup>
+<popup id="popup" typeOf="sendSuccess" title="报告团长" headTextOne="您发起的团购已经成立" content="{{content}}"></popup>

+ 227 - 139
pages/groupPage/group-details/group-details.js

@@ -18,7 +18,7 @@ Page({
     productId: '',
     groupId: '',
     orderId: '',
-    typeOf:'',
+    typeOf: '',
     title: '',
     headTextOne: '',
     headTextTwo: '',
@@ -32,23 +32,24 @@ Page({
     // wx.setNavigationBarTitle({
     //   title: '限量优惠团购'
     // })
-  
+
   },
   //开团
   openGroup: function () {
+   
     const productId = this.data.productId;
     const groupId = this.data.groupId;
     //开始发起团购
     httpRequestApi.SendGroupPurchas({
       productId,
       groupId
-    }).success( (res) =>{
-      console.log('发起团购',res);
-      if(res.data.message) {
+    }).success((res) => {
+      console.log('发起团购', res);
+      if (res.data.message) {
         wx.showModal({
           title: '提示',
           content: res.data.message,
-          success (res) {
+          success(res) {
             if (res.confirm) {
               console.log('用户点击确定')
             } else if (res.cancel) {
@@ -58,26 +59,28 @@ Page({
         })
         return false;
       }
-      if(res.data.data.groupPurchaseOrder.groupType === 'BASE') {
+      if (res.data.data.groupPurchaseOrder.groupType === 'BASE') {
         //掉起支付
-        this.prePayMap(res.data.data.prePayMap, res.data.data.groupPurchaseOrderDetail.orderId);
+        this.prePayMap(res.data.data.prePayMap, 'create');
       }
 
-    }).fail( (error) => {
-      
+    }).fail((error) => {
+
     })
   },
   //参团
   jionGroup: function () {
+    
     const orderId = this.data.orderId;
+    
     //开始发起团购
-    httpRequestApi.JoinGroupPurchas(orderId).success( (res) =>{
-      console.log('参加团购',res);
-      if(res.data.message) {
+    httpRequestApi.JoinGroupPurchas(orderId).success((res) => {
+      console.log('参加团购', res);
+      if (res.data.message) {
         wx.showModal({
           title: '提示',
           content: res.data.message,
-          success (res) {
+          success(res) {
             if (res.confirm) {
               console.log('用户点击确定')
             } else if (res.cancel) {
@@ -86,151 +89,235 @@ Page({
           }
         })
         return false;
-      }  
+      }
       //掉起支付
-      this.prePayMap(res.data.data.prePayMap, res.data.data.orderId, res.data.data.groupPurchaseOrder.id);
-    }).fail( (error) => {
-      
+      this.prePayMap(res.data.data.prePayMap, 'join');
+    }).fail((error) => {
+
     })
   },
 
   //支付
-  prePayMap: function (prePayMap, orderId, detailId) {
+  prePayMap: function (prePayMap, type) {
+    
     console.log(prePayMap)
     const that = this;
-    wx.requestPayment(
-      {
-        'appId': prePayMap.appId,
-        'timeStamp': prePayMap.timeStamp,
-        'nonceStr': prePayMap.nonceStr,
-        'package': prePayMap.package,
-        'signType': 'MD5',
-        'paySign': prePayMap.sign,
-        'success':function(res){
-          console.log('支付成功')
-          wx.showModal({
-            title: '提示',
-            content: '支付成功',
-            success (res) {
-              //获取拼团信息
-              setTimeout( () => {
-                that.jionSuccess(that.data.orderId);
-                that.groupSuccess(orderId, detailId);
-              },2000)
-            }
-          })
+    wx.requestPayment({
+      'appId': prePayMap.appId,
+      'timeStamp': prePayMap.timeStamp,
+      'nonceStr': prePayMap.nonceStr,
+      'package': prePayMap.package,
+      'signType': 'MD5',
+      'paySign': prePayMap.sign,
+      'success': function (res) {
+        console.log('支付成功')
+        const type1 = type;
+        wx.showModal({
+          title: '提示',
+          content: '支付成功',
+          success(res) {
+            //获取拼团信息
+            console.log(that.data.orderId)
+            wx.showLoading({
+              title: '作品转码中',
+              mask: true
+            })
+            setTimeout(() => {
+              wx.hideLoading();
+              console.log(that.data.orderId)
+              that.jionSuccess(that.data.orderId, type1);
+              // that.groupSuccess(orderId, detailId);
+            }, 2000)
+          }
+        })
 
-        },
-        'fail':function(res){
-          console.log('支付失败', res)
-        }
-      })
+      },
+      'fail': function (res) {
+        console.log('支付失败', res)
+      }
+    })
   },
   //跳转到拼团详情
   collage: function () {
 
   },
   //拼团详情
-  jionSuccess: function (orderId) {
-    httpRequestApi.getMygroupInfo(orderId).success( res => {
+  jionSuccess: function (orderId, type) {
+    debugger;
+    httpRequestApi.getMygroupInfo(orderId).success(res => {
       console.log('拼团详情', res.data.data);
       const surplusNum = res.data.data.groupPurchaseOrder.headcount - res.data.data.groupPurchaseOrder.joinCount;
-      for(var i = 0; i < surplusNum; i++) {
-        this.data.surplusList.push(1);
+      if (type === 'join') {
+        this.data.surplusList.pop();
+
+        if (res.data.data.groupPurchaseOrder.status === 'SUCCESSED') {
+          this.showSuccess(res.data.data.groupPurchaseOrder.organizer, res.data.data.groupPurchaseOrder.organizerPrice)
+        } else {
+          this.goToDetail(res.data.data.groupPurchaseOrder.id)
+        }
+
+      } else {
+        for (var i = 0; i < surplusNum; i++) {
+          this.data.surplusList.push(1);
+        }
       }
+
       console.log(res.data.data.groupPurchaseOrder.closeTime - res.data.data.groupPurchaseOrder.gmtModified)
       //时间转换
       const timeList = util.formatTime(res.data.data.groupPurchaseOrder.closeTime - res.data.data.groupPurchaseOrder.gmtModified);
+      console.log(timeList)
       this.setData({
         surplusNum,
         joinUserList: res.data.data.joinUserList,
         surplusList: this.data.surplusList,
         timeList,
       })
-    }).fail( error => {
+      // this.groupSuccess(res.data.data.groupPurchaseOrder.productId, detailId);
+    }).fail(error => {
       console.log('错误', error)
-    })    
+    })
   },
-
-  //拼团是否成功并弹窗
-  groupSuccess: function (orderId, detailId) {
-    httpRequestApi.groupSuccess(orderId).success( res => {
-      console.log('团购是否成功',res.data.data)
-      const status = res.data.data.status;
-      debugger;
-      const uid = res.data.data.uid;
-      if(status == 'successed') {
-        if(wx.getStorageSync(uid) == uid) {
-          this.setData({
-            typeOf: 'success',
-            title: '恭喜 !',
-            headTextOne: '您发起的团购拼团成功',
-            content: [
-              {
-                  text: "领袖体质魅力无穷!",
-                  color: "#000"
-              },
-              {
-                  text: " 您可以继续发起新的团购,",
-                  color: "#000"
-              },
-              {
-                text: " 不再需要支付本课程费用,拼团成功,",
-                color: "#FF9B00"
-              },                          
-              {
-                  text: " 您将得到xxx元奖励。",
-                  color: "#FF0000"
-              }
-            ],
-          })
-        }else {
-          this.setData({
-            typeOf: 'success',
-            title: '拼团成功 ! ',
-            headTextOne: '您参与的团购拼团成功',
-            headTextTwo: '订单号:12344',
-            content: [
-              {
-                  text: "感谢团长的分享",
-                  color: "#000"
-              },
-              {
-                  text: " 您也可以发起新的团购分享给需要的朋友们,",
-                  color: "#000"
-              },
-              {
-                  text: "作为新的发起人,您无需在支付本课程费用;",
-                  color: "#FF0000"
-              },
-              {
-                text: "团购成功,您将得到xxx元奖励。",
-                color: "#FF0000"
-              }                          
-            ],
-          })
-        }
-      }else {
-        debugger;
-        setTimeout(() => {
-          wx.navigateTo({
-            url: `/pages/groupPage/collage-details/collage-details?orderId=${detailId}`
-          })
-          wx.setNavigationBarTitle({
-            title: '拼团详情'
-          })
-        }, 1000)
-      }
-    }).fail( error => {
-      console.log('错误', eroor)
-    })    
+  // 弹成功信息框
+  showSuccess: function (organizerUid, price) {
+    if (wx.getStorageSync('uid') == organizerUid) {
+      this.setData({
+        typeOf: 'success',
+        title: '恭喜 !',
+        headTextOne: '您发起的团购拼团成功',
+        content: [{
+            text: "领袖体质魅力无穷!",
+            color: "#000"
+          },
+          {
+            text: " 您可以继续发起新的团购,",
+            color: "#000"
+          },
+          {
+            text: " 不再需要支付本课程费用,拼团成功,",
+            color: "#FF9B00"
+          },
+          {
+            text: `您将得到${price / 100}元奖励。`,
+            color: "#FF0000"
+          }
+        ],
+      },()=>{
+        this.popup.close()
+      })
+    } else {
+      this.setData({
+        typeOf: 'success',
+        title: '拼团成功 ! ',
+        headTextOne: '您参与的团购拼团成功',
+        headTextTwo: '',
+        content: [{
+            text: "感谢团长的分享",
+            color: "#000"
+          },
+          {
+            text: " 您也可以发起新的团购分享给需要的朋友们,",
+            color: "#000"
+          },
+          {
+            text: "作为新的发起人,您无需在支付本课程费用;",
+            color: "#FF0000"
+          },
+          {
+            text: `团购成功,您将得到${price/ 100}元奖励。`,
+            color: "#FF0000"
+          }
+        ],
+      },()=>{
+        this.popup.close()
+      })
+    }
+  },
+  // 去详情页面
+  goToDetail: function (detailId) {
+    setTimeout(() => {
+      wx.navigateTo({
+        url: `/pages/groupPage/collage-details/collage-details?orderId=${detailId}`
+      })
+      wx.setNavigationBarTitle({
+        title: '拼团详情'
+      })
+    }, 3000)
   },
+  //拼团是否成功并弹窗
+  // groupSuccess: function (orderId, detailId) {
+  //   httpRequestApi.groupSuccess(orderId).success(res => {
+  //     console.log('团购是否成功', res.data.data)
+  //     const status = res.data.data.status;
+  //     const uid = res.data.data.uid;
+  //     if (status === 'SUCCESSED') {
+  //       if (wx.getStorageSync('uid') == uid) {
+  //         this.setData({
+  //           typeOf: 'success',
+  //           title: '恭喜 !',
+  //           headTextOne: '您发起的团购拼团成功',
+  //           content: [{
+  //               text: "领袖体质魅力无穷!",
+  //               color: "#000"
+  //             },
+  //             {
+  //               text: " 您可以继续发起新的团购,",
+  //               color: "#000"
+  //             },
+  //             {
+  //               text: " 不再需要支付本课程费用,拼团成功,",
+  //               color: "#FF9B00"
+  //             },
+  //             {
+  //               text: " 您将得到xxx元奖励。",
+  //               color: "#FF0000"
+  //             }
+  //           ],
+  //         })
+  //       } else {
+  //         this.setData({
+  //           typeOf: 'success',
+  //           title: '拼团成功 ! ',
+  //           headTextOne: '您参与的团购拼团成功',
+  //           headTextTwo: '订单号:12344',
+  //           content: [{
+  //               text: "感谢团长的分享",
+  //               color: "#000"
+  //             },
+  //             {
+  //               text: " 您也可以发起新的团购分享给需要的朋友们,",
+  //               color: "#000"
+  //             },
+  //             {
+  //               text: "作为新的发起人,您无需在支付本课程费用;",
+  //               color: "#FF0000"
+  //             },
+  //             {
+  //               text: "团购成功,您将得到xxx元奖励。",
+  //               color: "#FF0000"
+  //             }
+  //           ],
+  //         })
+  //       }
+  //     } else {
+  //       setTimeout(() => {
+  //         wx.navigateTo({
+  //           url: `/pages/groupPage/collage-details/collage-details?orderId=${detailId}`
+  //         })
+  //         wx.setNavigationBarTitle({
+  //           title: '拼团详情'
+  //         })
+  //       }, 3000)
+  //     }
+  //   }).fail(error => {
+  //     console.log('错误', eroor)
+  //   })
+  // },
   //再次发起团
   group: function () {
     wx.showModal({
       title: '提示',
       content: '再次发起团',
-      success (res) {
+      success(res) {
         if (res.confirm) {
           console.log('用户点击确定')
         } else if (res.cancel) {
@@ -247,7 +334,7 @@ Page({
     wx.setNavigationBarTitle({
       title: '拼团详情'
     })
-    if(!options.productId) return false;
+    if (!options.productId) return false;
     const productId = options.productId;
     const groupId = options.groupId;
     const orderId = options.id;
@@ -257,27 +344,28 @@ Page({
       orderId
     })
     //课本详情
-    httpRequestApi.getBookDetail(wx.getStorageSync('uid'), productId).success( (res) =>{
-      console.log('课本详情',res.data.data);
+    httpRequestApi.getBookDetail(wx.getStorageSync('uid'), productId).success((res) => {
+
+      console.log('课本详情', res.data.data);
       const bookInfo = res.data.data.product;
       const lessonList = res.data.data.lessonList;
       this.setData({
-          titleIcon: bookInfo.bgImg,
-          title: bookInfo.title,
-          bookInfo: bookInfo.description
+        titleIcon: bookInfo.bgImg,
+        title: bookInfo.title,
+        bookInfo: bookInfo.description
       })
       const lessonTemp = [];
       lessonList.forEach(item => {
-          const temp = {};
-          temp.id = item.id;
-          temp.title = item.title;
-          temp.readNum = item.readCount;
-          lessonTemp.push(temp);
+        const temp = {};
+        temp.id = item.id;
+        temp.title = item.title;
+        temp.readNum = item.readCount;
+        lessonTemp.push(temp);
       });
       this.setData({
-          lessonList: lessonTemp
+        lessonList: lessonTemp
       });
-    }).fail( (error) => {
+    }).fail((error) => {
 
     })
     //获取拼团信息
@@ -288,7 +376,7 @@ Page({
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {
-
+    this.popup = this.selectComponent("#popupup");
   },
 
   /**

+ 3 - 2
pages/groupPage/group-details/group-details.wxml

@@ -16,7 +16,7 @@
         <view class="shengyu">
             <view class="shengyu-num" hidden="{{surplusNum == '0'}}">仅剩<text>{{surplusNum}}</text>个名额就拼团成功了</view>
             <view class="shengyu-num" hidden="{{surplusNum != '0'}}">拼团成功</view>
-            <view class="shengyu-time">
+            <view class="shengyu-time" hidden="{{surplusNum == '0'}}">
                 剩余时间:
                 <view class="time">
                     <image src="../../../static/groupImg/Rectangle_31.png"></image>
@@ -48,7 +48,7 @@
         </view>
         <view class="catalog">
             <image src="../../../static/groupImg/Rectangle 34@2x.png"></image>
-            <text>文目录</text>
+            <text>文目录</text>
         </view>
         <view class="catalog-list">
             <view class="catalog-item" wx:for="{{lessonList}}" wx:key="{{index}}" data-id="{{item.id}}" data-title="{{item.title}}">
@@ -69,6 +69,7 @@
 </view>
 
 <popup
+    id="popupup"
     typeOf="{{typeOf}}"
     title="{{title}}"
     headTextOne="{{headTextOne}}"

+ 6 - 0
pages/groupPage/my-group/my-group.js

@@ -25,6 +25,9 @@ Page({
       wx.navigateTo({
         url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
       })
+    } else {
+      
+  
     }
   },
 
@@ -42,6 +45,9 @@ Page({
       });
     }
     httpRequestApi.getMygroup().success((res) => {
+      if(!res.data.data.list){
+        return
+      }
       console.log('我的团', res.data.data.list)
       this.setData({
         myGroupList: res.data.data.list

+ 2 - 2
pages/groupPage/my-group/my-group.wxml

@@ -3,10 +3,10 @@
     <scroll-view scroll-y="{{true}}">
         <view class="my-group-content">
             <block wx:for="{{myGroupList}}" wx:key="{{index}}">
-                <view class="group-item" bindtap="collageDetails" data-num="{{item.joinCount >= item.headcount}}" data-orderId="{{item.id}}">
+                <view class="group-item" bindtap="collageDetails" data-num="{{item.status==='SUCCESSED'}}" data-orderId="{{item.id}}">
                     <image class="item-img" src="{{item.iconImg}}" style="background: red;"></image>
                     <view id="grade">{{item.groupTitle}}</view>
-                    <image class="type-img" src="../../../static/groupImg/{{item.joinCount >= item.headcount ? 'yisuccess' : 'weisuccess' }}.png"></image>
+                    <image class="type-img" src="../../../static/groupImg/{{item.status==='SUCCESSED' ? 'yisuccess' : 'weisuccess' }}.png"></image>
                 </view> 
             </block>
         </view>

+ 3 - 2
pages/groupPage/my-group/my-group.wxss

@@ -12,9 +12,9 @@
 .my-group-content {
     width: 100%;
     display: flex;
-    justify-content: space-between;
+    justify-content: row;
     flex-wrap: wrap;
-    padding: 44rpx 28rpx;
+    padding-top: 44rpx;
     box-sizing: border-box;
 }
 
@@ -23,6 +23,7 @@
     display: flex;
     flex-direction: column;
     text-align: center;
+    margin-left: 28rpx;
 }
 
 .group-item .item-img {

+ 52 - 18
pages/index/index.js

@@ -18,8 +18,9 @@ import {
   followInit
 } from '../../component/follow/follow';
 // import '../../utils/hls';
-// import httpRequestApi from '../../utils/APIRequest';
+import httpRequestApi from '../../utils/APIClient';
 import httputil from '../../utils/httpUtil';
+
 Page({
   data: {
     tab: [{
@@ -41,11 +42,12 @@ Page({
     ],
     winH: 568,
     myIndex: 1,
-    followData:[],
-    recommendPageNo:1,
-    recommendTotalNo:0,
-    followPageNo:1,
-    followPageTotalNo:0,
+    followData: [],
+    recommendPageNo: 1,
+    recommendTotalNo: 0,
+    followPageNo: 1,
+    followPageTotalNo: 0,
+    myData: {},
     templates: 'hot',
     title: 'index中的title',
     jurisdictionFlag: true,
@@ -95,8 +97,28 @@ Page({
       // });
     }
   },
+  aa: function () {
+    let a = new Promise((resolve, reject) => {
+      resolve(console.log('aa'))
+    });
+    return a;
+  },
+  bb: function () {
+    let b = new Promise((resolve, reject) => {
+      resolve(console.log('bb'))
+    });
+    return b
+  },
+  cc: function () {
+    let c = new Promise((resolve, reject) => {
+      console.log('cc')
+    });
+    return c
+  },
   onLoad: function (options) {
+    console.log(options)
     this.uid = wx.getStorageSync('uid');
+
     wx.getSystemInfo({
       success: (res) => {
         this.setData({
@@ -112,6 +134,7 @@ Page({
 
   },
   onShow: function () {
+
     // this.init();
     getOpenidSessionKey((res) => {}, (error) => {
       // console.log(error)
@@ -119,15 +142,14 @@ Page({
         hide: !this.data.hide
       })
     });
+    if (this.data.myIndex === 3) {
+      this.getUserWorksInfo();
+    }
   },
   //初始化数据
   init: function () {
     httputil.getOpenidSessionKey((res) => {
-      console.log('微信的用户信息', res);
-      // this.setData({
-      //   jurisdictionFlag: true
-      // })
-      // lookInit(this);
+      console.log('微信的用户信息', res)
     }, (error) => {
       console.log(error);
       this.jurisdiction()
@@ -136,6 +158,18 @@ Page({
       // })
     });
   },
+  // 获取用户信息
+  getUserWorksInfo: function () {
+    httpRequestApi.getUserWorksInfo().success(res => {
+      console.log(res)
+      this.data.myData.user = res.data.data; //直接赋值 给 myData的user对象。
+      this.setData({
+        myData: this.data.myData,
+      });
+    }).fail(error => {
+      console.log(error)
+    })
+  },
   // 触底加载
   onReachBottom: function () {
     console.log(this.data.recommendPageNo)
@@ -143,23 +177,23 @@ Page({
     // 当前在推荐页面 加载推荐
     if (this.data.myIndex === 1) {
       this.setData({
-        recommendPageNo: this.data.recommendPageNo+1
+        recommendPageNo: this.data.recommendPageNo + 1
       })
-      if(this.data.recommendPageNo <= this.data.recommendTotalNo ){
+      if (this.data.recommendPageNo <= this.data.recommendTotalNo) {
         this.getHotRecommend(this.uid, this.data.recommendPageNo, 3);
-        
+
       } else {
         console.log('没有更多')
       }
     }
-    if(this.data.myIndex === 2){
+    if (this.data.myIndex === 2) {
       console.log(this.data.followPageTotalNo)
       this.setData({
-        followPageNo: this.data.followPageNo+1
+        followPageNo: this.data.followPageNo + 1
       })
-      if(this.data.followPageNo <= this.data.followPageTotalNo ){
+      if (this.data.followPageNo <= this.data.followPageTotalNo) {
         this.getWorks(this.uid, this.data.followPageNo, 5);
-        
+
       } else {
         console.log('没有更多')
       }

+ 3 - 2
pages/main/books/books.js

@@ -27,9 +27,10 @@ Page({
         console.log(e.currentTarget.dataset)
         let id = e.currentTarget.dataset.id;
         let title = e.currentTarget.dataset.title;
-
+        
         wx.navigateTo({
-            url: `../singleBook/singleBook?id=${id}&title=${title}`
+            // url: `../singleBook/singleBook?id=${id}&title=${title}`
+            url: `../../groupPage/grade-details/grade-details?productId=${id}&title=${title}`
           })
     }
 })

+ 36 - 8
pages/main/class/class.js

@@ -20,11 +20,9 @@ Page({
   },
   onLoad: function (option) {
     console.log(option);
-    wx.setNavigationBarTitle({
-      title: option.title //页面标题为路由参数
-    })
+    
     this.setData({
-      title: option.title,
+      // title: option.title,
       id: option.id
     })
 
@@ -36,6 +34,10 @@ Page({
         title: res.data.data.title,
         videoUrl: res.data.data.playUrl,
         iconImg: res.data.data.iconImg
+      },()=>{
+        wx.setNavigationBarTitle({
+          title: res.data.data.title //页面标题为路由参数
+        })
       })
       this.getReadInfo(1, 10);
       this.checkLike();
@@ -58,6 +60,32 @@ Page({
       url: `../../main/reading/reading?id=${id}`
     })
   },
+  openShare: function (e) {
+    // this.setData({
+    //     shareFlag: !this.data.shareFlag
+    // })
+    this.shareDialog = this.selectComponent("#share-dialog");
+    const data = {
+      avatar: this.data.authorAvatar,
+      author: this.data.author,
+      iconImg: this.data.iconImg,
+      title: this.data.title,
+      path: `pages/social/works/works?id=${this.data.id}&title=${this.data.title}`
+      // tip: this.data.tip,
+    }
+    this.shareDialog.share(data);
+  },
+  onShareAppMessage: function (res) {
+    if (res.from === 'button') {
+        // 来自页面内转发按钮
+        console.log(res.target)
+    }
+    return {
+        title: this.data.title,
+        path: `pages/main/class/class?id=${this.data.id}&title=${this.data.title}`,
+        imageUrl: this.data.iconImg
+    }
+},
   goToWorks: function (e) {
     this.videoCtx = wx.createVideoContext('myVideo', this);
     this.videoCtx.stop();
@@ -109,14 +137,14 @@ Page({
     });
   },
   // 下拉加载
-  onReachBottom: function(e){
+  onReachBottom: function (e) {
     console.log(this.data.totalNo);
     this.setData({
-      pageNo: this.data.pageNo+1
+      pageNo: this.data.pageNo + 1
     })
-    if(this.data.pageNo <= this.data.totalNo ){
+    if (this.data.pageNo <= this.data.totalNo) {
       this.getReadInfo();
-      
+
     }
   }
 })

+ 6 - 1
pages/main/class/class.json

@@ -1,5 +1,10 @@
 {
     "window": {
         "onReachBottomDistance": 50
-      }
+    },
+    "component": true,
+    "usingComponents": {
+        "shareDialog": "/component/share/share",
+        "popup": "/component/popup/popup"
+    }
 }

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

@@ -20,16 +20,18 @@
     <view class="footSection">
         <image class="blackbord" src="../../../static/image/blackbord.png" />
         <view class="collectBtn footerBtn" bindtap="collect">
-            <image src=" {{collectFlag ? '../../../static/image/collected.png' : '../../../static/image/no_collect.png'}}" />
+            <image src="{{collectFlag ? '../../../static/image/collected.png' : '../../../static/image/no_collect.png'}}" />
             <text>{{collectFlag ? '取消收藏' : '收藏'}}</text>
         </view>
         <view class="readingBtn footerBtn" bindtap="goToReading">
             <image class="microphone" src="../../../static/image/microphone.png" />
             <text>我要朗读</text>
         </view>
-        <view class="shareBtn footerBtn">
+        <view class="shareBtn footerBtn" bindtap="openShare">
             <image src="../../../static/image/share.png" />
             <text>分享</text>
         </view>
     </view>
+    <canvas canvas-id="myCanvas" style="width:370px;z-index=99999; height: 507px; position: absolute; left: -99rpx; top: -999rpx;"></canvas>
+    <shareDialog id="share-dialog" shareType='class' />
 </view>

+ 42 - 12
pages/main/reading/reading.js

@@ -33,7 +33,8 @@ Page({
                 img: res.data.data.iconImg,
                 id: res.data.data.id,
                 // readingText: res.data.data.lessonText.replace(reg,'')
-                readingText: res.data.data.lessonText
+                readingText: res.data.data.lessonText,
+                grade: res.data.data.gradeClassify
             })
             console.log(this.data.readingText)
             console.log(this.data.img)
@@ -68,6 +69,16 @@ Page({
             })
         })
     },
+    onHide: function(){
+        if(this.innerAudioContext){
+            this.innerAudioContext.stop();
+        }
+    },
+    onUnload: function(){
+        if(this.innerAudioContext){
+            this.innerAudioContext.stop();
+        }
+    },
     // onShow:function(){
 
     // },
@@ -79,16 +90,13 @@ Page({
         // 
         if (this.data.recordFlag === 0) {
             // this.recordStop();
+        
             this.playingVideoEnd();
-            // this.setData({
-            //     videoCtr: 'playingVideoEnd'
-            // })
+            return;
         }
         // 录音结束
         if (this.data.recordFlag === 1) {
             this.recordStop();
-            // this.recordStop();
-            // this.innerAudioContext.stop();
         }
     },
     // 播放中视频播放结束 (控制录音同时结束)
@@ -108,9 +116,14 @@ Page({
             // this.recordStart();
             // this.saveVideo();
             this.videoComplete();
+            return;
         }
         // 录音结束后
         if (this.data.recordFlag === 1) {
+            wx.showLoading({
+                title: '作品转码中',
+                mask: true
+              })
             this.recordStop();
         }
     },
@@ -139,6 +152,7 @@ Page({
     recordStop: function () {
         console.log('录音结束')
         this.recorderManager.stop();
+        wx.hideLoading()
     },
     // 播放录音
     audioPlay: function () {
@@ -165,6 +179,10 @@ Page({
     },
     // 上传
     upload: function () {
+        wx.showLoading({
+            title: '作品分享中',
+            mask: true
+          })
         const recordSource = this.data.recordSource;
         wx.uploadFile({
             url: 'https://readerbase.efunbox.cn/file/upload',
@@ -188,14 +206,26 @@ Page({
                 "originVideo": this.data.videoUrl,
                 "audioPath": audio,
                 "title": this.data.title,
-                "iconImg": this.data.img
+                "iconImg": this.data.img,
+                "summary": this.data.grade,
             };
             httpRequestApi.postWork(uid, data).success(res => {
-                wx.showToast({
-                    title: '上传成功',
-                    icon: 'success',
-                    duration: 1000
-                  })
+                wx.hideLoading({
+                    success: ()=>{
+                        wx.showToast({
+                            title: '上传成功',
+                            icon: 'success',
+                            duration: 1000,
+                            success: ()=>{
+                                console.log(res);
+                                wx.navigateTo({
+                                    url: `../../social/works/works?id=${res.data.data.id}`
+                                })
+                            }
+                        })
+                    }
+                });
+                
             })
         };
     }

+ 31 - 0
pages/main/week/week.js

@@ -0,0 +1,31 @@
+import httpRequestApi from '../../../utils/APIClient';
+Page({
+    data: {
+
+    },
+    onLoad: function (option) {
+        const uid = wx.getStorageSync('uid');
+        httpRequestApi.getIndex(uid).success(res => {
+            const recommend = res.data.data.recommendLesson;
+            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);
+            });
+            this.setData({
+              recommend: recommendTemp
+            })
+        });
+    },
+    openClass: function(e) {
+          let id = e.currentTarget.dataset.classid;
+          let title = e.currentTarget.dataset.title;
+          wx.navigateTo({
+            url: `../class/class?id=${id}&title=${title}`
+          })
+      }
+})

+ 1 - 0
pages/main/week/week.json

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

+ 11 - 0
pages/main/week/week.wxml

@@ -0,0 +1,11 @@
+<view class="hotSection">
+        <view class="hotWares" style="flex-direction:row;">
+            <view wx:for="{{recommend}}" wx:key="{{index}}" class="hotWareCard" data-classId="{{item.classId}}" data-title="{{item.title}}">
+                <image class="wareCardImg" src="{{item.img}}" />
+                <text class="wareCardTitle">{{item.title}}</text>
+                <view class="bottomData">
+                    <text class="wareCardTip">{{item.grade}}</text>
+                </view>
+            </view>
+        </view>
+    </view>

+ 53 - 0
pages/main/week/week.wxss

@@ -0,0 +1,53 @@
+
+.hotSection {
+    width: 100%;
+    /* height: 50rpx; */
+    background: #fff;
+    margin-top: 10rpx;
+}
+
+.hotWares {
+    display: flex;
+    flex-wrap: wrap;
+}
+
+.hotSection .hotWares .hotWareCard {
+    position: relative;
+    overflow: hidden;
+    width: 704rpx;
+    height: 402rpx;
+    /* margin: 0 0 18rpx 16rpx; */
+    margin: 0 auto 20rpx;
+    /* box-shadow: 0 8rpx 6rpx 0 rgba(0, 0, 0, .28); */
+}
+
+
+
+.hotWareCard .wareCardImg {
+    width: 100%;
+    height: 290rpx;
+    border-radius: 20rpx;
+}
+
+
+
+.hotWareCard .wareCardTitle {
+    /* margin: 0 auto; */
+    width: 100%;
+    height: 46rpx;
+    display: block;
+    /* text-align: left; */
+    color: #414141;
+    font-size: 32rpx;
+    letter-spacing: 4rpx;
+    font-family: MicrosoftYaHei;
+}
+
+.hotWareCard .bottomData {
+    height: 34rpx;
+    margin-top: 10rpx;
+    display: flex;
+    /* flex-direction: row; */
+    justify-content: space-between;
+    align-items: center;
+}

+ 68 - 36
pages/social/works/works.js

@@ -13,19 +13,22 @@ Page({
         authorAvatar: '',
         user: [],
         inputValue: '',
-        inputSBValue:'',
+        inputSBValue: '',
         replyList: [],
         howMuch: '200',
         moneySelect: 'moneySelect',
         moneyNormal: 'moneyNormal',
         ifReward: false,
         id: '',
-        path:'',
-        replyModal: false
+        path: '',
+        replyModal: false,
+        totalRead: 0
         // shareFlag: false
     },
     onLoad: function (option) {
         console.log(option)
+        debugger;
+        let id = option.id ? option.id : option.scene.replace('QR', '')
 
         wx.setNavigationBarTitle({
             title: option.title //页面标题为路由参数
@@ -33,30 +36,40 @@ Page({
 
         this.setData({
             title: option.title,
-            id: option.id
+            id
         })
         this.uid = wx.getStorageSync('uid');
-        this.getWorks(this.uid, option.id);
+        this.getWorks(this.uid, id);
+    },
+    onHide: function(){
+        if(this.innerAudioContext){
+            this.innerAudioContext.stop();
+        }
+    },
+    onUnload: function(){
+        if(this.innerAudioContext){
+            this.innerAudioContext.stop();
+        }
     },
-    // onReady: function () {
-
-    // },
     getWorks: function (uid, id) {
         httpRequestApi.getWorksDetail(uid, id).success((res) => {
             console.log(res);
-            console.log(id)
+            console.log(id);
             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 = {};
+              const temp = {};
+                temp.uid = item.userRead.id;
+                temp.title = item.userRead.title;
                 temp.image = item.user.avatar;
                 temp.nickName = item.user.wechatName;
                 othersTemp.push(temp);
             });
             this.setData({
-                user: othersTemp,
+                user: othersTemp, 
+                totalRead: res.data.data.totalRead,
                 author: author.wechatName,
                 authorAvatar: author.avatar,
                 authorUid: author.uid,
@@ -77,26 +90,26 @@ Page({
         });
     },
     likeWorks: function (e) {
-        if(this.data.isLike){
+        if (this.data.isLike) {
             wx.showToast({
                 title: '不要重复点赞哦',
                 icon: 'fail',
                 duration: 1000
-              })
+            })
             return;
         }
         httpRequestApi.likeWorks(this.uid, this.data.id).success(res => {
             this.setData({
                 isLike: true
-            },()=>{
+            }, () => {
                 wx.showToast({
                     title: '点赞数+1',
                     icon: 'success',
                     duration: 1000
-                  })
+                })
             });
-            })
-            
+        })
+
     },
     // 弹出分享框
     openShare: function (e) {
@@ -109,7 +122,8 @@ Page({
             author: this.data.author,
             iconImg: this.data.iconImg,
             title: this.data.title,
-            path: `pages/social/works/works?id=${this.data.id}&title=${this.data.title}`
+            path: `pages/social/works/works`,
+            scene: `QR${this.data.id}`
             // tip: this.data.tip,
         }
         this.shareDialog.share(data);
@@ -133,27 +147,45 @@ Page({
             url: `../../main/reading/reading?id=${this.data.classId}`
         })
     },
-    onShareAppMessage: function(res) {
+    onShareAppMessage: function (res) {
         if (res.from === 'button') {
-          // 来自页面内转发按钮
-          console.log(res.target)
+            // 来自页面内转发按钮
+            console.log(res.target)
         }
         return {
-          title: this.data.title,
-          path: `pages/social/works/works?id=${this.data.id}&title=${this.data.title}`,
-          imageUrl: this.data.iconImg
+            title: this.data.title,
+            path: `pages/social/works/works?id=${this.data.id}&title=${this.data.title}`,
+            imageUrl: this.data.iconImg
         }
-      },
+    },
     follow: function () {
         // let uid = wx.getStorageSync('uid');
         let followUid = this.data.authorUid;
-        httpRequestApi.followUser(this.uid, followUid).success((res) => {
-            wx.showToast({
-                title: !this.data.isFans? '取消关注' : '关注啦',
-                icon: 'success',
-                duration: 1000
-              })
-        });
+        if (this.data.isFans) {
+            httpRequestApi.cancerFollow(this.uid, followUid).success((res) => {
+                this.setData({
+                    isFans: false
+                })
+                wx.showToast({
+                    title: '取消关注',
+                    icon: 'success',
+                    duration: 1000
+                })
+            });
+        } else {
+            httpRequestApi.followUser(this.uid, followUid).success((res) => {
+                this.setData({
+                    isFans: true
+                })
+                wx.showToast({
+                    title: '关注啦',
+                    icon: 'success',
+                    duration: 1000
+                })
+            });
+        }
+
+
     },
     // 点赞评论
     likeCommend: function (e) {
@@ -172,7 +204,7 @@ Page({
     // 去其他用户的作品页
     goToOthers: function (e) {
         wx.navigateTo({
-            url: `../../main/reading/reading?id=${id}&title=${title}`
+          url: `../../social/works/works?id=${e.currentTarget.dataset.uid}&title=${e.currentTarget.dataset.title}`
         })
     },
     // 查询回复
@@ -234,7 +266,7 @@ Page({
         }
     },
     // 设置点击时的id
-    setSBId: function(e){
+    setSBId: function (e) {
         console.log(e)
         this.setData({
             replySBId: e.currentTarget.dataset.id,
@@ -254,7 +286,7 @@ Page({
         });
     },
     // 获取回复楼中楼的内容
-    inputSBValue: function(e){
+    inputSBValue: function (e) {
         this.setData({
             inputSBValue: e.detail.value
         });
@@ -270,7 +302,7 @@ Page({
             ifReward: true
         })
     },
-    quitReward:function () {
+    quitReward: function () {
         this.setData({
             ifReward: false
         })

+ 8 - 6
pages/social/works/works.wxml

@@ -14,20 +14,20 @@
     <view class="userSection">
         <view class="peopleNum">
             <image class="peoplesIcon" src="../../../static/image/peoples.png" />
-            <view class="title">共有12345人完成了录音</view>
+            <view class="title">共有{{totalRead}}人完成了录音</view>
         </view>
         <scroll-view scroll-x class="scrollWrapper" scroll-with-animation="true">
             <view class="avatarRow">
                 <view class="userItem" wx:for="{{user}}" wx:key="{{index}}">
-                    <image src="{{item.image}}" bindtap="goToOthers" data-uid="{{item.uid}}" />
+                    <image src="{{item.image}}" bindtap="goToOthers" data-uid="{{item.uid}}" data-title="{{item.title}}" />
                 </view>
             </view>
         </scroll-view>
     </view>
-    <view class="commentSection">
+    <!-- <view class="commentSection">
         <view class="title">评论({{total}})</view>
         <input class="commentInput" bindconfirm="sendHandler" confirm-type="send" placeholder="听了这么多,说点什么吧" bindinput="inputValue"></input>
-    </view>
+    </view> -->
     <view class="commentArea">
         <view class="commentItem" wx:for="{{replyList}}" wx:key="{{index}}">
             <image class="avatar" src="{{item.avatar}}" />
@@ -66,6 +66,9 @@
             <text>分享</text>
         </view>
     </view>
+    <!-- 分享框 -->
+    <canvas canvas-id="myCanvas" style="width:370px;z-index=99999; height: 507px; position: absolute; left: -99rpx; top: -999rpx;"></canvas>
+    <shareDialog id="share-dialog" shareType='works' shareId="{{id}}" />
     <!-- 评论框 -->
     <view class="replySection" wx:if="{{replyModal}}">
         <input bindblur="bindTextAreaBlur"  bindconfirm="replySB" confirm-type="send" placeholder="回复" bindinput="inputSBValue" auto-focus auto-height />
@@ -91,6 +94,5 @@
         </cover-view>
         <cover-image class="quitBtn" bindtap="quitReward" src="../../../static/groupImg/cha.png" />
     </cover-view>
-    <canvas canvas-id="myCanvas" style="width:370px;z-index=99999; height: 507px; position: absolute; left: -99rpx; top: -999rpx;"></canvas>
-    <shareDialog id="share-dialog" shareType='works' />
+    
 </view>

+ 87 - 47
pages/user/myEdit/myEdit.js

@@ -1,126 +1,166 @@
 import httpRequestApi from '../../../utils/APIClient';
+import {
+  formatDate
+} from '../../../utils/util';
 Page({
   /**
    * 页面的初始数据
    */
   data: {
-    sexs: [
-      { value: '女',checked: true },
-      { value: '男', checked: false }
-      ], 
-    occupations: [
-      { value: '家长', checked: false },
-      { value: '老师', checked: false },
-      { value: '学生', checked: true }
-    ],
-    date: '2001年12月12日',
+    user: {},
+    sexs: [],
+    occupations: [],
+    date: '',
     msg: '',
     nickname: ''
   },
-  saveNickName: function(e){
+  saveNickName: function (e) {
     let nickname = e.detail.value;
     this.setData({
       nicename: nickname
-    }, () => {
-      console.log(nickname);
     });
   },
-  saveAddress: function(e){
+  saveAddress: function (e) {
     let msg = e.detail.value;
     this.setData({
       msg: msg
-    },() => {
-      console.log(msg);
     });
   },
-  bindDateChange: function(e) {
+  bindDateChange: function (e) {
     console.log(e.detail.value)
     this.setData({
-        date: e.detail.value
+      date: e.detail.value
     });
   },
-  optionAction:function(e){
+  optionAction: function (e) {
     console.log(e.detail.value);
   },
   optionSetting: function (e) {
     console.log(e.detail.value);
   },
-  formSubmit: function(e){
-    let { nickname, picker, radioGroup1, radioGroup2, address } = e.detail.value;
-    console.log(nickname);
-    let wechatName = nickname, mobile = '18295785982', gender = 3, schoolProvince = 11, schoolCity = '运城市', schoolName = '康杰中学', profession = radioGroup2, birthday = picker;
-    httpRequestApi.settingUserInfo(wechatName, mobile, gender, schoolProvince, schoolCity, schoolName, profession, birthday).success(res => {
-      console.log(res.data.data.wechatName);//修改资料成功后 调用 getUserInfo
-      
-        wx.redirectTo({
-            url: '/pages/index/index?index=3'
-        });
-      // wx.navigateBack({
-      //
-      //  });
+  formSubmit: function (e) {
+    console.log(e.detail.value)
+    // const uid = wx.getStorageSync('uid');
+    const data = {
+      wechatName: e.detail.value.nickname || '',
+      mobile: '',
+      gender: 1,
+      schoolProvince: '',
+      schoolCity: '',
+      schoolName: e.detail.value.address || '',
+      profession: e.detail.value.radioGroup2 || '',
+      birthday: e.detail.value.picker || ''
+    }
+    httpRequestApi.settingUserInfo(data).success(res => {
+      console.log(res.data.data); //修改资料成功后 调用 getUserInfo
+      // wx.redirectTo({
+      //   url: '/pages/index/index?index=3'
+      // });
+      wx.navigateBack({
+        delta: 1
+      })
     });
   },
   /**
    * 生命周期函数--监听页面加载
    */
+  getUserInfo: function () {
+
+  },
   onLoad: function (option) {
-    console.log(option.title);
-    if (option.title) {
-      wx.setNavigationBarTitle({
-        title: option.title//页面标题为路由参数
-      });
+    httpRequestApi.getUserInfo().success(res => {
+      const user = res.data.data
+      console.log(user)
+      const birthday = user.birthday ? formatDate(user.birthday, 2) : '2018-01-01';
+      console.log(birthday)
       this.setData({
-        title: option.title
-      });
-    }
+        user: user,
+        date: birthday,
+        sexs: [{
+            value: 2,
+            checked: user.gender === 2 ? true : false,
+            sex: '女'
+          },
+          {
+            value: 1,
+            checked: user.gender === 1 ? true : false,
+            sex: '男'
+          }
+        ],
+        occupations: [{
+            value: '家长',
+            checked: user.profession === '家长' ? true : false
+          },
+          {
+            value: '老师',
+            checked: user.profession === '老师' ? true : false
+          },
+          {
+            value: '学生',
+            checked: user.profession === '学生' ? true : false
+          }
+        ],
+
+      })
+      console.log(this.data.date)
+      if (option.title) {
+        wx.setNavigationBarTitle({
+          title: option.title //页面标题为路由参数
+        });
+        this.setData({
+          title: option.title
+        });
+      }
+    });
+
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {
-     
+
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-    
+
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
   onHide: function () {
-    
+
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
   onUnload: function () {
-    
+
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
   onPullDownRefresh: function () {
-    
+
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-    
+
   },
 
   /**
    * 用户点击右上角分享
    */
   onShareAppMessage: function () {
-    
+
   }
 })

+ 4 - 4
pages/user/myEdit/myEdit.wxml

@@ -4,7 +4,7 @@
       <view class='nickname-box'>
         <text class='setting-title'>昵称</text>
         <view class='user-action'>
-          <input name='nickname' class='nickname' type='text' placeholder='喔喔' placeholder-class='placeholderStyle' focus='{{ true }}' value='{{ nickname }}' bindblur='saveNickName'>
+          <input name='nickname' class='nickname' type='text' placeholder='{{user.wechatName}}' placeholder-class='placeholderStyle' focus='{{ true }}' value='{{user.wechatName}}' bindblur='saveNickName'>
           </input>
         </view>
         <view class='edit-img'>
@@ -15,13 +15,13 @@
         <view class='setting-title'>性别</view>
         <radio-group name='radioGroup1' class="radio-group" bindchange="optionAction">
           <label class="radio" wx:for="{{ sexs }}" wx:key="{{ index }}">
-            <text class='sex-title'>{{ item.value }}</text>
+            <text class='sex-title'>{{ item.sex }}</text>
             <radio value="{{ item.value }}" checked="{{ item.checked }}" color='#fff' />
           </label>
         </radio-group>
       </view>
       <view class='birthday-box'>
-        <picker name='picker' mode="date" value="{{ date }}" start="1900-01-01" end="2018-09-01" bindchange="bindDateChange">
+        <picker name='picker' mode="date" value="{{ date }}" start="1900-01-01" end="2020-09-01" bindchange="bindDateChange">
             <view class="picker">
               <text class='setting-title'>生日</text>
               <text>{{ date }}</text>
@@ -39,7 +39,7 @@
       </view>
       <view class='school-box'>
         <text class='setting-title'>学校</text>
-        <input name='address' class='address' type='text' placeholder='北京市海淀区万泉胜景远小学' value='{{ msg }}' bindblur='saveAddress'></input>
+        <input name='address' class='address' type='text' placeholder='{{user.schoolName}}' value='{{ user.schoolName }}' bindblur='saveAddress'></input>
         <view class='edit-image'>
           <image src='../../../static/image/edit.png' class='icon'></image>
         </view>

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

@@ -26,7 +26,8 @@ page{
 }
 
 .user-action{
-  width: 100rpx;
+  min-width: 100rpx;
+  max-width: 400rpx;
 }
 
 .nickname{
@@ -45,7 +46,7 @@ page{
 
 .edit-img{
   position: absolute;
-  left: 220rpx;
+  right:130rpx;
   top: 24rpx;
   width: 22rpx;
   height: 32rpx;

+ 1 - 1
pages/user/myWallet/myWallet.js

@@ -5,7 +5,7 @@ Page({
    */
   data: {
     title: '',
-    totalMoney: 3000,
+    totalMoney: 0,
     textDoc: '收到的赏金',
     textPrompt: '收到的奖励自动转入微信钱包',
     walletDetail: '资金明细',

+ 24 - 84
pages/user/mycollection/mycollection.js

@@ -1,148 +1,88 @@
-// pages/user/mycollection/mycollection.js
+import httpRequestApi from '../../../utils/APIClient';
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-    collection_data: [
-      {
-        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: "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: "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: "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: "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: "1",
-        avatar: '../../static/image/timg.jpg',
-        nickName: '木小雅',
-        time: '10-18 09:56'
-      }
-    ]
+    collection_data: []
+  },
+
+  toClass: function(e) {
+    let targetCode = e.currentTarget.dataset.targetcode;
+    let title = e.currentTarget.dataset.title;
+    wx.navigateTo({
+      url: `../../main/class/class?id=${targetCode}&title=${title}`
+    });
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (option) {
+  onLoad: function(option) {
     console.log(option.title);
     if (option.title) {
       wx.setNavigationBarTitle({
-        title: option.title//页面标题为路由参数
+        title: option.title //页面标题为路由参数
       });
       this.setData({
         title: option.title
       });
     }
 
+    httpRequestApi.myFavorites().success(res => {
+      this.setData({
+        collection_data: res.data.data.list
+      });
+    });
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function () {
+  onReady: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function () {
+  onShow: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function () {
+  onHide: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function () {
+  onUnload: function() {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function () {
+  onPullDownRefresh: function() {
 
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function () {
+  onReachBottom: function() {
 
   },
 
   /**
    * 用户点击右上角分享
    */
-  onShareAppMessage: function () {
+  onShareAppMessage: function() {
 
   }
 })

+ 3 - 26
pages/user/mycollection/mycollection.wxml

@@ -1,36 +1,13 @@
 <view class='my-collection'>
-  <view class='collection-article' wx:for="{{ collection_data }}" wx:key="{{ index }}">
-    <view class='collection-top'>
-      <view class='top-img'>
-        <image src='{{ item.avatarUrl }}'></image>
-      </view>
-      <view class='collection-info'>
-        <view class='title'>{{ item.nickName }}</view>
-        <view class='date'>{{ item.time }}</view>
-      </view>
-    </view>
+  <view class='collection-article' wx:for="{{ collection_data }}" wx:key="{{ index }}" bindtap='toClass' data-targetCode="{{item.targetCode}}" data-title='{{ item.title }}'>
     <view class='video-preview'>
-      <image src='{{ item.previewUrl }}'></image>
+      <image src='{{ item.iconImg }}'></image>
     </view>
     <view class='content-title'>
       {{ item.title }}
     </view>
     <view class='content-detail'>
-      <view class='left'>{{ item.grade }}</view>
-      <view class='right'>
-        <view class='right-detail'>
-          <view class='play-img'>
-            <image src='../../../static/image/hotPlays.png'></image>
-          </view>
-          <text>{{ item.plays }}</text>
-        </view>
-        <view class='right-detail'>
-          <view class='point-img'>
-            <image src='../../../static/image/like.png'></image>
-          </view>
-          <text>{{ item.likes }}</text>
-        </view>
-      </view>
+      <view class='left'>{{ item.summary }}</view>
     </view>
   </view>
 </view>

+ 1 - 1
pages/user/mycollection/mycollection.wxss

@@ -63,7 +63,7 @@
 .content-title{
   margin-top: 10rpx;
   width: 100%;
-  height: 50rpx;
+  height: 55rpx;
   font-size: 32rpx;
   font-weight: 600;
   color: #414141;

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

@@ -7,80 +7,7 @@ Page({
       fullScreenBtn: false,
       playBtn: false,
       gesture: true,
-      concerns:[
-          {
-              nickName: '清然未',
-              time: '10-18 09:56',
-              avatar: 'https://developers.weixin.qq.com/miniprogram/dev/image/cat/0.jpg?t=18102320',
-              concerned: '已关注',
-              followBack: '相互关注',
-              isEachOther: false
-          },
-          {
-              nickName: '木小雅',
-              time: '10-18 09:56',
-              avatar: 'https://developers.weixin.qq.com/miniprogram/dev/image/cat/0.jpg?t=18102320',
-              concerned: '已关注',
-              followBack: '相互关注',
-              isEachOther: true
-          },
-          {
-              nickName: '清然未',
-              time: '10-18 09:56',
-              avatar: 'https://developers.weixin.qq.com/miniprogram/dev/image/cat/0.jpg?t=18102320',
-              concerned: '已关注',
-              followBack: '相互关注',
-              isEachOther: false
-          },
-          {
-              nickName: '木小雅',
-              time: '10-18 09:56',
-              avatar: 'https://developers.weixin.qq.com/miniprogram/dev/image/cat/0.jpg?t=18102320',
-              concerned: '已关注',
-              followBack: '相互关注',
-              isEachOther: true
-          },
-          {
-              nickName: '清然未',
-              time: '10-18 09:56',
-              avatar: 'https://developers.weixin.qq.com/miniprogram/dev/image/cat/0.jpg?t=18102320',
-              concerned: '已关注',
-              followBack: '相互关注',
-              isEachOther: false
-          },
-          {
-              nickName: '清然未',
-              time: '10-18 09:56',
-              avatar: 'https://developers.weixin.qq.com/miniprogram/dev/image/cat/0.jpg?t=18102320',
-              concerned: '已关注',
-              followBack: '相互关注',
-              isEachOther: false
-          },
-          {
-              nickName: '清然未',
-              time: '10-18 09:56',
-              avatar: 'https://developers.weixin.qq.com/miniprogram/dev/image/cat/0.jpg?t=18102320',
-              concerned: '已关注',
-              followBack: '相互关注',
-              isEachOther: false
-          },
-          {
-              nickName: '木小雅',
-              time: '10-18 09:56',
-              avatar: 'https://developers.weixin.qq.com/miniprogram/dev/image/cat/0.jpg?t=18102320',
-              concerned: '已关注',
-              followBack: '相互关注',
-              isEachOther: true
-          },
-          {
-              nickName: '木小雅',
-              time: '10-18 09:56',
-              avatar: 'https://developers.weixin.qq.com/miniprogram/dev/image/cat/0.jpg?t=18102320',
-              concerned: '已关注',
-              followBack: '相互关注',
-              isEachOther: true
-          },
-      ]
+      fanList:[]
   },
 
   /**
@@ -96,11 +23,9 @@ Page({
         title: option.title
       });
     }
-    let uid = 1, pageNo = 8, pageSize = 18;
-    httpRequestApi.getFollowUsers(uid, pageNo, pageSize).success(res => {
-      let { data } = res.data;
+    httpRequestApi.myFans().success(res => {
       this.setData({
-        isEachOther: data.hasPrevious
+        fanList: res.data.data.list
       });
     });
   },

+ 16 - 8
pages/user/myconcern/myconcern.wxml

@@ -1,24 +1,32 @@
+<wxs module="wxs">
+  function formatDate(time) {
+    var timeTemp = getDate(time);
+    var timeString = timeTemp.toLocaleDateString() + timeTemp.toLocaleTimeString();
+    return timeString.replace('/','-').replace('/','-').replace('上午',' ').replace('下午',' ');
+  }
+  module.exports.formatDate = formatDate;
+</wxs>
 <view class='my-concern'>
   <view class="concern-center">
-    <view class='concern-info' wx:for="{{ concerns }}" wx:key="{{ index }}">
+    <view class='concern-info' wx:for="{{ fanList }}" wx:key="{{ index }}">
       <view class='avatar-box'>
-        <image class='avatar-image' src="{{ item.avatar }}" />
+        <image class='avatar-image' src="{{ item.user.avatar }}" />
       </view>
       <view class="avatar-name">
-        <text class="nickName">{{ item.nickName }}</text>
-        <text class="time">{{ item.time }}</text>
+        <text class="nickName">{{ item.user.wechatName }}</text>
+        <text class="time">{{ wxs.formatDate(item.fans.gmtCreated) }}</text>
       </view>
       <view class="avatar-follow" wx:if='{{ item.isEachOther }}'>
         <view class='avatar-img'>
-          <image class='avatar-images' src="../../../static/image/concerned.png" />
+          <image class='avatar-images' src="../../../static/image/concernback.png" />
         </view>
-        <view class="follow-status">{{ item.concerned }}</view>
+        <view class="follow-status">相互关注</view>
       </view>
       <view class="avatar-follow" wx:elif='{{ item.followBack === item.followBack || item.isEachOther }}'>
         <view class='avatar-img'>
-          <image class='avatar-images' src="../../../static/image/concernback.png" />
+          <image class='avatar-images' src="../../../static/image/concerned.png" />
         </view>
-        <view class="follow-status">{{ item.followBack }}</view>
+        <view class="follow-status">已关注</view>
       </view>
     </view>
   </view>

+ 9 - 8
pages/user/myconcern/myconcern.wxss

@@ -25,7 +25,7 @@ page{
 }
 
 .avatar-box{
-  margin-left: 20rpx;
+  margin-left: 30rpx;
   width: 96rpx;
   height: 96rpx;
   border-radius: 50%;
@@ -38,25 +38,26 @@ page{
 }
 
 .nickName{
-  width: 200rpx;
+  width: 420rpx;
   height: 44rpx;
   color: #000000;
   font-size: 32rpx;
 }
 
 .time{
-  width: 200rpx;
+  width: 420rpx;
   height: 44rpx;
   color: #686868;
   font-size: 32rpx;
 }
 
 .avatar-follow{
-  margin-left: 270rpx;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  width: 100rpx;
+  margin-left:30rpx;
+  display:flex;
+  flex-direction:column;
+  align-items:center;
+  width:100rpx;
+
 }
 
 .avatar-img{

+ 9 - 1
pages/user/mycourse/mycourse.js

@@ -33,7 +33,15 @@ Page({
       // }
     ]
   },
-
+  // 进入课本
+  toCourse: function(e) {
+    let productId = e.currentTarget.dataset.productid;
+    let productTitle = e.currentTarget.dataset.producttitle;
+    debugger
+    wx.navigateTo({
+      url: `../../groupPage/grade-details/grade-details?productId=${productId}&title=${productTitle}`
+    });
+  },
   /**
    * 生命周期函数--监听页面加载
    */

+ 1 - 1
pages/user/mycourse/mycourse.wxml

@@ -1,7 +1,7 @@
 <view class='my-course'>
   <block wx:for="{{ bookList }}" wx:key="{{ index }}">
     <view class="book-item">
-      <view class='book-box'>
+      <view class='book-box' bindtap='toCourse' data-productId='{{ item.productId }}' data-productTitle='{{ item.productTitle }}'>
         <image class="item-img" src="{{ item.iconImg }}"></image>
       </view>
       <view class='item-title'>{{ item.groupTitle }}</view>

+ 83 - 74
pages/user/myread/myread.js

@@ -6,81 +6,89 @@ 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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "1",
+        avatar: '../../static/image/timg.jpg',
+        nickName: '喔喔',
+        time: '10-18 09:56'
+      }
     ]
   },
 
+  toWork: function (e) {
+    let lessonId = e.currentTarget.dataset.lessonid;
+    let title = e.currentTarget.dataset.title;
+    wx.navigateTo({
+      url: `../../social/works/works?id=${lessonId}&title=${title}`
+    });
+  },
+
   /**
    * 生命周期函数--监听页面加载
    */
@@ -95,9 +103,10 @@ Page({
       });
     }
     APIClient.myRead().success(res => {
-      console.log(res);
+      console.log(res.data.data.list);
+      debugger;
       this.setData({
-        // wareCards: res.data.data.data.list
+        wareCards: res.data.data.list
       });
     }).fail(err => {
       console.log(err);

+ 13 - 14
pages/user/myread/myread.wxml

@@ -1,34 +1,33 @@
+<wxs module="wxs">
+  function formatDate(time) {
+    var timeTemp = getDate(time);
+    var timeString = timeTemp.toLocaleDateString() + timeTemp.toLocaleTimeString();
+    return timeString.replace('/','-').replace('/','-').replace('上午',' ').replace('下午',' ');
+  }
+  module.exports.formatDate = formatDate;
+</wxs>
 <view class='my-read'>
-  <view class='read-article' wx:for="{{ wareCards }}" wx:key="{{ index }}">
-    <view class='read-top'>
-      <view class='top-img'>
-        <image src='{{ item.avatarUrl }}'></image>
-      </view>
-      <view class='read-info'>
-        <view class='title'>{{ item.nickName }}</view>
-        <view class='date'>{{ item.time }}</view>
-      </view>
-    </view>
+  <view class='read-article' wx:for="{{ wareCards }}" wx:key="{{ index }}" bindtap='toWork' data-lessonId='{{ item.id }}' data-title='{{ item.title }}'>
     <view class='video-preview'>
-      <image src='{{ item.previewUrl }}'></image>
+      <image src='{{ item.iconImg }}'></image>
     </view>
     <view class='content-title'>
       {{ item.title }}
     </view>
     <view class='content-detail'>
-      <view class='left'>{{ item.grade }}</view>
+      <view class='left'>{{ item.summary }}</view>
       <view class='right'>
         <view class='right-detail'>
           <view class='play-img'>
             <image src='../../../static/image/hotPlays.png'></image>
           </view>
-          <text>{{ item.plays }}</text>
+          <text>{{ item.playAmount }}</text>
         </view>
         <view class='right-detail'>
           <view class='point-img'>
             <image src='../../../static/image/like.png'></image>
           </view>
-          <text>{{ item.likes }}</text>
+          <text>{{ item.likeAmount }}</text>
         </view>
       </view>
     </view>

+ 28 - 36
pages/user/walletDetails/walletDetails.wxml

@@ -1,46 +1,38 @@
-<wxs module="m1">
-    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.formatDate = formatDate;
+<wxs module="wxs">
+  function formatDate(time) {
+    var timeTemp = getDate(time);
+    var timeString = timeTemp.toLocaleDateString() + timeTemp.toLocaleTimeString();
+    return timeString.replace('/','-').replace('/','-').replace('上午',' ').replace('下午',' ');
+  }
+  function parseDouble(number) {
+    return parseFloat(number).toFixed(2);
+  }
+  module.exports.formatDate = formatDate;
+  module.exports.parseDouble = parseDouble;
 </wxs>
 <view class='walletDetails'>
   <view class="walletDetails-center">
     <view class='walletDetails-info' wx:for="{{ walletDatails }}" wx:key="{{ index }}">
-        <view class="walletDetails-left">
-            <view class='avatar-box'>
-                <image src="../../../static/image/walletdetails.png" />
-            </view>
-            <view class="avatar-info">
-                <text class="avatar-doc">{{ item.description }}</text>
+      <view class="walletDetails-left">
+        <view class='avatar-box'>
+          <image src="../../../static/image/walletdetails.png" />
+        </view>
+        <view class="avatar-info">
+          <text class="avatar-doc">{{ item.description }}</text>
 
-                <text class="avatar-time"></text>
-            </view>
+          <text class="avatar-time">{{wxs.formatDate(item.gmtCreated)}}</text>
+        </view>
+      </view>
+      <view class="walletDetails-right">
+        <view class="avatar-value-pos" wx:if="{{ item.type === 'INCOME' }}">
+          <text class="avatar-symbol">+</text>
+          <text>{{ wxs.parseDouble(item.price / 100) }}</text>
         </view>
-        <view class="walletDetails-right">
-            <view class="avatar-value-pos" wx:if="{{ item.type === 'INCOME' }}">
-                <text class="avatar-symbol">+</text>
-                <text>{{ item.price }}</text>
-            </view>
-            <view class="avatar-value-neg" wx:else>
-                <text class="avatar-symbol">-</text>
-                <text>{{ item.price }}</text>
-            </view>
+        <view class="avatar-value-neg" wx:else>
+          <text class="avatar-symbol">-</text>
+          <text>{{ wxs.parseDouble(item.price / 100) }}</text>
         </view>
+      </view>
     </view>
   </view>
 </view>

+ 6 - 89
project.config.json

@@ -36,12 +36,12 @@
 			"list": []
 		},
 		"miniprogram": {
-			"current": 19,
+			"current": 0,
 			"list": [
 				{
 					"id": 0,
 					"name": "edit",
-					"pathName": "pages/user/myEdit/myEdit",
+					"pathName": "pages/groupPage/my-group/my-group",
 					"query": ""
 				},
 				{
@@ -63,100 +63,17 @@
 					"query": ""
 				},
 				{
-					"id": -1,
-					"name": "团购",
-					"pathName": "pages/groupPage/collage-details/collage-details",
-					"query": ""
-				},
-				{
-					"id": -1,
-					"name": "aaa",
-					"pathName": "pages/groupPage/collage-details/collage-details",
-					"query": "productId=1"
-				},
-				{
-					"id": 5,
-					"name": "concern",
-					"pathName": "pages/user/myconcern/myconcern",
-					"query": ""
-				},
-				{
 					"id": 7,
 					"name": "作品页面",
 					"pathName": "pages/social/works/works",
 					"query": "id=1541489786444388&title=铺满色巴掌的水泥道"
 				},
 				{
-					"id": -1,
-					"name": "read",
-					"pathName": "pages/user/myread/myread",
-					"query": "productId=1"
-				},
-				{
-					"id": -1,
-					"name": "keep",
-					"pathName": "pages/user/mycollection/mycollection",
-					"query": "productId=1"
-				},
-				{
-					"id": -1,
-					"name": "course",
-					"pathName": "pages/user/mycourse/mycourse",
-					"query": "productId=1"
-				},
-				{
-					"id": -1,
-					"name": "course",
-					"pathName": "pages/user/mycourse/mycourse",
-					"query": "productId=1"
-				},
-				{
-					"id": -1,
-					"name": "course",
-					"pathName": "pages/index/index",
-					"query": "productId=1"
-				},
-				{
-					"id": -1,
-					"name": "course",
-					"pathName": "pages/user/mycourse/mycourse",
-					"query": "id=1541683622900612&title=【课文1】秋天"
-				},
-				{
-					"id": 8,
-					"name": "测试的",
-					"pathName": "pages/social/works/works",
-					"query": "id=1541743536238348&title=【课文6】比尾巴",
+					"id": 5,
+					"name": "修改资料",
+					"pathName": "pages/user/myEdit/myEdit",
+					"query": "title=修改资料",
 					"scene": "1012"
-				},
-				{
-					"id": -1,
-					"name": "collage",
-					"pathName": "pages/user/mycollage/mycollage",
-					"query": ""
-				},
-				{
-					"id": -1,
-					"name": "collage",
-					"pathName": "pages/user/mycollage/mycollage",
-					"query": ""
-				},
-				{
-					"id": -1,
-					"name": "details",
-					"pathName": "pages/user/myWallet/myWallet",
-					"query": ""
-				},
-				{
-					"id": -1,
-					"name": "details",
-					"pathName": "pages/user/myWallet/myWallet",
-					"query": ""
-				},
-				{
-					"id": -1,
-					"name": "course",
-					"pathName": "pages/user/mycourse/mycourse"
 				}
 			]
 		}

+ 312 - 302
utils/APIClient.js

@@ -5,311 +5,321 @@ let request = require('WXHttpRequest.js');
 const httputil = require('httpUtil.js');
 
 function getProductUrl(action) {
-	return HOST_PRODUCT + action;
+  return HOST_PRODUCT + action;
 }
 
 function getBaseUrl(action) {
-	return HOST_BASE + action;
+  return HOST_BASE + action;
 }
 module.exports = {
-    //获取推荐首页信息
-    getIndex(uid) {
-        let url = getProductUrl('wx/index');
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 获取首页人气推荐
-    getHotRecommend(uid, pageNo, pageSize) {
-        let url = getBaseUrl('wx/userRead/recommend');
-        return request.getInstance().header({
-            uid
-        }).data({
-            pageNo,
-            pageSize,
-        }).url(url).send();
-    },
-    // 获取用户朗读详细信息
-    getWorksDetail(uid, readId) {
-        let url = getBaseUrl(`wx/userRead/info/${readId}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 获取全部课本
-    getAllBooks(pageNo, pageSize) {
-        let url = getProductUrl('wx/product');
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).data({
-            pageNo,
-            pageSize
-        }).send();
-    },
-    // 获取课本详情
-    getBookDetail(uid, id) {
-        let url = getProductUrl(`wx/product/${id}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 获取单课详情
-    getClassDetail(uid, id) {
-        let url = getProductUrl(`wx/lesson/${id}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 检查是否收藏过课程
-    classIsLike(uid, data) {
-        let url = getProductUrl(`wx/favorites/isLike`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).send();
-    },
-    getClassDetail(uid, id) {
-        let url = getProductUrl(`wx/lesson/${id}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 获取单课朗读信息
-    getClassRead(uid, data) {
-        let url = getBaseUrl(`wx/userRead`);
-        return request.getInstance().header({
-            uid
-        }).data(data).url(url).send();
-    },
-    // 作品播放了+1
-    playWorks(uid, readId) {
-        let url = getBaseUrl(`wx/userRead/play/${readId}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 发布作品
-    postWork(uid, data) {
-        console.log(data);
-        let url = getBaseUrl(`wx/userRead`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).method('POST').send();
-    },
-    // 点赞作品
-    likeWorks(uid, readId) {
-        let url = getBaseUrl(`wx/userRead/like/${readId}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 关注用户
-    followUser(uid, followUid) {
-        let url = getBaseUrl(`wx/fans`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data({
-            "uid": followUid
-        }).method('POST').send();
-    },
-    //获取关注的用户列表
-    getFollowUsers(uid, pageNo, pageSize) {
-        let url = getBaseUrl(`wx/fans`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data({
-            pageNo: pageNo,
-            pageSize: pageSize
-        }).send();
-    },
-    // 获取关注用户的作品列表
-    getFollowWorks(uid, pageNo, pageSize) {
-        let url = getBaseUrl(`wx/fans/interest`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data({
-            pageNo: pageNo,
-            pageSize: pageSize
-        }).send();
-    },
-    // 搜索
-    getSearchResult(uid, key, pageNo, pageSize) {
-        let url = getProductUrl(`wx/lesson`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data({
-            title: key,
-            productId: '',
-            pageNo: pageNo,
-            pageSize: pageSize
-        }).send();
-    },
-    // 获取回复信息
-    getReply(uid, columnId, pageNo, pageSize) {
-        let url = getBaseUrl(`wx/posts/reply`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data({
-            columnId: columnId,
-            pageNo: pageNo,
-            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`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).method('POST').send();
-    },
-    // 点赞评论
-    likeCommend(uid, likeUid) {
-        let url = getBaseUrl(`wx/posts/attribute/${likeUid}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).method('GET').send();
-    },
-    // 发布讨论
-    postReply(uid, data) {
-        let url = getBaseUrl(`wx/posts`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).method('POST').send();
-    },
-    // 获取推荐团购信息
-    getGroupList() {
-        let url = getBaseUrl(`wx/groupPurchaseInfo/recommend`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).send();
-    },
-    // 获取课程团购信息
-    getGroupPurchaseInfo(productId) {
-        let url = getBaseUrl(`wx/groupPurchaseInfo/info/${productId}`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).send();
-    },
-    // 发起团购
-    SendGroupPurchas(data) {
-        let url = getBaseUrl(`wx/groupPurchase/create`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).data(data).method('POST').send();
-    },
-    // 参加团购
-    JoinGroupPurchas(orderId) {
-        let url = getBaseUrl(`wx/groupPurchase/join`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).data({
-            orderId
-        }).method('POST').send();
-    },
-    // 收藏课程
-    collectClass(uid, data) {
-        let url = getProductUrl(`wx/favorites`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).method('POST').send();
-    },
-    //我的团
-    getMygroup() {
-        let url = getBaseUrl(`wx/groupPurchase/my`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).data({
-            pageNo: 1,
-            pageSize: 100
-        }).send();
-    },
-    //获取团购详情
-    getMygroupInfo(orderId) {
-        let url = getBaseUrl(`wx/groupPurchase/info/${orderId}`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).send();
-    },
-    //团购是否成功
-    groupSuccess(orderId) {
-        let url = getBaseUrl(`wx/groupPurchase/joinStatus`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).data({
-            orderId
-        }).send();
-    },
-    // 发起奖励
-    rewardMoney(uid, data) {
-        let url = getBaseUrl(`wx/wallet/award`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).method('POST').send();
-    },
-    // 修改资料
-    settingUserInfo(wechatName, mobile, gender, schoolProvince, schoolCity, schoolName, profession, birthday) {
-        let url = getBaseUrl(`wx/user`);
-        return request.getInstance().header({
-            uid:wx.getStorageSync('uid')
-        }).data({
-            wechatName: wechatName,
-            mobile: mobile,
-            gender: gender,
-            schoolProvince: schoolProvince,
-            schoolCity: schoolCity,
-            schoolName: schoolName,
-            profession: profession,
-            birthday: birthday
-        }).url(url).method('PUT').send();
-    },
-    //获取个人信息
-    getUserInfo() {
-        let url = getBaseUrl(`wx/user`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).data({
-            uid: wx.getStorageSync('uid')
-        }).url(url).send();
-    },
-    // 生成二维码
-    createQRCode(data) {
-        let url = getBaseUrl(`wx/qrCode`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).data(data).url(url).send();
-    },
-//	我的奖金
-    myWallet() {
-      let url = getBaseUrl('wx/wallet/bonus');
-      return request.getInstance().header({
-          uid: wx.getStorageSync('uid')
-      }).url(url).send();
-    },
-    // 資金明細
-    myWalletDetails() {
-      let url = getBaseUrl('wx/wallet/record');
-      return request.getInstance().header({
-        uid: wx.getStorageSync('uid')
-      }).url(url).send();
-    },
-    // 我的課程
-    myCourse() {
-      let url = getBaseUrl('wx/groupPurchase/myCourse');
-      return request.getInstance().header({
-        uid: wx.getStorageSync('uid')
-      }).url(url).send();
-    },
-    // 我的朗读
-    myRead() {
-      let url = getBaseUrl('wx/userRead/my');
-      return request.getInstance().header({
-        uid: wx.getStorageSync('uid')
-      }).url(url).send();
-    },
+  //获取推荐首页信息
+  getIndex(uid) {
+    let url = getProductUrl('wx/index');
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 获取首页人气推荐
+  getHotRecommend(uid, pageNo, pageSize) {
+    let url = getBaseUrl('wx/userRead/recommend');
+    return request.getInstance().header({
+      uid
+    }).data({
+      pageNo,
+      pageSize,
+    }).url(url).send();
+  },
+  // 获取用户朗读详细信息
+  getWorksDetail(uid, readId) {
+    let url = getBaseUrl(`wx/userRead/info/${readId}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 获取全部课本
+  getAllBooks(pageNo, pageSize) {
+    let url = getProductUrl('wx/product');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data({
+      pageNo,
+      pageSize
+    }).send();
+  },
+  // 获取课本详情
+  getBookDetail(uid, id) {
+    let url = getProductUrl(`wx/product/${id}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 获取单课详情
+  getClassDetail(uid, id) {
+    let url = getProductUrl(`wx/lesson/${id}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 检查是否收藏过课程
+  classIsLike(uid, data) {
+    let url = getProductUrl(`wx/favorites/isLike`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).send();
+  },
+  getClassDetail(uid, id) {
+    let url = getProductUrl(`wx/lesson/${id}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 获取单课朗读信息
+  getClassRead(uid, data) {
+    let url = getBaseUrl(`wx/userRead`);
+    return request.getInstance().header({
+      uid
+    }).data(data).url(url).send();
+  },
+  // 作品播放了+1
+  playWorks(uid, readId) {
+    let url = getBaseUrl(`wx/userRead/play/${readId}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 发布作品
+  postWork(uid, data) {
+    console.log(data);
+    let url = getBaseUrl(`wx/userRead`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).method('POST').send();
+  },
+  // 点赞作品
+  likeWorks(uid, readId) {
+    let url = getBaseUrl(`wx/userRead/like/${readId}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 关注用户
+  followUser(uid, followUid) {
+    let url = getBaseUrl(`wx/fans`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data({
+      "uid": followUid
+    }).method('POST').send();
+  },
+  //获取关注的用户列表
+  getFollowUsers(uid, pageNo, pageSize) {
+    let url = getBaseUrl(`wx/fans`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data({
+      pageNo: pageNo,
+      pageSize: pageSize
+    }).send();
+  },
+  // 获取关注用户的作品列表
+  getFollowWorks(uid, pageNo, pageSize) {
+    let url = getBaseUrl(`wx/fans/interest`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data({
+      pageNo: pageNo,
+      pageSize: pageSize
+    }).send();
+  },
+  // 搜索
+  getSearchResult(uid, key, pageNo, pageSize) {
+    let url = getProductUrl(`wx/lesson`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data({
+      title: key,
+      productId: '',
+      pageNo: pageNo,
+      pageSize: pageSize
+    }).send();
+  },
+  // 获取回复信息
+  getReply(uid, columnId, pageNo, pageSize) {
+    let url = getBaseUrl(`wx/posts/reply`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data({
+      columnId: columnId,
+      pageNo: pageNo,
+      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`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).method('POST').send();
+  },
+  // 点赞评论
+  likeCommend(uid, likeUid) {
+    let url = getBaseUrl(`wx/posts/attribute/${likeUid}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).method('GET').send();
+  },
+  // 发布讨论
+  postReply(uid, data) {
+    let url = getBaseUrl(`wx/posts`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).method('POST').send();
+  },
+  // 获取推荐团购信息
+  getGroupList() {
+    let url = getBaseUrl(`wx/groupPurchaseInfo/recommend`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 获取课程团购信息
+  getGroupPurchaseInfo(productId) {
+    let url = getBaseUrl(`wx/groupPurchaseInfo/info/${productId}`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 发起团购
+  SendGroupPurchas(data) {
+    let url = getBaseUrl(`wx/groupPurchase/create`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data(data).method('POST').send();
+  },
+  // 参加团购
+  JoinGroupPurchas(orderId) {
+    let url = getBaseUrl(`wx/groupPurchase/join`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data({
+      orderId
+    }).method('POST').send();
+  },
+  // 收藏课程
+  collectClass(uid, data) {
+    let url = getProductUrl(`wx/favorites`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).method('POST').send();
+  },
+  //我的团
+  getMygroup() {
+    let url = getBaseUrl(`wx/groupPurchase/my`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data({
+      pageNo: 1,
+      pageSize: 100
+    }).send();
+  },
+  //获取团购详情
+  getMygroupInfo(orderId) {
+    let url = getBaseUrl(`wx/groupPurchase/info/${orderId}`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  //团购是否成功
+  groupSuccess(orderId) {
+    let url = getBaseUrl(`wx/groupPurchase/joinStatus`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data({
+      orderId
+    }).send();
+  },
+  // 发起奖励
+  rewardMoney(uid, data) {
+    let url = getBaseUrl(`wx/wallet/award`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).method('POST').send();
+  },
+  // 修改资料
+  settingUserInfo(data) {
+    let url = getBaseUrl(`wx/user`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).data(data).url(url).method('PUT').send();
+  },
+  //获取个人信息
+  getUserInfo() {
+    let url = getBaseUrl(`wx/user`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 获取播放量等数据
+  getUserWorksInfo() {
+    let url = getBaseUrl(`wx/user/my`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 生成二维码
+  createQRCode(data) {
+    let url = getBaseUrl(`wx/qrCode`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).data(data).url(url).send();
+  },
+  //	我的奖金
+  myWallet() {
+    let url = getBaseUrl('wx/wallet/bonus');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 資金明細
+  myWalletDetails() {
+    let url = getBaseUrl('wx/wallet/record');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 我的課程
+  myCourse() {
+    let url = getBaseUrl('wx/groupPurchase/myCourse');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 我的朗读
+  myRead() {
+    let url = getBaseUrl('wx/userRead/my');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 我的收藏
+  myFavorites() {
+    let url = getProductUrl(`wx/favorites`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 我的关注
+  myFans() {
+    let url = getBaseUrl(`wx/fans`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
 }

+ 1 - 0
utils/httpUtil.js

@@ -54,6 +54,7 @@ function getLoginSchedule(sessionKey, openId, successcallback, failcallback) {
                       })
                       wx.setStorageSync('uid', res.data.data.data.uid)
                       wx.setStorageSync('user', res)
+                      console.log(res)
                       successcallback(res)
                   });
                 },

+ 2 - 0
utils/util.js

@@ -14,6 +14,7 @@ const formatNumber = n => {
 }
 //时间戳转时间
 function formatDate(time, flag) {
+	console.log(time)
 	const t = new Date(time); 
 	const tf = function(i){return (i < 10 ? '0' : '') + i};
 	const year = t.getFullYear();
@@ -25,6 +26,7 @@ function formatDate(time, flag) {
 	if(flag == 1) {
 		return  month + '月' + day + '日' + ' ' + hour + ':' + minute;
 	}else if(flag == 2) {
+		console.log(year,month,day)
 		return year + '-' + month + '-' + day
 	}else if(flag == 3){
 		return month + '-' + day + ' ' + hour + ':' + minute;