refactor(RankingCard): 优化地区榜单显示逻辑并移除冗余代码
移除根据用户区县自动设置默认标签的逻辑,简化地区榜单显示方式 修改默认激活标签为'shanghai',直接显示区域名称而非固定文本
Showing
3 changed files
with
6 additions
and
18 deletions
| ... | @@ -137,7 +137,7 @@ const props = defineProps({ | ... | @@ -137,7 +137,7 @@ const props = defineProps({ |
| 137 | }) | 137 | }) |
| 138 | 138 | ||
| 139 | // 当前激活的tab | 139 | // 当前激活的tab |
| 140 | -const activeTab = ref('310101') | 140 | +const activeTab = ref('shanghai') |
| 141 | 141 | ||
| 142 | // 内容切换状态 | 142 | // 内容切换状态 |
| 143 | const isContentSwitching = ref(false) | 143 | const isContentSwitching = ref(false) |
| ... | @@ -200,18 +200,6 @@ const loadLeaderboardData = async (isInitialLoad = false) => { | ... | @@ -200,18 +200,6 @@ const loadLeaderboardData = async (isInitialLoad = false) => { |
| 200 | leaderboardData.value = response.data | 200 | leaderboardData.value = response.data |
| 201 | // 设置当前日期 | 201 | // 设置当前日期 |
| 202 | currentDate.value = response.data.yesterday | 202 | currentDate.value = response.data.yesterday |
| 203 | - | ||
| 204 | - // 只在初始加载时从current_family.county获取区县信息,设置默认tab | ||
| 205 | - if (isInitialLoad && response.data.current_family) { | ||
| 206 | - const currentFamilyCounty = response.data.current_family.county; | ||
| 207 | - if (currentFamilyCounty && String(currentFamilyCounty) !== activeTab.value) { | ||
| 208 | - // 只在county与当前activeTab不同时才设置,确保county字段为字符串格式 | ||
| 209 | - activeTab.value = String(currentFamilyCounty) | ||
| 210 | - // 设置activeTab后需要重新加载数据以获取正确的区县排行榜 | ||
| 211 | - await loadLeaderboardData(false) | ||
| 212 | - return | ||
| 213 | - } | ||
| 214 | - } | ||
| 215 | } | 203 | } |
| 216 | } catch (error) { | 204 | } catch (error) { |
| 217 | console.error('获取排行榜数据失败:', error) | 205 | console.error('获取排行榜数据失败:', error) |
| ... | @@ -265,10 +253,10 @@ const getTabDisplayName = (region) => { | ... | @@ -265,10 +253,10 @@ const getTabDisplayName = (region) => { |
| 265 | return '上海榜' | 253 | return '上海榜' |
| 266 | } else if (region.value === 'support') { | 254 | } else if (region.value === 'support') { |
| 267 | return '助力榜' | 255 | return '助力榜' |
| 268 | - } else if (region.value === 'region' || region.text.includes('区') || region.text.includes('县')) { | 256 | + } else { |
| 269 | - return '地区榜' | 257 | + // 直接显示区域名称,如"黄浦区"、"杨浦区"等 |
| 270 | - } | ||
| 271 | return region.text | 258 | return region.text |
| 259 | + } | ||
| 272 | } | 260 | } |
| 273 | 261 | ||
| 274 | /** | 262 | /** | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-19 14:11:06 | 2 | * @Date: 2022-09-19 14:11:06 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-09-15 14:10:11 | 4 | + * @LastEditTime: 2025-09-15 15:21:47 |
| 5 | * @FilePath: /lls_program/src/pages/ActivitiesCover/index.vue | 5 | * @FilePath: /lls_program/src/pages/ActivitiesCover/index.vue |
| 6 | * @Description: 活动海报页面 - 展示活动信息并处理定位授权 | 6 | * @Description: 活动海报页面 - 展示活动信息并处理定位授权 |
| 7 | --> | 7 | --> |
| ... | @@ -143,7 +143,7 @@ import { handleSharePageAuth, addShareFlag } from '@/utils/authRedirect' | ... | @@ -143,7 +143,7 @@ import { handleSharePageAuth, addShareFlag } from '@/utils/authRedirect' |
| 143 | import { THEME_COLORS } from '@/utils/config'; | 143 | import { THEME_COLORS } from '@/utils/config'; |
| 144 | 144 | ||
| 145 | // 默认海报图 | 145 | // 默认海报图 |
| 146 | -const defaultPoster = 'https://cdn.ipadbiz.cn/lls_prog/images/welcome_5.jpg'; | 146 | +const defaultPoster = 'https://cdn.ipadbiz.cn/lls_prog/images/welcome_6.png'; |
| 147 | /** | 147 | /** |
| 148 | * 活动海报页面组件 | 148 | * 活动海报页面组件 |
| 149 | * 功能:展示活动信息、处理定位授权、跳转到活动页面 | 149 | * 功能:展示活动信息、处理定位授权、跳转到活动页面 | ... | ... |
-
Please register or login to post a comment