You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
1.8 KiB

<template>
<view class="common_advert_page">
<view class="page_content">
<image class="full_page" mode="aspectFill" :src="advertise_img" @tap="go(advertise_link_url)"></image>
<view class='cut_down_block'>
<view class='btn margin-bottom-20 radius-6 border-ff text-center text-26 text-ff'>{{minute}}s</view>
<view class='btn radius-6 border-ff text-center text-26 text-ff' @tap.stop="jump">跳过</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
minute: 5, //倒计时
timer: '',
advertise_img: '', //广告图
advertise_link_url: '', //广告图链接
}
},
components: {
},
onReady() {
this.getAdvert()
this.setTimer()
},
onUnload() {
clearInterval(this.timer)
},
methods: {
//获取广告图
getAdvert() {
this.rq.getData('project/api/Config/getAdvertiseData').then(res => {
if (res.code == 0) {
this.advertise_img = res.data.advertise.advertise_img
this.advertise_link_url = res.data.advertise.advertise_link_url
}
})
},
//跳过
jump() {
this.minute = 0
clearInterval(this.timer)
uni.switchTab({
url: '/pages/mall/index'
})
},
//设置倒计时
setTimer() {
this.timer = setInterval(() => {
if (this.minute <= 0) {
clearInterval(this.timer)
uni.switchTab({
url: '/pages/mall/index'
})
} else {
this.minute--
}
}, 1000)
}
}
}
</script>
<style>
.cut_down_block {
position: fixed;
right: 30rpx;
/* #ifndef MP-WEIXIN */
top: calc(var(--status-bar-height) + 30rpx);
/* #endif */
/* #ifdef MP-WEIXIN */
top: 30rpx;
/* #endif */
}
.btn {
height: 50rpx;
line-height: 48rpx;
width: 90rpx;
background: rgba(0, 0, 0, 0.5);
}
</style>