Sfoglia il codice sorgente

增加活动团购

limengbo 3 anni fa
parent
commit
790a1e5903

+ 3 - 2
app.json

@@ -27,7 +27,8 @@
     "pages/activity/index/index",
     "pages/activity/rule/rule",
     "pages/activity/strategy/strategy",
-    "pages/activity/priceList/priceList"
+    "pages/activity/priceList/priceList",
+    "pages/vipActivity/vipActivity"
   ],
   "window": {
     "backgroundTextStyle": "light",
@@ -45,4 +46,4 @@
       "provider": "wx7279a29ef86a3002"
     }
   }
-}
+}

+ 9 - 14
component/my/my.js

@@ -6,20 +6,10 @@ import {
 export const myInit = (that) => {
   console.log(123123123, app.globalData.isIOS)
   that.setData({
-    myData: {
-      title: '修改资料',
-      concern: '我的关注',
-      course: '我的课程',
-      read: '我的朗读',
-      keep: '我的收藏',
-      collage: '我的拼团',
-      wallet: '我的钱包',
-      schoolCity: '',
-      schoolName: '',
-      user: {},
-      isIOS: app.globalData.isIOS,
-      isVIP: true,
-      grade:''
+    myData:{
+      isVIP: wx.getStorageSync('vip'),
+      price: wx.getStorageSync('price'),
+      date: wx.getStorageSync('date')
     },
     followData: []
   });
@@ -101,5 +91,10 @@ export const myInit = (that) => {
 
 
     },
+    /**创建支付订单 */
+    that.moneyBuy = function() {
+      that.messageAuth();
+
+    }
     that.getFollowWorks(1, 3);
 }

+ 38 - 6
component/my/my.wxml

@@ -1,4 +1,5 @@
 <!-- <wxs src="../../pages/commonWxs/format.wxs" module="format" /> -->
+<wxs src="../../utils/filter.wxs" module="filters"/>
 <template name="my">
   <view class='mine-container'>
     <view class='follow-details'>
@@ -14,10 +15,10 @@
             <view class='avatar-nickname'>年级:{{myData.userInfo.gradeText  }}</view>
             <image class="edit-img" src="../../static/index/edit.png" />
             <view class='mine-category'>
-              <view class='amount-text'>播放 {{ myData.playAmount || 0 }} </view>
+              <view class='amount-text'>播放 {{ myData.user.playAmount || 0 }} </view>
               <!-- <view class='amount-text'>{{ myData.user.likeAmount || 0 }} 赞</view> -->
-              <view class='amount-text'>粉丝 {{ myData.fansAmount || 0 }}</view>
-              <view class='amount-text'>作品 {{ myData.readAmount || 0 }} </view>
+              <view class='amount-text'>粉丝 {{ myData.user.fansAmount || 0 }}</view>
+              <view class='amount-text'>作品 {{ myData.user.readAmount || 0 }} </view>
             </view>
           </view>
         </view>
@@ -35,6 +36,37 @@
         </view>
         <view class="flower-tips" wx:if="{{myData.user.unfinishedAmount <= 0}}">今天任务全部完成,真棒</view>
       </view> -->
+
+      <view class="vip-con" wx:if="{{myData.isIOS}}">
+        <image src="http://reader-wx.ai160.com/images/reader/pay/vip_bg.png" />
+        <view class="invite" wx:if="{{!myData.isVIP}}" bindtap="myPlase">快去邀请好友 免费领取会员></view>
+        <view wx:else>
+          <view class="vip-end-time">{{filters.formatDate(myData.date)}}到期</view>
+          <view class="order-buy vip-buy"  bindtap="myPlase">
+              邀请有礼>
+          </view>
+        </view>
+      </view>
+      <view class="vip-con" wx:else>
+        <image src="http://reader-wx.ai160.com/images/reader/pay/vip_bg.png" />
+        <view wx:if="{{!myData.isVIP}}">
+          <view class="price">
+            <text >{{myData.price}}</text>元/月
+          </view>
+          <view class="flase-price">
+            原价:29.9元/月
+          </view>
+          <view class="order-buy"  bindtap="moneyBuy">
+              限时抢购>
+          </view>
+        </view>
+        <view wx:else>
+          <view class="vip-end-time">{{filters.formatDate(myData.date)}}到期</view>
+          <view class="order-buy vip-buy"  bindtap="moneyBuy">
+              立即续费>
+          </view>
+        </view>
+      </view>
       <!-- android 显示两个 -->
       <view class="wallet-section">
         <view class="flower-box" bindtap="goToFlower">
@@ -42,11 +74,11 @@
           <view class="flower-box-box">
             <image class="flower-icon" src='../../static/image/flower_small.png' />
             <view class="flower-text">
-              <view>小红花:{{myData.integralAmount || 0 }}</view>
+              <view>小红花:{{myData.user.integralAmount || 0 }}</view>
             </view>
           </view>
           <view class="flower-tips-text">
-            <text class="flower-last">{{myData.unfinishedAmount }}</text>
+            <text class="flower-last">{{myData.user.unfinishedAmount }}</text>
             个任务福利还没有完成
           </view>
         </view>
@@ -56,7 +88,7 @@
           <image class="btn-icon" src="../../static/image/concern.png" />
           <view class="btn-title">我的关注</view>
         </view>
-        <view class="btn" bindtap='toMyKeep' data-title='{{ myData.keep }}'>
+        <view class="btn" bindtap='toMyKeep'>
           <image class="btn-icon" src="../../static/image/collect.png" />
           <view class="btn-title">我的收藏</view>
         </view>

+ 76 - 4
component/my/my.wxss

@@ -8,7 +8,7 @@
   align-items: center;
   justify-content: space-between;
   box-sizing: border-box;
-  margin-bottom: 15rpx;
+  margin-bottom: 20rpx;
 }
 
 .follow-details {
@@ -215,12 +215,84 @@ image {
 }
 
 
+.vip-con {
+  position: relative;
+  width: 100%;
+  height: 140rpx;
+  background: #fff;
+  padding: 30rpx;
+  margin-top: 20rpx;
+  box-sizing: border-box;
+}
+.vip-con image {
+  width: 100%;
+  height: 100%;
+}
+.vip-con .price {
+  position: absolute;
+  left: 220rpx;
+  top: 35rpx;
+  color: #FE0606;
+  font-size: 30rpx;
+  width: 180rpx;
+  text-align: end;
+  font-weight: 600;
+}
+.vip-con .price text {
+  font-size: 45rpx;
+}
+.vip-con .flase-price {
+  position: absolute;
+  left: 408rpx;
+  top: 63rpx;
+  font-size: 15rpx;
+  text-decoration: line-through;
+  font-weight: 500;
+  color: rgba(0, 0, 0, 0.6);
+}
+.vip-con .order-buy {
+  position: absolute;
+  top: 46rpx;
+  right: 62rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 169rpx;
+  height: 49rpx;
+  background: #FF6300;
+  border-radius: 25rpx;
+  color: #fff;
+  font-size: 26rpx;
+  font-weight: 500;
+}
+.vip-con .vip-buy {
+  background: transparent;
+  color: #FE0606;
+  font-size: 30rpx;
+  top: 46rpx;
+}
+.vip-con  .vip-end-time {
+  position: absolute;
+  top: 53rpx;
+  left: 251rpx;
+  font-size: 28rpx;
+  color: #6E4008;
+  font-weight: 400;
+}
+.vip-con .invite {
+  position: absolute;
+  right: 73rpx;
+  top: 50rpx;
+  font-size: 30rpx;
+  color: #FE0606;
+  font-weight: 400;
+}
 .wallet-section {
-  width: 720rpx;
+  width: 100%;
   height: 120rpx;
   /* background: #fff; */
   border-radius: 10rpx;
-  margin: 10rpx auto 0;
+  margin-top: 20rpx;
   position: relative;
   display: flex;
   align-items: center;
@@ -316,7 +388,7 @@ margin-top: -7rpx;
   display: flex;
   justify-content: space-between;
   align-items: center;
-  margin-top: 10rpx;
+  margin-top: 20rpx;
   padding: 0 60rpx;
   box-sizing: border-box;
 }

+ 71 - 19
component/share/share.js

@@ -1,5 +1,6 @@
 // component/shar-dialog/shar-dialog.js
 import httpRequestApi from '../../utils/APIClient';
+const app = getApp();
 Component({
   /**
    * 组件的属性列表
@@ -62,26 +63,45 @@ Component({
         title: '专属海报生成中',
         // mask: true
       })
-      httpRequestApi.createQRCode(this.data.QRData).success(res => {
-        console.log('----------------->分享二维码222',res.data.data)
-        // 下载二维码
-        wx.downloadFile({
-          url: res.data.data,
-          success: res => {
-            console.log('----------------->分享二维码',res.tempFilePath)
-            this.setData({
-              QRCodeImagePath: res.tempFilePath
-            }, () => {
-              this.saveAvatar();
-            })
-          }
-        });
-      })
+      if (this.data.shareType === 'readActivity') {
+        httpRequestApi.getqrCodeShare(this.data.QRData).success(res => {
+          console.log('----------------->分享二维码222',res.data.data)
+          // 下载二维码
+          wx.downloadFile({
+            url: res.data.data,
+            success: res => {
+              console.log('----------------->分享二维码',res.tempFilePath)
+              this.setData({
+                QRCodeImagePath: res.tempFilePath
+              }, () => {
+                this.saveAvatar();
+              })
+            }
+          });
+        })
+      } else {
+        httpRequestApi.createQRCode(this.data.QRData).success(res => {
+          console.log('----------------->分享二维码222',res.data.data)
+          // 下载二维码
+          wx.downloadFile({
+            url: res.data.data,
+            success: res => {
+              console.log('----------------->分享二维码',res.tempFilePath)
+              this.setData({
+                QRCodeImagePath: res.tempFilePath
+              }, () => {
+                this.saveAvatar();
+              })
+            }
+          });
+        })
+      }
+
     },
     makeImage: function () {
       const ctx = wx.createCanvasContext('myCanvas');
       // 画出背景和相同内容
-      if(this.data.activity) {
+      if(this.data.activity || this.data.shareType === 'readActivity') {
         ctx.drawImage(this.data.activityImg, 0, 0, 1200, 2100, 0, 0, 600, 1050); //插入图片
       } else {
         if (this.data.shareType === 'works') {
@@ -109,6 +129,21 @@ Component({
         // 二维码
         ctx.drawImage(this.data.QRCodeImagePath, 104, 299, 92, 92);
         ctx.draw();
+      }else if(this.data.shareType === 'readActivity') {
+        ctx.save()
+        ctx.arc(49, 50, 29, 0, 2 * Math.PI, true)
+        ctx.clip(); //剪切头像区域
+        ctx.drawImage(this.data.avatar, 20, 20, 61, 61);
+        ctx.clip(); //剪切头像区域
+        ctx.restore();
+        ctx.font = 'normal bold 14px'
+        ctx.setFontSize(14)
+        ctx.setFillStyle('#fff')
+        ctx.fillText(this.data.name, 85, 59)
+        ctx.restore();
+        // 二维码
+        ctx.drawImage(this.data.QRCodeImagePath, 11, 409, 92, 92);
+        ctx.draw();
       } else {
         ctx.save()
         ctx.beginPath()
@@ -217,8 +252,9 @@ Component({
           this.setData({
             avatar: res.tempFilePath
           }, () => {
+            const imgName = this.data.shareType === 'readActivity' ? 'pay/share.png' : 'activity/activity_bg.jpg'
             wx.downloadFile({
-              url: 'https://reader-wx.ai160.com/images/reader/activity/activity_bg.jpg',
+              url: `https://reader-wx.ai160.com/images/reader/${imgName}`,
               success: res => {
                 this.setData({
                   activityImg: res.tempFilePath
@@ -238,7 +274,6 @@ Component({
     share: function (data) {
       console.log('分享内容', data)
       if (this.data.shareType === 'works') {
-
         this.setData({
           shareFlag: !this.data.shareFlag,
           avatar: data.avatar,
@@ -277,6 +312,20 @@ Component({
           groupType: data.groupType
         })
       }
+      /**添加团购分享海报为了进度代码越写越乱项目可重构 */
+      if (this.data.shareType === 'readActivity') {
+        console.log(data)
+        this.setData({
+          shareFlag: !this.data.shareFlag,
+          avatar: data.avatar,
+          name: data.name,
+          QRData: {
+            page: data.path,
+            type: `${data.type}`
+          }
+        })
+        this.poster();
+      }
       if (this.data.shareType === 'class') {
         console.log('课程分享')
         this.setData({
@@ -382,7 +431,10 @@ Component({
       this.setData({
         shareStep: 'circle'
       })
-      this.poster();
+      if (this.data.shareType !== 'readActivity') {
+        this.poster();
+      }
+      
       httpRequestApi.shareLog({
         readId: this.data.id,
         type: this.data.type,

+ 15 - 4
component/share/share.wxml

@@ -1,5 +1,16 @@
 <view class="share" bindtap="close" wx:if="{{shareFlag}}" catchtouchmove="touchMove">
-   <view class="btn" animation="{{animationData}}"  id="btnArea" catchtap="nothing">
+  <!--暂时使用传参方式判断不同海报保存类型 以后有时间可以重写这个组件,让组件成为公用全局组件-->
+   <view class="read-activity-btn" wx:if="{{shareType === 'readActivity'}}">
+    <button class="share-activity-friend" open-type="share" catchtap="shareFriend">
+        <image  src="http://reader-wx.ai160.com/images/reader/pay/weixin.png"></image>
+        <text>分享给好友/群聊 </text>
+    </button>
+        <view class="share-activity-circle" catchtap="PreservationImg">
+        <image  src="http://reader-wx.ai160.com/images/reader/pay/pengyouquan.png"></image>
+        <text>保存海报</text>
+    </view>
+   </view>
+   <view wx:else class="btn" animation="{{animationData}}"  id="btnArea" catchtap="nothing">
        <!-- <image class="bg" src="../../static/groupImg/share.png"></image> -->
        <!-- <view class="corss-line"></view> -->
        <view class="invite-text" wx-if="{{shareStep==='firend' && !activity}}">分享该作品,获得3朵<image class="cover-flower"  src="../../static/image/flower_small.png"></image></view>
@@ -22,9 +33,9 @@
        <cover-view class="cover-text">还可以额外获得10朵 <cover-image class="cover-flower"  src="../../static/image/flower_small.png"></cover-image></cover-view>
    </cover-view> -->
    <view class="share-img" wx:if="{{imgUrls}}" id="imgArea">
-       <image class="img" src="{{imgUrls}}"  catchtap="nothing"></image>
-       <view class="cover-text">将海报分享到朋友圈</view>
-       <view class="cover-text">{{activity ? '获取更多人气值' : '额外获得10朵'}}<image class="cover-flower" hidden="{{activity}}"  src="../../static/image/flower_small.png"></image></view>
+       <image class="img" src="{{imgUrls}}"  catchtap="nothing" style="{{shareType === 'readActivity' && '    position: absolute;left: 50%;top: 50%;transform: translate(-50%, -60%);'}}"></image>
+       <view class="cover-text" hidden="{{shareType === 'readActivity'}}">将海报分享到朋友圈</view>
+       <view class="cover-text" hidden="{{shareType === 'readActivity'}}">{{activity ? '获取更多人气值' : '额外获得10朵'}}<image class="cover-flower" hidden="{{activity}}"  src="../../static/image/flower_small.png"></image></view>
        <!-- <view class="cover-text">还可以额外获得10朵 <image class="cover-flower"  src="../../static/image/flower_small.png"></image>!</view> -->
    </view>
 </view>

+ 34 - 0
component/share/share.wxss

@@ -39,6 +39,40 @@
     justify-content: center;
 }
 
+.read-activity-btn {
+    position: fixed;
+    bottom: 0;
+    display: flex;
+    justify-content: space-between;
+    width: 100%;
+    height: 196rpx;
+    padding: 0 40rpx;
+    box-sizing: border-box;
+    background: #fff;
+}
+.share-activity-friend,
+.share-activity-circle {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    height: 140rpx;
+    width: 200rpx;
+    color: #333;
+    font-size: 24rpx;
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    margin-top: 40rpx;
+}
+.share-activity-circle text {
+    height: 56rpx;
+    line-height: 56rpx;
+}
+.read-activity-btn image {
+    width: 80rpx;
+    height: 80rpx;
+}
+
 .btn {
     position: fixed;
     bottom: -200rpx;

+ 19 - 0
component/tips/tips.js

@@ -0,0 +1,19 @@
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+  }
+})

+ 4 - 0
component/tips/tips.json

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

+ 4 - 0
component/tips/tips.wxml

@@ -0,0 +1,4 @@
+<!--component/tips/tips.wxml-->
+<view class="tips" wx:if="{{flag}}">
+</view>
+   

+ 11 - 0
component/tips/tips.wxss

@@ -0,0 +1,11 @@
+/* component/tips/tips.wxss */
+.tips {
+  width: 100%;
+  height: 100%;
+  background: rgba(37, 37, 37, .8);
+  position: absolute;
+  top: 0;
+  left: 0;
+  z-index:999;
+
+}

+ 271 - 12
pages/index/index.js

@@ -61,7 +61,6 @@ Page({
     hotInput: '12345',
     mineSettingInfo: '528',
     hide: true,
-    isIOS: app.globalData.isIOS,
     ifHaveMore: true,
     indexSignDialog: false,
     indexMissionDialog: false,
@@ -83,7 +82,15 @@ Page({
     grade: wx.getStorageSync('grade'),
     noMoreWork: false, // 没有更多作品 已经到底了
     upgradeHide: true,
-    gradeActivity: ''
+    gradeActivity: '',
+    helpPayHide: true,
+    tipsType: '',
+    helpPayImg: '',
+    tipsImg: '',
+    payPrice: '',
+    iphoneType: '',
+    isVip: null,
+    isIos: null
   },
   jurisdiction: function () {
     //隐藏弹框
@@ -250,6 +257,9 @@ Page({
     }, 2800)
   },
   onLoad: function (options) {
+    this.setData({
+      isIos: app.globalData.isIOS
+    })
     console.log('onload', options);
     if (options.scene) {
       // this.setData({
@@ -257,8 +267,16 @@ Page({
       // })
       let optionsStr = decodeURIComponent(options.scene);
       let optionsArr = optionsStr.split('&');
-      options.readId = optionsArr[0];
-      options.activity = optionsArr[1];
+      // 暂时这样写
+      if (optionsArr[0].split("=")[0] === "type"){
+        console.log('我是团购分享')
+        options.type = optionsArr[0].split("=")[1];
+        options.sid = optionsArr[1].split("=")[1];
+      } else {
+        options.readId = optionsArr[0];
+        options.activity = optionsArr[1];
+      }
+
       console.log('整理后options', options)
     }
     if (options.readId) {
@@ -275,9 +293,27 @@ Page({
         console.log(res)
       })
     }
-
+    /**团购弹窗时间紧逻辑越写越乱功能越加越多 */
+    this.setData({
+      iphoneType: options.type || ''
+    })
     getOpenidNoLogin((res) => {
       console.log('getOpenidNoLogin', res)
+      /**获取权限和订单信息 */
+      // 获取商品信息
+      httpRequestApi.getProductActivity().success(res => {
+        wx.setStorageSync('price', res.data.data.price / 100)
+        wx.setStorageSync('productId', res.data.data.id)
+        if (options.type && options.type === 'iphone') {
+          this.setData({
+            payPrice: res.data.data.price / 100
+          })
+        }
+      }).fail(error => {
+        console.log(error)
+      })
+      // 获取用户权限
+      this.getHelpAuth()
       if (!res.data.data.grade) {
         // 没有年级的老用户
         if (res.data.data.wechatName) {
@@ -313,6 +349,14 @@ Page({
 
 
     this.uid = wx.getStorageSync('uid');
+    if (options.sid) {
+      httpRequestApi.getUserRec(options.sid).success(res => {
+          options.uid = res.data.data;
+          this.shareGetPage(options)
+      })
+    } else {
+        this.shareGetPage(options)
+    }
     // if (!this.uid || !grade) {
     //   this.setData({
     //     isGradeShow: true,
@@ -347,7 +391,34 @@ Page({
 
       }
     });
-
+  },
+  // 封装分享方法之后跳到页面方法
+  shareGetPage(options) {
+    console.log(this.uid,  options.uid ,this.uid !== options.uid)
+    if(options.type && options.type === 'iphone' && !app.globalData.isIOS && this.uid !== options.uid) {
+        this.setData({
+          helpPayHide: false,
+          tipsType: 'helpPay',
+          helpPayImg: 'http://reader-wx.ai160.com/images/reader/pay/buy.png',
+        })
+    }
+    if(options.type && options.type === 'ios' && this.uid !== options.uid) {
+        this.setData({
+          helpPayHide: false,
+          tipsType: 'helpPay',
+          helpPayImg: 'http://reader-wx.ai160.com/images/reader/pay/help.png',
+        })
+        console.log(options.uid)
+    }
+    const recOsType = options.type === 'iphone' ? 'ANDROID' : (options.type === 'ios' && 'IOS');
+    if (options.type && options.uid) {
+      httpRequestApi.settingUserInfo({
+        rec_uid: options.uid,
+        recOsType,
+      }).success(res => {
+        console.log(res)
+      })
+    } 
   },
   onShow: function () {
     let grade = wx.getStorageSync('grade');
@@ -356,6 +427,7 @@ Page({
     })
     if (this.data.myIndex === 3) {
       this.getUserWorksInfo(1)
+      this.getHelpAuth()
     }
     wx.setNavigationBarTitle({
       title: '小学语文朗读配音'
@@ -495,8 +567,10 @@ Page({
       }
       res.data.data.user = this.formatGrade(res.data.data.user);
       this.setData({
-        myData: res.data.data,
-        ['myData.userInfo']: res.data.data.user
+        // myData: res.data.data,
+        ['myData.user']: res.data.data,
+        ['myData.userInfo']: res.data.data.user,
+        ['myData.isIOS']: app.globalData.isIOS
       }, () => {
         this.getMyRead()
       });
@@ -1045,9 +1119,194 @@ Page({
       url: `../activity/index/index`
     });
   },
-  goToActivityPrice(){
-    wx.navigateTo({
-      url: `../activity/priceList/priceList`
-    });
+  /**
+   * banner点击
+   */
+   bannerTap() {
+    if (!this.data.isLogin) {
+      wx.navigateTo({
+        url: `../../pages/login/login?index=0`
+      });
+      return;
+    }
+    if(this.data.isIos || this.data.isVip) {
+      this.myPlase();
+    } else {
+      this.messageAuth();
+    }
+   },
+  /**活动改版 */
+  myPlase() {
+    if(!wx.getStorageSync('message')) {
+      wx.requestSubscribeMessage({
+        tmplIds: ['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY',
+          '-2ZZpWFoyKvAtX1HwEIQLQ92LnN8cryamB94LqLGo98'],
+        success: (res) => { 
+          console.log(res)
+          if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'reject') {
+              console.log('用户不同意订阅')
+              // 用户不同意订阅
+              wx.setStorageSync('message', false)
+          } else if(res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'accept') {
+              console.log('订阅成功')
+              // 用户点击统一订阅
+              wx.setStorageSync('message', true)
+          }
+          wx.navigateTo({
+            url: `../vipActivity/vipActivity`
+          });
+        },
+        fail: () => {
+          wx.navigateTo({
+            url: `../vipActivity/vipActivity`
+          });
+        }
+      })
+    }else {
+      wx.navigateTo({
+        url: `../vipActivity/vipActivity`
+      });
+    }
+
+
+  },
+  // 弹窗提示
+  helpPayHideEvent() {
+    this.setData({
+      helpPayHide: !this.data.helpPayHide
+    })
+  },
+  // 支付或者助力
+  payAndHelp() {
+    if (!this.data.isLogin) {
+      wx.navigateTo({
+        url: `../../pages/login/login?index=0`
+      });
+      return;
+    }
+    if (this.data.iphoneType === 'ios') {
+      httpRequestApi.postUserHelp().success(res => {
+        console.log(res)
+        if (res.data.data) {
+          this.setData({
+            tipsType: 'tips',
+            tipsImg: 'http://reader-wx.ai160.com/images/reader/pay/help_success.png'
+          })
+        } else {
+          this.setData({
+            tipsType: 'tips',
+            tipsImg: 'http://reader-wx.ai160.com/images/reader/pay/helped.png'
+          })
+        }
+      })
+    }else{
+      // 去支付需要获取权限
+      this.messageAuth();
+    }
+
+  },
+  // 授权
+  messageAuth() {
+    if (!wx.getStorageSync('message')) {
+      wx.requestSubscribeMessage({
+        tmplIds: ['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY',
+          '-2ZZpWFoyKvAtX1HwEIQLQ92LnN8cryamB94LqLGo98'],
+        success: (res) => { 
+          console.log(res)
+          if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'reject') {
+              console.log('用户不同意订阅')
+              wx.setStorageSync('message', false)
+          } else if(res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'accept') {
+              console.log('订阅成功')
+              wx.setStorageSync('message', true)
+          }
+          this.order();
+        },
+        fail: () => {
+          this.order();
+        }
+      })
+    } else {
+      this.order();
+    }
+  },
+  // 支付
+  order () {
+    // 渠道id
+    const productId = wx.getStorageSync('productId');
+    httpRequestApi.createOrder(productId).success(res => {
+      console.log(res.data.data.package);
+      const timeStamp = res.data.data.timeStamp;
+      const nonceStr = res.data.data.nonceStr;
+      const packages = res.data.data.package;
+      const paySign = res.data.data.sign;
+      wx.requestPayment({
+        timeStamp,
+        nonceStr,
+        package: packages,
+        signType: 'MD5',
+        paySign,
+        success: (res) => {
+          if (this.data.iphoneType === 'iphone') {
+            this.setData({
+              tipsType: 'tips',
+              tipsImg: 'http://reader-wx.ai160.com/images/reader/pay/success.png'
+            })
+          }
+          httpRequestApi.getAuthActivity().success(res => {
+            if (!res.data.data) {
+                wx.setStorageSync('vip', false)
+                wx.setStorageSync('date', '')
+            } else {
+                wx.setStorageSync('vip', true)
+                wx.setStorageSync('date', res.data.data)
+                this.setData({
+                  ['myData.isVIP']: true,
+                  ['myData.date']: res.data.data
+                })
+                this.showGift();
+            }
+            }).fail(error => {
+                console.log(error)
+            })
+        },
+        fail (res) { }
+      })
+    })
+  },
+  // 助力或者支付提示
+  tips() {
+    console.log('支付完了')
+    this.setData({
+      helpPayHide: true
+    })
+    this.updateData("2");
+  },
+  // 购买成功告诉首页显示邀请有礼
+  showGift() {
+    console.log('通知')
+    this.setData({
+      isVip: true
+    })
+  },
+  // 首页获取权限
+  getHelpAuth() {
+    httpRequestApi.getAuthActivity().success(res => {
+      if (!res.data.data) {
+        wx.setStorageSync('vip', false)
+        wx.setStorageSync('date', '')
+        this.setData({
+          isVip: false
+        })
+      } else {
+        wx.setStorageSync('vip', true)
+        wx.setStorageSync('date', res.data.data)
+        this.setData({
+          isVip: true
+        })
+      }
+    }).fail(error => {
+      console.log(error)
+    })
   }
 })

+ 16 - 2
pages/index/index.wxml

@@ -49,8 +49,11 @@
   <!-- <view hidden="{{0 != myIndex}}" class="activity-img" bindtap="goToActivity">
     <image src="http://reader-wx.ai160.com/images/reader/activity/banner.jpg"></image>
   </view> -->
-  <view hidden="{{0 != myIndex}}" class="activity-img" bindtap="goToActivityPrice">
-    <image src="http://reader-wx.ai160.com/images/reader/activity/price_list_banner.jpg"></image>
+  <view hidden="{{0 != myIndex}}" class="activity-img" bindtap="bannerTap">
+    <image src="http://reader-wx.ai160.com/images/reader/pay/{{isIos ? 'ios_banner' : 'android_banner'}}.jpg"></image>
+  </view>
+  <view wx:if="{{isIos ||  isVip}}" class="activity-buy" bindtap="myPlase">
+    <image src="http://reader-wx.ai160.com/images/reader/pay/vip_icon.png"></image>
   </view>
   <!-- 调用组件 -->
   <template is="{{templates}}" wx:if="{{myIndex === 3 || myIndex === 2}}" data="{{myData: myData,coursesData:coursesData,noMoreWork:noMoreWork}}"></template>
@@ -73,6 +76,17 @@
     <text>这里将会发生欣喜的变化。</text>
   </view>
 </view>
+<!--弹窗-->
+<view class="help-pay" hidden="{{helpPayHide}}">
+  <view class="help-pay-main" style="{{tipsType === 'tips' && 'top: 35%'}}">
+    <view wx:if="{{ tipsType === 'helpPay'}}" bindtap="payAndHelp">
+        <view class="pay-price" wx:if="{{payPrice}}">{{payPrice}}<text>元</text></view>
+        <image  class="help-pay-icon" src="{{helpPayImg}}"></image>
+    </view>
+    <image wx:else class="tips-icon" src="{{tipsImg}}" bindtap="tips"></image>
+    <image class="help-close" bindtap="helpPayHideEvent" src="../../static/image/close.png"></image>
+  </view>
+</view>
 <!-- <MyToast /> -->
 <view hidden="{{hide}}">
   <Dialog bindmyevent="jurisdiction" />

+ 34 - 3
pages/index/index.wxss

@@ -49,7 +49,18 @@
   width: 100%;
   height: 100%;
 }
-
+.activity-buy {
+  position: fixed;
+  right: 17rpx;
+  bottom: 300rpx;
+  width: 148rpx;
+  height: 149rpx;
+  z-index: 999;
+}
+.activity-buy image {
+  width: 100%;
+  height: 100%;
+}
 .no_follow {
   display: flex;
   width: 100%;
@@ -408,7 +419,8 @@
 .change_grade .change_brage_wrapper .change_item_blank{
   background: #ffffff !important;
 }
-.upgrade {
+.upgrade,
+.help-pay {
   position: fixed;
   left: 0;
   top: 0;
@@ -417,6 +429,7 @@
   background: rgba(0, 0, 0, .75);
   z-index:9999;
 }
+.help-pay-main,
 .upgrade-main {
   position: absolute;
   left: 50%;
@@ -427,7 +440,15 @@
   width: 562rpx;
   height: 789rpx;
 }
-.close {
+.help-pay-icon {
+  width: 570rpx;
+  height: 747rpx;
+}
+.tips-icon {
+  width: 570rpx;
+  height: 390rpx;
+}
+.help-close {
   position: absolute;
   left: 50%;
   transform: translateX(-50%);
@@ -435,3 +456,13 @@
   width: 65rpx;
   height: 65rpx;
 }
+.pay-price {
+  position: absolute;
+  bottom: 65rpx;
+  left: 88rpx;
+  color: #FFFFFF;
+  font-size: 49rpx;
+}
+.pay-price  text {
+  font-size: 30rpx;
+}

+ 120 - 27
pages/reading/reading.js

@@ -1,6 +1,7 @@
 import httpRequestApi from '../../utils/APIClient';
 const aiengine = require('../../utils/ChivoxAiEngine')
 const sha1 = require('../../utils/sha1');
+const app = getApp()
 
 import {
     formatDate
@@ -45,7 +46,11 @@ Page({
             title: "小学语文朗读配音", //标题
         },
         isScroll: true,
-        noMoreWork: false
+        noMoreWork: false,
+        authHide: true,
+        authImg: '',
+        isIOS: app.globalData.isIOS,
+        payPrice: ''
     },
     onLoad: function (option) {
         console.log(option);
@@ -241,34 +246,50 @@ Page({
     audioRecord: function () {
 
         console.log('111111111111111recordFlag', this.data.recordFlag)
-        if (this.recorderManager) {
-            this.recorderManager.stop();
-        }
-        if (this.innerAudioContext) {
-            this.innerAudioContext.stop();
-        }
-        if (this.data.recordFlag === 0) {
-            this.wsEngine = aiengine.createWsEngine({});
-            this.wsEngine.onResult(res => {
-                wx.hideLoading();
-                this.getRecordScore(res)
-            })
-            this.wsEngine.onErrorResult(res => {
-                wx.hideLoading();
-                console.log('驰声createWsEngine失败', res);
-            })
-            this.videoComplete();
-            // this.getMicAuth()
-            return;
-        }
-        // 录音结束后
-        if (this.data.recordFlag === 1) {
-            wx.showLoading({
-                title: '作品转码中',
-                mask: true
+        // 判断是否有权限朗读
+        const isVip = wx.getStorageSync('vip');
+        if (!isVip) {
+            const imgName = this.data.isIOS ? 'ios_read' : 'android_read';
+            if(!this.data.isIOS) {
+                this.setData({
+                    payPrice: wx.getStorageSync('price')
+                })
+            }
+            this.setData({
+                authHide: !this.data.authHide,
+                authImg: `http://reader-wx.ai160.com/images/reader/pay/${imgName}.png`
             })
-            this.recordStop();
+        } else {
+            if (this.recorderManager) {
+                this.recorderManager.stop();
+            }
+            if (this.innerAudioContext) {
+                this.innerAudioContext.stop();
+            }
+            if (this.data.recordFlag === 0) {
+                this.wsEngine = aiengine.createWsEngine({});
+                this.wsEngine.onResult(res => {
+                    wx.hideLoading();
+                    this.getRecordScore(res)
+                })
+                this.wsEngine.onErrorResult(res => {
+                    wx.hideLoading();
+                    console.log('驰声createWsEngine失败', res);
+                })
+                this.videoComplete();
+                // this.getMicAuth()
+                return;
+            }
+            // 录音结束后
+            if (this.data.recordFlag === 1) {
+                wx.showLoading({
+                    title: '作品转码中',
+                    mask: true
+                })
+                this.recordStop();
+            }
         }
+
     },
     // 录音开始
     /**
@@ -831,5 +852,77 @@ Page({
         this.setData({
             [str]: this.data.videoList[e.detail.index].shareAmount + 1
         })
+    },
+    // 去鉴权
+    goToAuth() {
+      if (!wx.getStorageSync('message')) {
+        wx.requestSubscribeMessage({
+            tmplIds: ['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY',
+                '-2ZZpWFoyKvAtX1HwEIQLQ92LnN8cryamB94LqLGo98'],
+            success: (res) => { 
+                console.log(res)
+                if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'reject') {
+                    console.log('用户不同意订阅')
+                    wx.setStorageSync('message', false)
+                } else if(res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'accept') {
+                    console.log('订阅成功')
+                    wx.setStorageSync('message', true)
+                }
+                this.userAuth()
+            },
+            fail: () => {
+                this.userAuth()
+            }
+          })
+      } else {
+        this.userAuth()
+      }
+
+    },
+    userAuth() {
+        if(this.data.isIOS) {
+            wx.navigateTo({
+                url: `../vipActivity/vipActivity`
+              });
+        } else {
+            const productId = wx.getStorageSync('productId');
+            httpRequestApi.createOrder(productId).success(res => {
+              console.log(res.data.data.package);
+              const timeStamp = res.data.data.timeStamp;
+              const nonceStr = res.data.data.nonceStr;
+              const packages = res.data.data.package;
+              const paySign = res.data.data.sign;
+              wx.requestPayment({
+                timeStamp,
+                nonceStr,
+                package: packages,
+                signType: 'MD5',
+                paySign,
+                success: (res) => {
+                    this.setData({
+                        authHide: !this.data.authHide
+                    })
+                    httpRequestApi.getAuthActivity().success(res => {
+                    if (!res.data.data) {
+                        wx.setStorageSync('vip', false)
+                        wx.setStorageSync('date', '')
+                    } else {
+                        wx.setStorageSync('vip', true)
+                        wx.setStorageSync('date', res.data.data)
+                    }
+                    }).fail(error => {
+                        console.log(error)
+                    })
+                },
+                fail (res) { }
+              })
+            })
+        }
+        this.hideAuth();
+    },
+    hideAuth() {
+        this.setData({
+            authHide: !this.data.authHide
+        })
     }
 })

+ 14 - 0
pages/reading/reading.wxml

@@ -119,4 +119,18 @@
         <image class="close_icon" src="../../static/index/close.png" />
     </view>
 </view>
+<view class="auth" hidden="{{authHide}}">
+  <view class="auth-main">
+    <image class="auth-icon" src="{{authImg}}" bindtap="goToAuth"></image>
+    <view class="auth-price" wx:if="{{payPrice}}">
+         <view class="price">
+            <text >{{payPrice}}</text>元/月
+          </view>
+          <view class="flase-price">
+            原价:29.9元/月
+          </view>
+    </view>
+    <image class="auth-close" bindtap="hideAuth" src="../../static/image/close.png"></image>
+  </view>
+</view>
 <flowerBox id="flower-toast" flowerNum="{{flowerNum}}" />

+ 49 - 0
pages/reading/reading.wxss

@@ -255,4 +255,53 @@ audio {
     height: 17.6rpx;
     background: #cda069;
     margin-right: 30rpx;
+}
+.auth {
+  position: fixed;
+  left: 0;
+  top: 0;
+  width: 100%;
+  height: 100%;
+  background: rgba(0, 0, 0, .75);
+  z-index:9999;
+}
+.auth-main {
+  position: absolute;
+  left: 50%;
+  top: 14%;
+  transform: translate(-50%, 0);
+}
+.auth-main .auth-price {
+    position: absolute;
+    left: 125rpx;
+    bottom: 64rpx;
+}
+.auth-main .price {
+    color: #fff;
+    font-size: 30rpx;
+    width: 160rpx;
+    text-align: end;
+    font-weight: 500;
+  }
+  .auth-main .price text {
+    font-size: 45rpx;
+  }
+  .auth-main .flase-price {
+    margin-left: 25rpx;
+    font-size: 15rpx;
+    text-decoration: line-through;
+    font-weight: 500;
+    color: #fff;
+  }
+.auth-icon {
+  width: 662rpx;
+  height: 591rpx;
+}
+.auth-close {
+  position: absolute;
+  left: 50%;
+  transform: translateX(-50%);
+  bottom: -100rpx;
+  width: 65rpx;
+  height: 65rpx;
 }

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

@@ -1,6 +1,6 @@
 <!-- <StatusBar receiveData="{{statusbarobj}}" grade="{{grade}}" bindgradeTap="gradeTap" /> -->
 
-<view style="background:#f7f7f7;margin-top:-30rpx;">
+<view style="background:#f7f7f7;margin-top:-30rpx;height: 100%">
   <view class="avatarBox" name="avatar" value="user.avatar">
     <image src="{{user.avatar}}" bindtap="changeAvatar" class="avatarImage" />
     <view class="avatar-text" bindtap="changeAvatar">

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

@@ -190,7 +190,7 @@ radio .wx-radio-input.wx-radio-input-checked{
 }
 
 .submit-btn{
-  margin-top: 392rpx;
+  margin-top: 92rpx;
   width: 716rpx;
   height: 200rpx;
   display: flex;

+ 132 - 0
pages/vipActivity/vipActivity.js

@@ -0,0 +1,132 @@
+// pages/vipActivity/vipActivity.js
+import httpRequestApi from '../../utils/APIClient';
+const app = getApp()
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    peopleNumData: [],
+    isIOS: app.globalData.isIOS,
+    date: ''
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.getVipData();
+    this.getHelp();
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+    this.getVipData();
+    this.getHelp();
+    wx.showNavigationBarLoading() //在标题栏中显示加载
+    //模拟加载
+    setTimeout(function () {
+      wx.hideNavigationBarLoading() //完成停止加载
+      wx.stopPullDownRefresh() //停止下拉刷新
+    }, 1000);
+  },
+  /**
+   * 点击分享e
+   */
+   shareRead(e) {
+    this.triggerEvent('openShare', e)
+    this.shareDialog = this.selectComponent("#share-dialog");
+    const user = wx.getStorageSync('user');
+    const type = this.data.isIOS ? 'ios' : 'iphone';
+    const data = {
+        avatar: user.avatar,
+        name: user.wechatName,
+        uid: user.uid,
+        type,
+        path: `pages/index/index`
+    }
+    this.setData({
+        noScroll: 'noScroll'
+    })
+    this.shareDialog.share(data);
+   },
+   onShareAppMessage: function (res) {
+    if (res.from === 'button') {
+      const type = this.data.isIOS ? 'ios' : 'iphone';
+      const user = wx.getStorageSync('user');
+      return {
+        title: `${user.wechatName}邀请你一起来朗读课文`,
+        path: `/pages/index/index?type=${type}&uid=${user.uid}`,
+        imageUrl: 'http://reader-wx.ai160.com/images/reader/pay/share_read_bg.png'
+      }
+    }
+  },
+  // 获取会员信息
+  getVipData() {
+    httpRequestApi.getAuthActivity().success(res => {
+      if (!res.data.data) {
+        wx.setStorageSync('vip', false)
+        wx.setStorageSync('date', '')
+      } else {
+        wx.setStorageSync('vip', true)
+        wx.setStorageSync('date', res.data.data)
+        this.setData({
+          date: res.data.data
+        })
+      }
+    }).fail(error => {
+      console.log(error)
+    })
+  },
+  // 获取帮助的人
+  getHelp() {
+    if (this.data.isIOS) {
+      httpRequestApi.getHelpNum().success(res => {
+        this.setData({
+          peopleNumData: res.data.data.list
+        })
+      }).fail(error => {
+        console.log(error)
+      })
+    } else {
+      httpRequestApi.getOrderNum().success(res => {
+        this.setData({
+          peopleNumData: res.data.data.list
+        })
+      }).fail(error => {
+        console.log(error)
+      })
+    }
+  }
+})

+ 5 - 0
pages/vipActivity/vipActivity.json

@@ -0,0 +1,5 @@
+{
+  "usingComponents": {
+    "shareDialog": "/component/share/share"
+  }
+}

+ 38 - 0
pages/vipActivity/vipActivity.wxml

@@ -0,0 +1,38 @@
+<!--pages/vipActivity/vipActivity.wxml-->
+<wxs src="../../utils/filter.wxs" module="filters"/>
+<view class="vip-activity">
+  <view class="vip-activity-con">
+    <view class="vip-rule">
+      <image class="vip-rule-bg" src="http://reader-wx.ai160.com/images/reader/pay/{{date ? 'vip_explain' : 'no_vip'}}.png" />
+      <text class="expire-date">{{date && filters.formatDate(date) + '到期'}}</text>
+      <view class="plase-rule">
+        <text>邀请规则:</text>
+        <text class="rule-con">{{isIOS ? '每分享3位好友助力,即可获得1月朗读会员' : '邀请1位好友付费成功,即可免费获得1月朗读会员'}}</text>
+      </view>
+    </view>
+    <image class="plase-friend-bg" src="http://reader-wx.ai160.com/images/reader/pay/please_friend.png" />
+    <view class="friend" wx:if="{{peopleNumData.length > 0}}">
+      <view class="friend-title {{isIOS ? 'ios-title' : ''}}">
+        <text >好友</text>
+        <text class="name-title">昵称</text>
+        <text >{{isIOS ? '助力日期' : '会员权益'}}</text>
+      </view>
+      <view class="friend-message" wx:for="{{peopleNumData}}" wx:key="{{item.user.uid}}">
+        <image class="friend-head" src="{{item.user.avatar}}" />
+        <view class="{{isIOS ? 'ios-name' : 'name'}}">
+          <text style="font-weight: 500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{item.user.wechatName}}</text>
+          <text class="friend-date" hidden="{{isIOS}}">购买日期:{{filters.formatDate(item.orderInfo.gmtCreated)}}</text>
+        </view>
+        <text class="{{isIOS ? 'ios-friend-time' : 'friend-time'}}">{{isIOS ? filters.formatDate(item.userHelp.gmtCreated) : '+1个月'}}</text>
+      </view>
+    </view>
+    <view wx:else class="no-data">
+        <image src="http://reader-wx.ai160.com/images/reader/pay/no_one.png" />
+    </view>
+  </view>
+  <view class="vip-go-read" bindtap="shareRead">
+    <text>快喊小伙伴,一起来读课文吧!</text>
+  </view>
+</view>
+<shareDialog id="share-dialog" shareType='readActivity' bindShareDialogClose="shareDialogClose" bindaddShareAmount="addShareAmount" shareId="{{id}}" />
+<canvas canvas-id="myCanvas" style="width:300px; height: 525px; position: absolute; left: -999rpx; top: -9999rpx;"></canvas>

+ 161 - 0
pages/vipActivity/vipActivity.wxss

@@ -0,0 +1,161 @@
+/* pages/vipActivity/vipActivity.wxss */
+.vip-activity {
+  width: 100%;
+  height: 100%;
+  padding: 0 14rpx;
+  box-sizing: border-box;
+  background: #EEEEEE;
+  overflow: scroll;
+}
+.vip-activity-con {
+  width: 100%;
+  margin-bottom: 160rpx;
+}
+.vip-activity-con .vip-rule {
+  position: relative;
+  width: 100%;
+  height: 300rpx;
+  margin-top: 20rpx;
+}
+.vip-rule-bg {
+  width: 100%;
+  height: 100%;
+}
+.expire-date {
+  position: absolute;
+  left: 350rpx;
+  top: 40rpx;
+  font-size: 28rpx;
+  color: #6E4008;
+  font-weight: 500;
+}
+.plase-rule {
+  position: absolute;
+  top: 136rpx;
+  left: 46rpx;
+}
+.plase-rule text {
+  display: block;
+  font-size: 30rpx;
+  color: #FE6A00;
+}
+.plase-rule .rule-con {
+  color: #000;
+  font-size: 28rpx;
+  box-shadow: -1px 5px 5px -3px #FFE150;
+  margin-top: 20rpx;
+}
+.plase-friend-bg {
+  width: 392rpx;
+  height: 34rpx;
+  margin: 30rpx auto;
+  display: block;
+}
+.vip-activity-con .friend {
+  width: 100%;
+  background: #fff;
+  display: flex;
+  flex-direction: column;
+  border-radius: 20rpx;
+}
+.vip-activity-con .no-data {
+    margin-top: 150rpx;
+}
+.vip-activity-con .no-data image {
+  width: 263rpx;
+  height: 240rpx;
+  display: block;
+  margin: 0 auto;
+}
+
+.vip-activity-con .friend-title {
+  display: flex;
+  justify-content: space-between;
+  width: 100%;
+  padding: 0 14rpx 0 42rpx;
+  box-sizing: border-box;
+  margin: 26rpx 0;
+  font-weight: 500;
+  color: #333333;
+  font-size: 36rpx;
+}
+.vip-activity-con .ios-title {
+  padding: 0 59rpx 0 42rpx;
+}
+.vip-activity-con .friend .name-title {
+  width: 340rpx;
+}
+.vip-activity-con .ios-title .name-title {
+  width: 280rpx;
+}
+.friend-message {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  width: 100%;
+  padding: 0 37rpx 0 24rpx;
+  box-sizing: border-box;
+  margin-bottom: 30rpx;
+}
+.friend-message .friend-head {
+  width: 80rpx;
+  height: 80rpx;
+  border-radius: 50%;
+}
+.friend-message .name {
+  display: flex;
+  flex-direction: column;
+  width: 375rpx;
+}
+.friend-message .name text {
+  width: 375rpx;
+  height: 40rpx;
+  overflow:hidden;
+  text-overflow:ellipsis;
+  white-space:nowrap;
+}
+.friend-message .ios-name {
+  display: flex;
+  flex-direction: column;
+  width: 240rpx;
+  height: 40rpx;
+}
+.friend-message .friend-time {
+  font-size: 36rpx;
+  color: #FE6A00;
+}
+.friend-message .ios-friend-time {
+  font-size: 32rpx;
+  color: #333;
+}
+.friend-message .text {
+  color: #333333;
+  font-size: 36rpx;
+}
+.friend-message .friend-date {
+  color: #666;
+  font-size: 25rpx;
+}
+.vip-go-read {
+  position: fixed;
+  left: 0;
+  bottom: 0;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 100%;
+  height: 139rpx;
+  background: #fff;
+  box-shadow: 0px -5px 4px 0px rgba(0, 0, 0, 0.11);
+}
+.vip-go-read text {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 607rpx;
+  height: 80rpx;
+  background: #FF9900;
+  color: #fff;
+  font-size: 40rpx;
+  border-radius: 40rpx;
+}

+ 121 - 124
project.config.json

@@ -1,126 +1,123 @@
 {
-	"description": "项目配置文件",
-	"packOptions": {
-		"ignore": []
-	},
-	"setting": {
-		"urlCheck": true,
-		"es6": true,
-		"postcss": true,
-		"preloadBackgroundData": false,
-		"minified": true,
-		"newFeature": true,
-		"coverView": true,
-		"autoAudits": true,
-		"showShadowRootInWxmlPanel": true,
-		"scopeDataCheck": false,
-		"checkInvalidKey": true,
-		"checkSiteMap": true,
-		"uploadWithSourceMap": true,
-		"babelSetting": {
-			"ignore": [],
-			"disablePlugins": [],
-			"outputPath": ""
-		},
-		"bundle": false,
-		"useCompilerModule": false,
-		"userConfirmedUseCompilerModuleSwitch": false,
-		"useMultiFrameRuntime": true,
-		"useApiHook": true,
-		"useIsolateContext": true,
-		"userConfirmedBundleSwitch": false,
-		"packNpmManually": false,
-		"packNpmRelationList": [],
-		"minifyWXSS": true,
-		"useApiHostProcess": true
-	},
-	"compileType": "miniprogram",
-	"libVersion": "2.14.0",
-	"appid": "wx8961a3e5512f307c",
-	"projectname": "%E5%B0%8F%E5%AD%A6%E8%AF%BE%E6%96%87%E6%9C%97%E8%AF%BB%E9%85%8D%E9%9F%B3",
-	"debugOptions": {
-		"hidedInDevtools": []
-	},
-	"isGameTourist": false,
-	"simulatorType": "wechat",
-	"simulatorPluginLibVersion": {},
-	"condition": {
-		"search": {
-			"current": -1,
-			"list": []
-		},
-		"conversation": {
-			"current": -1,
-			"list": []
-		},
-		"plugin": {
-			"list": []
-		},
-		"game": {
-			"list": []
-		},
-		"gamePlugin": {
-			"list": []
-		},
-		"miniprogram": {
-			"list": [
-				{
-					"id": 0,
-					"name": "pages/vipPage/wechat/wechat",
-					"pathName": "pages/vipPage/wechat/wechat",
-					"query": "",
-					"scene": null
-				},
-				{
-					"id": 1,
-					"name": "作品",
-					"pathName": "pages/social/works/works",
-					"query": "id=1548160250807513&title=【识字1】春夏秋冬",
-					"scene": "1012"
-				},
-				{
-					"id": 2,
-					"name": "分享团",
-					"pathName": "pages/groupPage/group-details/group-details",
-					"query": "productId=1550459447432909",
-					"scene": 1012
-				},
-				{
-					"id": -1,
-					"name": "公众号进入",
-					"pathName": "pages/index/index",
-					"query": "",
-					"scene": 1020,
-					"referrerInfo": {}
-				},
-				{
-					"id": -1,
-					"name": "公众号文章进入",
-					"pathName": "pages/index/index",
-					"query": "",
-					"scene": 1058
-				},
-				{
-					"id": -1,
-					"name": "小红花兑换页面",
-					"pathName": "pages/social/prize/prize",
-					"query": "",
-					"scene": null
-				},
-				{
-					"id": -1,
-					"name": "有问题朗读页面",
-					"pathName": "pages/social/works/works",
-					"query": "id=1553402613620097&title=【课文7】怎么都快乐",
-					"scene": null
-				},
-				{
-					"id": -1,
-					"name": "活动页面",
-					"pathName": "pages/activity/index/index",
-					"scene": null
-				}
-			]
-		}
-	}
+  "description": "项目配置文件",
+  "packOptions": {
+    "ignore": []
+  },
+  "setting": {
+    "urlCheck": false,
+    "es6": true,
+    "postcss": true,
+    "preloadBackgroundData": false,
+    "minified": true,
+    "newFeature": true,
+    "coverView": true,
+    "autoAudits": false,
+    "showShadowRootInWxmlPanel": true,
+    "scopeDataCheck": false,
+    "checkInvalidKey": true,
+    "checkSiteMap": true,
+    "uploadWithSourceMap": true,
+    "useMultiFrameRuntime": false,
+    "useApiHook": true,
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
+    },
+    "bundle": false,
+    "useIsolateContext": true,
+    "useCompilerModule": false,
+    "userConfirmedUseCompilerModuleSwitch": false,
+    "packNpmManually": false,
+    "packNpmRelationList": [],
+    "minifyWXSS": true
+  },
+  "compileType": "miniprogram",
+  "libVersion": "2.16.0",
+  "appid": "wx8961a3e5512f307c",
+  "projectname": "%E5%B0%8F%E5%AD%A6%E8%AF%BE%E6%96%87%E6%9C%97%E8%AF%BB%E9%85%8D%E9%9F%B3",
+  "debugOptions": {
+    "hidedInDevtools": []
+  },
+  "isGameTourist": false,
+  "simulatorType": "wechat",
+  "simulatorPluginLibVersion": {},
+  "condition": {
+    "plugin": {
+      "list": []
+    },
+    "game": {
+      "list": []
+    },
+    "gamePlugin": {
+      "list": []
+    },
+    "miniprogram": {
+      "list": [
+        {
+          "id": 0,
+          "name": "pages/vipPage/wechat/wechat",
+          "pathName": "pages/vipPage/wechat/wechat",
+          "query": "",
+          "scene": null
+        },
+        {
+          "id": 1,
+          "name": "作品",
+          "pathName": "pages/social/works/works",
+          "query": "id=1548160250807513&title=【识字1】春夏秋冬",
+          "scene": "1012"
+        },
+        {
+          "id": 2,
+          "name": "分享团",
+          "pathName": "pages/groupPage/group-details/group-details",
+          "query": "productId=1550459447432909",
+          "scene": 1012
+        },
+        {
+          "id": -1,
+          "name": "公众号进入",
+          "pathName": "pages/index/index",
+          "query": "",
+          "scene": 1020,
+          "referrerInfo": {}
+        },
+        {
+          "id": -1,
+          "name": "公众号文章进入",
+          "pathName": "pages/index/index",
+          "query": "",
+          "scene": 1058
+        },
+        {
+          "id": -1,
+          "name": "小红花兑换页面",
+          "pathName": "pages/social/prize/prize",
+          "query": "",
+          "scene": null
+        },
+        {
+          "id": -1,
+          "name": "有问题朗读页面",
+          "pathName": "pages/social/works/works",
+          "query": "id=1553402613620097&title=【课文7】怎么都快乐",
+          "scene": null
+        },
+        {
+          "id": -1,
+          "name": "活动页面",
+          "pathName": "pages/activity/index/index",
+          "query": "",
+          "scene": null
+        },
+        {
+          "name": "pages/vipActivity/vipActivity",
+          "pathName": "pages/vipActivity/vipActivity",
+          "query": "",
+          "scene": null
+        }
+      ]
+    }
+  }
 }

+ 60 - 0
utils/APIClient.js

@@ -593,5 +593,65 @@ module.exports = {
     }).data({
       readId
     }).url(url).method('POST').send();
+  },
+  /**团购活动 */
+  // 获取商品信息
+  getProductActivity() {
+    let url = getBaseUrl('product')
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid'),
+    }).url(url).method('GET').send();
+  },
+  // 获取权限
+  getAuthActivity() {
+    let url = getBaseUrl('auth')
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid'),
+    }).url(url).method('GET').send();
+  },
+  // 创建订单
+  createOrder(productId) {
+    let url = getBaseUrl('order')
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid'),
+    }).url(url).data({
+      productId
+    }).method('POST').send();
+  },
+  // 安卓获取购买人
+  getOrderNum() {
+    let url = getBaseUrl('order/helpList')
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid'),
+    }).url(url).method('GET').send();
+  },
+  // 苹果获取参团人
+  getHelpNum() {
+    let url = getBaseUrl('userHelp')
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid'),
+    }).url(url).method('GET').send();
+  },
+  // ios助力
+  postUserHelp() {
+    let url = getBaseUrl('userHelp')
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid'),
+    }).url(url).method('POST').send();
+  },
+  // 分享二维码
+  getqrCodeShare(data) {
+    let url = getBaseUrl(`wx/qrCode/share?page=${data.page}&type=${data.type}`)
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid'),
+    }).url(url).method('GET').send();
+  },
+  // 通过二维码获取分享过来的id
+  getUserRec(sid) {
+    let url = getBaseUrl(`wx/user/sid?sid=${sid}`)
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid'),
+    }).url(url).method('GET').send();
   }
 }
+

+ 2 - 2
utils/const.js

@@ -5,6 +5,6 @@ module.exports = {
   productApi:  'https://reader-test.efunbox.cn/readerProduct/',
   // baseApi: 'https://reader.lingjiao.cn/readerBase/'
   // baseApi: 'https://readertest.lingjiao.cn:442/readerBase/'
-  baseApi: 'https://reader-api.ai160.com/'
-  // baseApi: 'https://reader-api.efunbox.cn/'
+  // baseApi: 'https://reader-api.ai160.com/'
+  baseApi: 'https://reader-api.efunbox.cn/'
 }

+ 18 - 0
utils/filter.wxs

@@ -0,0 +1,18 @@
+var formatNumber = function (n) {
+  n = n.toString()
+  return n[1] ? n : '0' + n
+}
+/**
+ * 将时间戳(1570550400)格式转为 yyyy-MM-dd格式
+ */
+var formatDate = function (datetime) {
+  var time = datetime * 1
+  var date = getDate(time);
+  var year = date.getFullYear();
+  var month = date.getMonth() + 1;
+  var day = date.getDate();
+  return year + '年' + month + '月' + day + '日';
+}
+module.exports = {
+  formatDate: formatDate
+}