<template>
	<view class="launch-bg" :style="[background]" @tap="launchApp()">
		<image class="launch-img" mode="widthFix" :src="appConfig.mobile_start_page"></image>
		<view class="img-datu">
			<view class="jishi" :style="{ top: (sysInfo.statusBarHeight + 60) + 'px' }">
				<text>跳过</text>
				<text>{{countDownNum}}秒</text>
			</view>
		</view>
	</view>

</template>

<script>
	import {
		mapGetters
	} from 'vuex'

	const app = getApp()
	const homeItem = {
		name: '启动页'
	}
	export default {
		data() {
			return {
				countDownNum: 5,
				timer: null,
			}
		},
		onLoad(options) {
            console.log('token' + this.appConfig.token)
			this.timer = setInterval(() => {
				if (this.countDownNum == 0) {
					clearInterval(this.timer)
					this.launchApp()
				} else {
					this.countDownNum = this.countDownNum - 1;
				}
			}, 1000)
		},
		onUnload() {},
		onShow() {
		},
		onHide() {},
		methods: {
			launchApp() {
                
				if (this.timer) {
					clearInterval(this.timer)
				}
				uni.switchTab({
					url: '/pages/index/index'
				})
			},
		},
		computed: {
			...mapGetters(['sysInfo', 'inviteCode', 'appConfig']),
			background() {
				const {
					mobile_start_bg
				} = this.appConfig
				return mobile_start_bg ? {
					'background-image': `url(${mobile_start_bg})`,
					'background-size': 'cover'
				} : {}
			},
		}
	}
</script>

<style lang="scss">
	page {
		padding: 0;
		height: 100%;
	}

	.launch-bg {

		height: 100%;
	}

	.launch-img {
		width: 100%;
	}

	.img-datu .jishi {
		background-color: rgba(0, 0, 0, 0.4);
		position: fixed;
		top: 200rpx;
		right: 50rpx;
		border-radius: 50%;
		width: 100rpx;
		height: 100rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	.img-datu .jishi text {
		color: #fff;
		font-size: 24rpx;
	}
</style>