<template>
	<view class="welcome">
		<!-- 倒计时（跳过） -->
		<remaining v-if="guidePages"></remaining>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import remaining from '@/components/remaining/remaining';
	export default {
		computed: {
			...mapState(['hasLogin', 'token'])
		},
		data() {
			return {
				guidePages: true
			}
		},
		onLoad() {
			this.loadExecution();
		},
		methods: {
			loadExecution() {
				/**
				 * 获取本地存储中launchFlag的值
				 * 若存在，说明不是首次启动，直接进入首页；
				 * 若不存在，说明是首次启动，进入引导页；
				 */
				// 获取本地存储中launchFlag标识
				const value = uni.getStorageSync('launchFlag') || "";
				// console.log(value, this.hasLogin);
				if (value) {
					this.guidePages = false;
					if (this.hasLogin) {
						uni.switchTab({
							url: '../../pages/index/index'
						});
					} else {
						// launchFlag=true直接跳转到首页
						uni.navigateTo({
							url: '../../pageA/login/login'
						});
					}
				} else {
					// launchFlag!=true显示引导页
					this.guidePages = true;
				}
			}
		}
	}
</script>

<style>
	.welcome {}

	.welcome_jumpes {
		width: 90rpx;
		height: 35rpx;
		opacity: 0.5;
		border-radius: 18rpx;
		position: absolute;
		right: 37rpx;
		top: 34rpx;
		font-size: 20rpx;
		text-align: center;
		line-height: 35rpx;
		color: #fff;
		background: #C4CAC6;
	}

	.welcome_images {
		width: 100%;
		position: fixed;
		width: 100%;
		height: 100%
	}
</style>
