Преглед изворни кода

活动作品限时免费功能

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

Разлика између датотеке није приказан због своје велике величине
+ 22 - 20
api/global.js


+ 0 - 1
api/works.js

@@ -29,7 +29,6 @@ module.exports = {
   //查询某作品的所有用户作品
   getUserReadByExampleId: data => request('/userRead/userReadByExampleId', 'get', data),
   // 分享时调用,判断分享作品是不是活动作品
-  // wx/activityJoinRead/isActivityRead/{readId}2月17日 16:52
   isActivityWork: data => request(`/activityJoinRead/isActivityRead/${data}`, 'get'),
 }
 

+ 6 - 7
components/activityList/index.js

@@ -115,7 +115,7 @@ Component({
         activityEvent({
             currentTarget
         }) {
-            //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章
+            //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章,9:邀新
             let {
                 type,
                 id,
@@ -137,12 +137,11 @@ Component({
                     url: `/pages/ranking/index?id=${id}&type=${type}`,
                 })
             }
-
-        },
-        jumpInvite() {
-            wx.navigateTo({
-                url: "/pages/invite/index",
-            })
+            if (type == 9) {
+                wx.navigateTo({
+                    url: "/pages/invite/index",
+                })
+            }
         },
         drawVoucher({
             currentTarget

+ 1 - 2
components/activityList/index.wxml

@@ -1,9 +1,8 @@
 <wxs src="../../utils/filter.wxs" module="filters" />
 <view class="activityList">
-
     <block wx:for="{{activityList}}" wx:key="id">
         <!-- 邀新活动 -->
-        <view class="newActivityBox" bindtap="jumpInvite" wx:if="{{item.type==9}}">
+        <view class="newActivityBox" data-info="{{item}}" bindtap="activityEvent" wx:if="{{item.type==9}}">
             <image src="{{item.icon}}" class="cover" />
             <view class="footer">
                 <view class="row">

+ 14 - 4
pages/match/index.js

@@ -7,6 +7,7 @@ import {
 import {
     getModelTexts,
     getReadRanking,
+    getActivityInfo,
     getSelfReadRanking
 } from '~/api/global'
 import {
@@ -17,7 +18,6 @@ import {
 } from 'mobx-miniprogram-bindings'
 import share from '~/mixins/share'
 Page({
-    // behaviors: [share],
     /**
      * 页面的初始数据
      */
@@ -29,16 +29,26 @@ Page({
         modelList: [],
         myActivityUser: {},
         activityId: '',
-        bannerList: []
+        bannerList: [],
+        //1是收费0是免费
+        free: 1
     },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-        // console.log(decodeURIComponent(options.scene));
+        console.log(options);
         this.setData({
             activityId: options.activityId
         })
+        getActivityInfo(options.activityId).then(res => {
+            let {
+                free
+            } = res
+            this.setData({
+                free
+            })
+        })
         this.getLocUserInfo()
         if (Object.keys(this.data.userInfo).length > 0) {
             this.reload()
@@ -102,7 +112,7 @@ Page({
         target
     }) {
         wx.navigateTo({
-            url: `/pages/reading/index?videoId=${target.dataset.id}&activityId=${this.data.activityId}&readingType=readMatch&autoPlay=true&free=true`
+            url: `/pages/reading/index?videoId=${target.dataset.id}&activityId=${this.data.activityId}&readingType=readMatch&autoPlay=true&free=${this.data.free}`
         })
     },
     jumpUserInfo({

+ 4 - 4
pages/reading/index.js

@@ -70,8 +70,8 @@ Page({
         },
         // 朗读赛的id
         activityId: '',
-        // 是否免
-        free: false,
+        // 0免费1收
+        free: 1,
         isVip: false
     },
     onLoad(options) {
@@ -95,7 +95,7 @@ Page({
             readingType: options.readingType || 'public',
             uploadHide: options.uploadHide,
             activityId: options.activityId || '',
-            free: options.free || false
+            free: Number(options.free)
         })
         // 手工绑定 
         this.storeBindings = createStoreBindings(this, {
@@ -237,7 +237,7 @@ Page({
     },
     // 开始录制
     setCountDown() {
-        if (!this.data.isVip && !this.data.free) {
+        if (!this.data.isVip && !!this.data.free) {
             this.resetReading()
             return this.selectComponent('#buyVip').open({
                 isVip: this.data.isVip

+ 1 - 1
pages/reading/index.wxml

@@ -114,7 +114,7 @@
     <view class="controller">
         <!--     <image wx:else src="/static/work.png" class="playImg" bindtap="eeeeee" /> -->
         <view class="workBox">
-            <view class="vipLogo" wx:if="{{!isVip}}">{{!free?'VIP':'限免'}}</view>
+            <view class="vipLogo" wx:if="{{!isVip}}">{{!free?'限免':'VIP'}}</view>
             <image wx:if="{{state}}" src="/static/readingNow.gif" class="readingNow" bindtap="setCountDown" />
             <image wx:else src="/static/work.png" class="playImg" bindtap="setCountDown" />
         </view>