SignRedPacket.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <script setup lang="ts">
  2. import {CDN_URL} from "~/config/app";
  3. const signInRedPacketImage = CDN_URL + 'https://cdn.bjtdba.com/chuxubao/static/assets/sign_in_red_packet.png'
  4. const props = defineProps({
  5. day: {
  6. type: Number,
  7. required: true
  8. },
  9. text: {
  10. type: String,
  11. }
  12. })
  13. const getScore =computed(() => {
  14. if (props.day == 1) {
  15. return '+2'
  16. } else if (props.day == 2) {
  17. return '+4'
  18. } else if (props.day == 3) {
  19. return '+6'
  20. } else if (props.day == 4) {
  21. return '+10'
  22. } else if (props.day == 5) {
  23. return '+14'
  24. } else if (props.day == 6) {
  25. return '+20'
  26. }
  27. })
  28. </script>
  29. <template>
  30. <div class=" flex flex-col items-center text-xs gap-2" >
  31. <div class=" flex flex-col items-center justify-end "
  32. :class="[text ? 'activeBg' : 'defaultBg', 'h-29 w-20']"
  33. >
  34. <div class="text-[11px] text-white mb-1">{{ getScore }}</div>
  35. </div>
  36. <div>
  37. <div class="relative text-[10px]" v-if="text"> {{ text}} </div>
  38. <div class="relative text-[10px]" v-else> 第 {{ day }} 天</div>
  39. </div>
  40. </div>
  41. </template>
  42. <style>
  43. .defaultBg {
  44. width: 80rpx;
  45. height: 116rpx;
  46. background-image: url('https://cdn.bjtdba.com/chuxubao/static/assets/sign_in_red_packet.png');
  47. background-size: 100% 100%;
  48. }
  49. .activeBg {
  50. width: 80rpx;
  51. height: 116rpx;
  52. background-image: url('https://cdn.bjtdba.com/chuxubao/static/assets/hb_yiqiandao_220908.png');
  53. background-size: 100% 100%;
  54. }
  55. </style>