Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
mlaj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-06-09 14:06:11 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fcc0c956d1d9f274522d4b89ec9b3a847e8ed895
fcc0c956
1 parent
6ae58283
refactor(profile): 更新打卡数据字段名以匹配后端返回结构
将打卡数据字段从驼峰式改为下划线式以保持前后端一致
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
src/views/profile/ProfilePage.vue
src/views/profile/ProfilePage.vue
View file @
fcc0c95
...
...
@@ -39,19 +39,19 @@
<div class="flex justify-between">
<div class="flex flex-col items-center">
<div class="text-2xl font-bold text-gray-800">
{{
profile.checkIns?.totalD
ays || 0 }}
{{
checkIns?.total_d
ays || 0 }}
</div>
<div class="text-xs text-gray-500 mt-1">累计打卡</div>
</div>
<div class="flex flex-col items-center">
<div class="text-2xl font-bold text-green-600">
{{
profile.checkIns?.currentStreak
|| 0 }}
{{
checkIns?.consecutive_days
|| 0 }}
</div>
<div class="text-xs text-gray-500 mt-1">连续打卡</div>
</div>
<div class="flex flex-col items-center">
<div class="text-2xl font-bold text-blue-600">
{{
profile.checkIns?.longestStreak
|| 0 }}
{{
checkIns?.longest_consecutive_days
|| 0 }}
</div>
<div class="text-xs text-gray-500 mt-1">最长连续</div>
</div>
...
...
@@ -136,11 +136,13 @@ const $route = useRoute();
useTitle($route.meta.title);
const profile = ref({});
const checkIns = ref({});
onMounted(async () => {
const { code, data } = await getUserInfoAPI();
if (code) {
profile.value = data.user;
checkIns.value = data.checkin;
}
})
...
...
@@ -148,11 +150,11 @@ const showCheckInDialog = ref(false);
// 处理打卡成功
const handleCheckInSuccess = () => {
profile.value.checkIns.totalD
ays++;
profile.value.checkIns.currentStreak
++;
profile.value.checkIns.longestStreak
= Math.max(
profile.value.checkIns.longestStreak
,
profile.value.checkIns.currentStreak
checkIns.value.total_d
ays++;
checkIns.value.consecutive_days
++;
checkIns.value.longest_consecutive_days
= Math.max(
checkIns.value.longest_consecutive_days
,
checkIns.value.consecutive_days
);
};
...
...
Please
register
or
login
to post a comment