<template>
	<view class="app">
		<image src="../../static/logo.png" mode=""></image>
		<view class="title">
			泉医到家
		</view>
	</view>
</template>

<script>
	import {
		appLoginpwd
	} from '../../api/login/index.js'
	export default {
		data() {
			return {};
		},
		onShow() {
			let that = this
			try {
				const value = uni.getStorageSync('phone');
				const value2 = uni.getStorageSync('password');
				if (value && value2) {
					appLoginpwd(value, value2).then(res => {
						if (res.code == 200) {
							setTimeout(() => {
								uni.switchTab({
									url: '/pages/homepage/homepage',
								})
							}, 2000);
						} else {
							setTimeout(() => {
								uni.reLaunch({
									url: '/pages/login/login'
								});
							}, 2000);
						}
					})
				} else {
					setTimeout(() => {
						uni.reLaunch({
							url: '/pages/login/login'
						});
					}, 2000);
				}
			} catch (e) {
				setTimeout(() => {
					uni.reLaunch({
						url: '/pages/login/login'
					});
				}, 2000);
			}
			// uni.getStorage({
			// 	key: 'patientId',
			// 	success: function(res) {
			// 		setTimeout(() => {
			// 			uni.reLaunch({
			// 				url: '/pages/homepage/homepage'
			// 			});
			// 		}, 2000);
			// 	},
			// 	fail() {
			// 		setTimeout(() => {
			// 			uni.reLaunch({
			// 				url: '/pages/login/login'
			// 			});
			// 		}, 2000);
			// 	}
			// });
		},
		methods: {},
	}
</script>

<style lang="scss">
	.app {
		height: 100vh;
	}

	image {
		width: 50%;
		height: 200rpx;
		position: absolute;
		left: 25%;
		top: 28%;
	}

	.title {
		width: 80%;
		height: 48rpx;
		font-size: 49rpx;
		text-align: center;
		font-family: DengXian;
		font-weight: bold;
		color: #000000;
		position: absolute;
		top: 50%;
		left: 10%;
	}
</style>
