index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page;推荐使用json5,更强大,且允许注释 -->
  2. <route lang="json5" type="home">
  3. {
  4. layout: 'tabbar',
  5. style: {
  6. navigationStyle: 'custom',
  7. navigationBarTitleText: '首页',
  8. },
  9. }
  10. </route>
  11. <script lang="ts" setup>
  12. import Card from '@/components/card.vue'
  13. import HotActivity from '@/components/hot-activity.vue'
  14. import MomentItem from '@/components/moment-item.vue'
  15. import useRequest from '../../hooks/useRequest'
  16. import dayjs from 'dayjs'
  17. import Menus from './components/menus.vue'
  18. import ScheduleCard from './components/schedule-card.vue'
  19. import { getCircles } from '../../core/libs/requests'
  20. defineOptions({
  21. name: 'Home',
  22. })
  23. // 测试 uni API 自动引入
  24. const { data } = useRequest(async () => ({ code: 0, msg: '', data: {} }) as IResData<any>, {
  25. initialData: {
  26. banners: [],
  27. hots: [
  28. {
  29. id: 1,
  30. title: '日本研学·东京艺术大学游学',
  31. img: '',
  32. start: dayjs('2024-07-15').toDate(),
  33. end: dayjs('2024-08-10').toDate(),
  34. },
  35. {
  36. id: 1,
  37. title: '日本研学·东京艺术大学游学',
  38. img: '',
  39. start: dayjs('2024-07-15').toDate(),
  40. end: dayjs('2024-08-10').toDate(),
  41. },
  42. ],
  43. dynamics: [
  44. {
  45. author: {
  46. avatar: 'https://via.placeholder.com/35x35',
  47. nickname: '苏小萌',
  48. level: '0',
  49. },
  50. content: '用心做好设计,为客户创造美好家居环境',
  51. images: ['https://via.placeholder.com/165x220'],
  52. tags: ['意大利游学设计班'],
  53. shares: 0,
  54. comments: 0,
  55. likes: 0,
  56. createdAt: dayjs('2024-07-15').toDate(),
  57. },
  58. {
  59. author: {
  60. avatar: 'https://via.placeholder.com/35x35',
  61. nickname: '苏小萌',
  62. level: '0',
  63. },
  64. content: '用心做好设计,为客户创造美好家居环境',
  65. images: ['https://via.placeholder.com/220x165'],
  66. tags: ['意大利游学设计班'],
  67. shares: 0,
  68. comments: 0,
  69. likes: 0,
  70. createdAt: dayjs('2024-07-15').toDate(),
  71. },
  72. {
  73. author: {
  74. avatar: 'https://via.placeholder.com/35x35',
  75. nickname: '苏小萌',
  76. level: '0',
  77. },
  78. content: '用心做好设计,为客户创造美好家居环境',
  79. images: [
  80. 'https://via.placeholder.com/104x104',
  81. 'https://via.placeholder.com/104x204',
  82. 'https://via.placeholder.com/204x104',
  83. ],
  84. tags: ['意大利游学设计班'],
  85. shares: 0,
  86. comments: 0,
  87. likes: 0,
  88. createdAt: dayjs('2024-07-15').toDate(),
  89. },
  90. ],
  91. studyTour: null,
  92. },
  93. })
  94. const { data: circlesData, run } = useRequest(() => getCircles({}), { initialData: { list: [] } })
  95. console.log(data.value)
  96. onShow(async () => {
  97. await run()
  98. console.log(circlesData.value)
  99. })
  100. onLoad(() => {})
  101. onShareAppMessage(() => ({}))
  102. </script>
  103. <template>
  104. <view class="">
  105. <view class="bg-black w-full pos-relative aspect-[1.26/1]">
  106. <wd-img custom-class="w-[375px] h-[297px]" src="https://via.placeholder.com/375x297" />
  107. <div
  108. class="w-[375px] h-[90px] bg-gradient-to-t from-black to-black/0 absolute left-0 bottom-0 w-full flex items-center"
  109. >
  110. <!-- <div class="w-[82px] h-[33px] rounded-[60px] border border-white"></div> -->
  111. <view class="mx-7">
  112. <wd-button plain custom-class="bg-transparent! border-white! text-white!">
  113. 02:30
  114. </wd-button>
  115. </view>
  116. </div>
  117. </view>
  118. <view class="bg-[#f6f6f6] relative bottom-4 rounded-t-2xl py-1">
  119. <ScheduleCard custom-class="my-6 mx-3.5"></ScheduleCard>
  120. <menus></menus>
  121. <view class="my-6 mx-3.5">
  122. <HotActivity></HotActivity>
  123. </view>
  124. <view class="my-6 mx-3.5">
  125. <Card>一分钟快速了解筑巢荟</Card>
  126. </view>
  127. <view class="mx-3.5 text-5 font-400">设计圈</view>
  128. <view class="mx-3.5">
  129. <template v-for="it of circlesData.list" :key="it.id">
  130. <view class="my-6">
  131. <MomentItem :options="it"></MomentItem>
  132. </view>
  133. </template>
  134. </view>
  135. </view>
  136. </view>
  137. </template>
  138. <style></style>