<template>
	<view class="client-my-page">
		<view class="my-head-box">
			<img class="head-img-box" :src="myInfoData.userImg">
			<view class="head-content-box">
				<text>{{myInfoData.userName}}</text>
				<view class="idcard-row-box">
					<icon class="idcard-icon"></icon>
					<text class="idcard-text" >{{myInfoData.idcard}}</text>
				</view>
			</view>
		</view>
		
		<view class="my-num-box">
			<view class="num-item-box">
				<uni-badge class="uni-badge-left-margin my-num-badge" v-if="myInfoData.kaoshiCount"
				:customStyle="{background: '#ff2527'}" :text="myInfoData.kaoshiCount" />
				<icon class="ks-icon"></icon>
				<text class="num-title">考试管理</text>
			</view>
			<view class="num-item-box">
				<uni-badge class="uni-badge-left-margin my-num-badge" v-if="myInfoData.lianxiCount"
				:customStyle="{background: '#ff2527'}" :text="myInfoData.lianxiCount" />
				<icon class="lx-icon"></icon>
				<text class="num-title">练习管理</text>
			</view>
			<view class="num-item-box">
				<uni-badge class="uni-badge-left-margin my-num-badge" v-if="myInfoData.kechengCount"
				:customStyle="{background: '#ff2527'}" :text="myInfoData.kechengCount" />
				<icon class="kc-icon"></icon>
				<text class="num-title">课程管理</text>
			</view>
		</view>
		
		<view class="my-list-box">
			<view class="list-row" @click="telClick">
				<icon class="list-icon user-icon"></icon>
				<text>修改个人信息</text>
			</view>
			<view class="list-row" @click="checkWrong">
				<icon class="list-icon score-icon"></icon>
				<text>成绩列表</text>
			</view>
			<view class="list-row" @click="exitLogin">
				<icon class="list-icon login-out-icon"></icon>
				<text>退出登录</text>
			</view>
		</view>
		<!-- 底部区域 -->
		<customTabbarClient></customTabbarClient>
	</view>
</template>

<script setup>
	import {onLoad} from '@dcloudio/uni-app';
	import {getMineUser,getMineInfo} from '@/api/my.js'
	import {reactive,ref} from "vue";
	import customTabbarClient from "@/components/custom-tabbar/custom-tabbar-client.vue"
	let myInfoData = reactive({
		userImg: '',
		userName: '',
		idcard: '',
		kaoshiCount: '',
		kechengCount: '',
		lianxiCount: '',
	});
	function getMyInit() {
		getUserInfo();
		getNumInfo();
	}
	function getUserInfo(){
		getMineUser({}).then(res => {
			myInfoData.userImg= res.data.icon;
			myInfoData.userName = res.data.userName;
			myInfoData.idcard = res.data.idcard;
		})
	}
	function getNumInfo(){
		getMineInfo({}).then(res => {
			myInfoData.kaoshiCount = res.data.kaoshiCount;
			myInfoData.kechengCount = res.data.kechengCount;
			myInfoData.lianxiCount = res.data.lianxiCount;
		})
	}
	function exitLogin(){
		
	}
	
	onLoad(() => {
		getMyInit()
	})
</script>

<style>
</style>