Skip to content

Commit 85e9ce5

Browse files
第一次进入才显示
1 parent c75547a commit 85e9ce5

File tree

152 files changed

+30699
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+30699
-88
lines changed

App.vue

+55-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
<style lang="scss">
2+
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
3+
@import "uview-ui/index.scss";
4+
</style>
5+
16
<script>
2-
/* 本项目为开源项目,作者微信:zheng593446899,如有问题可联系*/
37
import { login, inviteTrack } from "./request"
48
59
export default {
@@ -8,17 +12,26 @@ export default {
812
console.log('App Launch');
913
var openid = uni.getStorageSync('openid');
1014
if (openid) {
15+
console.log('获取到本地openid')
1116
this.globalData.openid = openid;
12-
this.globalData.inviteStatus = this.inviteTrack(e.query.openid, openid, e.query.id, false);
17+
this.globalData.inviteOpenid = e.query.openid;
18+
this.inviteTrack(e.query.openid, openid, e.query.id, false);
1319
} else {
1420
// 登录
21+
console.log('登录')
1522
const [loginError, loginRes] = await uni.login();
23+
console.log(loginError, loginRes)
1624
// 发送 res.code 到后台换取 openId, sessionKey, unionId
17-
const res = await login({code: loginRes.code})
18-
this.globalData.openid = res.result.data.user.openid;
19-
uni.setStorageSync('openid', res.result.data.user.openid);
20-
this.globalData.inviteStatus = this.inviteTrack(e.query.openid, this.globalData.openid, e.query.id, false);
25+
if (!loginError){
26+
const res = await login({code: loginRes.code})
27+
this.globalData.openid = res.result.data.user.openid;
28+
uni.setStorageSync('openid', res.result.data.user.openid);
29+
this.inviteTrack(e.query.openid, this.globalData.openid, e.query.id, false);
30+
}else{
31+
32+
}
2133
}
34+
2235
},
2336
onShow: function() {
2437
console.log('App Show');
@@ -27,8 +40,16 @@ export default {
2740
console.log('App Hide');
2841
},
2942
globalData: {
43+
api: {
44+
login: 'https://3e08f5fc-25d1-41dc-9dab-418a7fb3e2dd.bspapp.com/http/api/login',
45+
cover: 'https://3e08f5fc-25d1-41dc-9dab-418a7fb3e2dd.bspapp.com/http/api/cover',
46+
coverDetail: 'https://3e08f5fc-25d1-41dc-9dab-418a7fb3e2dd.bspapp.com/http/api/cover/detail',
47+
lookVideo: 'https://3e08f5fc-25d1-41dc-9dab-418a7fb3e2dd.bspapp.com/http/api/look/video',
48+
inviteTrack: 'https://3e08f5fc-25d1-41dc-9dab-418a7fb3e2dd.bspapp.com/http/api/invite/track',
49+
},
3050
openid: '',
31-
inviteStatus: '',
51+
inviteOpenid:'',
52+
inviteStatus: null,
3253
},
3354
methods: {
3455
shareConfig(){
@@ -40,16 +61,35 @@ export default {
4061
];
4162
return messages[Math.floor(Math.random()*messages.length)];
4263
},
64+
shareTimelineConfig(){
65+
var messages = [
66+
{
67+
title: '送你个性微信红包封面,发红包时可用',
68+
query: 'openid=' + this.globalData.openid,
69+
path: '/pages/index/index'
70+
},
71+
];
72+
return messages[Math.floor(Math.random()*messages.length)];
73+
},
4374
//邀请上报
4475
inviteTrack(inviteOpenid, openid, id, adinvite){
45-
if(inviteOpenid && openid && inviteOpenid != openid && adinvite){
46-
console.log(inviteOpenid, openid)
47-
inviteTrack({
48-
inviteOpenid,
49-
openid,
50-
id,
51-
adinvite,
52-
})
76+
console.log('邀请上报')
77+
console.log(inviteOpenid, openid)
78+
if(inviteOpenid && openid && inviteOpenid != openid){
79+
wx.request({
80+
url: this.globalData.api.inviteTrack,
81+
method: "POST",
82+
data: {
83+
inviteOpenid,
84+
openid,
85+
id,
86+
adinvite,
87+
},
88+
success: (res) => {
89+
console.log(res)
90+
this.globalData.inviteStatus = res.data.data
91+
}
92+
});
5393
}
5494
},
5595
}

main.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
// 本项目为开源项目,作者微信:zheng593446899,如有问题可联系
22
import Vue from 'vue'
33
import App from './App'
4+
import uView from "uview-ui";
45

5-
Vue.config.productionTip = false
66

7+
Vue.config.productionTip = false
8+
Vue.use(uView);
79
App.mpType = 'app'
810

911
const app = new Vue({
1012
...App
1113
})
1214
app.$mount()
15+

pages.json

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
//本项目为开源项目,作者微信:zheng593446899,如有问题可联系
22
{
3+
"easycom": {
4+
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
5+
},
36
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
47
{
58
"path": "pages/index/index",

pages/detail/detail.vue

+96-14
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
11
<template>
22
<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+
315
<view class="cover">
416
<image :src="coverDetail.pic" mode="" class="cover-img"></image>
517
</view>
618
<ad :unit-id="ad.two" ad-type="grid" grid-opacity="0.8" grid-count="5" ad-theme="white" v-if="ad.two"></ad>
719
<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}}个
1123
</button>
1224
<button plain class="func-btn" open-type="share" v-if="coverDetail.inviteLockNum > 0">
1325
<image src="/static/share.png" mode="" class="func-btn-img"></image>
1426
邀请好友领取({{lockEdInfo.inviteLockNum}}/{{coverDetail.inviteLockNum}})
1527
</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">
1729
<image src="/static/video.png" mode="" class="func-btn-img"></image>
1830
观看视频领取({{lockEdInfo.lookVideoLockNum}}/{{coverDetail.lookVideoLockNum}})
1931
</button>
2032
<button plain class="func-btn success" @click="openModal" v-if="lockEdInfo.isLocked">
2133
领取封面
2234
</button>
2335
</view>
24-
<view class="recommand">更多封面👇👇👇</view>
36+
<view class="recommand" v-if="modalShow">更多封面👇👇👇</view>
2537
<ad-custom :unit-id="ad.three" v-if="ad.three"></ad-custom>
2638
<ad :unit-id="ad.four" ad-type="video" ad-theme="white" v-if="ad.four"></ad>
2739
<view class="modal" @touchmove.stop="handle" @click="closeModal" v-if="modalShow">
@@ -31,6 +43,7 @@
3143
领取方式
3244
</view>
3345
<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>
3447
<button plain class="modal-content-body-question" open-type="contact">有疑问?</button>
3548
</view>
3649
<image src="/static/close.png" mode="" class="modal-content-cancel" @click.stop="closeModal"></image>
@@ -41,7 +54,6 @@
4154

4255
<script>
4356
import { coverDetail, lookVideo } from '../../request';
44-
4557
var rewardedVideoAd = null
4658
// 在页面中定义插屏广告
4759
var interstitialAd = null
@@ -53,7 +65,6 @@ export default {
5365
coverDetail: {
5466
inviteLockNum: 0,
5567
lookVideoLockNum: 0,
56-
lookInviteVideoLockNum: 0,
5768
getDesc: "",
5869
},
5970
lockEdInfo: {
@@ -64,21 +75,38 @@ export default {
6475
},
6576
ad: '',
6677
lookType: '',
78+
lookinviteVideoLockNum: 0,
79+
inviteNum: 0,
80+
openid: '',
81+
show: false
6782
};
6883
},
6984
onLoad(e) {
7085
this.id = e.id
86+
this.openid = getApp().globalData.openid
7187
this.getCoverDetail(true)
88+
wx.showShareMenu({
89+
withShareTicket: true,
90+
menus: ['shareAppMessage', 'shareTimeline']
91+
})
7292
},
7393
onShow(e) {
7494
this.getCoverDetail(false)
7595
},
7696
onShareAppMessage(res) {
7797
var shareConfig = getApp().shareConfig()
7898
shareConfig.path += '&id='+this.id
99+
shareConfig.imageUrl = this.coverDetail.pic
79100
console.log(shareConfig)
80101
return shareConfig
81102
},
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+
},
82110
methods: {
83111
handle(){
84112
return
@@ -88,13 +116,21 @@ export default {
88116
id: this.id,
89117
openid: getApp().globalData.openid,
90118
})
119+
console.log(res.result)
91120
this.coverDetail = res.result.data.coverDetail
92121
this.lockEdInfo = res.result.data.lockEdInfo
93122
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;
97132
}
133+
console.log('this.coverDetail', this.coverDetail)
98134
if(isFirst && this.ad){
99135
//激励视频和插屏广告
100136
if(this.ad.one){
@@ -104,13 +140,14 @@ export default {
104140
this.adInit(this.ad.five);
105141
}
106142
}
107-
if(this.lockEdInfo.isLocked){
143+
if(this.lockEdInfo.isLocked && isFirst){
108144
this.modalShow = true
109145
}
110146
uni.hideLoading()
111147
},
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'];
114151
this.lookType = lookType;
115152
rewardedVideoAd.show().catch(() => {
116153
rewardedVideoAd
@@ -141,6 +178,14 @@ export default {
141178
if (res && res.isEnded) {
142179
if (this.lookType === "1"){
143180
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+
}
144189
}else{
145190
this.lockEdInfo.lookVideoLockNum++
146191
}
@@ -172,7 +217,7 @@ export default {
172217
await lookVideo({
173218
openid: getApp().globalData.openid,
174219
id: this.id,
175-
isEnded,
220+
isEnded: isEnded,
176221
lookType: this.lookType,
177222
})
178223
},
@@ -290,4 +335,41 @@ export default {
290335
291336
}
292337
}
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: 40rpx;
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: 40rpx;
363+
font-weight: bold;
364+
text-align: center;
365+
366+
}
367+
.popup-more-text-desc {
368+
width: 90%;
369+
height: 40px;
370+
font-size: 30rpx;
371+
font-weight: bold;
372+
text-align: center;
373+
374+
}
293375
</style>

0 commit comments

Comments
 (0)