feat(components): 添加积分规则提示并优化测试用户检测逻辑
在PointsCollector和TotalPointsDisplay组件中添加积分规则提示入口 将WeRunAuth中的测试用户检测逻辑改为基于环境变量判断 移除Rewards页面中注释掉的积分攻略部分
Showing
4 changed files
with
94 additions
and
25 deletions
| 1 | <template> | 1 | <template> |
| 2 | <view class="points-collector" :style="{ height: height }"> | 2 | <view class="points-collector" :style="{ height: height }"> |
| 3 | + <!-- 积分规则提示 --> | ||
| 4 | + <view class="points-rule-tip" @tap="handleGoToPointsRule"> | ||
| 5 | + <view class="tip-icon">💡</view> | ||
| 6 | + <text class="tip-text">积分规则</text> | ||
| 7 | + </view> | ||
| 8 | + | ||
| 3 | <!-- 中心圆形显示总积分 --> | 9 | <!-- 中心圆形显示总积分 --> |
| 4 | <view class="center-circle"> | 10 | <view class="center-circle"> |
| 5 | <view class="total-points" @tap="handleGoToRewards"> | 11 | <view class="total-points" @tap="handleGoToRewards"> |
| ... | @@ -417,6 +423,15 @@ const handleGoToRewards = () => { | ... | @@ -417,6 +423,15 @@ const handleGoToRewards = () => { |
| 417 | }) | 423 | }) |
| 418 | } | 424 | } |
| 419 | 425 | ||
| 426 | +/** | ||
| 427 | + * 处理积分规则点击事件 | ||
| 428 | + */ | ||
| 429 | +const handleGoToPointsRule = () => { | ||
| 430 | + Taro.navigateTo({ | ||
| 431 | + url: '/pages/PointsList/index' | ||
| 432 | + }) | ||
| 433 | +} | ||
| 434 | + | ||
| 420 | </script> | 435 | </script> |
| 421 | 436 | ||
| 422 | <style lang="less"> | 437 | <style lang="less"> |
| ... | @@ -428,6 +443,30 @@ const handleGoToRewards = () => { | ... | @@ -428,6 +443,30 @@ const handleGoToRewards = () => { |
| 428 | overflow: hidden; | 443 | overflow: hidden; |
| 429 | } | 444 | } |
| 430 | 445 | ||
| 446 | +.points-rule-tip { | ||
| 447 | + position: absolute; | ||
| 448 | + background-color: white; | ||
| 449 | + top: 0rpx; | ||
| 450 | + right: 0rpx; | ||
| 451 | + display: flex; | ||
| 452 | + flex-direction: column; | ||
| 453 | + align-items: center; | ||
| 454 | + justify-content: center; | ||
| 455 | + z-index: 30; | ||
| 456 | + cursor: pointer; | ||
| 457 | +} | ||
| 458 | + | ||
| 459 | +.tip-icon { | ||
| 460 | + font-size: 32rpx; | ||
| 461 | + margin-bottom: 4rpx; | ||
| 462 | +} | ||
| 463 | + | ||
| 464 | +.tip-text { | ||
| 465 | + font-size: 20rpx; | ||
| 466 | + color: #666; | ||
| 467 | + line-height: 1; | ||
| 468 | +} | ||
| 469 | + | ||
| 431 | .center-circle { | 470 | .center-circle { |
| 432 | position: absolute; | 471 | position: absolute; |
| 433 | left: 50%; | 472 | left: 50%; | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <view class="total-points-display" :style="{ height: height }"> | 2 | <view class="total-points-display" :style="{ height: height }"> |
| 3 | + <!-- 积分规则提示 --> | ||
| 4 | + <view class="points-rule-tip" @tap="handleGoToPointsRule"> | ||
| 5 | + <view class="tip-icon">💡</view> | ||
| 6 | + <text class="tip-text">积分规则</text> | ||
| 7 | + </view> | ||
| 8 | + | ||
| 3 | <!-- 中心圆形显示总积分 --> | 9 | <!-- 中心圆形显示总积分 --> |
| 4 | <view class="center-circle1"> | 10 | <view class="center-circle1"> |
| 5 | <view class="total-points" @tap="handleGoToRewards"> | 11 | <view class="total-points" @tap="handleGoToRewards"> |
| ... | @@ -103,6 +109,15 @@ const handleGoToRewards = () => { | ... | @@ -103,6 +109,15 @@ const handleGoToRewards = () => { |
| 103 | url: '/pages/RewardCategories/index', | 109 | url: '/pages/RewardCategories/index', |
| 104 | }) | 110 | }) |
| 105 | } | 111 | } |
| 112 | + | ||
| 113 | +/** | ||
| 114 | + * 处理积分规则点击事件 | ||
| 115 | + */ | ||
| 116 | +const handleGoToPointsRule = () => { | ||
| 117 | + Taro.navigateTo({ | ||
| 118 | + url: '/pages/PointsList/index' | ||
| 119 | + }) | ||
| 120 | +} | ||
| 106 | </script> | 121 | </script> |
| 107 | 122 | ||
| 108 | <style lang="less"> | 123 | <style lang="less"> |
| ... | @@ -115,6 +130,30 @@ const handleGoToRewards = () => { | ... | @@ -115,6 +130,30 @@ const handleGoToRewards = () => { |
| 115 | align-items: center; | 130 | align-items: center; |
| 116 | } | 131 | } |
| 117 | 132 | ||
| 133 | +.points-rule-tip { | ||
| 134 | + position: absolute; | ||
| 135 | + background-color: white; | ||
| 136 | + top: 0rpx; | ||
| 137 | + right: 0rpx; | ||
| 138 | + display: flex; | ||
| 139 | + flex-direction: column; | ||
| 140 | + align-items: center; | ||
| 141 | + justify-content: center; | ||
| 142 | + z-index: 30; | ||
| 143 | + cursor: pointer; | ||
| 144 | +} | ||
| 145 | + | ||
| 146 | +.tip-icon { | ||
| 147 | + font-size: 32rpx; | ||
| 148 | + margin-bottom: 4rpx; | ||
| 149 | +} | ||
| 150 | + | ||
| 151 | +.tip-text { | ||
| 152 | + font-size: 20rpx; | ||
| 153 | + color: #666; | ||
| 154 | + line-height: 1; | ||
| 155 | +} | ||
| 156 | + | ||
| 118 | .center-circle1 { | 157 | .center-circle1 { |
| 119 | position: absolute; | 158 | position: absolute; |
| 120 | left: 50%; | 159 | left: 50%; | ... | ... |
| ... | @@ -125,25 +125,16 @@ const getWeRunData = async () => { | ... | @@ -125,25 +125,16 @@ const getWeRunData = async () => { |
| 125 | try { | 125 | try { |
| 126 | isLoading.value = true | 126 | isLoading.value = true |
| 127 | 127 | ||
| 128 | - // 检查是否为测试用户(openid以h-开头),如果是则跳过步数同步 | 128 | + // 检查是否为测试环境下的测试用户,如果是则跳过步数同步 |
| 129 | - try { | 129 | + if (process.env.NODE_ENV === 'development') { |
| 130 | - const { getUserProfileAPI } = await import('@/api/user') | 130 | + console.log('开发环境下跳过步数同步') |
| 131 | - const profileResponse = await getUserProfileAPI() | 131 | + Taro.showToast({ |
| 132 | - if (profileResponse.code === 1 && profileResponse.data?.user?.openid) { | 132 | + title: '开发环境无需同步步数', |
| 133 | - const openid = profileResponse.data.user.openid | 133 | + icon: 'none', |
| 134 | - if (openid.startsWith('h-')) { | 134 | + duration: 2000 |
| 135 | - console.log('检测到测试用户openid:', openid, '跳过步数同步') | 135 | + }) |
| 136 | - Taro.showToast({ | 136 | + isLoading.value = false |
| 137 | - title: '测试用户无需同步步数', | 137 | + return |
| 138 | - icon: 'none', | ||
| 139 | - duration: 2000 | ||
| 140 | - }) | ||
| 141 | - isLoading.value = false | ||
| 142 | - return | ||
| 143 | - } | ||
| 144 | - } | ||
| 145 | - } catch (profileError) { | ||
| 146 | - console.warn('获取用户信息失败,继续执行步数同步:', profileError) | ||
| 147 | } | 138 | } |
| 148 | 139 | ||
| 149 | // 先调用 wx.login 获取 code | 140 | // 先调用 wx.login 获取 code | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-08-27 17:47:26 | 2 | * @Date: 2025-08-27 17:47:26 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-09-04 21:38:56 | 4 | + * @LastEditTime: 2025-09-05 10:39:16 |
| 5 | * @FilePath: /lls_program/src/pages/Rewards/index.vue | 5 | * @FilePath: /lls_program/src/pages/Rewards/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -19,16 +19,16 @@ | ... | @@ -19,16 +19,16 @@ |
| 19 | </view> | 19 | </view> |
| 20 | <!-- Main content --> | 20 | <!-- Main content --> |
| 21 | <view class="bg-white rounded-t-3xl px-4 pt-5"> | 21 | <view class="bg-white rounded-t-3xl px-4 pt-5"> |
| 22 | - <!-- Points strategy section --> | 22 | +<!-- <!~~ Points strategy section ~~> |
| 23 | <view v-if="!isCreator" class="mb-8 bg-gradient-to-br from-blue-50 to-indigo-50 rounded-2xl p-5 shadow-sm border border-blue-100"> | 23 | <view v-if="!isCreator" class="mb-8 bg-gradient-to-br from-blue-50 to-indigo-50 rounded-2xl p-5 shadow-sm border border-blue-100"> |
| 24 | <view class="flex justify-between items-center mb-4"> | 24 | <view class="flex justify-between items-center mb-4"> |
| 25 | <h3 class="text-lg font-medium text-gray-800">积分攻略</h3> | 25 | <h3 class="text-lg font-medium text-gray-800">积分攻略</h3> |
| 26 | <view @tap="handleViewAll" class="text-blue-500 text-sm flex items-center hover:text-blue-600"> | 26 | <view @tap="handleViewAll" class="text-blue-500 text-sm flex items-center hover:text-blue-600"> |
| 27 | 查看全部 | 27 | 查看全部 |
| 28 | - <!-- <Right size="16" /> --> | 28 | + <!~~ <Right size="16" /> ~~> |
| 29 | </view> | 29 | </view> |
| 30 | </view> | 30 | </view> |
| 31 | - <!-- Strategy cards --> | 31 | + <!~~ Strategy cards ~~> |
| 32 | <view v-if="isStrategyExpanded" class="space-y-3 mb-4 transition-all duration-300"> | 32 | <view v-if="isStrategyExpanded" class="space-y-3 mb-4 transition-all duration-300"> |
| 33 | <view class="bg-white border border-gray-100 p-4 rounded-lg flex items-start shadow-sm"> | 33 | <view class="bg-white border border-gray-100 p-4 rounded-lg flex items-start shadow-sm"> |
| 34 | <view class="w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center mr-3"> | 34 | <view class="w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center mr-3"> |
| ... | @@ -64,12 +64,12 @@ | ... | @@ -64,12 +64,12 @@ |
| 64 | </view> | 64 | </view> |
| 65 | </view> | 65 | </view> |
| 66 | </view> | 66 | </view> |
| 67 | - <!-- Expand/Collapse button at bottom --> | 67 | + <!~~ Expand/Collapse button at bottom ~~> |
| 68 | <view @tap="toggleStrategyExpand" class="flex justify-center items-center py-2 cursor-pointer hover:bg-blue-100 rounded-lg transition-colors"> | 68 | <view @tap="toggleStrategyExpand" class="flex justify-center items-center py-2 cursor-pointer hover:bg-blue-100 rounded-lg transition-colors"> |
| 69 | <ArrowUp v-if="isStrategyExpanded" size="16" class="text-gray-500" /> | 69 | <ArrowUp v-if="isStrategyExpanded" size="16" class="text-gray-500" /> |
| 70 | <ArrowDown v-else size="16" class="text-gray-500" /> | 70 | <ArrowDown v-else size="16" class="text-gray-500" /> |
| 71 | </view> | 71 | </view> |
| 72 | - </view> | 72 | + </view>--> |
| 73 | <!-- Quick exchange options --> | 73 | <!-- Quick exchange options --> |
| 74 | <!-- Search bar --> | 74 | <!-- Search bar --> |
| 75 | <view class="mb-6"> | 75 | <view class="mb-6"> | ... | ... |
-
Please register or login to post a comment