<template>
	<view class="u-relative  bg-gray fixed position-all">
		<view class="time btn" v-if="time<=0" @click="enter"><text>进入</text></view>
		<view class="time" v-else ><text>{{time}}</text></view>
		<view class="w-full box">
			<image src="/static/images/share_bg2.png" class="img"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				time:3
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			enter(){
				uni.reLaunch({
					url:'/pages/index/index'
				})
			},
			init(){
				this.timer=setInterval(()=>{
					this.time--
					if(this.time<=0){
						clearInterval(this.timer)
					}
				},1000)
			}
		}
	}
</script>

<style lang="scss" scoped>
.position-all{
	position: fixed;
	inset: 0;
	.time{
		position: absolute;
		z-index: 10;
		width: 50rpx;
		height: 50rpx;
		text-align: center;
		display: flex;
		justify-content: center;
		font-size: 14px;
		color: #555;
		align-items: center;
		right: 30rpx;
		border-radius: 50%;
		background-color: rgba(255, 255, 255, .5);
		border: 1px solid rgba(255, 255, 255, .8);
		top: calc(var(--status-bar-height) + 20rpx );
	}
	.btn{
		border-radius: 100rpx;
		white-space: nowrap;
		width: auto;
		height: auto;
		padding: 4rpx 20rpx;
	}
	.box{
		position: absolute;
		inset: 0;
		.img{
			width: 100%;
			height: 100%;
		}
	}
	
}
</style>
