Rorschach %!s(int64=6) %!d(string=hai) anos
pai
achega
e14b55acd0

+ 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>

+ 3 - 3
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>
@@ -57,7 +57,7 @@
     </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>

+ 46 - 13
pages/groupPage/grade-details/grade-details.js

@@ -20,10 +20,11 @@ Page({
         color: "#000"
       },
       {
-        text: "在限定时间内内成功拼团,您将得到xx元的奖励金哦。",
+        text: `在限定时间内成功拼团,您将得到xx元的奖励金哦。`,
         color: "#FF4600"
       }
-    ]
+    ],
+
   },
   //获取团购信息并掉起支付
   pay: function ({
@@ -54,14 +55,42 @@ Page({
         })
         return false;
       }
-      //掉起支付
-      this.prePayMap(res.data.data.prePayMap, res.data.data.groupPurchaseOrder.id);
+      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())
@@ -78,15 +107,19 @@ Page({
           title: '提示',
           content: '支付成功',
           success(res) {
+            console.log(res)
             that.popup.close();
-            setTimeout(() => {
-              wx.navigateTo({
-                url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
-              })
-              wx.setNavigationBarTitle({
-                title: '拼团详情'
-              })
-            }, 1000)
+            if (num !== 1) {
+              setTimeout(() => {
+                wx.navigateTo({
+                  url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
+                })
+                wx.setNavigationBarTitle({
+                  title: '拼团详情'
+                })
+              }, 3000)
+            }
+
           }
         })
 

+ 1 - 1
pages/groupPage/grade-details/grade-details.wxml

@@ -28,4 +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,150 +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 {
-        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) {
@@ -243,11 +331,10 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    debugger
     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");
   },
 
   /**

+ 2 - 1
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>
@@ -69,6 +69,7 @@
 </view>
 
 <popup
+    id="popupup"
     typeOf="{{typeOf}}"
     title="{{title}}"
     headTextOne="{{headTextOne}}"

+ 3 - 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 {
+      
+  
     }
   },
 

+ 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 {

+ 6 - 4
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();

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

@@ -69,6 +69,16 @@ Page({
             })
         })
     },
+    onHide: function(){
+        if(this.innerAudioContext){
+            this.innerAudioContext.stop();
+        }
+    },
+    onUnload: function(){
+        if(this.innerAudioContext){
+            this.innerAudioContext.stop();
+        }
+    },
     // onShow:function(){
 
     // },
@@ -80,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();
         }
     },
     // 播放中视频播放结束 (控制录音同时结束)
@@ -109,9 +116,14 @@ Page({
             // this.recordStart();
             // this.saveVideo();
             this.videoComplete();
+            return;
         }
         // 录音结束后
         if (this.data.recordFlag === 1) {
+            wx.showLoading({
+                title: '作品转码中',
+                mask: true
+              })
             this.recordStop();
         }
     },
@@ -140,6 +152,7 @@ Page({
     recordStop: function () {
         console.log('录音结束')
         this.recorderManager.stop();
+        wx.hideLoading()
     },
     // 播放录音
     audioPlay: function () {
@@ -166,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',
@@ -193,11 +210,22 @@ Page({
                 "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}`
+                                })
+                            }
+                        })
+                    }
+                });
+                
             })
         };
     }

+ 10 - 3
pages/social/works/works.js

@@ -38,9 +38,16 @@ Page({
         this.uid = wx.getStorageSync('uid');
         this.getWorks(this.uid, option.id);
     },
-    // onReady: function () {
-
-    // },
+    onHide: function(){
+        if(this.innerAudioContext){
+            this.innerAudioContext.stop();
+        }
+    },
+    onUnload: function(){
+        if(this.innerAudioContext){
+            this.innerAudioContext.stop();
+        }
+    },
     getWorks: function (uid, id) {
         httpRequestApi.getWorksDetail(uid, id).success((res) => {
             console.log(res);