index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <route lang="json">
  2. { "style": { "navigationBarTitleText": "线下活动", "navigationBarBackgroundColor": "#fff" } }
  3. </route>
  4. <script setup lang="ts">
  5. import { getActivities, getByDictType } from '../../../../core/libs/requests'
  6. import Card from '@/components/card.vue'
  7. import PageHelper from '@/components/page-helper.vue'
  8. import TiltedButton from '@/components/tilted-button.vue'
  9. import { useRouter } from '../../../../core/utils/router'
  10. import dayjs from 'dayjs'
  11. import ActivityCountDown from '../../components/activity-count-down.vue'
  12. import { getActivityStatus, getActivityStatusButtonText } from '../../../../core/utils/common'
  13. import { DictType } from '../../../../core/models/moment'
  14. const tab = ref<number>(0)
  15. const router = useRouter()
  16. const { data: tabs, run: setTabs } = useRequest(() => getByDictType(DictType.MemberActivityType), {
  17. initialData: [],
  18. })
  19. onMounted(async () => {
  20. await setTabs()
  21. })
  22. </script>
  23. <template>
  24. <div class="flex-grow flex flex-col gap-6 mx-3.5">
  25. <div class="mx--3.5">
  26. <wd-tabs v-model="tab" custom-class="" :slidable-num="4">
  27. <block v-for="(it, item) in tabs" :key="item">
  28. <wd-tab :title="it.label"></wd-tab>
  29. </block>
  30. </wd-tabs>
  31. </div>
  32. <PageHelper
  33. v-if="tabs.length"
  34. :request="getActivities"
  35. :query="{ activityType: tabs[tab].value }"
  36. class="flex flex-col flex-grow"
  37. >
  38. <template #default="{ source }">
  39. <div class="flex flex-col gap-6">
  40. <template v-for="(it, index) in source.list" :key="index">
  41. <!-- <offline-activity-item class="" :options="it"></offline-activity-item> -->
  42. <div
  43. @click="router.push(`/pages/home/activity/detail/index?id=${it.id}&type=activity`)"
  44. >
  45. <Card>
  46. <div class="flex flex-col gap-5">
  47. <div class="flex gap-4 mb-2">
  48. <wd-img
  49. width="110px"
  50. height="88px"
  51. class="rounded-[10px]"
  52. :src="it.thumbnailUrl"
  53. ></wd-img>
  54. <div class="flex flex-col justify-between">
  55. <div
  56. class="w-[168px] text-black text-base font-normal font-['PingFang_SC'] leading-relaxed"
  57. >
  58. {{ it.name }}
  59. </div>
  60. <div class="flex">
  61. <div
  62. class="w-[70px] text-black/40 text-sm font-normal font-['PingFang_SC'] leading-[34px]"
  63. >
  64. 活动时间:
  65. </div>
  66. <div
  67. class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-[34px] flex items-center"
  68. >
  69. {{ dayjs(it.activityStartTime).format('MM.DD') }}
  70. <wd-icon name="play" size="22px"></wd-icon>
  71. {{ dayjs(it.activityEndTime).format('MM.DD') }}
  72. </div>
  73. </div>
  74. <div class="flex items-end">
  75. <div
  76. class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-[34px]"
  77. >
  78. 兑换积分:
  79. </div>
  80. <div
  81. class="text-[#ef4343] text-xl font-normal font-['D-DIN Exp'] leading-[34px]"
  82. >
  83. {{ it.needPointsCount }}
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <view class="flex items-center justify-between mb-1.5">
  89. <view
  90. class="flex items-center text-black/40 text-sm font-normal font-['PingFang_SC'] leading-[34px]"
  91. >
  92. <!-- <wd-count-down
  93. :time="dayjs(it.applyStartTime).diff(new Date(), 'millisecond')"
  94. >
  95. <template #default="{ current }">
  96. <div class="flex items-center gap-1.25 text-black/40 text-sm">
  97. <div>距结束还剩</div>
  98. <div
  99. class="w-4 h-4 bg-black/90 rounded text-white text-2.5 flex items-center justify-center"
  100. >
  101. {{ current.days }}
  102. </div>
  103. <span class="custom-count-down-colon">天</span>
  104. <div
  105. class="w-4 h-4 bg-black/90 rounded text-white text-2.5 flex items-center justify-center"
  106. >
  107. {{ current.hours }}
  108. </div>
  109. <span class="custom-count-down-colon">时</span>
  110. <div
  111. class="w-4 h-4 bg-black/90 rounded text-white text-2.5 flex items-center justify-center"
  112. >
  113. {{ current.minutes }}
  114. </div>
  115. <span class="custom-count-down-colon">分</span>
  116. </div>
  117. </template>
  118. </wd-count-down> -->
  119. <ActivityCountDown
  120. :start-at="it.applyStartTime"
  121. :end-at="it.applyEndTime"
  122. ></ActivityCountDown>
  123. </view>
  124. <tilted-button>
  125. {{
  126. it.ifSingnUp
  127. ? '已报名'
  128. : getActivityStatusButtonText(it.applyStartTime, it.applyEndTime)
  129. }}
  130. </tilted-button>
  131. </view>
  132. </div>
  133. </Card>
  134. </div>
  135. </template>
  136. </div>
  137. </template>
  138. </PageHelper>
  139. </div>
  140. </template>