<template>
	<view>
	</view>
</template>

<script setup>
	import {
		onLoad
	} from "@dcloudio/uni-app"

	const APPKEY = '4AA7B3944BDF3739'
	const ocode = '1015730314'
	const URL = 'http://192.168.161.125:5173/#/pages/home/home'

	onLoad(() => {
		hasUserInfo()
	})

	const hasUserInfo = () => {
		try {
			const busUserInfo = uni.getStorageSync('busUserInfo');
			if (!busUserInfo) {
				window.
				location.href =
					`https://open.wecard.qq.com/connect/oauth/authorize?app_key=${APPKEY}&response_type=code&scope=snsapi_base&ocode=${ocode}&redirect_uri=${encodeURIComponent(URL)}`
			} else {
				uni.switchTab({
					url: "/pages/home/home"
				})
			}
		} catch (e) {
			uni.showToast({
				title: '异常：' + e,
				duration: 3000
			})
		}
	}
</script>

<style lang="scss" scoped>

</style>