index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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/libs/models'
  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. onShareAppMessage(() => ({
  23. title: '线下活动',
  24. }))
  25. onShareTimeline(() => ({
  26. title: '线下活动',
  27. }))
  28. </script>
  29. <template>
  30. <div class="flex-grow flex flex-col gap-6 mx-3.5">
  31. <div class="mx--3.5 fixed left-4 w-full bg-white z-10">
  32. <wd-tabs v-model="tab" custom-class="" :slidable-num="4">
  33. <block v-for="(it, item) in tabs" :key="item">
  34. <wd-tab :title="it.label"></wd-tab>
  35. </block>
  36. </wd-tabs>
  37. </div>
  38. <div class="mt-[50px]">
  39. <PageHelper
  40. v-if="tabs.length"
  41. :request="getActivities"
  42. :query="{ activityType: tabs[tab].value, showStatus: 1 }"
  43. class="flex flex-col flex-grow"
  44. >
  45. <template #default="{ source }">
  46. <div class="flex flex-col gap-6">
  47. <template v-for="(it, index) in source.list" :key="index">
  48. <!-- <offline-activity-item class="" :options="it"></offline-activity-item> -->
  49. <div
  50. @click="router.push(`/pages/home/activity/detail/index?id=${it.id}&type=activity`)"
  51. >
  52. <Card>
  53. <div class="flex flex-col gap-5">
  54. <div class="flex gap-4 mb-2">
  55. <wd-img
  56. width="110px"
  57. height="88px"
  58. class="rounded-[10px]"
  59. :src="it.thumbnailUrl"
  60. ></wd-img>
  61. <div class="flex flex-col justify-between">
  62. <div
  63. class="w-[168px] text-black text-base font-normal font-['PingFang_SC'] leading-relaxed"
  64. >
  65. {{ it.name }}
  66. </div>
  67. <div class="flex">
  68. <div
  69. class="w-[70px] text-black/40 text-sm font-normal font-['PingFang_SC'] leading-[34px]"
  70. >
  71. 活动时间:
  72. </div>
  73. <div
  74. class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-[34px] flex items-center"
  75. >
  76. {{ dayjs(it.activityStartTime).format('MM.DD') }}
  77. <wd-icon name="play" size="22px"></wd-icon>
  78. {{ dayjs(it.activityEndTime).format('MM.DD') }}
  79. </div>
  80. </div>
  81. <div class="flex items-end">
  82. <div
  83. class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-[34px]"
  84. >
  85. 兑换积分:
  86. </div>
  87. <div
  88. class="text-[#ef4343] text-xl font-normal font-['D-DIN_Exp'] leading-[34px]"
  89. >
  90. {{ it.needPointsCount }}
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. <view class="flex items-center justify-between mb-1.5">
  96. <view
  97. class="flex items-center text-black/40 text-sm font-normal font-['PingFang_SC'] leading-[34px]"
  98. >
  99. <!-- <wd-count-down
  100. :time="dayjs(it.applyStartTime).diff(new Date(), 'millisecond')"
  101. >
  102. <template #default="{ current }">
  103. <div class="flex items-center gap-1.25 text-black/40 text-sm">
  104. <div>距结束还剩</div>
  105. <div
  106. class="w-4 h-4 bg-black/90 rounded text-white text-2.5 flex items-center justify-center"
  107. >
  108. {{ current.days }}
  109. </div>
  110. <span class="custom-count-down-colon">天</span>
  111. <div
  112. class="w-4 h-4 bg-black/90 rounded text-white text-2.5 flex items-center justify-center"
  113. >
  114. {{ current.hours }}
  115. </div>
  116. <span class="custom-count-down-colon">时</span>
  117. <div
  118. class="w-4 h-4 bg-black/90 rounded text-white text-2.5 flex items-center justify-center"
  119. >
  120. {{ current.minutes }}
  121. </div>
  122. <span class="custom-count-down-colon">分</span>
  123. </div>
  124. </template>
  125. </wd-count-down> -->
  126. <ActivityCountDown
  127. :start-at="it.applyStartTime"
  128. :end-at="it.applyEndTime"
  129. ></ActivityCountDown>
  130. </view>
  131. <tilted-button>
  132. {{
  133. it.ifSingnUp
  134. ? '已报名'
  135. : getActivityStatusButtonText(it.applyStartTime, it.applyEndTime)
  136. }}
  137. </tilted-button>
  138. </view>
  139. </div>
  140. </Card>
  141. </div>
  142. </template>
  143. </div>
  144. </template>
  145. </PageHelper>
  146. </div>
  147. </div>
  148. </template>