<template>
	<view>
		<!-- 用户未登录时，显示登录组件 -->
		<my-login v-if="!token && token === ''"></my-login>
		
		<!-- 用户登录后，显示用户信息组件 -->
		<my-userinfo v-else></my-userinfo>
	</view>
</template>

<script>
	import badgeMix from '@/mixins/tabbar-badge.js'
	import { mapState, mapMutations } from 'vuex'
	
	export default {
		mixins: [badgeMix],
		computed: {
			...mapState('m_user', ['token'])
		},
		data() {
			return {
			};
		},
		onReady() {
			this.findVerifyStatus()
		},
		onHide() {
			this.findVerifyStatus()
		},
		methods: {
			...mapMutations('m_user', ['updateAuthentication']),
			// 查询是否通过了老师认证
			async findVerifyStatus() {
				const { data: result } = await uni.$http.get('/education/teacher-certifications/findVerifyStatus')
				const message = result.message
				this.updateAuthentication(message)
			},
		}
	}
</script>

<style lang="scss">
</style>
