hookehuyr

feat(ProfilePage): 添加打卡次数格式化功能

添加 formatCheckInCount 方法,将超过99的打卡次数显示为'99+'
......@@ -39,19 +39,19 @@
<div class="flex justify-around">
<div class="flex flex-col items-center min-w-[4rem]">
<div class="font-bold text-gray-800 px-2 leading-normal text-center w-full" style="font-size: 1.5rem;">
{{ checkIns?.total_days || 0 }}
{{ formatCheckInCount(checkIns?.total_days) }}
</div>
<div class="text-xs text-gray-500 mt-1">累计打卡</div>
</div>
<div class="flex flex-col items-center min-w-[4rem]">
<div class="font-bold text-green-600 px-2 leading-normal text-center w-full" style="font-size: 1.5rem;">
{{ checkIns?.consecutive_days || 0 }}
{{ formatCheckInCount(checkIns?.consecutive_days) }}
</div>
<div class="text-xs text-gray-500 mt-1">连续打卡</div>
</div>
<div class="flex flex-col items-center min-w-[4rem]">
<div class="font-bold text-blue-600 px-2 leading-normal text-center w-full" style="font-size: 1.5rem;">
{{ checkIns?.longest_consecutive_days || 0 }}
{{ formatCheckInCount(checkIns?.longest_consecutive_days) }}
</div>
<div class="text-xs text-gray-500 mt-1">最长连续</div>
</div>
......@@ -148,6 +148,11 @@ const profile = ref({});
const checkIns = ref({});
const isTeacher = ref(false);
const formatCheckInCount = (count) => {
const num = Number(count) || 0;
return num > 99 ? '99+' : num;
};
onMounted(async () => {
const { code, data } = await getUserInfoAPI();
if (code) {
......