RewardGuide.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div class="guide-card">
  3. <!-- 烟花动画背景 -->
  4. <div class="guide-illustration reward-bg">
  5. <div class="firework fw-1">🎆</div>
  6. <div class="firework fw-2">✨</div>
  7. <div class="firework fw-3">🎇</div>
  8. <div class="illus-center">🎁</div>
  9. </div>
  10. <div class="guide-body">
  11. <div class="guide-badge finish">Step 7 · 完成!</div>
  12. <h2 class="guide-title">引导完成,领取奖励!</h2>
  13. <p class="guide-desc">恭喜你完成新手引导!<br />你的专属<strong>新手礼包</strong>已准备就绪 🎉</p>
  14. <!-- 奖励展示 -->
  15. <div class="reward-list">
  16. <div class="reward-item" v-for="item in rewards" :key="item.id">
  17. <div class="reward-icon">{{ item.icon }}</div>
  18. <div class="reward-info">
  19. <div class="reward-name">{{ item.name }}</div>
  20. <div class="reward-value">{{ item.value }}</div>
  21. </div>
  22. <div class="reward-badge">新人专享</div>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="guide-footer" v-if="hasClaimed !== null">
  27. <button class="btn-finish" v-if="hasClaimed" @click="$emit('next')">
  28. <span>🚀</span> 开始探索
  29. </button>
  30. <button class="btn-finish" v-else @click="handleClaim">
  31. <span>🎁</span> 立即领取
  32. </button>
  33. <button class="btn-prev" @click="$emit('prev')">
  34. 上一步
  35. </button>
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. import { Message } from 'element-ui'
  41. import { hasClaimedEntryIntegral, claimEntryIntegral } from '@/api/allApi'
  42. export default {
  43. name: 'RewardGuide',
  44. props: {
  45. isLast: { type: Boolean, default: false },
  46. isFirst: { type: Boolean, default: false },
  47. isReplay: { type: Boolean, default: false },
  48. },
  49. data() {
  50. return {
  51. hasClaimed: null,
  52. rewards: [
  53. { id: 1, icon: '💰', name: '积分奖励', value: '+1000 积分' },
  54. { id: 2, icon: '🏅', name: '引导完成成就徽章', value: '新手成就解锁' },
  55. // { id: 3, icon: '🎫', name: '专属礼品券', value: '满 100 积分可用' },
  56. ],
  57. }
  58. },
  59. created() {
  60. const userId = this.$store.getters.userInfo.loginId
  61. if (userId) {
  62. hasClaimedEntryIntegral({ userId }).then(res => {
  63. if (res.data && res.data.data) {
  64. this.hasClaimed = !!res.data.data.hasClaimed
  65. }
  66. }).catch(() => {
  67. // 接口异常默认已领过,显示「开始探索」
  68. this.hasClaimed = true
  69. })
  70. }else {
  71. this.hasClaimed = true
  72. }
  73. },
  74. methods: {
  75. handleClaim() {
  76. const userId = this.$store.getters.userInfo.loginId
  77. claimEntryIntegral({ userId }).then(() => {
  78. Message.success('奖励领取成功!')
  79. this.hasClaimed = true
  80. this.$emit('next')
  81. }).catch(() => {
  82. Message.error('领取失败,请稍后重试')
  83. })
  84. },
  85. },
  86. }
  87. </script>
  88. <style scoped>
  89. .guide-card {
  90. width: 440px;
  91. max-width: 90vw;
  92. background: #fff;
  93. border-radius: 20px;
  94. overflow: hidden;
  95. box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  96. animation: cardFloat 0.5s ease-out;
  97. }
  98. @keyframes cardFloat {
  99. from { opacity: 0; transform: translateY(30px) scale(0.95); }
  100. to { opacity: 1; transform: translateY(0) scale(1); }
  101. }
  102. .reward-bg {
  103. position: relative;
  104. height: 160px;
  105. background: linear-gradient(135deg, #27ae60 0%, #6dd5fa 100%);
  106. display: flex;
  107. align-items: center;
  108. justify-content: center;
  109. overflow: hidden;
  110. }
  111. .illus-center {
  112. font-size: 64px;
  113. z-index: 2;
  114. animation: giftPulse 2s ease-in-out infinite;
  115. }
  116. @keyframes giftPulse {
  117. 0%, 100% { transform: scale(1); }
  118. 50% { transform: scale(1.1) rotate(5deg); }
  119. }
  120. .firework {
  121. position: absolute;
  122. font-size: 24px;
  123. animation: fireworkAnim 3s ease-in-out infinite;
  124. }
  125. .fw-1 { top: 16px; left: 24px; animation-delay: 0s; }
  126. .fw-2 { top: 20px; right: 28px; animation-delay: 1s; }
  127. .fw-3 { bottom: 16px; left: 50%; transform: translateX(-50%); animation-delay: 2s; }
  128. @keyframes fireworkAnim {
  129. 0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.7; }
  130. 50% { transform: scale(1.3) rotate(15deg); opacity: 1; }
  131. }
  132. .guide-body { padding: 24px 28px 16px; }
  133. .guide-badge {
  134. display: inline-block;
  135. padding: 3px 12px;
  136. font-size: 12px;
  137. font-weight: 600;
  138. color: #fff;
  139. background: linear-gradient(135deg, #27ae60, #6dd5fa);
  140. border-radius: 12px;
  141. margin-bottom: 12px;
  142. }
  143. .guide-title {
  144. font-size: 20px;
  145. font-weight: 700;
  146. color: #1d2129;
  147. margin: 0 0 8px;
  148. }
  149. .guide-desc {
  150. font-size: 13px;
  151. line-height: 1.7;
  152. color: #86909c;
  153. margin: 0 0 16px;
  154. }
  155. .guide-desc strong { color: #27ae60; }
  156. .reward-list { display: flex; flex-direction: column; gap: 10px; }
  157. .reward-item {
  158. display: flex;
  159. align-items: center;
  160. gap: 12px;
  161. padding: 12px 16px;
  162. background: linear-gradient(135deg, #f0fdf4, #e8fdf5);
  163. border-radius: 12px;
  164. border: 1px solid #d1fae5;
  165. transition: all 0.25s;
  166. }
  167. .reward-item:hover { transform: translateX(4px); box-shadow: 0 2px 10px rgba(39,174,96,0.15); }
  168. .reward-icon { font-size: 26px; }
  169. .reward-info { flex: 1; }
  170. .reward-name { font-size: 13px; font-weight: 600; color: #1d2129; }
  171. .reward-value { font-size: 12px; color: #27ae60; font-weight: 700; margin-top: 2px; }
  172. .reward-badge {
  173. padding: 2px 8px;
  174. font-size: 11px;
  175. color: #27ae60;
  176. background: #fff;
  177. border: 1px solid #27ae60;
  178. border-radius: 10px;
  179. white-space: nowrap;
  180. }
  181. .guide-footer { padding: 16px 28px 28px; }
  182. .btn-finish {
  183. display: flex;
  184. align-items: center;
  185. justify-content: center;
  186. gap: 8px;
  187. width: 100%;
  188. height: 50px;
  189. font-size: 16px;
  190. font-weight: 700;
  191. color: #fff;
  192. background: linear-gradient(135deg, #27ae60, #6dd5fa);
  193. border: none;
  194. border-radius: 25px;
  195. cursor: pointer;
  196. transition: all 0.3s;
  197. box-shadow: 0 4px 12px rgba(39,174,96,0.2);
  198. animation: btnShine 3s ease-in-out infinite;
  199. }
  200. .btn-finish:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(39,174,96,0.3); }
  201. .btn-finish:active { transform: translateY(0); }
  202. .btn-prev {
  203. width: 100%;
  204. height: 40px;
  205. font-size: 14px;
  206. font-weight: 500;
  207. color: #86909c;
  208. background: #f7f9fc;
  209. border: none;
  210. border-radius: 20px;
  211. cursor: pointer;
  212. transition: all 0.25s;
  213. margin-top: 10px;
  214. }
  215. .btn-prev:hover { color: #4e5969; background: #eef1f6; }
  216. @keyframes btnShine {
  217. 0%, 100% { box-shadow: 0 4px 12px rgba(39,174,96,0.2); }
  218. 50% { box-shadow: 0 4px 16px rgba(39,174,96,0.35); }
  219. }
  220. </style>