bayi пре 2 година
родитељ
комит
4607f7aad0

+ 2 - 0
api/global.js

@@ -4,6 +4,8 @@ import {
 module.exports = {
   //获取充值配置信息
   getProducts: data => request('/v3/product', 'get', data),
+  // 领取代金卷
+  getVoucher: data => request('/v3/activity/voucher', 'post', data),
   // 获取任务配置
   getTasks: data => request('/v3/task', 'get', data),
   // 提交任务

+ 11 - 4
components/activityList/index.js

@@ -7,7 +7,7 @@ Component({
    * 组件的初始数据
    */
   data: {
-    //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章
+    //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章,7年包红包8,次数红包
     type: '4',
     activityList: [],
     dsqList: []
@@ -109,9 +109,16 @@ Component({
         })
       }
     },
-    drawVoucher() {
-      console.log(this.selectComponent('#voucher'));
-      this.selectComponent('#voucher').open()
+    drawVoucher({
+      currentTarget
+    }) {
+      let info = currentTarget.dataset.info
+      this.selectComponent('#voucher').open({
+        type: info.type,
+        id: info.id,
+        voucherType: info.voucherType,
+        preferential: info.price
+      })
     }
   }
 })

+ 7 - 0
components/activityList/index.less

@@ -299,6 +299,13 @@
       background-color: #EBEBEB;
     }
 
+    .cover-small {
+      width: 100%;
+      height: 260rpx;
+      border-radius: 20rpx;
+      background-color: #EBEBEB;
+    }
+
     .footer {
       display: flex;
       align-items: center;

+ 19 - 26
components/activityList/index.wxml

@@ -1,34 +1,8 @@
 <wxs src="../../utils/filter.wxs" module="filters" />
 <view class="activityList">
-  <!-- <view class="activityBox">
-    <image src="" class="cover" />
-    <view class="footer">
-      <view class="info">
-        <view class="title">标题</view>
-        <view class="time">{{filters.formatDate(item.startTime,2)}}—{{filters.formatDate(item.endTime,2)}}
-        </view>
-        <view class="timeOut {{item.second=='00'?'closing':''}}" wx:if="{{item.second}}">距活动结束:
-          <view class="outNum">{{item.hour}}</view>
-          <view class="outSplit">:</view>
-          <view class="outNum">{{item.minute}}</view>
-          <view class="outSplit">:</view>
-          <view class="outNum">{{item.second}}</view>
-        </view>
-      </view>
-      <view class="btn {{item.second=='00'?'closingBtn':''}}" bindtap="drawVoucher">立即领取</view>
-    </view>
-  </view> -->
   <block wx:for="{{activityList}}" wx:key="id">
     <view class="activityBox" wx:if="{{item.bannerType==1}}" bindtap="activityEvent" data-info="{{item}}">
       <image src="{{item.icon}}" class="cover" />
-      <!--  <view class="footer">
-        <view class="info">
-          <view class="title">{{item.title}}</view>
-          <view class="time">{{filters.formatDate(item.startTime,2)}}—{{filters.formatDate(item.endTime,2)}}
-          </view>
-        </view>
-        <view class="btn">立即参与</view>
-      </view> -->
     </view>
     <view class="ranking-class-1 {{item.type=='2'?'yxb':item.type=='3'?'rbb':'pkb'}}" wx:if="{{item.bannerType==2}}">
       <view class="header">
@@ -101,6 +75,25 @@
         </view>
       </view>
     </view>
+    <view class="activityBox" wx:if="{{item.bannerType==4}}">
+      <image src="{{item.icon}}" class="cover-small " />
+      <view class="footer">
+        <view class="info">
+          <view class="title">{{item.title}}</view>
+          <view class="time">{{filters.formatDate(item.startTime,2)}}—{{filters.formatDate(item.endTime,2)}}
+          </view>
+          <view class="timeOut {{item.second=='00'?'closing':''}}" wx:if="{{item.second}}">距活动结束:
+            <view class="outNum">{{item.hour}}</view>
+            <view class="outSplit">:</view>
+            <view class="outNum">{{item.minute}}</view>
+            <view class="outSplit">:</view>
+            <view class="outNum">{{item.second}}</view>
+          </view>
+        </view>
+        <view class="btn {{item.second=='00'?'closingBtn':''}}" data-info='{{item}}' bindtap="drawVoucher">立即领取
+        </view>
+      </view>
+    </view>
   </block>
 </view>
 <Voucher id="voucher" />

+ 6 - 0
components/activityList/index.wxss

@@ -244,6 +244,12 @@
   border-radius: 20rpx;
   background-color: #EBEBEB;
 }
+.activityList .activityBox .cover-small {
+  width: 100%;
+  height: 260rpx;
+  border-radius: 20rpx;
+  background-color: #EBEBEB;
+}
 .activityList .activityBox .footer {
   display: flex;
   align-items: center;

+ 5 - 6
components/readingTips/index.wxml

@@ -1,12 +1,11 @@
 <view class="half-screen">
   <!--屏幕背景变暗的背景  -->
-  <view class="background_screen" bindtap="hideModal"></view>
+  <view class="background_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view>
   <!--弹出框  -->
-  <!--  wx:if="{{showModalStatus}}" -->
-  <view animation="{{animationData}}" class="attr_box">
+  <view animation="{{animationData}}" class="attr_box" wx:if="{{showModalStatus}}">
     <image class="share_cancel" bindtap="hideModal" src="/static/lollipop.png"></image>
     <!-- 支付 -->
-    <view class="payBox">
+    <view class="payBox" wx:if="{{!isIos}}">
       <view class="title">
         付费购
       </view>
@@ -32,10 +31,10 @@
         </view>
       </view>
     </view>
-    <view class="bindNumber">
+    <!--     <view class="bindNumber">
       <view class="desc">绑定手机号赠送7天VIP</view>
       <view class="bindBtn">立即绑定</view>
-    </view>
+    </view> -->
     <!-- 剩余使用次数 -->
     <view class="surplus">
       <view class="title">剩余使用次数:</view>

+ 57 - 8
components/voucher/index.js

@@ -2,6 +2,10 @@ import {
   buyVip,
   buyNum,
 } from '~/api/user'
+import {
+  getProducts,
+  getVoucher
+} from '~/api/global'
 Component({
   /**
    * 组件的属性列表
@@ -14,16 +18,40 @@ Component({
    * 组件的初始数据
    */
   data: {
-    state: false
+    state: false,
+    // 红包类型
+    type: '',
+    // 优惠金额
+    preferential: '',
+    productVip: 0,
+    productNum: 0,
+    // 红包id
+    id: '',
+    voucherType: ''
+  },
+  pageLifetimes: {
+    show() {
+      this.getProducts()
+    },
   },
-
   /**
    * 组件的方法列表
    */
   methods: {
-    open() {
+    open(data) {
+      let {
+        type,
+        id,
+        voucherType,
+        preferential
+      } = data
+      console.log(data);
       this.setData({
-        state: true
+        state: true,
+        type,
+        id,
+        voucherType,
+        preferential
       })
     },
     close() {
@@ -31,11 +59,32 @@ Component({
         state: false
       })
     },
+    async getProducts() {
+      let products = await getProducts()
+      let productVip = products.find(item => {
+        return item.type == 1
+      })
+      let productNum = products.find(item => {
+        return item.type == 2
+      })
+      console.log(productVip,
+        productNum);
+      this.setData({
+        productVip,
+        productNum
+      })
+    },
+    async getVoucher() {
+      console.log('zz');
+      if (!this.data.voucherType) {
+        await getVoucher({
+          id: this.data.id
+        })
+      }
+      this.toBuy()
+    },
     //购买vip和购买次数不是一个接口 type 1001是vip,1010是次数
-    async toBuy({
-      currentTarget
-    }) {
-      let productId = currentTarget.dataset.type
+    async toBuy(productId) {
       wx.showLoading({
         title: '提交中',
         mask: true

+ 2 - 2
components/voucher/index.less

@@ -5,11 +5,11 @@
   left: 0px;
   top: 0px;
   background-color: rgba(0, 0, 0, 0.35);
-  z-index: 10;
+  z-index:999;
 
   .voucher {
     position: relative;
-    margin: 340rpx auto 0px;
+    margin: 400rpx auto 0px;
     width: 630rpx;
     height: 694rpx;
     padding: 30rpx;

+ 7 - 6
components/voucher/index.wxml

@@ -2,7 +2,7 @@
   <view class="voucher">
     <view class="body">
       <view class="title" style="margin-top: 24rpx;">
-        恭喜您获得5元抵用卷
+        恭喜您获得{{preferential/100}}元抵用卷
       </view>
       <view class="title" style="margin:26rpx 0rpx 50rpx;">
         快去使用
@@ -10,19 +10,20 @@
       <image src="/static/hongbao.png" class="hongbao" />
       <view class="info">
         <view class="row">
-          <view class="row-left">现价:10元</view>
+          <view class="row-left">现价:{{(type=='7'?productVip.price-preferential:productNum.price-preferential)/100}}元
+          </view>
           <view class="row-right">
-            <image src="/static/hongbao.png" class="hongbao-mini" />-5
+            <image src="/static/hongbao.png" class="hongbao-mini" />-{{preferential/100}}
           </view>
         </view>
         <view class="row" style="margin-top: 14rpx;">
-          <view class="row-left oldMoney">原价:20元</view>
+          <view class="row-left oldMoney">原价:{{(type=='7'?productVip.price:productNum.price)/100}}元</view>
           <view class="row-right newMoney">
-            实际支付15
+            实际支付{{(type=='7'?productVip.price-preferential:productNum.price-preferential)/100}}
           </view>
         </view>
       </view>
-      <view class="btn" catchtap="toBuy">领取使用</view>
+      <view class="btn" catchtap="getVoucher">领取使用</view>
       <view class="tips">领取后在24小时内使用,过期作废</view>
     </view>
     <image src="/static/lollipop.png" class="close" catchtap="close" />

+ 2 - 2
components/voucher/index.wxss

@@ -5,11 +5,11 @@
   left: 0px;
   top: 0px;
   background-color: rgba(0, 0, 0, 0.35);
-  z-index: 10;
+  z-index: 999;
 }
 .voucherBox .voucher {
   position: relative;
-  margin: 340rpx auto 0px;
+  margin: 400rpx auto 0px;
   width: 630rpx;
   height: 694rpx;
   padding: 30rpx;

+ 1 - 1
pages/index/index.js

@@ -113,7 +113,7 @@ Page({
     }
   },
   onReachBottom() {
-    this.loadMore()
+    console.log('zzz');
   },
   async getCategoryList() {
     let grade = this.data.userInfo.grade

+ 2 - 2
pages/my/index.wxml

@@ -35,11 +35,11 @@
     <view class="below sectionBoxs">
       <view class="sBox" bindtap='jump' data-url="/pages/follow/index">
         <image class="img" src="/static/concern.png" mode="" />
-        <text class="title">朋友 {{1234}}</text>
+        <text class="title">朋友</text>
       </view>
       <view class="sBox" bindtap='jump' data-url="/pages/userWorks/index">
         <image class="img" src="/static/work.png" mode="" />
-        <text class="title">作品 {{1234}}</text>
+        <text class="title">作品</text>
       </view>
       <view class="sBox" bindtap='jump' data-url="/pages/notice/index">
         <!-- <view class="noticeTips">31</view> -->

+ 9 - 0
pages/ranking/index.js

@@ -8,6 +8,9 @@ Page({
   data: {
     ranking: '',
     userList: [],
+    currentWeek: 0,
+    weekBegin: '',
+    weekEnd: '',
     //2:邀新榜,3:热播榜,4:挑战pk榜
     rankingType: '',
     icon: '',
@@ -35,6 +38,9 @@ Page({
     let {
       ranking,
       userList,
+      currentWeek,
+      weekBegin,
+      weekEnd,
       title,
       explain
     } = await getRankingData(id)
@@ -44,6 +50,9 @@ Page({
     this.setData({
       ranking,
       userList,
+      currentWeek,
+      weekBegin,
+      weekEnd,
       explain
     })
   },

+ 4 - 0
pages/ranking/index.wxml

@@ -1,5 +1,9 @@
 <view class="rankingBox">
   <view class="podiumBox {{podiumBoxBg}}">
+    <view class="dateBox">
+      <text class="dataTitle">第一期</text>
+      <text class="interval">{{weekBegin+'-'+weekEnd}}</text>
+    </view>
     <view class="podiumContent">
       <view class="user first">
         <image src="{{userList[0].avatar}}" class="avatar" bindtap="jumpUserInfo" data-uid='{{userList[0].uid}}' />