<script setup>
	/**
	 * name：
	 * user：sa0ChunLuyu
	 * date：2023年6月8日 19:26:33
	 */
	import {
		ref
	} from 'vue'
	import {
		$response
	} from '@/api'
	import {
		onShow
	} from '@dcloudio/uni-app'
	import {
		setToken
	} from '@/lu/token.js'
	const $props = defineProps({
		token: {
			type: String,
			default: ''
		},
		page: {
			type: String,
			default: 'home'
		},
		orderid: {
			type: String,
			default: ''
		},
		param: {
			type: String,
			default: ''
		},
		hospital: {
			type: String,
			default: '0'
		}
	});
	const tip_content = ref('正在校验')
	const getUserInfo = () => {
		setToken($props.token)
		uni.$lu.user((info) => {
			if (!!info.id) {
				tip_content.value = '登录成功'
				let param = decodeURIComponent($props.param)
				
				let page = !!$props.page ? $props.page : 'home'
				
				let orderid=!!$props.orderid ? $props.orderid : ''
				param = !!param ? '&' + param : ''

				uni.reLaunch({
					
					url: `/pages/main/${page}/${page}?hospital=${$props.hospital}${param}&orderid=${$props.orderid}`
				})
			} else {
				tip_content.value = '登录失败'
			}
		}, () => {
			tip_content.value = '登录失败'
		})
	}
	onShow(() => {
		
		getUserInfo()
	})
</script>
<template>
	<view>
		<view class="tip_wrapper">{{ tip_content }}</view>
	</view>
</template>
<style scoped>
	.tip_wrapper {
		position: fixed;
		top: 40%;
		left: 50%;
		transform: translate(-50%, -50%);
		font-size: 30rpx;
		font-weight: bold;
	}
</style>