feat(Rewards): 添加积分攻略模块及展开收起功能
添加积分攻略模块,包含三种积分获取方式的卡片展示 实现查看全部和展开收起功能,提升用户体验
Showing
1 changed file
with
89 additions
and
2 deletions
| 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 12:38:36 | 4 | + * @LastEditTime: 2025-09-04 21:38:56 |
| 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,6 +19,57 @@ | ... | @@ -19,6 +19,57 @@ |
| 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 --> | ||
| 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"> | ||
| 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"> | ||
| 27 | + 查看全部 | ||
| 28 | + <!-- <Right size="16" /> --> | ||
| 29 | + </view> | ||
| 30 | + </view> | ||
| 31 | + <!-- Strategy cards --> | ||
| 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"> | ||
| 34 | + <view class="w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center mr-3"> | ||
| 35 | + <My size="20" class="text-blue-500" /> | ||
| 36 | + </view> | ||
| 37 | + <view> | ||
| 38 | + <h4 class="font-medium">每日同步步数可获得积分</h4> | ||
| 39 | + <p class="text-sm text-gray-600"> | ||
| 40 | + 每100步可兑换1积分,每日上限200积分 | ||
| 41 | + </p> | ||
| 42 | + </view> | ||
| 43 | + </view> | ||
| 44 | + <view class="bg-white border border-gray-100 p-4 rounded-lg flex items-start shadow-sm"> | ||
| 45 | + <view class="w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center mr-3"> | ||
| 46 | + <My size="20" class="text-blue-500" /> | ||
| 47 | + </view> | ||
| 48 | + <view> | ||
| 49 | + <h4 class="font-medium">家人陪伴健步有奖励积分</h4> | ||
| 50 | + <p class="text-sm text-gray-600"> | ||
| 51 | + 一起健步晒合影每天可获得额外100积分 | ||
| 52 | + </p> | ||
| 53 | + </view> | ||
| 54 | + </view> | ||
| 55 | + <view class="bg-white border border-gray-100 p-4 rounded-lg flex items-start shadow-sm"> | ||
| 56 | + <view class="w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center mr-3"> | ||
| 57 | + <My size="20" class="text-blue-500" /> | ||
| 58 | + </view> | ||
| 59 | + <view> | ||
| 60 | + <h4 class="font-medium">邀请家人加入家庭,人数达标奖励</h4> | ||
| 61 | + <p class="text-sm text-gray-600"> | ||
| 62 | + 邀请的家人达到5位,获得500奖励积分 | ||
| 63 | + </p> | ||
| 64 | + </view> | ||
| 65 | + </view> | ||
| 66 | + </view> | ||
| 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"> | ||
| 69 | + <ArrowUp v-if="isStrategyExpanded" size="16" class="text-gray-500" /> | ||
| 70 | + <ArrowDown v-else size="16" class="text-gray-500" /> | ||
| 71 | + </view> | ||
| 72 | + </view> | ||
| 22 | <!-- Quick exchange options --> | 73 | <!-- Quick exchange options --> |
| 23 | <!-- Search bar --> | 74 | <!-- Search bar --> |
| 24 | <view class="mb-6"> | 75 | <view class="mb-6"> |
| ... | @@ -76,7 +127,7 @@ | ... | @@ -76,7 +127,7 @@ |
| 76 | <script setup> | 127 | <script setup> |
| 77 | import { ref, computed, onMounted } from 'vue'; | 128 | import { ref, computed, onMounted } from 'vue'; |
| 78 | import Taro, { useDidShow } from '@tarojs/taro'; | 129 | import Taro, { useDidShow } from '@tarojs/taro'; |
| 79 | -import { ScreenLittle, Search2 } from '@nutui/icons-vue-taro'; | 130 | +import { ScreenLittle, Search2, My, ArrowUp, ArrowDown } from '@nutui/icons-vue-taro'; |
| 80 | import { getUserProfileAPI } from '@/api/user'; | 131 | import { getUserProfileAPI } from '@/api/user'; |
| 81 | import { getFamilyDashboardAPI } from '@/api/family'; | 132 | import { getFamilyDashboardAPI } from '@/api/family'; |
| 82 | 133 | ||
| ... | @@ -86,6 +137,7 @@ const sortOrder = ref('desc'); // 'asc' or 'desc' | ... | @@ -86,6 +137,7 @@ const sortOrder = ref('desc'); // 'asc' or 'desc' |
| 86 | 137 | ||
| 87 | const totalPoints = ref(0); | 138 | const totalPoints = ref(0); |
| 88 | const isCreator = ref(false); | 139 | const isCreator = ref(false); |
| 140 | +const isStrategyExpanded = ref(false); // 积分攻略展开状态,默认收起 | ||
| 89 | 141 | ||
| 90 | const sortedRewardItems = computed(() => { | 142 | const sortedRewardItems = computed(() => { |
| 91 | let items = [...rewardItems.value]; | 143 | let items = [...rewardItems.value]; |
| ... | @@ -161,6 +213,22 @@ const goToRewardDetail = (reward) => { | ... | @@ -161,6 +213,22 @@ const goToRewardDetail = (reward) => { |
| 161 | }); | 213 | }); |
| 162 | }; | 214 | }; |
| 163 | 215 | ||
| 216 | +/** | ||
| 217 | + * 处理查看全部积分攻略 | ||
| 218 | + */ | ||
| 219 | +const handleViewAll = () => { | ||
| 220 | + Taro.navigateTo({ | ||
| 221 | + url: '/pages/PointsList/index' | ||
| 222 | + }); | ||
| 223 | +}; | ||
| 224 | + | ||
| 225 | +/** | ||
| 226 | + * 切换积分攻略展开收起状态 | ||
| 227 | + */ | ||
| 228 | +const toggleStrategyExpand = () => { | ||
| 229 | + isStrategyExpanded.value = !isStrategyExpanded.value; | ||
| 230 | +}; | ||
| 231 | + | ||
| 164 | const initData = async () => { | 232 | const initData = async () => { |
| 165 | // 获取用户信息,判断是否为创建者 | 233 | // 获取用户信息,判断是否为创建者 |
| 166 | try { | 234 | try { |
| ... | @@ -189,3 +257,22 @@ useDidShow(() => { | ... | @@ -189,3 +257,22 @@ useDidShow(() => { |
| 189 | initData(); | 257 | initData(); |
| 190 | }) | 258 | }) |
| 191 | </script> | 259 | </script> |
| 260 | + | ||
| 261 | +<style scoped> | ||
| 262 | +/* 过渡动画 */ | ||
| 263 | +.transition-all { | ||
| 264 | + transition: all 0.3s ease-in-out; | ||
| 265 | +} | ||
| 266 | + | ||
| 267 | +.duration-300 { | ||
| 268 | + transition-duration: 300ms; | ||
| 269 | +} | ||
| 270 | + | ||
| 271 | +.cursor-pointer { | ||
| 272 | + cursor: pointer; | ||
| 273 | +} | ||
| 274 | + | ||
| 275 | +.gap-3 { | ||
| 276 | + gap: 0.75rem; | ||
| 277 | +} | ||
| 278 | +</style> | ... | ... |
-
Please register or login to post a comment