|
|
@@ -37,9 +37,9 @@
|
|
|
<template v-if="index < 6">
|
|
|
<view class="repair" v-if="item.canSupplement">看视频补签</view>
|
|
|
<text class="day">{{item.dayDescribe}}</text>
|
|
|
- <image src="../../static/goldSelect.png" class="goldCoins" mode="heightFix" v-if="item.signIn"></image>
|
|
|
- <image src="../../static/clickVideo.png" class="goldCoins" mode="heightFix" style="position: relative; z-index: 101;" @click="repairSign(item)" v-else-if="item.canSupplement"></image>
|
|
|
- <image src="../../static/gold.png" class="goldCoins" mode="heightFix" v-else></image>
|
|
|
+ <image src="../../static/goldSelect.png" class="goldCoins" style="width: 68rpx;" mode="heightFix" v-if="item.signIn"></image>
|
|
|
+ <image src="../../static/clickVideo.png" class="goldCoins" mode="heightFix" style="position: relative; z-index: 101;" @click="showVideoAd(2, item)" v-else-if="item.canSupplement"></image>
|
|
|
+ <image src="../../static/gold.png" class="goldCoins" style="width: 68rpx;" mode="heightFix" v-else></image>
|
|
|
<text class="reward">{{item.bookCoin}}书币</text>
|
|
|
<image src="../../static/signSub.png" class="signSub" mode="widthFix" v-if="item.signIn"></image>
|
|
|
</template>
|
|
|
@@ -56,7 +56,8 @@
|
|
|
</template>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <navigator url="../officialAccount/officialAccount" class="gignBt" v-if="!signData.mpName" :animation="btAnimationData">签到领书币</navigator>
|
|
|
+ <!-- <navigator url="../officialAccount/officialAccount" class="gignBt" v-if="!signData.mpName" :animation="btAnimationData">签到领书币</navigator> -->
|
|
|
+ <view class="gignBt" @click="tsAccount" v-if="!signData.mpName" :animation="btAnimationData">签到领书币</view>
|
|
|
<view class="gignBt" @click="signIn" v-else-if="!isSignIn" :animation="btAnimationData">签到领书币</view>
|
|
|
<!-- <view class="already" v-else>今日已签</view> -->
|
|
|
<view class="gignBt" v-else @click="moreGold" :animation="btAnimationData">去抽奖获更多奖励</view>
|
|
|
@@ -78,6 +79,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
+ <ad-view :unitId="adConfig.bannerAd" adIntervals="200"></ad-view>
|
|
|
<!-- 活动规则模块 -->
|
|
|
<view class="activityRules">
|
|
|
<view class="top" @click="activityRulesHandle">
|
|
|
@@ -112,6 +114,11 @@
|
|
|
<view class="fragmentGold" :animation="animationDatas[index]" v-for="(item, index) in goldData" :key="index" :style="{top: item.top, left: item.left}">
|
|
|
<image src="../../static/gold.png" mode="widthFix"></image>
|
|
|
</view>
|
|
|
+
|
|
|
+ <!-- 去抽奖路口 -->
|
|
|
+ <view class="qLuckDraw" @click="moreGold">
|
|
|
+ <image src="../../static/1234.gif" mode="widthFix"></image>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
<!-- -->
|
|
|
@@ -123,7 +130,7 @@
|
|
|
<text class="ts">签到成功!</text> </br>
|
|
|
<text class="reward">恭喜您获得{{signInDay.bookCoin}}书币</text> </br>
|
|
|
<image src="../../static/doubleBt.png" class="doubleBt" mode="widthFix" :style="{transform: `scale(${scale})`}" @click="lookVideo"></image> </br>
|
|
|
- <text class="bt" @click="signInHandle(false); startGold(false)">不了,单倍领取</text>
|
|
|
+ <text class="bt" @click="signInHandle(false)">不了,单倍领取</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<image src="../../static/close.png" class="close" mode="widthFix" @click="closeHandle"></image>
|
|
|
@@ -134,15 +141,31 @@
|
|
|
<view class="receiveTs" :animation="animationDataTs">
|
|
|
{{tsTitle}}
|
|
|
</view>
|
|
|
+
|
|
|
+ <!-- 格子广告 -->
|
|
|
+ <!-- <view class="singleLattice">
|
|
|
+ <ad-custom-view :unit-id="adConfig.singleLatticeAd" adIntervals="200"></ad-custom-view>
|
|
|
+ </view> -->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- let timer = null, btTimer = null
|
|
|
+ let timer = null, btTimer = null, adTimer = null, powerOnTimer = null
|
|
|
import { config, getHome, getOpenId, signInAjax, getTemplateIDs, setMessage, switchUpdate } from '@/api/api.js'
|
|
|
+ import { bannerAd, urgeVideoAd, insertScreenAd, singleLatticeAd } from '@/utils/ad_config.js'
|
|
|
+ import adView from '@/components/ad-view/ad-view.vue'
|
|
|
+ import adCustomView from '@/components/ad-custom-view/ad-custom-view.vue'
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ adView,
|
|
|
+ adCustomView
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ adConfig: {
|
|
|
+ bannerAd,
|
|
|
+ singleLatticeAd
|
|
|
+ },
|
|
|
list: [
|
|
|
'恭喜用户 “0016” 成功提现 200书币',
|
|
|
'恭喜用户 “1037” 成功提现 10书币',
|
|
|
@@ -245,6 +268,12 @@
|
|
|
{top: '724rpx', left: '484rpx'}
|
|
|
],
|
|
|
animationDatas: [null, null, null, null, null, null, null, null], // 金币动画组
|
|
|
+ getIntoCount: 0,
|
|
|
+ loading: false,
|
|
|
+ powerOnTimer: new Date().getTime(), // 保存当前进入页面的时间挫
|
|
|
+ isVideoType: null, // 1 是否是看视频签到 2 是否是补签
|
|
|
+ repairSignData: null, // 保存补签的信息
|
|
|
+ powerOnCount: 0, // 记录开机秒数
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -273,14 +302,6 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.btAnimation = uni.createAnimation({ timingFunction: 'ease' })
|
|
|
- this.btBreathAni()
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
- timer && clearInterval(timer)
|
|
|
- btTimer && clearInterval(btTimer)
|
|
|
- },
|
|
|
onLoad(options) {
|
|
|
this.mpData = options
|
|
|
uni.login({
|
|
|
@@ -294,11 +315,139 @@
|
|
|
})
|
|
|
},
|
|
|
onShareAppMessage() {},
|
|
|
+ onReady() {
|
|
|
+ this.createInterstitialAd()
|
|
|
+ this.btAnimation = uni.createAnimation({ timingFunction: 'ease' })
|
|
|
+ this.btBreathAni()
|
|
|
+ this.powerOnShowAd()
|
|
|
+ },
|
|
|
+ onUnload() {
|
|
|
+ console.log('onUnload---->')
|
|
|
+ timer && clearInterval(timer)
|
|
|
+ btTimer && clearInterval(btTimer)
|
|
|
+ this.interstitialAd.destroy()
|
|
|
+ adTimer && clearTimeout(adTimer)
|
|
|
+ powerOnTimer && clearInterval(powerOnTimer)
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ // 提示关注公众号
|
|
|
+ tsAccount() {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请先关注公众号~~',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ powerOnShowAd() {
|
|
|
+ // 开机25秒调取弹窗广告 以后没5分钟调取
|
|
|
+ powerOnTimer = setInterval(() => {
|
|
|
+ this.powerOnCount += 1
|
|
|
+ if(this.powerOnCount === 25 || this.powerOnCount % 325 === 0) {
|
|
|
+ this.showInterstitialAd()
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ },
|
|
|
+ // 创建插屏广告 激励视频广告
|
|
|
+ createInterstitialAd() {
|
|
|
+ // 创建插屏广告
|
|
|
+ let interstitialAd = this.interstitialAd = uni.createInterstitialAd({adUnitId: insertScreenAd});
|
|
|
+ interstitialAd.onLoad(() => {
|
|
|
+ // 插屏 广告加载成功
|
|
|
+ console.log("插屏 广告加载成功");
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ interstitialAd.onClose(() => {
|
|
|
+ // 用户点击了关闭或返回键(仅Android有返回键)
|
|
|
+ console.log("插屏 广告关闭");
|
|
|
+ });
|
|
|
+ interstitialAd.onError((err) => {
|
|
|
+ // 插屏 广告加载失败
|
|
|
+ console.log("插屏 广告加载失败", err);
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ // 广告实例创建成功后默认会执行一次 load,加载广告数据
|
|
|
+ // 如果界面有 "显示广告" 按钮,需要先禁用掉,防止用户点击,等待广告数据加载成功后在放开
|
|
|
+ this.loading = true;
|
|
|
+
|
|
|
+ // 激励视频广告
|
|
|
+ this._isLoaded = false
|
|
|
+ let rewardedVideoAd = this._rewardedVideoAd = uni.createRewardedVideoAd({ adUnitId: urgeVideoAd }) // 仅用于HBuilder基座调试 adpid: '1507000689'
|
|
|
+ rewardedVideoAd.onLoad(() => {
|
|
|
+ this._isLoaded = true
|
|
|
+ console.log('onLoad event')
|
|
|
+ // 加载激励视频成功
|
|
|
+ // 当激励视频被关闭时,默认预载下一条数据,加载完成时仍然触发 `onLoad` 事件
|
|
|
+ })
|
|
|
+ rewardedVideoAd.onError((err) => {
|
|
|
+ // 加载激励视频失败
|
|
|
+ // console.log('onError event', err)
|
|
|
+ })
|
|
|
+ rewardedVideoAd.onClose((res) => {
|
|
|
+ // 用户点击了【关闭广告】按钮
|
|
|
+ if (res && res.isEnded) {
|
|
|
+ // 正常播放结束
|
|
|
+ if(this.isVideoType === 1){ // 看视频签到
|
|
|
+ this.signInHandle(true)
|
|
|
+ } else if (this.isVideoType === 2) { // 看视频补签
|
|
|
+ this.repairSign(this.repairSignData)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 播放中途退出
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 显示插屏广告广告
|
|
|
+ showInterstitialAd() {
|
|
|
+ // 调用 interstitialAd.show(),如果数据正在加载中不会显示广告,加载成功后才显示
|
|
|
+ // 在数据没有加载成功时,需要防止用户频繁点击显示广告
|
|
|
+ if(adTimer) {
|
|
|
+ clearTimeout(adTimer)
|
|
|
+ }
|
|
|
+ let newT = new Date().getTime()
|
|
|
+ if (((newT / 1000) - (this.powerOnTimer / 1000)) < 15) { // 判断是否开机15秒
|
|
|
+ adTimer = setTimeout(() => {
|
|
|
+ if (this.loading == true) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.loading = true;
|
|
|
+ this.interstitialAd.show().then((res) => {
|
|
|
+ console.log('插屏广告成功---》', res)
|
|
|
+ this.loading = false;
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('插屏广告错误---》', err)
|
|
|
+ });
|
|
|
+ clearTimeout(adTimer)
|
|
|
+ }, newT - this.powerOnTimer + 1000)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.loading == true) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.loading = true;
|
|
|
+ this.interstitialAd.show().then((res) => {
|
|
|
+ console.log('插屏广告成功---》', res)
|
|
|
+ this.loading = false;
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('插屏广告错误---》', err)
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 显示激励视频广告
|
|
|
+ showVideoAd(type, data) {
|
|
|
+ if (this._isLoaded) {
|
|
|
+ this.isVideoType = type
|
|
|
+ this.repairSignData = data
|
|
|
+ this._rewardedVideoAd.show().catch(() => {
|
|
|
+ this._rewardedVideoAd && this._rewardedVideoAd.load().then(() => this._rewardedVideoAd && this._rewardedVideoAd.show()).catch(err => {
|
|
|
+ uni.showToast({
|
|
|
+ title: '当前无视频广告',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
// 按钮呼吸
|
|
|
btBreathAni() {
|
|
|
btTimer = setInterval(() => {
|
|
|
- console.log(11111)
|
|
|
if(this.btScale === 1) {
|
|
|
this.btScale = 0.92
|
|
|
this.btAnimation.scale(0.92).step({ duration: 600 })
|
|
|
@@ -416,6 +565,7 @@
|
|
|
let { mpName, ...mp } = this.mpData
|
|
|
setMessage({appId: config.appid, openId: this.openId, allowSwitch, remindSwitch, ...mp}).then(res => {
|
|
|
this.getList()
|
|
|
+ this.showInterstitialAd()
|
|
|
})
|
|
|
},
|
|
|
// 获取模板签到ID
|
|
|
@@ -444,10 +594,14 @@
|
|
|
let { dayTime, dayNum } = data
|
|
|
signInAjax({watchVideo: false, supplement: true, appId: config.appid, openId: this.openId, dayNum, dayTime, ...this.mpData}).then(res => {
|
|
|
this.getList(res.data)
|
|
|
+ this.startGold(false)
|
|
|
uni.showToast({
|
|
|
title: '补签成功',
|
|
|
icon: 'success'
|
|
|
})
|
|
|
+ setTimeout(() => {
|
|
|
+ this.showInterstitialAd()
|
|
|
+ }, 20000)
|
|
|
})
|
|
|
},
|
|
|
getTimer() { // 获取年月日时分秒
|
|
|
@@ -543,7 +697,15 @@
|
|
|
if (!signIn) {
|
|
|
signInAjax({watchVideo, supplement: false, appId: config.appid, openId: this.openId, dayNum, dayTime, ...this.mpData}).then(res => {
|
|
|
this.getList()
|
|
|
+ this.startGold(watchVideo)
|
|
|
this.popupShow = false
|
|
|
+ if(!watchVideo) {
|
|
|
+ this.showInterstitialAd()
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.showInterstitialAd()
|
|
|
+ }, 20000)
|
|
|
+ }
|
|
|
})
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
@@ -560,8 +722,7 @@
|
|
|
},
|
|
|
/** 看视频签到 */
|
|
|
lookVideo() {
|
|
|
- this.signInHandle(true)
|
|
|
- this.startGold(true)
|
|
|
+ this.showVideoAd(1)
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
@@ -580,8 +741,7 @@
|
|
|
.signCenter {
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
- padding: 40rpx 0;
|
|
|
- margin-bottom: 20rpx;
|
|
|
+ margin: 40rpx 0 60rpx;
|
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
|
}
|
|
|
.signTop {
|
|
|
@@ -898,7 +1058,6 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
.popup {
|
|
|
position: fixed;
|
|
|
width: 100%;
|
|
|
@@ -982,6 +1141,18 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ .qLuckDraw {
|
|
|
+ position: absolute;
|
|
|
+ top: 240rpx;
|
|
|
+ right: 8rpx;
|
|
|
+ z-index: 200;
|
|
|
+ animation: lanimation 1.3s linear infinite;
|
|
|
+ &>image {
|
|
|
+ width: 150rpx;
|
|
|
+ height: 150rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.receiveTs {
|
|
|
position: absolute;
|
|
|
border: 2rpx solid rgb(242, 164, 39);
|
|
|
@@ -995,5 +1166,32 @@
|
|
|
border-radius: 5rpx;
|
|
|
opacity: 0;
|
|
|
}
|
|
|
+
|
|
|
+ .singleLattice {
|
|
|
+ position: fixed;
|
|
|
+ top: 200rpx;
|
|
|
+ right: 4rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @-webkit-keyframes lanimation {
|
|
|
+ 0% {
|
|
|
+ transform: rotate(0deg);
|
|
|
+ }
|
|
|
+ 8% {
|
|
|
+ transform: rotate(12deg);
|
|
|
+ }
|
|
|
+ 16% {
|
|
|
+ transform: rotate(0deg);
|
|
|
+ }
|
|
|
+ 24% {
|
|
|
+ transform: rotate(-12deg);
|
|
|
+ }
|
|
|
+ 32% {
|
|
|
+ transform: rotate(0deg);
|
|
|
+ }
|
|
|
+ 100% {
|
|
|
+ transform: rotate(0deg);
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|