Selaa lähdekoodia

Merge branch 'master' into sophie

Rorschach 6 vuotta sitten
vanhempi
commit
376bd1febc

+ 53 - 41
component/follow/follow.js

@@ -1,61 +1,73 @@
 import httpRequestApi from '../../utils/APIClient';
+import {
+  formatDate
+} from '../../utils/util';
 export const followInit = (that) => {
   that.setData({
-    followData: {
-      title: '关注',
-      wareCards: [{
-          title: "铺满色巴掌的水泥道",
-          grade: "一年级 上学期",
-          img: "../../static/image/timg.jpg",
-          plays: "1",
-          likes: "2",
-          classId: "1",
-          avatar: '../../static/image/timg.jpg',
-          nickName: '萝莉小猫咪',
-          time: '11-01 14:14'
-        },
-        {
-          title: "铺满色巴掌的水泥道",
-          grade: "一年级 上学期",
-          img: "../../static/image/timg.jpg",
-          plays: "1",
-          likes: "2",
-          classId: "1",
-          avatar: '../../static/image/timg.jpg',
-          nickName: '萝莉小猫咪',
-          time: '11-01 14:14'
-        },
-        {
-          title: "铺满色巴掌的水泥道",
-          grade: "一年级 上学期",
-          img: "../../static/image/timg.jpg",
-          plays: "1",
-          likes: "2",
-          classId: "1",
-          avatar: '../../static/image/timg.jpg',
-          nickName: '萝莉小猫咪',
-          time: '11-01 14:14'
-        },
-      ]
-    }
+    followData: []
+    //   title: '关注',
+    //   wareCards: [{
+    //       title: "铺满色巴掌的水泥道",
+    //       grade: "一年级 上学期",
+    //       img: "../../static/image/timg.jpg",
+    //       plays: "1",
+    //       likes: "2",
+    //       classId: "1",
+    //       avatar: '../../static/image/timg.jpg',
+    //       nickName: '萝莉小猫咪',
+    //       time: '11-01 14:14'
+    //     },
+    //     {
+    //       title: "铺满色巴掌的水泥道",
+    //       grade: "一年级 上学期",
+    //       img: "../../static/image/timg.jpg",
+    //       plays: "1",
+    //       likes: "2",
+    //       classId: "1",
+    //       avatar: '../../static/image/timg.jpg',
+    //       nickName: '萝莉小猫咪',
+    //       time: '11-01 14:14'
+    //     },
+    //     {
+    //       title: "铺满色巴掌的水泥道",
+    //       grade: "一年级 上学期",
+    //       img: "../../static/image/timg.jpg",
+    //       plays: "1",
+    //       likes: "2",
+    //       classId: "1",
+    //       avatar: '../../static/image/timg.jpg',
+    //       nickName: '萝莉小猫咪',
+    //       time: '11-01 14:14'
+    //     },
+    //   ]
+    // }
   })
   //请求数据封装
   that.getWorks = (uid, pageNo, pageSize) => {
     httpRequestApi.getFollowWorks(uid, pageNo, pageSize).success(res => {
+      console.log(res)
       const followData = res.data.data.list;
-      const followTemp = [];
+      // const followTemp = [];
       followData.forEach(item => {
         const temp = {};
+        console.log(item.userRead.id)
         temp.nickName = item.user.wechatName;
         temp.avatar = item.user.avatar;
         temp.plays = item.userRead.playAmount;
         temp.likes = item.userRead.likeAmount;
+        temp.img = item.userRead.iconImg;
         temp.id = item.userRead.id;
+        temp.title = item.userRead.title;
+        temp.time = formatDate(item.userRead.gmtCreated, 3);
         // 还差一些字段
-        followTemp.push(temp);
+        that.data.followData.push(temp);
       });
-      console.log(followTemp);
+      // console.log(followTemp);
+      that.setData({
+        followData: that.data.followData,
+        followPageTotalNo: res.data.data.totalNo
+      })
     });
   }
-  that.getWorks(1, 1, 10);
+  that.getWorks(that.uid, 1, 5);
 }

+ 1 - 1
component/follow/follow.wxml

@@ -1,6 +1,6 @@
 <template name="follow">
   <view class="followWares" style="flex-direction:row;">
-    <view wx:for="{{followData.wareCards}}" wx:key="{{index}}" class="followWareCard" bindtap="openWorks" data-uid="{{item.classId}}" data-title="{{item.title}}">
+    <view wx:for="{{followData}}" wx:key="{{index}}" class="followWareCard" bindtap="openWorks" data-readid="{{item.id}}" data-title="{{item.title}}">
       <view class="userCard">
         <image class="avatar" src="{{item.avatar}}" />
         <view class="nameCross">

+ 16 - 8
component/group/group.js

@@ -35,17 +35,16 @@ export const groupInit = (that) => {
   //点击跳转
   that.more = function ({currentTarget}) {
     let type;
-    let title;
     if(currentTarget.dataset.type == 'group') {
-      type = true
-      title = '限量优惠团购'
+      wx.navigateTo({
+        url: `/pages/groupPage/discount-group/discount-group`
+      })
     }else {
-      type = false
-      title = '全部课'
+      wx.navigateTo({
+        url: `../main/books/books`
+      })
     }
-    wx.navigateTo({
-      url: `/pages/groupPage/discount-group/discount-group?type=${type}&title=${title}`
-    })
+
   }
   //发起团购
   that.sendGroup = function () {
@@ -100,4 +99,13 @@ export const groupInit = (that) => {
       url: `/pages/groupPage/group-details/group-details?productId=${productId}&id=${id}&groupId=${groupId}`
     })
   }
+  //跳转到课程详情
+  that.goToBook = function(e){
+    console.log(e.currentTarget.dataset)
+    let id = e.currentTarget.dataset.id;
+    let title = e.currentTarget.dataset.title;
+    wx.navigateTo({
+        url: `/pages/main/singleBook/singleBook?id=${id}&title=${title}`
+      })
+  }
 }

+ 2 - 2
component/group/group.wxml

@@ -26,12 +26,12 @@
       <view class="whole-group">
           <view class="title">
             <image class="ren" src="../../static/groupImg/Shape3.png" style="width: 30rpx; height: 38rpx;"></image>
-            <text class="left">全部课程<text class="quota" style="margin-left: 20rpx;">拼团大不同</text></text>
+            <text class="left">全部课程</text>
             <text class="right" bindtap="more" data-type="course">更多 ></text>
           </view>
           <view class="group-box"> 
             <block wx:for="{{groupData.bookList}}" wx:key="{{index}}">
-              <view class="group-item">
+              <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>    

+ 1 - 1
component/hot/hot.js

@@ -148,5 +148,5 @@ export const hotInit = (that) => {
     console.log(e)
   }
   that.getIndex();
-  that.getHotRecommend(1, 1, 3)
+  that.getHotRecommend(that.uid, 1, 3)
 }

+ 63 - 10
component/share/share.js

@@ -1,4 +1,5 @@
 // component/shar-dialog/shar-dialog.js
+import httpRequestApi from '../../utils/APIClient';
 Component({
   /**
    * 组件的属性列表
@@ -20,6 +21,7 @@ Component({
     author: '',
     iconImg: '',
     title: '',
+    path: ''
   },
 
   /**
@@ -38,6 +40,12 @@ Component({
       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)
@@ -48,7 +56,15 @@ Component({
         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)
-        // ctx.drawImage(this.data.iconImg, 9, 205, 352, 145);
+        // 保存图片到本地
+        // 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')
         ctx.drawImage('../../../static/groupImg/share_bottom.png', 3, 419, 370, 192);
@@ -101,12 +117,12 @@ Component({
           canvasId: 'myCanvas',
           success: (res) => {
             console.log(res.tempFilePath)
-            // wx.saveImageToPhotosAlbum({
-            //   filePath: res.path,
-            //   success(res) {
-            //     console.log(res);
-            //    }
-            // })
+            wx.saveImageToPhotosAlbum({
+              filePath: res.path,
+              success(res) {
+                console.log(res);
+              }
+            })
             that.setData({
               imgUrls: res.tempFilePath
             })
@@ -120,12 +136,39 @@ Component({
     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,
+        // avatar: data.avatar,
         author: data.author,
-        iconImg: data.iconImg,
+        // iconImg: data.iconImg,
         title: data.title,
+        path: data.path
       })
     },
     PreservationImg: function () {
@@ -139,5 +182,15 @@ Component({
     shareFriend: function () {
       this.triggerEvent('customevent', {})
     }
-  }
+  },
+  onShareAppMessage: (res) => {
+    if (res.from === 'button') {
+      // 来自页面内转发按钮
+      console.log(res.target)
+    }
+    return {
+      title: this.data.title,
+      path: this.data.path
+    }
+  },
 })

+ 2 - 2
pages/groupPage/collage-details/collage-details.js

@@ -68,9 +68,9 @@ Page({
       for(var i = 0; i < surplusNum; i++) {
         this.data.surplusList.push(1);
       }
-      //console.log(res.data.data.groupPurchaseOrder.closeTimed - res.data.data.groupPurchaseOrder.gmtCreated)
+      //console.log(res.data.data.groupPurchaseOrder.closeTime - res.data.data.groupPurchaseOrder.gmtModified)
       //时间转换
-      const timeList = util.formatTime(res.data.data.groupPurchaseOrder.closeTimed - res.data.data.groupPurchaseOrder.gmtCreated);
+      const timeList = util.formatTime(res.data.data.groupPurchaseOrder.closeTime - res.data.data.groupPurchaseOrder.gmtModified);
       this.setData({
         surplusNum,
         joinUserList: res.data.data.joinUserList,

+ 2 - 15
pages/groupPage/discount-group/discount-group.js

@@ -6,8 +6,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-    recommendList: [],
-    bookList: []
+    recommendList: []
   },
 
   //点击跳转到团购详情
@@ -20,9 +19,8 @@ Page({
    */
   onLoad: function (options) {
     wx.setNavigationBarTitle({
-      title: options.title
+      title: '优惠团购'
     })
-    if(options.type == 'true') {
       //优惠内容
       httpRequestApi.getGroupList().success( (res) => {
         console.log('推荐团购',res.data.data)
@@ -32,17 +30,6 @@ Page({
       }).fail((error) => {
         console.log('错误',error)
       })
-    }else {
-      //全部课
-      httpRequestApi.getAllBooks(1, 10).success((res) => {
-        console.log('全部课',res.data.data.list)
-        this.setData({
-          bookList: res.data.data.list
-        })
-      }).fail((error) => {
-        console.log('错误',error)
-      })
-    }
   },
 
   /**

+ 0 - 6
pages/groupPage/discount-group/discount-group.wxml

@@ -14,12 +14,6 @@
                   <text>{{item.headcount}}人团</text>
                 </view>
               </view>
-            </block> 
-            <block wx:for="{{bookList}}" wx:key="{{index}}">
-              <view class="group-item">
-                <image class="item-img" src="{{item.iconImg}}"></image>
-                <view id="grade">一年级</view>
-              </view>    
             </block>                
           </view>                        
         </view>

+ 11 - 23
pages/groupPage/grade-details/grade-details.js

@@ -54,7 +54,7 @@ Page({
           return false;
         }
         //掉起支付
-        this.prePayMap(res.data.data.prePayMap, res.data.data.groupPurchaseOrderDetail.orderId);
+        this.prePayMap(res.data.data.prePayMap, res.data.data.groupPurchaseOrder.id);
       }).fail( (error) => {
         
       })
@@ -78,27 +78,15 @@ Page({
             title: '提示',
             content: '支付成功',
             success (res) {
-              if (res.confirm) {
-                that.popup.close();
-                setTimeout(() => {
-                  wx.navigateTo({
-                    url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
-                  })
-                  wx.setNavigationBarTitle({
-                    title: '拼团详情'
-                  })
-                }, 1000)
-              } else if (res.cancel) {
-                that.popup.close();
-                setTimeout(() => {
-                  wx.navigateTo({
-                    url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
-                  })
-                  wx.setNavigationBarTitle({
-                    title: '拼团详情'
-                  })
-                }, 1000)                
-              }
+              that.popup.close();
+              setTimeout(() => {
+                wx.navigateTo({
+                  url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
+                })
+                wx.setNavigationBarTitle({
+                  title: '拼团详情'
+                })
+              }, 1000)
             }
           })
 
@@ -124,7 +112,7 @@ Page({
       })
     }
     //课本详情
-    httpRequestApi.getBookDetail(productId).success( (res) =>{
+    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;

+ 13 - 17
pages/groupPage/group-details/group-details.js

@@ -88,14 +88,14 @@ Page({
         return false;
       }  
       //掉起支付
-      this.prePayMap(res.data.data.prePayMap, res.data.data.orderId);
+      this.prePayMap(res.data.data.prePayMap, res.data.data.orderId, res.data.data.groupPurchaseOrder.id);
     }).fail( (error) => {
       
     })
   },
 
   //支付
-  prePayMap: function (prePayMap, orderId) {
+  prePayMap: function (prePayMap, orderId, detailId) {
     console.log(prePayMap)
     const that = this;
     wx.requestPayment(
@@ -112,16 +112,11 @@ Page({
             title: '提示',
             content: '支付成功',
             success (res) {
-              if (res.confirm) {
-                //获取拼团信息
-                this.jionSuccess(this.data.orderId);
-                this.groupSuccess(orderId);
-
-              } else if (res.cancel) {
-                //获取拼团信息
-                this.jionSuccess(this.data.orderId);                
-                this.groupSuccess(orderId);
-              }
+              //获取拼团信息
+              setTimeout( () => {
+                that.jionSuccess(that.data.orderId);
+                that.groupSuccess(orderId, detailId);
+              },2000)
             }
           })
 
@@ -143,9 +138,9 @@ Page({
       for(var i = 0; i < surplusNum; i++) {
         this.data.surplusList.push(1);
       }
-      console.log(res.data.data.groupPurchaseOrder.closeTimed - res.data.data.groupPurchaseOrder.gmtCreated)
+      console.log(res.data.data.groupPurchaseOrder.closeTime - res.data.data.groupPurchaseOrder.gmtModified)
       //时间转换
-      const timeList = util.formatTime(res.data.data.groupPurchaseOrder.closeTimed - res.data.data.groupPurchaseOrder.gmtCreated);
+      const timeList = util.formatTime(res.data.data.groupPurchaseOrder.closeTime - res.data.data.groupPurchaseOrder.gmtModified);
       this.setData({
         surplusNum,
         joinUserList: res.data.data.joinUserList,
@@ -158,13 +153,13 @@ Page({
   },
 
   //拼团是否成功并弹窗
-  groupSuccess: function (orderId) {
+  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',
@@ -216,9 +211,10 @@ Page({
           })
         }
       }else {
+        debugger;
         setTimeout(() => {
           wx.navigateTo({
-            url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
+            url: `/pages/groupPage/collage-details/collage-details?orderId=${detailId}`
           })
           wx.setNavigationBarTitle({
             title: '拼团详情'

+ 1 - 1
pages/groupPage/group-details/group-details.wxss

@@ -76,7 +76,7 @@
 }
 
 scroll-view {
-    height: 59%;
+    height: 64%;
     width: 100%;
 }
 

+ 2 - 2
pages/groupPage/make-money/make-money.js

@@ -44,9 +44,9 @@ Page({
       for(var i = 0; i < surplusNum; i++) {
         this.data.surplusList.push(1);
       }
-      //console.log(res.data.data.groupPurchaseOrder.closeTimed - res.data.data.groupPurchaseOrder.gmtCreated)
+      //console.log(res.data.data.groupPurchaseOrder.closeTime - res.data.data.groupPurchaseOrder.gmtModified)
       //时间转换
-      const timeList = util.formatTime(res.data.data.groupPurchaseOrder.closeTimed - res.data.data.groupPurchaseOrder.gmtCreated);
+      const timeList = util.formatTime(res.data.data.groupPurchaseOrder.closeTime - res.data.data.groupPurchaseOrder.gmtModified);
       this.setData({
         surplusNum,
         joinUserList: res.data.data.joinUserList,

+ 14 - 1
pages/index/index.js

@@ -41,10 +41,11 @@ Page({
     ],
     winH: 568,
     myIndex: 1,
+    followData:[],
     recommendPageNo:1,
     recommendTotalNo:0,
     followPageNo:1,
-    followPageSize:0,
+    followPageTotalNo:0,
     templates: 'hot',
     title: 'index中的title',
     jurisdictionFlag: true,
@@ -144,5 +145,17 @@ Page({
         console.log('没有更多')
       }
     }
+    if(this.data.myIndex === 2){
+      console.log(this.data.followPageTotalNo)
+      this.setData({
+        followPageNo: this.data.followPageNo+1
+      })
+      if(this.data.followPageNo <= this.data.followPageTotalNo ){
+        this.getWorks(this.uid, this.data.followPageNo, 5);
+        
+      } else {
+        console.log('没有更多')
+      }
+    }
   }
 })

+ 19 - 9
pages/main/class/class.js

@@ -15,6 +15,8 @@ Page({
     title: '',
     id: '',
     iconImg: '',
+    pageNo: 1,
+    totalNo: 0,
     collectFlag: false,
   },
   onLoad: function (option) {
@@ -54,7 +56,7 @@ Page({
     let id = this.data.id;
     let title = this.data.title;
     wx.navigateTo({
-      url: `../../main/reading/reading?id=${id}&title=${this.data.title}&img=${this.data.iconImg}&video=${this.data.videoUrl}`
+      url: `../../main/reading/reading?id=${id}`
     })
   },
   goToWorks: function (e) {
@@ -83,9 +85,9 @@ Page({
   getReadInfo: function (pageNo, pageSize) {
     // const uid =  wx.getStorageSync('uid');
     const data = {
-      lessonId: 1,
-      pageNo: pageNo,
-      pageSize: pageSize
+      lessonId: this.data.id,
+      pageNo: this.data.pageNo,
+      pageSize: 1
     };
     httpRequestApi.getClassRead(this.uid, data).success(res => {
       const readInfo = res.data.data.list;
@@ -93,21 +95,29 @@ Page({
       readInfo.forEach(item => {
         const temp = {};
         temp.nickName = item.user.wechatName;
-        temp.time = formatDate(item.userRead.gmtCreated, 3);
+        temp.time = formatDate(item.userRead.gmtModified, 3);
         temp.avatar = item.user.avatar;
         temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
         temp.uid = item.userRead.uid;
         temp.id = item.userRead.id;
-        readTemp.push(temp);
+        this.data.works.push(temp);
       });
       this.setData({
+        totalNo: res.data.data.totalNo,
         total: res.data.data.totalSize,
-        works: readTemp
+        works: this.data.works
       })
     });
   },
   // 下拉加载
-  scrollUpdate: function (e) {
-    console.log(e)
+  onReachBottom: function(e){
+    console.log(this.data.totalNo);
+    this.setData({
+      pageNo: this.data.pageNo+1
+    })
+    if(this.data.pageNo <= this.data.totalNo ){
+      this.getReadInfo();
+      
+    }
   }
 })

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

@@ -1 +1,5 @@
-{}
+{
+    "window": {
+        "onReachBottomDistance": 50
+      }
+}

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

@@ -1,6 +1,6 @@
 <view class="classPage">
     <video id="classVideo" class="videoSection" src="{{videoUrl}}" controls show-fullscreen-btn="{{fullScreenBtn}}" show-play-btn="{{playBtn}}"></video>
-    <scroll-view class="readWorksSection" lower-threshold="160" bindscrolltolower="scrollUpdate">
+    <view class="readWorksSection" >
         <view class="peopleNum">
             <image class="peoplesIcon" src="../../../static/image/peoples.png" />
             <view class="title">共有{{total}}人完成了录音</view>
@@ -16,7 +16,7 @@
                 <text class="likeNum">{{item.likes}}</text>
             </view>
         </view>
-    </scroll-view>
+    </view>
     <view class="footSection">
         <image class="blackbord" src="../../../static/image/blackbord.png" />
         <view class="collectBtn footerBtn" bindtap="collect">

+ 2 - 1
pages/main/class/class.wxss

@@ -95,7 +95,8 @@
 
 .readWorksSection .workCard {
     width: 716rpx;
-    height: 132rpx;
+    /* height: 132rpx; */
+    height: 700rpx;
     display: flex;
     align-items: center;
     flex-direction: row;

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 26 - 12
pages/main/reading/reading.js


+ 2 - 2
pages/social/replyDetail/replyDetail.js

@@ -33,7 +33,7 @@ Page({
             const authorDetail = {};
             authorDetail.name = replied.user.wechatName;
             authorDetail.text = replied.detailDesc;
-            authorDetail.time = formatDate(replied.gmtCreated, 3);
+            authorDetail.time = formatDate(replied.gmtModified,3);
             authorDetail.likes = replied.postsAttributeInfo.favors;
             authorDetail.avatar = replied.user.avatar;
             replyTemp.push(authorDetail);
@@ -41,7 +41,7 @@ Page({
                 const temp = {};
                 temp.name = item.user.wechatName;
                 temp.text = item.content;
-                temp.time = formatDate(item.gmtCreated, 3);
+                temp.time = formatDate(item.gmtModified,3);
                 temp.likes = 0;
                 temp.id = item.postId;
                 temp.avatar = item.user.avatar;

+ 23 - 15
pages/social/works/works.js

@@ -20,6 +20,7 @@ Page({
         moneyNormal: 'moneyNormal',
         ifReward: false,
         id: '',
+        path:'',
         replyModal: false
         // shareFlag: false
     },
@@ -62,6 +63,7 @@ Page({
                 videoSrc: works.originVideo,
                 audioSrc: works.audioPath,
                 iconImg: works.iconImg,
+                classId: works.lessonId,
                 isLike: res.data.data.isLike,
                 isFans: res.data.data.isFans,
             })
@@ -84,13 +86,17 @@ Page({
             return;
         }
         httpRequestApi.likeWorks(this.uid, this.data.id).success(res => {
-            console.log(this.uid)
-            wx.showToast({
-                title: '点赞数+1',
-                icon: 'success',
-                duration: 1000
-              })
-        });
+            this.setData({
+                isLike: true
+            },()=>{
+                wx.showToast({
+                    title: '点赞数+1',
+                    icon: 'success',
+                    duration: 1000
+                  })
+            });
+            })
+            
     },
     // 弹出分享框
     openShare: function (e) {
@@ -103,6 +109,7 @@ 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}`
             // tip: this.data.tip,
         }
         this.shareDialog.share(data);
@@ -123,19 +130,20 @@ Page({
         let id = this.data.id;
         let title = this.data.title;
         wx.navigateTo({
-            url: `../../main/reading/reading?id=${id}&title=${title}&img=${this.data.iconImg}&video=${this.data.videoSrc}`
+            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: '测试',
-            path: '/pages/social/works/works'
+          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;
@@ -184,7 +192,7 @@ Page({
                 temp.text = item.detailDesc;
                 temp.id = item.id;
                 temp.replyCount = item.replyCount;
-                temp.time = formatDate(item.gmtCreated, 3);
+                temp.time = formatDate(item.gmtModified, 3);
                 temp.likes = item.postsAttributeInfo.favors || 0;
                 console.log(temp.time)
                 replyTemp.push(temp);

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

@@ -4,7 +4,7 @@
         <image class="avatar" src="{{authorAvatar}}" />
         <text class="nickName">{{author}}</text>
         <view class="like" bindtap="likeWorks">
-            <image src="../../../static/image/liked.png" />
+            <image src="{{isLike? '../../../static/image/liked.png' : '../../../static/image/like.png'}}" />
             <text class="likeBtn">{{isLike ? '已' : ''}}点赞</text>
         </view>
         <view class="follow">

+ 10 - 3
project.config.json

@@ -36,7 +36,7 @@
 			"list": []
 		},
 		"miniprogram": {
-			"current": 7,
+			"current": 8,
 			"list": [
 				{
 					"id": 0,
@@ -81,10 +81,17 @@
 					"query": ""
 				},
 				{
-					"id": -1,
+					"id": 7,
 					"name": "作品页面",
 					"pathName": "pages/social/works/works",
-					"query": "id=1541489786444388&title=铺满色巴掌的水泥道"
+					"query": "id=1541683622900612&title=【课文1】秋天"
+				},
+				{
+					"id": 8,
+					"name": "测试的",
+					"pathName": "pages/social/works/works",
+					"query": "id=1541743536238348&title=【课文6】比尾巴",
+					"scene": "1012"
 				}
 			]
 		}

+ 56 - 49
utils/APIClient.js

@@ -37,7 +37,7 @@ module.exports = {
 		}).url(url).send();
 	},
 	// 获取全部课本
-	getAllBooks(pageNo,pageSize) {
+	getAllBooks(pageNo, pageSize) {
 		let url = getProductUrl('wx/product');
 		return request.getInstance().header({
 			uid: wx.getStorageSync('uid')
@@ -47,41 +47,41 @@ module.exports = {
 		}).send();
 	},
 	// 获取课本详情
-	getBookDetail(uid,id) {
+	getBookDetail(uid, id) {
 		let url = getProductUrl(`wx/product/${id}`);
 		return request.getInstance().header({
 			uid
 		}).url(url).send();
 	},
 	// 获取单课详情
-	getClassDetail(uid,id) {
+	getClassDetail(uid, id) {
 		let url = getProductUrl(`wx/lesson/${id}`);
 		return request.getInstance().header({
 			uid
 		}).url(url).send();
 	},
 	// 检查是否收藏过课程
-	classIsLike(uid,data){
+	classIsLike(uid, data) {
 		let url = getProductUrl(`wx/favorites/isLike`);
 		return request.getInstance().header({
 			uid
 		}).url(url).data(data).send();
 	},
-	getClassDetail(uid,id) {
+	getClassDetail(uid, id) {
 		let url = getProductUrl(`wx/lesson/${id}`);
 		return request.getInstance().header({
 			uid
 		}).url(url).send();
 	},
 	// 获取单课朗读信息
-	getClassRead(uid,data){
+	getClassRead(uid, data) {
 		let url = getBaseUrl(`wx/userRead`);
 		return request.getInstance().header({
 			uid
 		}).data(data).url(url).send();
 	},
 	// 作品播放了+1
-	playWorks(uid,readId){
+	playWorks(uid, readId) {
 		let url = getBaseUrl(`wx/userRead/play/${readId}`);
 		return request.getInstance().header({
 			uid
@@ -96,7 +96,7 @@ module.exports = {
 		}).url(url).data(data).method('POST').send();
 	},
 	// 点赞作品
-	likeWorks(uid,readId){
+	likeWorks(uid, readId) {
 		let url = getBaseUrl(`wx/userRead/like/${readId}`);
 		return request.getInstance().header({
 			uid
@@ -132,19 +132,19 @@ module.exports = {
 		}).send();
 	},
 	// 搜索
-	getSearchResult(uid,key,pageNo,pageSize){
+	getSearchResult(uid, key, pageNo, pageSize) {
 		let url = getProductUrl(`wx/lesson`);
 		return request.getInstance().header({
 			uid
 		}).url(url).data({
-			title:key,
+			title: key,
 			productId: '',
 			pageNo: pageNo,
 			pageSize: pageSize
 		}).send();
 	},
 	// 获取回复信息
-	getReply(uid, columnId, pageNo, pageSize){
+	getReply(uid, columnId, pageNo, pageSize) {
 		let url = getBaseUrl(`wx/posts/reply`);
 		return request.getInstance().header({
 			uid
@@ -155,56 +155,56 @@ module.exports = {
 		}).send();
 	},
 	// 获取回复(楼中楼)
-	getReplyComment(uid, postId){
+	getReplyComment(uid, postId) {
 		let url = getBaseUrl(`wx/posts/one/${postId}`);
 		return request.getInstance().header({
 			uid
 		}).url(url).send();
 	},
 	// 发布回复(楼中楼)
-	postReplyComment(uid, data){
+	postReplyComment(uid, data) {
 		let url = getBaseUrl(`wx/reply`);
 		return request.getInstance().header({
 			uid
 		}).url(url).data(data).method('POST').send();
 	},
 	// 点赞评论
-	likeCommend(uid,likeUid){
+	likeCommend(uid, likeUid) {
 		let url = getBaseUrl(`wx/posts/attribute/${likeUid}`);
 		return request.getInstance().header({
 			uid
 		}).url(url).method('GET').send();
 	},
 	// 发布讨论
-	postReply(uid, data){
+	postReply(uid, data) {
 		let url = getBaseUrl(`wx/posts`);
 		return request.getInstance().header({
 			uid
 		}).url(url).data(data).method('POST').send();
 	},
 	// 获取推荐团购信息
-	getGroupList () {
+	getGroupList() {
 		let url = getBaseUrl(`wx/groupPurchaseInfo/recommend`);
 		return request.getInstance().header({
 			uid: wx.getStorageSync('uid')
 		}).url(url).send();
 	},
 	// 获取课程团购信息
-	getGroupPurchaseInfo (productId) {
+	getGroupPurchaseInfo(productId) {
 		let url = getBaseUrl(`wx/groupPurchaseInfo/info/${productId}`);
 		return request.getInstance().header({
 			uid: wx.getStorageSync('uid')
 		}).url(url).send();
 	},
 	// 发起团购
-	SendGroupPurchas (data) {
+	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) {
+	JoinGroupPurchas(orderId) {
 		let url = getBaseUrl(`wx/groupPurchase/join`);
 		return request.getInstance().header({
 			uid: wx.getStorageSync('uid')
@@ -213,14 +213,14 @@ module.exports = {
 		}).method('POST').send();
 	},
 	// 收藏课程
-	collectClass(uid, data){
+	collectClass(uid, data) {
 		let url = getProductUrl(`wx/favorites`);
 		return request.getInstance().header({
 			uid
 		}).url(url).data(data).method('POST').send();
 	},
 	//我的团
-	getMygroup () {
+	getMygroup() {
 		let url = getBaseUrl(`wx/groupPurchase/my`);
 		return request.getInstance().header({
 			uid: wx.getStorageSync('uid')
@@ -230,51 +230,58 @@ module.exports = {
 		}).send();
 	},
 	//获取团购详情
-	getMygroupInfo (orderId) {
+	getMygroupInfo(orderId) {
 		let url = getBaseUrl(`wx/groupPurchase/info/${orderId}`);
 		return request.getInstance().header({
 			uid: wx.getStorageSync('uid')
 		}).url(url).send();
 	},
 	//团购是否成功
-	groupSuccess (orderId) {
+	groupSuccess(orderId) {
 		let url = getBaseUrl(`wx/groupPurchase/joinStatus`);
 		return request.getInstance().header({
 			uid: wx.getStorageSync('uid')
 		}).url(url).data({
 			orderId
 		}).send();
-	},	
+	},
 	// 发起奖励
-	rewardMoney(uid, data){
+	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();
+	// 修改资料
+	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();
 	}
 }