Rorschach vor 6 Jahren
Ursprung
Commit
172abd6723
39 geänderte Dateien mit 520 neuen und 388 gelöschten Zeilen
  1. 101 44
      component/group/group.js
  2. 5 0
      component/group/group.json
  3. 37 14
      component/group/group.wxml
  4. 11 2
      component/group/group.wxss
  5. 3 3
      component/hot/hot.wxml
  6. 6 1
      component/hot/hot.wxss
  7. 8 6
      component/my/my.wxml
  8. 12 7
      component/my/my.wxss
  9. 28 0
      component/myToast/myToast.js
  10. 3 0
      component/myToast/myToast.json
  11. 11 0
      component/myToast/myToast.wxml
  12. 60 0
      component/myToast/myToast.wxss
  13. 2 2
      component/popup/popup.wxml
  14. 1 1
      component/share/share.js
  15. 13 45
      pages/groupPage/collage-details/collage-details.js
  16. 61 81
      pages/groupPage/grade-details/grade-details.js
  17. 14 5
      pages/groupPage/grade-details/grade-details.wxml
  18. 29 58
      pages/groupPage/group-details/group-details.js
  19. 12 13
      pages/groupPage/group-details/group-details.wxml
  20. 5 3
      pages/groupPage/group-details/group-details.wxss
  21. 6 6
      pages/groupPage/make-money/make-money.js
  22. 16 43
      pages/groupPage/my-group/my-group.js
  23. 1 0
      pages/index/index.js
  24. 2 1
      pages/index/index.json
  25. 3 1
      pages/index/index.wxml
  26. 24 13
      pages/main/class/class.js
  27. 2 2
      pages/main/class/class.wxml
  28. 8 21
      pages/social/works/works.js
  29. 1 1
      pages/social/works/works.wxml
  30. 1 2
      pages/social/works/works.wxss
  31. 3 2
      pages/user/myWallet/myWallet.wxss
  32. BIN
      static/image/alert_icon.png
  33. BIN
      static/image/group_poster.jpg
  34. BIN
      static/image/works_poster.jpg
  35. BIN
      static/image/works_poster.png
  36. 1 1
      towxml/style/main.wxss
  37. 18 8
      utils/APIClient.js
  38. 10 0
      utils/WXHttpRequest.js
  39. 2 2
      utils/const.js

+ 101 - 44
component/group/group.js

@@ -11,36 +11,59 @@ export const groupInit = (that) => {
       isIPX: app.globalData.isIPX,
       timeList: [],
       listLength: '',
-      baseIndex: 0
-    }
+      baseIndex: 0,
+      isIOS: app.globalData.isIOS,
+      alertFlag: false
+    },
+    groupIndex: 1
   })
   //推荐团购
-  that.recommend = function (start, end) {
-    httpRequestApi.getGroupList().success( (res) => {
-      console.log('推荐团购',res.data.data)
-      that.data.groupData.listLength = res.data.data.length;
-      that.data.groupData.recommendList = res.data.data.slice(start, end);
-      that.data.groupData.recommendList.forEach( (item) => {
-        if(item.groupPurchaseOrder.closeTime - Date.parse(new Date()) < 0 ) {
-          that.data.groupData.timeList.push('时间到了,')
-        } else {
-          that.data.groupData.timeList.push(util.formatTime(item.groupPurchaseOrder.closeTime - Date.parse(new Date())).join(':'))
-        }
+  that.recommend = function (pageNo) {
+    httpRequestApi.getGroupList(pageNo).success((res) => {
+      // that.data.groupData.listLength = res.data.data.length;
+      // that.data.groupData.recommendList = res.data.data.slice(start, end);
+      // that.setData({
+      //   groupData: that.data.groupData
+      // })
+      // that.data.groupData.recommendList.forEach( (item) => {
+      //   if(item.groupPurchaseOrder.closeTime - Date.parse(new Date()) < 0 ) {
+      //     that.data.groupData.timeList.push('时间到了,')
+      //   } else {
+      //     that.data.groupData.timeList.push(util.formatTime(item.groupPurchaseOrder.closeTime - Date.parse(new Date())).join(':'))
+      //   }
+      // })
+      // that.setData({
+      //   groupData: that.data.groupData
+      // })
+      const recommendListTemp = [];
+      res.data.data.forEach(item => {
+        const temp = {};
+        temp.avatar = item.organizer.avatar;
+        temp.wechatName = item.organizer.wechatName;
+        temp.groupTitle = item.groupPurchaseOrder.groupTitle;
+        temp.headCount = item.groupPurchaseOrder.headcount;
+        temp.joinCount = item.groupPurchaseOrder.joinCount;
+        temp.lastTime = item.groupPurchaseOrder.closeTime - item.currentTime <= 0 ? '时间不足,' : util.formatTime(item.groupPurchaseOrder.closeTime - item.currentTime).join(':');
+        temp.id = item.groupPurchaseOrder.id;
+        // that.data.groupData.recommendList.push(temp);
+        recommendListTemp.push(temp);
       })
-      console.log('截取之后', that.data.groupData.recommendList)
+      const recommendListStr = "groupData.recommendList";
+      // const recommendListThreeStr = "groupData.recommendListThree";
       that.setData({
-        groupData: that.data.groupData
+        [recommendListStr]: recommendListTemp,
+        // [recommendListThreeStr]: that.data.groupData.recommendList.slice(that.data.groupData.baseIndex, that.data.groupData.baseIndex + 3),
+        // listLength: res.data.data.length
       })
-      //util.formatTime(groupOrder.closeTime - Date.parse(new Date()))
     }).fail((error) => {
-      console.log('错误',error)
+      console.log('错误', error)
     })
   }
 
   //请求数据封装
   that.getGroupList = function () {
     httpRequestApi.getAllBooks(1, 10).success((res) => {
-      console.log('全部课',res.data.data.list)
+      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 => {
@@ -50,28 +73,44 @@ export const groupInit = (that) => {
         groupData: that.data.groupData
       })
     }).fail((error) => {
-      console.log('错误',error)
+      console.log('错误', error)
     })
   }();
 
-  that.recommend(0, 3);
+  that.recommend(1);
 
   //点击换一换
   that.change = function () {
-    that.data.groupData.baseIndex++;
-    if(that.data.groupData.listLength <= 3 * (that.data.groupData.baseIndex)) {
-      that.data.groupData.baseIndex = 0;
-    }
-    that.setData({
-      groupData: that.data.groupData
-    })
-    that.recommend(3 * that.data.groupData.baseIndex, 3 * (that.data.groupData.baseIndex + 1));
+    // that.data.groupData.baseIndex++;
+    // if(that.data.groupData.listLength <= 3 * (that.data.groupData.baseIndex)) {
+    //   that.data.groupData.baseIndex = 0;
+    // }
+    // that.setData({
+    //   groupData: that.data.groupData
+    // })
+    // that.recommend(3 * that.data.groupData.baseIndex, 3 * (that.data.groupData.baseIndex + 1));
+
+    // if (that.data.groupData.baseIndex / 3 >= that.data.listLength / 3) {
+    //   that.data.groupData.baseIndex = 0
+    // }
+    // const recommendListThreeStr = "groupData.recommendListThree";
+    // const baseIndexStr = "groupData.baseIndex";
+    // this.setData({
+    //   [recommendListThreeStr]: that.data.groupData.recommendList.slice(that.data.groupData.baseIndex + 3, that.data.groupData.baseIndex + 6),
+    //   [baseIndexStr]: that.data.groupData.baseIndex + 3
+    // })
+    // console.log(that.data.groupData.baseIndex / 3);
+    // console.log(that.data.listLength / 3);
+    // if(that.groupIndex )
+    that.recommend(that.data.groupIndex++)
   }
   //点击跳转
-  that.more = function ({currentTarget}) {
-      wx.navigateTo({
-        url: `../main/books/books`
-      })
+  that.more = function ({
+    currentTarget
+  }) {
+    wx.navigateTo({
+      url: `../main/books/books`
+    })
   }
   //发起团购
   that.sendGroup = function () {
@@ -81,13 +120,15 @@ export const groupInit = (that) => {
     })
   }
   //选中团购课程
-  that.selectImg = function ({ currentTarget }) {
+  that.selectImg = function ({
+    currentTarget
+  }) {
     const ind = currentTarget.dataset.ind;
     //判断单选
     that.data.groupData.selectFlag.forEach((item, index) => {
-      if(index == ind) {
+      if (index == ind) {
         that.data.groupData.selectFlag[ind] = !that.data.groupData.selectFlag[ind];
-      }else {
+      } else {
         that.data.groupData.selectFlag[index] = true;
       }
     })
@@ -97,8 +138,8 @@ export const groupInit = (that) => {
   }
   //点击确定
   that.sure = function () {
-    that.data.groupData.selectFlag.forEach( (item ,index) => {
-      if(!item) {
+    that.data.groupData.selectFlag.forEach((item, index) => {
+      if (!item) {
         const productId = that.data.groupData.bookList[index].id;
         const title = that.data.groupData.bookList[index].title
         wx.navigateTo({
@@ -117,16 +158,32 @@ export const groupInit = (that) => {
       title: '我的团购'
     })
   }
+  // IOS提示不能参团
+  that.showAlert = function () {
+    let str = "groupData.alertFlag"
+    that.setData({
+      [str]: !that.data.groupData.alertFlag
+    })
+    console.log(that.data.groupData.alertFlag)
+  }
   //跳转到团购详情页
-  that.groupDetail = function ({currentTarget}) {
+  that.groupDetail = function ({
+    currentTarget
+  }) {
+    if (that.data.groupData.isIOS) {
+      that.showAlert();
+      return;
+    }
     const productId = currentTarget.dataset.productid;
     const id = currentTarget.dataset.id;
     const groupId = currentTarget.dataset.groupid;
     const ind = currentTarget.dataset.ind;
     const groupType = that.data.groupData.recommendList[ind].groupType;
-      wx.navigateTo({
-        url: `/pages/groupPage/group-details/group-details?productId=${productId}&id=${id}&groupId=${groupId}`
-      })
+    console.log(id)
+    wx.navigateTo({
+      // url: `/pages/groupPage/group-details/group-details?productId=${productId}&id=${id}&groupId=${groupId}`
+      url: `/pages/groupPage/group-details/group-details?productId=${id}`
+    })
     // if(groupType === "PROMOTION") {
     //   wx.navigateTo({
     //     url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${id}&groupId=${groupId}`
@@ -139,13 +196,13 @@ export const groupInit = (that) => {
 
   }
   //跳转到课程详情
-  that.goToBook = function(e){
+  that.goToBook = function (e) {
     console.log(e.currentTarget.dataset)
     let id = e.currentTarget.dataset.id;
     let title = e.currentTarget.dataset.title;
     console.log(id)
     wx.navigateTo({
-        url: `/pages/groupPage/grade-details/grade-details?productId=${id}&title=${title}`
-      })
+      url: `/pages/groupPage/grade-details/grade-details?productId=${id}&title=${title}`
+    })
   }
 }

+ 5 - 0
component/group/group.json

@@ -0,0 +1,5 @@
+{
+    "usingComponents": {
+        "MyToast": "../../component/myToast/myToast"
+    }
+  }

+ 37 - 14
component/group/group.wxml

@@ -2,7 +2,7 @@
   <view class="group">
     <scroll-view scroll-y="{{true}}">
       <view class="group-container">
-        <block wx:for="{{groupData.recommendList}}" wx:key="{{index}}">
+        <!-- <block wx:for="{{groupData.recommendList}}" wx:key="{{index}}">
           <view class="group-bars">
             <view class="group-head">
               <image src="{{item.organizer.avatar}}"></image>
@@ -13,12 +13,35 @@
                 <text>{{item.groupPurchaseOrder.groupTitle}}</text>
                 <text>{{item.groupPurchaseOrder.headcount}}人团</text>
               </view>
-              <view class="group-detail">
+              <view class="group-detail {{groupData.isIOS ? 'specialBorder' : ''}}">
                 <view class="number">
                   <text>还剩{{item.groupPurchaseOrder.headcount - item.groupPurchaseOrder.joinCount}}人成团</text>
                   <text>剩余{{groupData.timeList[index]}}结束</text>
                 </view>
-                <view class="jion-btn" bindtap="groupDetail" data-ind="{{index}}" data-id="{{item.groupPurchaseOrder.id}}" data-productId="{{item.groupPurchaseOrder.productId}}" data-groupId="{{item.groupPurchaseOrder.groupId}}">
+                <view class="jion-btn {{groupData.isIOS ? 'specialBtn' : ''}}" bindtap="groupDetail" data-ind="{{index}}" data-id="{{item.groupPurchaseOrder.id}}" data-productId="{{item.groupPurchaseOrder.productId}}" data-groupId="{{item.groupPurchaseOrder.groupId}}">
+                  去参团
+                </view>
+              </view>
+            </view>
+          </view>
+        </block> -->
+        <block wx:for="{{groupData.recommendList}}" wx:key="{{index}}">
+          <view class="group-bars">
+            <view class="group-head">
+              <image src="{{item.avatar}}"></image>
+              <text>{{item.wechatName}}</text>
+            </view>
+            <view class="group-jion">
+              <view class="top-title">
+                <text>{{item.groupTitle}}</text>
+                <text>{{item.headCount}}人团</text>
+              </view>
+              <view class="group-detail {{groupData.isIOS ? 'specialBorder' : ''}}">
+                <view class="number">
+                  <text>还剩{{item.headCount - item.joinCount}}人成团</text>
+                  <text>剩余{{item.lastTime}}结束</text>
+                </view>
+                <view class="jion-btn {{groupData.isIOS ? 'specialBtn' : ''}}" bindtap="groupDetail" data-ind="{{index}}" data-id="{{item.id}}" >
                   去参团
                 </view>
               </view>
@@ -30,22 +53,22 @@
       <view class="title">
         <image class="ren" src="../../static/groupImg/Shape3.png" style="width: 30rpx; height: 38rpx;"></image>
         <text class="left">全部课程</text>
-        <view class="right" bindtap="more" data-type="course">更多
+        <view class="right" bindtap="more" data-type="course">
+          更多
           <image src="../../static/image/to.png" />
         </view>
       </view>
       <view class="whole-group">
-          <view class="group-box"> 
-            <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">{{item.subTitle}}</view>
-              </view>
-            </block>          
-          </view>
+        <view class="group-box">
+          <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">{{item.subTitle}}</view>
+            </view>
+          </block>
         </view>
+      </view>
     </scroll-view>
-   
   </view>
-
+  <MyToast bindShowAlert="showAlert" wx:if="{{groupData.alertFlag}}"  />
 </template>

+ 11 - 2
component/group/group.wxss

@@ -49,6 +49,11 @@ scroll-view {
 .group-head text {
     font-size: 32rpx;
     margin-top: 12rpx;
+    width: 150rpx;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    text-align: center;
 }
 
 .group-jion {
@@ -71,7 +76,9 @@ scroll-view {
     overflow: hidden;
     margin-top: 26rpx;
 }
-
+.group-jion .specialBorder{
+    border: 4rpx solid #C6C6C6;
+}
 .group-jion .group-detail .number {
     display: flex;
     flex-direction: column;
@@ -92,7 +99,9 @@ scroll-view {
     font-size: 36rpx;
     line-height: 100%;
 }
-
+.group-jion .group-detail .specialBtn{
+    background: #C6C6C6
+}
 .change {
     width: 146rpx;
     height: 48rpx;

+ 3 - 3
component/hot/hot.wxml

@@ -49,7 +49,7 @@
             <view wx:for="{{hotData.hotWorks}}" wx:key="{{index}}" class="worksCard" bindtap="openWorks" data-readId="{{item.classId}}" data-title="{{item.title}}">
                 <view class="topData">
                     <view class="worksLeft">
-                        <image class="authorAvatar" src="{{item.avatar}}" />
+                        <image class="authorAvatar" lazy-load="true" src="{{item.avatar}}" />
                         <view class="worksInfo">
                             <view class="authorName">{{item.nickName}}</view>
                             <view class="time">{{item.time}}</view>
@@ -58,11 +58,11 @@
                     <view class="numberInfo">
                         <view class="wareCardPlays">
                             <text>{{item.plays}}</text>
-                            <image class="wareCardPlaysImg" src="../../static/image/hotPlays.png" />
+                            <image class="wareCardPlaysImg" lazy-load="true" src="../../static/image/hotPlays.png" />
                         </view>
                         <view class="wareCardLikes">
                             <text>{{item.likes}}</text>
-                            <image class="wareCardLikesImg" src="../../static/image/like.png" />
+                            <image class="wareCardLikesImg" lazy-load="true" src="../../static/image/like.png" />
                         </view>
                     </view>
                 </view>

+ 6 - 1
component/hot/hot.wxss

@@ -57,8 +57,13 @@ swiper {
     font-size: 32rpx;
     color: #41bb32;
     font-family: PingFangSC-regular;
-    width: 128rpx;
+    width: 135rpx;
+    text-align: center;
     margin-left: 56rpx;
+    background:#F0F1F5;
+    height: 56rpx;
+    line-height: 56rpx;
+    border-radius: 10rpx;
 }
 
 .hotSection {

+ 8 - 6
component/my/my.wxml

@@ -1,4 +1,4 @@
-<wxs src="../../pages/commonWxs/format.wxs" module="format"/>
+<wxs src="../../pages/commonWxs/format.wxs" module="format" />
 <template name="my">
   <view class='mine-container'>
     <view class='follow-details'>
@@ -25,9 +25,9 @@
             <view class='avatar-address'>{{ myData.user.user.schoolName }}</view>
           </view>
           <view class='mine-edit' bindtap='toMyEdit' data-title='{{ myData.title }}'>
-            <view class='edit-image'>
-              <image class='edit-img' src='../../static/image/reset.png'></image>
-            </view>
+            <!-- <view class='edit-image'> -->
+            <image class='edit-img' src='../../static/image/reset.png'></image>
+            <!-- </view> -->
             <view class='edit-text'>修改</view>
           </view>
         </view>
@@ -70,7 +70,8 @@
           </view>
         </view>
       </view>
-      <view class='wallet-module' bindtap='toMyWallet' data-title='{{ myData.wallet }}' wx:if="{{!myData.isIOS}}">
+      <!-- <view class='wallet-module' bindtap='toMyWallet' data-title='{{ myData.wallet }}' wx:if="{{!myData.isIOS}}"> -->
+      <view class='wallet-module' bindtap='toMyWallet' data-title='{{ myData.wallet }}'>
         <view class='wallet-center'>
           <view class='wallet-left'>
             <view class='icon-box'>
@@ -96,7 +97,8 @@
           </view>
         </view>
       </view>
-      <view class='group-module' bindtap='toMyCollage' data-title='{{ myData.collage }}' wx:if="{{!myData.isIOS}}">
+      <!-- <view class='group-module' bindtap='toMyCollage' data-title='{{ myData.collage }}' wx:if="{{!myData.isIOS}}"> -->
+      <view class='group-module' bindtap='toMyCollage' data-title='{{ myData.collage }}'>
         <view class='wallet-center'>
           <view class='wallet-left'>
             <view class='icon-box'>

+ 12 - 7
component/my/my.wxss

@@ -202,28 +202,33 @@ image{
   border-radius: 26rpx;
   background: #FF9209;
   box-sizing: border-box;
-  padding-top: 3rpx;
+  align-items:center;
   display: flex;
 }
 
-.edit-image{
+/* .edit-image{
   width: 24rpx;
   height: 34rpx;
   margin-left: 24rpx;
   margin-right: 10rpx;
-}
+} */
 
 .edit-img{
-  width: 24rpx;
-  height: 34rpx;
+width:42rpx;
+height:34rpx;
+display:block;
+margin-left:20rpx;
+margin-right:10rpx;
+
+
 }
 
 .edit-text{
   width: 150rpx;
-  height: 32rpx;
+  /* height: 32rpx; */
   color: #FFFFFF;
   font-size: 32rpx;
-  line-height:46rpx;
+  /* line-height:46rpx; */
 }
 
 .wallet-module{

+ 28 - 0
component/myToast/myToast.js

@@ -0,0 +1,28 @@
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+      flag: {
+        type: "Boolean",
+        value: false
+      },
+    },
+  
+    /**
+     * 组件的初始数据
+     */
+    data: {
+      flag: true,
+    },
+  
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+      close: function () {
+        console.log(1111111111111111111111111)
+        this.triggerEvent('ShowAlert', {})
+      },
+    }
+  })

+ 3 - 0
component/myToast/myToast.json

@@ -0,0 +1,3 @@
+{
+    "component": true
+  }

+ 11 - 0
component/myToast/myToast.wxml

@@ -0,0 +1,11 @@
+<view class="myToast" bindtap="close" >
+    <view class="toastBox">
+        <view class="line1">
+            <image class="myToastIcon" src="../../static/image/alert_icon.png" />
+            <text class="line1Text">规范规定,IOS此功能暂不可用</text>
+        </view>
+        <view class="line2">
+            <text class="line2Text">您可以免费开团,成团后获得使用权</text>
+        </view>
+    </view>
+</view>

+ 60 - 0
component/myToast/myToast.wxss

@@ -0,0 +1,60 @@
+.myToast {
+    width: 100%;
+    height: 100%;
+    background: rgba(37, 37, 37, .6);
+    position: absolute;
+    top: 0;
+    left: 0;
+
+}
+
+.toastBox {
+    width: 600rpx;
+    height: 274rpx;
+    border-radius: 8rpx;
+    background: #fff;
+    position: absolute;
+    left: 0;
+    right: 0;
+    margin: auto;
+    top: 0;
+    bottom: 0;
+    padding: 86rpx 0 0 80rpx;
+    box-sizing: border-box;
+
+}
+
+.line1 {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    margin: 0 auto 20rpx;
+}
+
+.line2 {
+    margin: 0 auto;
+}
+
+.myToastIcon {
+    width: 26rpx;
+    height: 26rpx;
+    margin-right: 10rpx;
+}
+
+.line1Text {
+    height: 40rpx;
+    font-size: 28rpx;
+    font-family: PingFangSC-Regular;
+    font-weight: 400;
+    color: rgba(37, 37, 37, 1);
+    line-height: 40rpx;
+}
+
+.line2Text {
+    height: 40rpx;
+    font-size: 28rpx;
+    font-family: PingFangSC-Regular;
+    font-weight: 400;
+    color: rgba(37, 37, 37, 1);
+    line-height: 40rpx;
+}

+ 2 - 2
component/popup/popup.wxml

@@ -48,11 +48,11 @@
     <!--发起拼团成功 -->
     <view class="popup-container"  wx:if="{{typeOf == 'sendSuccess' ? true : false}}">
         <view class="content">
-            <text style="color: #F66C1C; font-weight: bolder;">{{title}}</text>
+            <text style="color: #F66C1C; font-weight: bolder; margin-top: 20rpx;">{{title}}</text>
             <text style="font-size: 28rpx">{{headTextOne}}</text>
             <text style="font-size: 28rpx">{{headTextTwo}}</text>
         </view>
-        <view class="content" style="margin-top: 30rpx; font-size:28rpx;">
+        <view class="content" style="margin-top: 15rpx; font-size:28rpx;">
             <block wx:for="{{content}}" wx:key="{{index}}">
                 <text style="color: {{item.color}};">{{item.text}}</text>
             </block>

+ 1 - 1
component/share/share.js

@@ -245,7 +245,7 @@ Component({
           mask: true
         })
         if (this.data.shareType === 'works') {
-          ctx.drawImage('../../../static/image/works_poster.png', 0, 0, 1500, 2668,0,0,750,1334); //插入图片  
+          ctx.drawImage('../../../static/image/works_poster.jpg', 0, 0, 1500, 2668,0,0,750,1334); //插入图片  
         } else {
           ctx.drawImage('../../../static/image/group_poster.jpg', 0, 0, 1500, 2668,0,0,750,1334); //插入图片  
         }

+ 13 - 45
pages/groupPage/collage-details/collage-details.js

@@ -18,15 +18,19 @@ Page({
     orderId: '',
     groupId: '',
     content: [{
-        text: "转发给自己的朋友们,分享好课,",
+        text: "转发给自己的朋友们",
         color: "#000"
       },
       {
-        text: " 追随您一起学习进步。您的魅力不是吹的!",
+        text: " 分享好课,追随您一起学习进步",
         color: "#000"
       },
       {
-        text: "在限定时间内内成功拼团,您将得到xx元的奖励金哦。",
+        text: " 您的魅力不是吹的",
+        color: "#000"
+      },
+      {
+        text: "在限定时间内成功拼团,您将得到奖学金。",
         color: "#FF4600"
       }
     ],
@@ -62,12 +66,12 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    if (app.globalData.isIOS) {
-      wx.redirectTo({
-        url: '../../index/index'
-      })
-      return 
-    }
+    // if (app.globalData.isIOS) {
+    //   wx.redirectTo({
+    //     url: '../../index/index'
+    //   })
+    //   return 
+    // }
     if (options.read) {
       this.setData({
         read: options.read
@@ -135,42 +139,6 @@ Page({
     this.shareDialog = this.selectComponent("#share-dialog");
 
   },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
   /**
    * 用户点击右上角分享
    */

+ 61 - 81
pages/groupPage/grade-details/grade-details.js

@@ -45,16 +45,18 @@ Page({
     currentTarget
   }) {
     const productId = this.data.productId;
-    const groupId =  currentTarget.dataset.id;
+    const groupId = currentTarget.dataset.id;
+    const osType = this.data.isIOS ? 'IOS' : 'ANDROID';
     //开始发起团购
     httpRequestApi.SendGroupPurchas({
       productId,
-      groupId
+      groupId,
+      osType
     }).success((res) => {
       console.log('发起团购', res);
-      // wx.navigateTo({
-      //   url: `/pages/groupPage/collage-details/collage-details`
-      // })
+      this.setData({
+        orderId: res.data.data.groupPurchaseOrder.id
+      })
       if (res.data.message) {
         wx.showModal({
           title: '提示',
@@ -69,12 +71,13 @@ Page({
         })
         return false;
       }
-      this.data.content[2].text = res.data.data.groupPurchaseOrder.organizerPrice === 0 ? '' : `在限定时间内内成功拼团,您将得到${res.data.data.groupPurchaseOrder.organizerPrice}元的奖励金哦。`
-      this.setData({
-        content: this.data.content
-      })
+      // 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') {
+      if (res.data.data.groupPurchaseOrder.groupType === 'PROMOTION') {
+        let that = this;
         wx.showModal({
           title: '重新发起团购',
           content: '您会获得奖励哦',
@@ -83,17 +86,35 @@ Page({
             that.popup.close();
             if (res.data.data.groupPurchaseOrder.headCount !== 1) {
               setTimeout(() => {
-                wx.navigateTo({
+                wx.redirectTo({
                   url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${res.data.data.groupPurchaseOrder.id}&groupId=${groupId}`
                 })
                 wx.setNavigationBarTitle({
                   title: '拼团详情'
                 })
-              }, 3000)
+              }, 1800)
             }
 
           }
         })
+      } else if (this.data.isIOS) {
+        let that = this;
+        wx.showModal({
+          title: '提示',
+          content: '开团成功',
+          success(res) {
+            console.log(res)
+            that.popup.close();
+            setTimeout(() => {
+              wx.navigateTo({
+                url: `/pages/groupPage/collage-details/collage-details?orderId=${that.data.orderId}`
+              })
+              wx.setNavigationBarTitle({
+                title: '拼团详情'
+              })
+            }, 1800)
+          }
+        })
       } else {
         //掉起支付
         this.prePayMap(res.data.data.prePayMap, res.data.data.groupPurchaseOrder.id, res.data.data.groupPurchaseOrder.headCount);
@@ -116,7 +137,7 @@ Page({
       'signType': 'MD5',
       'paySign': prePayMap.sign,
       'success': function (res) {
-        console.log('支付成功',res)
+        console.log('支付成功', res)
         wx.showModal({
           title: '提示',
           content: '支付成功',
@@ -131,7 +152,7 @@ Page({
                 wx.setNavigationBarTitle({
                   title: '拼团详情'
                 })
-              }, 3000)
+              }, 1800)
             }
 
           }
@@ -149,28 +170,35 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    // if (app.globalData.isIOS) {
-    //   wx.redirectTo({
-    //     url: '../../index/index'
-    //   })
-    //   return 
-    // }
     console.log(options)
-    if(options.share){
+    if (options.share) {
       this.setData({
         share: options.share
       })
     }
-  
-    // wx.setNavigationBarTitle({
-    //   title: options.title
-    // })
-    const productId = options.productId;
-    if (productId) {
+    // const productId = options.productId;
+    this.getBookInfo(options.productId);
+    this.areYouBookSuper(options.productId)
+    this.getGroupInfo(options.productId)
+    // if (productId) {
+    this.setData({
+      productId: options.productId
+    })
+    // }
+
+  },
+  // 课本鉴权
+  areYouBookSuper: function (productId) {
+    const productArr = [];
+    productArr.push(productId);
+    httpRequestApi.areYouSuper(productArr).success(res => {
+      console.log(res)
       this.setData({
-        productId
+        imSuper: res.data.data
       })
-    }
+    })
+  },
+  getBookInfo: function (productId) {
     //课本详情
     httpRequestApi.getBookDetail(wx.getStorageSync('uid'), productId).success((res) => {
       console.log('课本详情', res.data.data);
@@ -184,10 +212,6 @@ Page({
         'markdown',
         this
       )
-      // data.theme = 'light';
-      // this.setData({
-      //   article: data
-      // })
       this.setData({
         titleIcon: bookInfo.bgImg,
         title: bookInfo.title,
@@ -205,17 +229,15 @@ Page({
       this.setData({
         lessonList: lessonTemp
       });
-    }).fail((error) => {
-
     })
-    //支付详情
+  },
+  getGroupInfo: function (productId) {
+    //团购内容
     httpRequestApi.getGroupPurchaseInfo(productId).success((res) => {
-      console.log('支付详情', res.data.data);
+      console.log(res)
       this.setData({
         payList: res.data.data
       })
-    }).fail((error) => {
-
     })
   },
   goToClass: function (e) {
@@ -231,47 +253,5 @@ Page({
   onReady: function () {
     //获取弹窗组件
     this.popup = this.selectComponent("#popup");
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
   }
 })

+ 14 - 5
pages/groupPage/grade-details/grade-details.wxml

@@ -25,7 +25,7 @@
             <template is="entry" data="{{...article}}" />
         </view>
     </scroll-view>
-    <view class="group-btn {{isIPX ? 'bottomx' :''}}" wx:if="{{isIOS? false : !share}}">
+    <view class="group-btn" wx:if="{{!imSuper? !isIOS : null}}">
         <image class="bg1" src="../../../static/groupImg/baise.png"></image>
         <image class="bg2" src="../../../static/groupImg/baise.png"></image>      
         <block wx:for="{{payList}}" wx:key="{{index}}">
@@ -35,10 +35,19 @@
             </view>
         </block>
     </view>
-    <view class="group-btn {{isIPX ? 'bottomx' :''}}" wx:if="{{isIOS? false : share}}">
-        <image class="bg1" src="../../../static/groupImg/baise.png" style="left: 50%"></image>   
+    <view class="group-btn" wx:if="{{!imSuper? isIOS : null}}">
+        <image class="bg1" src="../../../static/groupImg/baise.png" style="left: 50%"></image>
         <block wx:for="{{payList}}" wx:key="{{index}}">
-            <view class="Price" bindtap="pay" data-id="{{item.id}}" wx:if="{{share ? (index != 0) : true }}">
+            <view class="Price" bindtap="pay" data-id="{{item.id}}" wx:if="{{share ? (index != 0) : item.headcount === 1 ? false : true }}">
+                <text>{{item.price / 100}}元/{{item.headcount - 1}}人帮忙</text>
+                <text style="fontSize: 28rpx">免费开团</text>
+            </view>
+        </block>
+    </view>
+    <view class="group-btn" wx:if="{{imSuper}}">
+        <image class="bg1" style="left: 50%" src="../../../static/groupImg/baise.png" ></image>   
+        <block wx:for="{{payList}}" wx:key="{{index}}">
+            <view class="Price" bindtap="pay" data-id="{{item.id}}" wx:if="{{imSuper ? (index != 0) : true }}">
                 <view>继续开团 赚奖学金</view>
                 <view>
                     <text>{{item.headcount}}人团</text>
@@ -47,4 +56,4 @@
         </block>
     </view>
 </view>
-<popup id="popup" typeOf="sendSuccess" title="报告团长" headTextOne="您发起的团购已经成立" headTextTwo="订单号:{{groupPurchaseOrder.id}}" content="{{content}}"></popup>
+<popup id="popup" typeOf="sendSuccess" title="报告团长" headTextOne="您发起的团购已经成立" headTextTwo="订单号:{{orderId}}" content="{{content}}"></popup>

+ 29 - 58
pages/groupPage/group-details/group-details.js

@@ -90,45 +90,6 @@ Page({
     })
 
   },
-  //开团
-  // openGroup: function (productId) {
-  //   //const productId = this.data.productId;
-  //   const groupId = this.data.groupId;
-  //   //开始发起团购
-  //   httpRequestApi.SendGroupPurchas({
-  //     productId,
-  //     groupId
-  //   }).success((res) => {
-  //     console.log('发起团购', res);
-  //     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;
-  //     }
-
-  //     if (res.data.data.groupPurchaseOrder.groupType === 'BASE') {
-  //       debugger;
-  //       //掉起支付
-  //       this.prePayMap(res.data.data.prePayMap, 'create');
-  //     }else {
-  //       wx.navigateTo({
-  //         url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${res.data.data.groupPurchaseOrder.id}&groupId=${groupId}`
-  //       })
-  //     }
-
-  //   }).fail((error) => {
-
-  //   })
-  // },
   //参团
   jionGroup: function () {
     const orderId = this.data.orderId;
@@ -185,7 +146,7 @@ Page({
               console.log(that.data.orderId)
               that.jionSuccess(that.data.orderId, type1);
               // that.groupSuccess(orderId, detailId);
-            }, 2000)
+            }, 800)
           }
         })
 
@@ -204,7 +165,13 @@ Page({
       if (this.data.article === '') {
         this.getBooksInfo(res.data.data.groupPurchaseOrder.productId)
       }
-
+      // 分享进来的并且团购失效 就跳转到详情页面
+      if(this.data.goBackHome && (surplusNum ===0 || !stillGoing) ){
+        console.log(' productID>>>>>>>>>>>>>>>>'+ res.data.data.groupPurchaseOrder.productId)
+        wx.navigateTo({
+          url: `/pages/groupPage/grade-details/grade-details?productId=${res.data.data.groupPurchaseOrder.productId}`
+        })
+      }
       this.setData({
         organizer: groupOrder.organizer,
       })
@@ -228,14 +195,20 @@ Page({
 
       console.log(groupOrder.closeTime - groupOrder.gmtModified)
       //时间转换
-      let timeNow = new Date()
+  
       // const timeList = util.formatTime(groupOrder.closeTime - groupOrder.gmtModified);
-      const timeList = util.formatTime(groupOrder.closeTime - Date.parse(new Date()));
+      let timeList = [];
+      const stillGoing = groupOrder.closeTime - Date.parse(new Date()) <= 0 ? false : true
+      if(stillGoing){
+        timeList = util.formatTime(groupOrder.closeTime - Date.parse(new Date()));
+      }
+      console.log(stillGoing)
       this.setData({
         surplusNum,
         joinUserList: res.data.data.joinUserList,
         surplusList: this.data.surplusList,
         timeList,
+        stillGoing
       })
       if (groupOrder.groupType === 'PROMOTION') {
         //this.data.joinUserList.unshift(res.data.data.organizer);
@@ -249,8 +222,7 @@ Page({
           surplusNum: this.data.surplusNum
         })
       }
-      console.log(this.data.joinUserList)
-      // this.groupSuccess(res.data.data.groupPurchaseOrder.productId, detailId);
+      
     }).fail(error => {
       console.log('错误', error)
     })
@@ -277,6 +249,7 @@ Page({
             color: "#F97800"
           }
         ],
+        btnContent: '再接再厉 赚奖学金'
       }, () => {
         this.popup.close()
       })
@@ -303,6 +276,7 @@ Page({
             color: "#F97800"
           }
         ],
+        btnContent: '我也试试 赚奖学金'
       }, () => {
         this.popup.close()
       })
@@ -311,13 +285,13 @@ Page({
   // 去详情页面
   goToDetail: function (detailId) {
     setTimeout(() => {
-      wx.navigateTo({
+      wx.redirectTo({
         url: `/pages/groupPage/collage-details/collage-details?orderId=${detailId}`
       })
       wx.setNavigationBarTitle({
         title: '拼团详情'
       })
-    }, 3000)
+    }, 1000)
   },
   //跳到课程
   goToClass: function (e) {
@@ -330,8 +304,11 @@ Page({
 
   //再次发起团
   group: function () {
-    const orderId = this.data.orderId;
-    this.goToDetail(orderId);
+    // const orderId = this.data.orderId;
+    // this.goToDetail(orderId);
+    wx.navigateTo({
+      url: `/pages/groupPage/grade-details/grade-details?productId=${this.data.productId}`
+    })
     //拼团是否成功并弹窗
     // httpRequestApi.groupSuccess(orderId).success(res => {
     //   console.log('团购是否成功', res.data.data)
@@ -364,24 +341,18 @@ Page({
       title: '拼团详情'
     })
     console.log(options)
-
-
-    // if (oprions.shareId) {
-    //   const orderId = options.shareId
-    // }
     if (options.orderId) {
-      // const productId = options.productId;
-      // const groupId = options.groupId;
       const orderId = options.id;
       this.setData({
-        // productId,
-        // groupId,
         orderId
       })
       this.jionSuccess(orderId);
     } else {
       // 从分享页面进入的
       const orderId = options.productId ? options.productId : options.scene ? options.scene.replace('QR', '') : options.shareId;
+      this.setData({
+        orderId
+      })
       this.jionSuccess(orderId);
     }
     if (options.scene || options.shareId) {

+ 12 - 13
pages/groupPage/group-details/group-details.wxml

@@ -16,25 +16,23 @@
         </view>
         <view class="shengyu">
             <view class="shengyu-num" wx:if="{{colonelName}}">团长{{colonelName}}发起团购</view>
-            <view class="shengyu-num" hidden="{{surplusNum == '0'}}">仅剩<text>{{surplusNum}}</text>个名额就拼团成功了</view>
+            <view class="shengyu-num" hidden="{{surplusNum == '0' || !stillGoing}}">仅剩<text>{{surplusNum}}</text>个名额就拼团成功了</view>
+            <view class="shengyu-num" hidden="{{stillGoing}}">团购已超过时限</view>
             <view class="shengyu-num" hidden="{{surplusNum != '0'}}">拼团成功!快去朗读吧</view>
-            <view class="shengyu-time" hidden="{{surplusNum == '0'}}">
+            <view class="shengyu-time" hidden="{{!stillGoing}}">
                 剩余时间:
                 <view class="time">
-                    <!-- <image src="../../../static/groupImg/Rectangle_31.png"></image> -->
                     <text>{{timeList[0]}}</text>
                 </view>
                 <block wx:for="{{timeList[1]}}" wx:key="{{index}}">
                     <view class="time">
-                        <!-- <image src="../../../static/groupImg/Rectangle_31.png"></image> -->
                         <text>{{item}}</text>
                     </view>
                 </block>
                 <block wx:for="{{timeList[2]}}" wx:key="{{index}}">
                     <view class="time">
-                        <!-- <image src="../../../static/groupImg/Rectangle_31.png"></image> -->
                         <text>{{item}}</text>
                     </view>
                 </block>                
@@ -55,8 +53,7 @@
             <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>
                 <view class="right">
-                    <!-- <image src="../../../static/image/play.png"></image>
-                    <text>{{item.readNum}}</text> -->
+            
                     <image  src="../../../static/image/to.png"></image>
                 </view>
             </view>           
@@ -66,12 +63,8 @@
             <template is="entry" data="{{...article}}" />
         </view>
     </scroll-view>
-    <view class="group-details-btn {{isIPX ? 'bottomx' :''}}" hidden="{{surplusNum == '0'}}">
-        <!--
-        <view class="left-btn" bindtap="openGroup">
-            开团
-        </view>
-        -->
+    <!-- 底部按钮 -->
+    <view class="group-details-btn" hidden="{{surplusNum == '0' || !stillGoing }}">
         <view class="left-btn" bindtap="sendGroup">
             开团
         </view>
@@ -79,6 +72,11 @@
             参团
         </view>
     </view>
+    <view class="group-details-btn" hidden="{{stillGoing }}">
+        <view class="only-one-btn" bindtap="sendGroup">
+            重新开团
+        </view>
+    </view>
 </view>
 
 <view class="group-popup" bindtap="sendGroup" hidden="{{sendGroupFlag}}">
@@ -106,6 +104,7 @@
     title="{{titles}}"
     headTextOne="{{headTextOne}}"
     headTextTwo="{{headTextTwo}}"
+    btnContent="{{btnContent}}"
     content="{{content}}"
     bindGroup="group"
 ></popup>

+ 5 - 3
pages/groupPage/group-details/group-details.wxss

@@ -31,8 +31,8 @@
 
 .headImg-item {
     position: relative;
-    width: 106rpx;
-    height: 106rpx;
+    width:104rpx;
+height:104rpx;
     border-radius: 50%;
     margin: 20rpx 22rpx;
 }
@@ -219,7 +219,9 @@ scroll-view {
 }
 
 .left-btn,
-.right-btn {
+.right-btn,
+.only-one-btn
+{
     flex: 1;
     height: 54rpx;
     display: flex;

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

@@ -38,12 +38,12 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    if (app.globalData.isIOS) {
-      wx.redirectTo({
-        url: '../../index/index'
-      })
-      return 
-    }
+    // if (app.globalData.isIOS) {
+    //   wx.redirectTo({
+    //     url: '../../index/index'
+    //   })
+    //   return 
+    // }
     wx.setNavigationBarTitle({
       title: '邀请赚取奖学金'
     })

+ 16 - 43
pages/groupPage/my-group/my-group.js

@@ -58,12 +58,12 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (option) {
-    if (app.globalData.isIOS) {
-      wx.redirectTo({
-        url: '../../index/index'
-      })
-      return 
-    }
+    // if (app.globalData.isIOS) {
+    //   wx.redirectTo({
+    //     url: '../../index/index'
+    //   })
+    //   return 
+    // }
     if (option && option.title) {
       wx.setNavigationBarTitle({
         title: option.title//页面标题为路由参数
@@ -72,10 +72,19 @@ Page({
         title: option.title
       });
     }
+    this.getMyGroup();
+  },
+  // 获取我的拼团
+  getMyGroup: function(){
     httpRequestApi.getMygroup().success((res) => {
       if(!res.data.data.list){
         return
       }
+      this.setData({
+        myGroupList: [],
+        myGroupList: [],
+        timeList: []
+      });
       console.log('我的团', res.data.data.list)
       res.data.data.list.forEach(element => {
         if(element.groupPurchaseOrder.status == 'SUCCESSED') {
@@ -182,7 +191,7 @@ Page({
       wx.navigateTo({
         url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${res.data.data.groupPurchaseOrder.id}&groupId=${groupId}`
       })
-      this.close();
+      // this.getMygroup();
     }).fail((error) => {
 
     })  
@@ -194,42 +203,6 @@ Page({
   onReady: function () {
     this.popup = this.selectComponent("#popup");
   },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
   /**
    * 用户点击右上角分享
    */

+ 1 - 0
pages/index/index.js

@@ -71,6 +71,7 @@ Page({
   switcher: function ({
     currentTarget
   }) {
+    if(currentTarget.dataset.index === this.data.myIndex) return;
     this.updateData(currentTarget.dataset.index);
   },
   // 根据index 更新template

+ 2 - 1
pages/index/index.json

@@ -1,6 +1,7 @@
 {
     "usingComponents": {
-        "Dialog": "../../component/dialog/dialog"
+        "Dialog": "../../component/dialog/dialog",
+        "MyToast": "../../component/myToast/myToast"
     },
     "window": {
         "onReachBottomDistance": 50

+ 3 - 1
pages/index/index.wxml

@@ -10,7 +10,8 @@
   <!-- 顶部导航 -->
   <view class="top-tab">
     <block wx:for="{{tab}}" wx:key="{{index}}">
-      <view class="tabbar {{index == myIndex ? 'select':' '}}" bindtap="switcher" data-index="{{index}}" wx:if="{{isIOS ? index === 0?  false : true : true}}">
+      <!-- <view class="tabbar {{index == myIndex ? 'select':' '}}" bindtap="switcher" data-index="{{index}}" wx:if="{{isIOS ? index === 0?  false : true : true}}"> -->
+      <view class="tabbar {{index == myIndex ? 'select':' '}}" bindtap="switcher" data-index="{{index}}">
         <text>{{item.name}}</text>
       </view>
     </block>
@@ -25,6 +26,7 @@
     <template is="{{templates}}" data="{{myData: myData}}"></template>
   </view> -->
 </view>
+ <!-- <MyToast /> -->
 <view hidden="{{hide}}">
   <Dialog bindmyevent="jurisdiction" />
 </view>

+ 24 - 13
pages/main/class/class.js

@@ -18,7 +18,8 @@ Page({
     pageNo: 1,
     totalNo: 0,
     collectFlag: false,
-    goBackHome: false
+    goBackHome: false,
+    lazyVideoUrl: ''
   },
   onLoad: function (option) {
     console.log(option);
@@ -34,21 +35,28 @@ Page({
 
     this.uid = wx.getStorageSync('uid');;
 
-    httpRequestApi.getClassDetail(this.uid, option.id).success(res => {
-      console.log(res);
-      this.setData({
-        title: res.data.data.title,
-        videoUrl: res.data.data.playUrl,
-        iconImg: res.data.data.iconImg
-      },()=>{
+
+      httpRequestApi.getClassDetail(this.uid, option.id).success(res => {
+        console.log(res);
+        this.setData({
+          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();
       })
-      this.getReadInfo(1, 10);
-      this.checkLike();
-    })
   },
+      // video组件在获得url时迅速退出页面会导致小程序闪退,官方还没修复(11/28),处理办法:懒加载思路,在用户点击时再获取videoUrl
+  // setVideoUrl: function(){
+  //   console.log('视频地址>>>>>>>>',this.data.lazyVideoUrl)
+  //   this.setData({
+  //     videoUrl: this.data.lazyVideoUrl,
+  //   })
+  // },
   // 检查是否收藏
   checkLike: function () {
     httpRequestApi.classIsLike(this.uid, {
@@ -192,7 +200,10 @@ Page({
     })
     if (this.data.pageNo <= this.data.totalNo) {
       this.getReadInfo();
-
     }
-  }
+  },
+  onHide: function () {
+    let videoCtx = wx.createVideoContext('classVideo',this);
+    videoCtx.stop();
+},
 })

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

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

+ 8 - 21
pages/social/works/works.js

@@ -41,8 +41,6 @@ Page({
         wx.setNavigationBarTitle({
             title: option.title //页面标题为路由参数
         })
-
-        
         this.uid = wx.getStorageSync('uid');
         this.setData({
             title: option.title,
@@ -100,7 +98,6 @@ Page({
                 // 播放音频失败的回调
             })
             this.innerAudioContext.src = this.data.audioSrc; // 这里可以是录音的临时路径
-
         });
     },
     onShow(options) {
@@ -137,9 +134,6 @@ Page({
     },
     // 弹出分享框
     openShare: function (e) {
-        // this.setData({
-        //     shareFlag: !this.data.shareFlag
-        // })
         this.shareDialog = this.selectComponent("#share-dialog");
         const data = {
             avatar: this.data.authorAvatar,
@@ -165,11 +159,6 @@ Page({
         this.innerAudioContext.pause();
     },
     goToReading: function () {
-
-        // wx.navigateTo({
-        //     url: `../../main/reading/reading?id=${this.data.classId}`
-        // })
-
         const classId = this.data.classId;
         httpRequestApi.checkLesson(classId).success(res => {
             const productId = res.data.data[0];
@@ -224,7 +213,6 @@ Page({
         }
     },
     follow: function () {
-        // let uid = wx.getStorageSync('uid');
         let followUid = this.data.authorUid;
         if (this.data.isFans) {
             httpRequestApi.cancerFollow(this.uid, followUid).success((res) => {
@@ -391,14 +379,14 @@ Page({
         })
     },
     reward: function () {
-        if(this.data.isIOS){
-            wx.showToast({
-                title: '奖励成功!',
-                icon: 'success',
-                duration: 1000
-            })
-            return 
-        };
+        // if(this.data.isIOS){
+        //     wx.showToast({
+        //         title: '奖励成功!',
+        //         icon: 'success',
+        //         duration: 1000
+        //     })
+        //     return 
+        // };
         this.setData({
             ifReward: true
         })
@@ -410,7 +398,6 @@ Page({
     },
     // 奖励
     rewardMoney: function () {
-        
         console.log(this.data.authorUid);
         const data = {
             targetUid: this.data.authorUid,

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

@@ -20,7 +20,7 @@
         <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}}" data-title="{{item.title}}" />
+                    <image src="{{item.image}}" bindtap="goToOthers" lazy-load="true" data-uid="{{item.uid}}" data-title="{{item.title}}" />
                 </view>
             </view>
         </scroll-view>

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

@@ -451,8 +451,7 @@ button::after {
     height: 68rpx;
     position: absolute;
     left: 345rpx;
-    bottom: 110rpx;
-
+    top:1025rpx;
 }
 
 .replySection {

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

@@ -60,8 +60,9 @@ image{
     margin-right:16rpx;
 }
 .wallet-right {
-    width:16rpx;
-    height:28rpx;
+   width:18rpx;
+   height:34rpx;
+
 }
 .wallet-detail {
     margin-top:20rpx;

BIN
static/image/alert_icon.png


BIN
static/image/group_poster.jpg


BIN
static/image/works_poster.jpg


BIN
static/image/works_poster.png


+ 1 - 1
towxml/style/main.wxss

@@ -412,7 +412,7 @@
 image,
 video {
     width: 100%;
-    margin: 10rpx auto;
+    /* margin: 10rpx auto; */
 }
 
 image {

+ 18 - 8
utils/APIClient.js

@@ -192,11 +192,14 @@ module.exports = {
     }).url(url).data(data).method('POST').send();
   },
   // 获取推荐团购信息
-  getGroupList() {
+  getGroupList(pageNo) {
     let url = getBaseUrl(`wx/groupPurchaseInfo/recommend`);
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')
-    }).url(url).send();
+    }).url(url).data({
+      pageNo,
+      pageSize: 3
+    }).send();
   },
   // 获取课程团购信息
   getGroupPurchaseInfo(productId) {
@@ -223,7 +226,7 @@ module.exports = {
   },
   // 收藏课程
   collectClass(uid, data) {
-    let url = getProductUrl(`wx/favorites`); 
+    let url = getProductUrl(`wx/favorites`);
     return request.getInstance().header({
       uid
     }).url(url).data(data).method('POST').send();
@@ -331,22 +334,29 @@ module.exports = {
       uid: wx.getStorageSync('uid')
     }).url(url).send();
   },
-  // 产品鉴权
-  areYouSuper(productArr){
+  // 课程鉴权
+  areYouSuper(productArr) {
     let url = getBaseUrl(`wx/groupPurchase/auth`);
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')
     }).url(url).data(productArr).method('POST').send();
   },
+  // // 课本鉴权
+  // areYouBookSuper(productArr){
+  //   let url = getBaseUrl(`wx/groupPurchase/auth`);
+  //   return request.getInstance().header({
+  //     uid: wx.getStorageSync('uid')
+  //   }).url(url).data(productArr).method('POST').send();
+  // },
   // 找到课程对应的课本
- checkLesson(lessonId){
+  checkLesson(lessonId) {
     let url = getProductUrl(`wx/lesson/product/${lessonId}`);
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')
     }).url(url).send();
   },
   // 获取 用户朗读的作品
-  userWorks(followUid, pageNo, pageSize){
+  userWorks(followUid, pageNo, pageSize) {
     let url = getBaseUrl('wx/userRead');
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')
@@ -357,7 +367,7 @@ module.exports = {
     }).url(url).send();
   },
   //  获取用户信息
-  getUserMsg(followUid, pageNo, pageSize){
+  getUserMsg(followUid, pageNo, pageSize) {
     let url = getBaseUrl('wx/user/info');
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')

+ 10 - 0
utils/WXHttpRequest.js

@@ -1,5 +1,9 @@
 module.exports = {
 	getInstance: function() {
+		wx.showLoading({
+			title: '加载中...',
+			mast: true
+		})
 		return {
 			_sucCallback: null,
 			_failCallback: null,
@@ -24,10 +28,16 @@ module.exports = {
 			},
 			success: function(callback) {
 				this._sucCallback = callback;
+				setTimeout(function () {
+					wx.hideLoading()
+				  }, 200)
 				return this;
 			},
 			fail: function(callback) {
 				this._failCallback = callback;
+				setTimeout(function () {
+					wx.hideLoading()
+				  }, 200)
 				return this;
 			},
 			url: function(url) {

+ 2 - 2
utils/const.js

@@ -4,8 +4,8 @@ module.exports = {
 	// ----测试环境-----
 	productApi: 'https://readerproduct.efunbox.cn/',
 	baseApi: 'https://readerbase.efunbox.cn/'
-	
-	// // ----测试环境-----
+
+	// // ----正式环境-----
 	// productApi: 'https://readerproduct.ai160.com/',
 	// baseApi: 'https://readerbase.ai160.com/'
 }