feat: 增加积分模块

This commit is contained in:
2026-08-31 15:23:17 +08:00
parent b058394b42
commit 9c6895caf1
8 changed files with 192 additions and 2 deletions

View File

@@ -20,6 +20,24 @@
</view>
</wd-card>
<wd-card title="积分成就" type="rectangle">
<view class="flex items-center justify-between">
<view class="mt-2 space-y-1 text-gray-600">
<view> 当前积分{{ appStore.points }}</view>
<view>📊 记录次数{{ appStore.recordCount }}</view>
<view>🏆 当前成就{{ appStore.achievement }}</view>
</view>
<wd-button size="small" plain type="primary" @click="openPointPopup">
查看说明
</wd-button>
</view>
<view class="mt-2 text-xs text-gray-400">
坚持记录健康数据解锁更多成就
</view>
</wd-card>
<wd-cell-group>
<wd-cell size="large" title="记录默认值" is-link @click="openDefaultPopup"/>
<wd-cell size="large" title="今日概览" is-link @click="openOverviewPopup"/>
@@ -38,6 +56,8 @@
<plan-popup />
<default-popup />
<point-popup />
</view>
</template>
@@ -47,12 +67,15 @@ import StoragePopup from "@/components/Profile/StoragePopup.vue";
import OverviewPopup from "@/components/Profile/OverviewPopup.vue";
import PlanPopup from "@/components/Profile/PlanPopup.vue";
import { computed, ref, watch } from 'vue'
import {getDefaultRecordValue, getOverview, getPlan, getProfile} from '@/utils/profile'
import { getDefaultRecordValue, getOverview, getPlan, getProfile } from '@/utils/profile'
import { useProfileStore } from '@/store/profile'
import { useAppStore } from "@/store/app";
import type { IProfile } from "@/type/profile";
import { countRecordsByMonth, getMaxRecord, getTotalCount } from "@/utils/record";
import DefaultPopup from "@/components/Profile/DefaultPopup.vue";
import { getAchievement, getPoints, getRecordCount } from "@/utils/points";
import { onShow } from "@dcloudio/uni-app";
import PointPopup from "@/components/Profile/PointPopup.vue";
const profileStore = useProfileStore()
const appStore = useAppStore()
@@ -68,6 +91,12 @@ const genderText = computed(() => {
return '性别未填'
})
onShow(() => {
appStore.points = getPoints()
appStore.recordCount = getRecordCount()
appStore.achievement = getAchievement()
})
watch(() => profileStore.isRefresh, () => {
profile.value = getProfile()
})
@@ -99,4 +128,8 @@ function openStoragePopup() {
profileStore.storageMax = getMaxRecord()
profileStore.showStoragePopup = true
}
function openPointPopup() {
profileStore.showPointPopup = true
}
</script>