hookehuyr

feat(排行榜): 实现动态数据加载并添加日期显示

- 重构排行榜组件,从API动态加载数据
- 添加排行榜日期显示功能
- 优化区域切换逻辑,支持动态区域显示
- 调整返回顶部按钮位置
- 添加默认头像处理逻辑
<!--
* @Date: 2025-09-02 13:06:39
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-02 13:12:20
* @LastEditTime: 2025-09-09 14:17:13
* @FilePath: /lls_program/src/components/BackToTop.vue
* @Description: 文件描述
-->
......@@ -56,7 +56,7 @@ const scrollToTop = () => {
.back-to-top {
position: fixed;
right: 30rpx;
bottom: 180rpx;
bottom: 250rpx;
width: 80rpx;
height: 80rpx;
background: rgba(64, 158, 255, 0.8);
......
This diff is collapsed. Click to expand it.
<!--
* @Date: 2025-09-01 13:07:52
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-09 14:07:23
* @LastEditTime: 2025-09-09 14:16:08
* @FilePath: /lls_program/src/pages/FamilyRank/index.vue
* @Description: 文件描述
-->
......@@ -34,6 +34,11 @@
<view class="loading-text">加载中...</view>
</view>
<!-- 排行榜日期 -->
<view class="rank-date">
{{ currentDate }}
</view>
<!-- 前三名展示 -->
<view v-else-if="topThreeData.length > 0" class="top-three">
<!-- 第二名 -->
......@@ -131,7 +136,7 @@
</view>
<!-- 返回顶部组件 -->
<!-- <BackToTop :distance="200" /> -->
<BackToTop :distance="200" />
</view>
</template>
......@@ -165,7 +170,8 @@ const leaderboardData = ref(null)
// 加载状态
const loading = ref(false)
// 当前日期
const currentDate = ref('')
/**
* 切换tab
......@@ -230,6 +236,7 @@ const loadLeaderboardData = async (isInitialLoad = false) => {
const response = await getStepLeaderboardAPI(params)
if (response.code) {
leaderboardData.value = response.data
currentDate.value = response.data.yesterday
// 只在初始加载时从current_family.county获取区县信息,设置默认tab
if (isInitialLoad && response.data.current_family) {
......@@ -411,6 +418,14 @@ onMounted(async () => {
opacity: 0.3;
transform: translateY(-20rpx);
}
.rank-date {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.8);
text-align: center;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
}
.top-three {
......