hot-activity-item.vue 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <script lang="ts" setup>
  2. import dayjs from 'dayjs'
  3. import { Activity, StudyTour } from '../core/libs/models'
  4. import ActivityCountDown from '@/pages/home/components/activity-count-down.vue'
  5. import ButtonEvo from './button-evo.vue'
  6. import { useRouter } from '../core/utils/router'
  7. import { useActivity } from '../composables/activity'
  8. import { omit } from 'radash'
  9. const props = withDefaults(
  10. defineProps<{ options?: StudyTour | Activity; type?: 'studyTour' | 'activity' }>(),
  11. {},
  12. )
  13. const router = useRouter()
  14. const activityOptions = ref(omit(props.options, []))
  15. const { listItemButtonText, statusText, status, difference, startAt, endAt, refresh } =
  16. useActivity(activityOptions)
  17. </script>
  18. <template>
  19. <view
  20. class="relative w-full h-full box-border flex m-a"
  21. @click="router.push(`/pages/home/activity/detail/index?id=${options?.id}&type=${type}`)"
  22. >
  23. <view class="w-full h-full flex flex-col justify-between pt-14 box-border px-3.5">
  24. <!-- <view class="flex"></view> -->
  25. <div class="w-[321px] h-[88px] relative">
  26. <div class="w-[94px] h-3 left-[185px] top-[64px] absolute">
  27. <div
  28. class="left-0 top-0 absolute text-black/40 text-sm font-normal font-['PingFang_SC'] leading-[34px] flex items-center"
  29. >
  30. {{ dayjs(startAt).format('MM.DD') }}
  31. <wd-icon name="play" size="22px"></wd-icon>
  32. {{ dayjs(endAt).format('MM.DD') }}
  33. </div>
  34. </div>
  35. <wd-img
  36. custom-class="w-[110px] h-[88px] left-0 top-0 absolute rounded-[10px] overflow-hidden vertical-bottom"
  37. :src="options?.thumbnailUrl"
  38. mode="scaleToFill"
  39. />
  40. <div
  41. class=" px-2 h-4 bg-black/60 rounded-[20px] backdrop-blur-[15px] absolute top-2.5 left-[7px] flex items-center justify-center"
  42. >
  43. <div class="text-white text-[9px] font-normal font-['PingFang_SC']">
  44. {{statusText}}
  45. </div>
  46. </div>
  47. <div
  48. class="w-[202px] left-[119px] top-0 absolute text-black text-base font-normal font-['PingFang_SC'] leading-relaxed"
  49. >
  50. <!-- 活动预告 | 日本研学·东京艺术大学设计游学 -->
  51. {{ options?.name }}
  52. </div>
  53. <div
  54. class="left-[119px] top-[64px] absolute text-black/40 text-sm font-normal font-['PingFang_SC'] leading-[34px]"
  55. >
  56. {{ { studyTour: '游学', activity: '活动' }[type] }}时间:
  57. </div>
  58. </div>
  59. <view class="flex items-center justify-between mb-1.5">
  60. <ActivityCountDown
  61. :start-at="options?.applyStartTime"
  62. :end-at="options?.applyEndTime"
  63. @end="refresh"
  64. ></ActivityCountDown>
  65. <div
  66. @click.stop="
  67. router.push(`/pages/home/activity/detail/index?id=${options?.id}&type=${type}`)
  68. "
  69. >
  70. <ButtonEvo size="md">
  71. <!-- 立即报名 -->
  72. {{ options?.ifSingnUp ? '已报名' : listItemButtonText }}
  73. </ButtonEvo>
  74. </div>
  75. </view>
  76. </view>
  77. </view>
  78. </template>