1
1
<template >
2
2
<view class =" wrapper" >
3
+ <u-popup v-model =" show" mode =" center" width =" 61%" height =" 38%" border-radius =" 25" closeable =true close-icon-color =" red" >
4
+ <view class =" popup" >
5
+ <text class =" popup-more-text" >
6
+ 敲黑板!
7
+ </text >
8
+ <text class =" popup-more-text-desc" >
9
+ 您已经帮助过{{inviteNum}}个好友,如果想再次助力,请完成【看视频助力】任务
10
+ </text >
11
+ <image class =" popup-bg" src =" https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-fcrle97u1myh788c20/6dd525a0-5fa5-11eb-8d54-21c4ca4ce5d7.png" ></image >
12
+ </view >
13
+ </u-popup >
14
+
3
15
<view class =" cover" >
4
16
<image :src =" coverDetail.pic" mode =" " class =" cover-img" ></image >
5
17
</view >
6
18
<ad :unit-id =" ad.two" ad-type =" grid" grid-opacity =" 0.8" grid-count =" 5" ad-theme =" white" v-if =" ad.two" ></ad >
7
19
<view class =" func" >
8
- <button plain class =" func-btn" bindtap =" lookAd" data-type =" 1" v-if =" coverDetail. lookinviteVideoLockNum > 0" >
9
- <image src =" /static/share .png" mode =" " class =" func-btn-img" ></image >
10
- 继续帮好友助力({{lockEdInfo.lookInviteVideoLockNum}}/{{coverDetail.lookInviteVideoLockNum}} )
20
+ <button plain class =" func-btn" @tap =" lookAd" data-type =" 1" v-if =" lookinviteVideoLockNum > 0" >
21
+ <image src =" /static/video .png" mode =" " class =" func-btn-img" ></image >
22
+ 看视频助力(再看{{lookinviteVideoLockNum}}个 )
11
23
</button >
12
24
<button plain class =" func-btn" open-type =" share" v-if =" coverDetail.inviteLockNum > 0" >
13
25
<image src =" /static/share.png" mode =" " class =" func-btn-img" ></image >
14
26
邀请好友领取({{lockEdInfo.inviteLockNum}}/{{coverDetail.inviteLockNum}})
15
27
</button >
16
- <button plain class =" func-btn" bindtap =" lookAd" data-type =" 2" v-if =" coverDetail.lookVideoLockNum > 0" >
28
+ <button plain class =" func-btn" @tap =" lookAd" data-type =" 2" v-if =" coverDetail.lookVideoLockNum > 0" >
17
29
<image src =" /static/video.png" mode =" " class =" func-btn-img" ></image >
18
30
观看视频领取({{lockEdInfo.lookVideoLockNum}}/{{coverDetail.lookVideoLockNum}})
19
31
</button >
20
32
<button plain class =" func-btn success" @click =" openModal" v-if =" lockEdInfo.isLocked" >
21
33
领取封面
22
34
</button >
23
35
</view >
24
- <view class =" recommand" >更多封面👇👇👇</view >
36
+ <view class =" recommand" v-if = " modalShow " >更多封面👇👇👇</view >
25
37
<ad-custom :unit-id =" ad.three" v-if =" ad.three" ></ad-custom >
26
38
<ad :unit-id =" ad.four" ad-type =" video" ad-theme =" white" v-if =" ad.four" ></ad >
27
39
<view class =" modal" @touchmove.stop =" handle" @click =" closeModal" v-if =" modalShow" >
31
43
领取方式
32
44
</view >
33
45
<text user-select decode class =" modal-content-body-getdesc" >{{coverDetail.getDesc}}</text >
46
+ <text user-select decode class =" modal-content-body-getdesc" >{{id}}\n{{openid}}</text >
34
47
<button plain class =" modal-content-body-question" open-type =" contact" >有疑问?</button >
35
48
</view >
36
49
<image src =" /static/close.png" mode =" " class =" modal-content-cancel" @click.stop =" closeModal" ></image >
41
54
42
55
<script >
43
56
import { coverDetail , lookVideo } from ' ../../request' ;
44
-
45
57
var rewardedVideoAd = null
46
58
// 在页面中定义插屏广告
47
59
var interstitialAd = null
@@ -53,7 +65,6 @@ export default {
53
65
coverDetail: {
54
66
inviteLockNum: 0 ,
55
67
lookVideoLockNum: 0 ,
56
- lookInviteVideoLockNum: 0 ,
57
68
getDesc: " " ,
58
69
},
59
70
lockEdInfo: {
@@ -64,21 +75,38 @@ export default {
64
75
},
65
76
ad: ' ' ,
66
77
lookType: ' ' ,
78
+ lookinviteVideoLockNum: 0 ,
79
+ inviteNum: 0 ,
80
+ openid: ' ' ,
81
+ show: false
67
82
};
68
83
},
69
84
onLoad (e ) {
70
85
this .id = e .id
86
+ this .openid = getApp ().globalData .openid
71
87
this .getCoverDetail (true )
88
+ wx .showShareMenu ({
89
+ withShareTicket: true ,
90
+ menus: [' shareAppMessage' , ' shareTimeline' ]
91
+ })
72
92
},
73
93
onShow (e ) {
74
94
this .getCoverDetail (false )
75
95
},
76
96
onShareAppMessage (res ) {
77
97
var shareConfig = getApp ().shareConfig ()
78
98
shareConfig .path += ' &id=' + this .id
99
+ shareConfig .imageUrl = this .coverDetail .pic
79
100
console .log (shareConfig)
80
101
return shareConfig
81
102
},
103
+ onShareTimeline () {
104
+ var shareConfig = getApp ().shareTimelineConfig ()
105
+ shareConfig .query += ' &id=' + this .id
106
+ shareConfig .imageUrl = this .coverDetail .pic
107
+ console .log (shareConfig)
108
+ return shareConfig;
109
+ },
82
110
methods: {
83
111
handle (){
84
112
return
@@ -88,13 +116,21 @@ export default {
88
116
id: this .id ,
89
117
openid: getApp ().globalData .openid ,
90
118
})
119
+ console .log (res .result )
91
120
this .coverDetail = res .result .data .coverDetail
92
121
this .lockEdInfo = res .result .data .lockEdInfo
93
122
this .ad = res .result .data .ad
94
- if (getApp ().globalData .inviteStatus .status ){
95
- this .coverDetail .lookInviteVideoLockNum = getApp ().globalData .inviteStatus .inviteNum * 2 - this .lockEdInfo .lookInviteVideoLockNum + 1 ;
96
- this .lockEdInfo .lookInviteVideoLockNum = 0 ;
123
+ console .log (' inviteStatus' , getApp ().globalData .inviteStatus )
124
+ if (getApp ().globalData .inviteStatus && getApp ().globalData .inviteStatus .status == 1 ){
125
+ this .lookinviteVideoLockNum = getApp ().globalData .inviteStatus .inviteNum * 2 - this .lockEdInfo .lookInviteVideoLockNum - 1 ;
126
+ this .inviteNum = getApp ().globalData .inviteStatus .inviteNum
127
+ if (this .lookinviteVideoLockNum > 0 && isFirst){
128
+ this .show = true
129
+ }
130
+ }else {
131
+ this .lookInviteVideoLockNum = 0 ;
97
132
}
133
+ console .log (' this.coverDetail' , this .coverDetail )
98
134
if (isFirst && this .ad ){
99
135
// 激励视频和插屏广告
100
136
if (this .ad .one ){
@@ -104,13 +140,14 @@ export default {
104
140
this .adInit (this .ad .five );
105
141
}
106
142
}
107
- if (this .lockEdInfo .isLocked ){
143
+ if (this .lockEdInfo .isLocked && isFirst ){
108
144
this .modalShow = true
109
145
}
110
146
uni .hideLoading ()
111
147
},
112
- lookAd : function (e ) {
113
- let lookType = e .currentTarget .dataset [' type' ];
148
+ lookAd : function (event ) {
149
+ console .log (' 观看广告' , event )
150
+ let lookType = event .currentTarget .dataset [' type' ];
114
151
this .lookType = lookType;
115
152
rewardedVideoAd .show ().catch (() => {
116
153
rewardedVideoAd
@@ -141,6 +178,14 @@ export default {
141
178
if (res && res .isEnded ) {
142
179
if (this .lookType === " 1" ){
143
180
this .lockEdInfo .lookinviteVideoLockNum ++
181
+ if (this .lockEdInfo .lookinviteVideoLockNum == this .lookInviteVideoLockNum ){
182
+ uni .showToast ({
183
+ title: ' 助力成功' ,
184
+ icon: ' success' ,
185
+ duration: 2000
186
+ });
187
+ getApp ().inviteTrack (getApp ().globalData .inviteOpenid , getApp ().globalData .openid , this .id , true );
188
+ }
144
189
}else {
145
190
this .lockEdInfo .lookVideoLockNum ++
146
191
}
@@ -172,7 +217,7 @@ export default {
172
217
await lookVideo ({
173
218
openid: getApp ().globalData .openid ,
174
219
id: this .id ,
175
- isEnded,
220
+ isEnded: isEnded ,
176
221
lookType: this .lookType ,
177
222
})
178
223
},
@@ -290,4 +335,41 @@ export default {
290
335
291
336
}
292
337
}
338
+ .popup-bg {
339
+ background-color : #ffffff ;
340
+ position : absolute ;
341
+ top :0 ;
342
+ left :0 ;
343
+ width :100% ;
344
+ height :100% ;
345
+ z-index :-1 ;
346
+ padding : 0 ;
347
+ margin : 0 ;
348
+ }
349
+ .popup {
350
+ border-radius : 40 rpx;
351
+ display : flex ;
352
+ flex-direction : column ;
353
+ align-items : center ;
354
+ justify-content : center ;
355
+ width : 100% ;
356
+ height : 100% ;
357
+ }
358
+ .popup-more-text {
359
+ width : 61% ;
360
+ height : 40px ;
361
+
362
+ font-size : 40 rpx;
363
+ font-weight : bold ;
364
+ text-align : center ;
365
+
366
+ }
367
+ .popup-more-text-desc {
368
+ width : 90% ;
369
+ height : 40px ;
370
+ font-size : 30 rpx;
371
+ font-weight : bold ;
372
+ text-align : center ;
373
+
374
+ }
293
375
</style >
0 commit comments