hookehuyr

refactor(RankingCard): 优化地区榜单显示逻辑并移除冗余代码

移除根据用户区县自动设置默认标签的逻辑,简化地区榜单显示方式
修改默认激活标签为'shanghai',直接显示区域名称而非固定文本
......@@ -139,7 +139,7 @@ const handleItemClick = (item, index) => {
const imageUrls = albumData.value
.filter(media => media.media_type === 'IMAGE')
.map(media => media.media_url);
Taro.previewImage({
urls: imageUrls,
current: item.media_url
......
......@@ -137,7 +137,7 @@ const props = defineProps({
})
// 当前激活的tab
const activeTab = ref('310101')
const activeTab = ref('shanghai')
// 内容切换状态
const isContentSwitching = ref(false)
......@@ -200,18 +200,6 @@ const loadLeaderboardData = async (isInitialLoad = false) => {
leaderboardData.value = response.data
// 设置当前日期
currentDate.value = response.data.yesterday
// 只在初始加载时从current_family.county获取区县信息,设置默认tab
if (isInitialLoad && response.data.current_family) {
const currentFamilyCounty = response.data.current_family.county;
if (currentFamilyCounty && String(currentFamilyCounty) !== activeTab.value) {
// 只在county与当前activeTab不同时才设置,确保county字段为字符串格式
activeTab.value = String(currentFamilyCounty)
// 设置activeTab后需要重新加载数据以获取正确的区县排行榜
await loadLeaderboardData(false)
return
}
}
}
} catch (error) {
console.error('获取排行榜数据失败:', error)
......@@ -241,7 +229,7 @@ const availableRegions = computed(() => {
{ text: '地区', value: 'region' },
{ text: '助力', value: 'support' }
]
// 如果有用户区县信息,将地区榜的value设置为用户区县
const currentFamilyCounty = leaderboardData.value?.current_family?.county
if (currentFamilyCounty) {
......@@ -251,7 +239,7 @@ const availableRegions = computed(() => {
regions[1] = { text: userRegion.text, value: userCounty }
}
}
return regions
})
......@@ -265,10 +253,10 @@ const getTabDisplayName = (region) => {
return '上海榜'
} else if (region.value === 'support') {
return '助力榜'
} else if (region.value === 'region' || region.text.includes('区') || region.text.includes('县')) {
return '地区榜'
} else {
// 直接显示区域名称,如"黄浦区"、"杨浦区"等
return region.text
}
return region.text
}
/**
......@@ -417,11 +405,11 @@ defineExpose({
&.indicator-shanghai {
transform: translateX(0%);
}
&.indicator-region {
transform: translateX(100%);
}
&.indicator-support {
transform: translateX(200%);
}
......
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-15 14:10:11
* @LastEditTime: 2025-09-15 15:21:47
* @FilePath: /lls_program/src/pages/ActivitiesCover/index.vue
* @Description: 活动海报页面 - 展示活动信息并处理定位授权
-->
......@@ -143,7 +143,7 @@ import { handleSharePageAuth, addShareFlag } from '@/utils/authRedirect'
import { THEME_COLORS } from '@/utils/config';
// 默认海报图
const defaultPoster = 'https://cdn.ipadbiz.cn/lls_prog/images/welcome_5.jpg';
const defaultPoster = 'https://cdn.ipadbiz.cn/lls_prog/images/welcome_6.png';
/**
* 活动海报页面组件
* 功能:展示活动信息、处理定位授权、跳转到活动页面
......