App.vue 1.09 KB
<script lang="ts" setup>
	import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
	import registerApi from '@/api/register'
	onLaunch((option) => {
		console.log('App Launch', option)
		if (option && option.path) {
			if (option.path == 'pages/login/index') {
				const token = wx.getStorageSync('token')
				if (token) {
					getUserInfo()
				}
			}
		}
	})
	onShow(() => {
		console.log('App Show')
	})
	onHide(() => {
		console.log('App Hide')
	})
	
	function getUserInfo() {
		registerApi.getUserInfo().then((res) => {
			console.log('getUserInfo', res)
			if (res.signStatus == 0) {
				uni.reLaunch({
					url: '/pages/register/audit'
				})
			} else if (res.signStatus == 1) {
				uni.reLaunch({
					url: '/pages/register/auditSuccess'
				})
			} else if (res.signStatus == 2) {
				uni.reLaunch({
					url: '/pages/register/registerSuccess'
				})
			} else if (res.signStatus == -1) {
				uni.reLaunch({
					url: '/pages/register/registerSuccess'
				})
			}
		}).catch((error) => {
			console.log('getUserInfo error', error.msg)
		})
	}
</script>

<style>
	/*每个页面公共css */
</style>