72 lines
1.4 KiB
Vue
72 lines
1.4 KiB
Vue
<template>
|
|
<view class="start-page">
|
|
<image class="bg" :src="$url + 'home/startPage_yg.png'" mode="aspectFill" />
|
|
<view class="count-down" :class="{ enabled: canEnter }" @click.stop="onEnterClick">
|
|
{{ canEnter ? '进入' : `跳过 ${countDown}s` }}
|
|
</view>
|
|
</view>
|
|
</template>
|
|
<script setup>
|
|
import { ref, onMounted, onUnmounted } from 'vue'
|
|
|
|
const countDown = ref(3)
|
|
let timer = null
|
|
const canEnter = ref(false)
|
|
|
|
onMounted(() => {
|
|
timer = setInterval(() => {
|
|
if (countDown.value <= 1) {
|
|
//点击进入
|
|
// countDown.value = 0
|
|
// canEnter.value = true
|
|
clearInterval(timer)
|
|
//直接进入
|
|
toHome()
|
|
return
|
|
}
|
|
countDown.value -= 1
|
|
}, 1000)
|
|
})
|
|
|
|
onUnmounted(() => {
|
|
if (timer) clearInterval(timer)
|
|
})
|
|
|
|
function toHome() {
|
|
uni.reLaunch({
|
|
url: '/pages/index/index'
|
|
})
|
|
}
|
|
function onEnterClick() {
|
|
if (!canEnter.value) return
|
|
toHome()
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.start-page {
|
|
position: relative;
|
|
width: 100vw;
|
|
height: 100vh;
|
|
overflow: hidden;
|
|
}
|
|
.bg {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
.count-down {
|
|
position: absolute;
|
|
top: calc(env(safe-area-inset-top) + 100rpx);
|
|
right: 60rpx;
|
|
padding: 18rpx 20rpx;
|
|
border-radius: 50rpx;
|
|
font-size: 28rpx;
|
|
line-height: 1;
|
|
color: #fff;
|
|
background: rgba(0, 0, 0, 0.4);
|
|
z-index: 10;
|
|
}
|
|
.count-down.enabled {
|
|
// background: rgba(54, 110, 238, 0.85);
|
|
}
|
|
</style>
|