hookehuyr

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

移除根据用户区县自动设置默认标签的逻辑,简化地区榜单显示方式
修改默认激活标签为'shanghai',直接显示区域名称而非固定文本
...@@ -139,7 +139,7 @@ const handleItemClick = (item, index) => { ...@@ -139,7 +139,7 @@ const handleItemClick = (item, index) => {
139 const imageUrls = albumData.value 139 const imageUrls = albumData.value
140 .filter(media => media.media_type === 'IMAGE') 140 .filter(media => media.media_type === 'IMAGE')
141 .map(media => media.media_url); 141 .map(media => media.media_url);
142 - 142 +
143 Taro.previewImage({ 143 Taro.previewImage({
144 urls: imageUrls, 144 urls: imageUrls,
145 current: item.media_url 145 current: item.media_url
......
...@@ -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)
...@@ -241,7 +229,7 @@ const availableRegions = computed(() => { ...@@ -241,7 +229,7 @@ const availableRegions = computed(() => {
241 { text: '地区', value: 'region' }, 229 { text: '地区', value: 'region' },
242 { text: '助力', value: 'support' } 230 { text: '助力', value: 'support' }
243 ] 231 ]
244 - 232 +
245 // 如果有用户区县信息,将地区榜的value设置为用户区县 233 // 如果有用户区县信息,将地区榜的value设置为用户区县
246 const currentFamilyCounty = leaderboardData.value?.current_family?.county 234 const currentFamilyCounty = leaderboardData.value?.current_family?.county
247 if (currentFamilyCounty) { 235 if (currentFamilyCounty) {
...@@ -251,7 +239,7 @@ const availableRegions = computed(() => { ...@@ -251,7 +239,7 @@ const availableRegions = computed(() => {
251 regions[1] = { text: userRegion.text, value: userCounty } 239 regions[1] = { text: userRegion.text, value: userCounty }
252 } 240 }
253 } 241 }
254 - 242 +
255 return regions 243 return regions
256 }) 244 })
257 245
...@@ -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 + // 直接显示区域名称,如"黄浦区"、"杨浦区"等
258 + return region.text
270 } 259 }
271 - return region.text
272 } 260 }
273 261
274 /** 262 /**
...@@ -417,11 +405,11 @@ defineExpose({ ...@@ -417,11 +405,11 @@ defineExpose({
417 &.indicator-shanghai { 405 &.indicator-shanghai {
418 transform: translateX(0%); 406 transform: translateX(0%);
419 } 407 }
420 - 408 +
421 &.indicator-region { 409 &.indicator-region {
422 transform: translateX(100%); 410 transform: translateX(100%);
423 } 411 }
424 - 412 +
425 &.indicator-support { 413 &.indicator-support {
426 transform: translateX(200%); 414 transform: translateX(200%);
427 } 415 }
......
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 * 功能:展示活动信息、处理定位授权、跳转到活动页面
......