index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <route lang="yaml">
  2. style:
  3. navigationBarTitleText: '详情'
  4. navigationBarBackgroundColor: '#fff'
  5. </route>
  6. <script setup lang="ts">
  7. import SectionHeading from '@/components/section-heading.vue'
  8. import Tag from '@/components/tag.vue'
  9. import { getCircle, getMoment } from '../../../core/libs/requests'
  10. import { thumbsUp } from '../../../core/libs/svgs'
  11. import dayjs from 'dayjs'
  12. import CommentItem from '../components/comment-item.vue'
  13. import AvatarGroupCasual from '@/components/avatar-group-casual/avatar-group-casual.vue'
  14. const id = ref()
  15. const { data, run } = useRequest(() => getCircle(id.value), { initialData: {} })
  16. const current = ref(0)
  17. const swiperSizes = ref()
  18. const swiperStyle = ref()
  19. const handleChange = ({ detail: { current } }) => {
  20. swiperStyle.value = {
  21. height: swiperSizes.value[current].height + 'px',
  22. }
  23. }
  24. const setSwiperStyle = async () => {
  25. const { screenWidth } = await uni.getSystemInfo()
  26. swiperSizes.value = (
  27. await Promise.all(data.value.bannerUrls.map((src) => uni.getImageInfo({ src })))
  28. ).map(({ width, height }) => ({ width: screenWidth, height: height / (width / screenWidth) }))
  29. swiperStyle.value = {
  30. height: swiperSizes.value[0].height + 'px',
  31. }
  32. }
  33. onMounted(async () => {})
  34. onLoad(async (query: { id: string }) => {
  35. id.value = query.id
  36. await run()
  37. await setSwiperStyle()
  38. })
  39. </script>
  40. <template>
  41. <view class="bg-white flex-grow">
  42. <!-- <div class="my-4 text-black/90 text-lg font-normal font-['PingFang SC'] leading-[10.18px]">
  43. {{ data?.content }}
  44. </div> -->
  45. <template v-if="swiperSizes">
  46. <swiper :style="swiperStyle" @change="handleChange">
  47. <template v-for="it of data?.bannerUrls" :key="it">
  48. <swiper-item>
  49. <wd-img width="100%" :src="it" mode="widthFix"></wd-img>
  50. </swiper-item>
  51. </template>
  52. </swiper>
  53. </template>
  54. <!-- <wd-swiper
  55. v-model="current"
  56. custom-class="my-1"
  57. autoplay="false"
  58. :list="data?.images"
  59. :indicator="{ type: 'fraction' }"
  60. indicatorPosition="top-right"
  61. imageMode="widthFix"
  62. ></wd-swiper> -->
  63. <view class="m-3.5">
  64. <div class="text-black/90 text-base font-normal font-['PingFang SC'] leading-[10.18px]">
  65. {{ data?.circleDesc }}
  66. </div>
  67. <view class="my-5.5 flex gap-3.5">
  68. <!-- <TiltedButton>按钮</TiltedButton> -->
  69. <template v-if="data?.tagName !== ''">
  70. <template v-for="it of data?.tagName?.split(',')" :key="it">
  71. <Tag>{{ it }}</Tag>
  72. </template>
  73. </template>
  74. </view>
  75. <div class="text-black/30 text-xs font-normal font-['PingFang SC'] leading-[10.18px]">
  76. 2024-5-31 10:06
  77. </div>
  78. <view class="flex items-center my-4">
  79. <view class="flex items-center">
  80. <avatar-group-casual
  81. :show-number="3"
  82. :urls="[
  83. 'https://via.placeholder.com/20x20',
  84. 'https://via.placeholder.com/20x20',
  85. 'https://via.placeholder.com/20x20',
  86. ]"
  87. ></avatar-group-casual>
  88. <div
  89. class="ml-1 text-black/60 text-sm font-normal font-['PingFang SC'] leading-[10.18px]"
  90. >
  91. 40人赞过
  92. </div>
  93. </view>
  94. <view class="flex-1"></view>
  95. <view><wd-icon class="text-black/65" name="arrow-right" size="22px"></wd-icon></view>
  96. </view>
  97. <!-- <SectionHeading :title="`评论 ${data.comments}`"></SectionHeading> -->
  98. <view class="flex items-center my-8">
  99. <div class="text-black/90 text-base font-normal font-['PingFang SC'] leading-[10.18px]">
  100. <span>评论</span>
  101. <!-- <span v-if="data?.comments">{{ data?.comments }}</span> -->
  102. </div>
  103. <view class="flex-1"></view>
  104. <!-- <view v-if="data?.comments" class="flex">
  105. <div class="text-black/90 text-xs font-normal font-['PingFang SC'] leading-[10.18px]">
  106. 按热度
  107. </div>
  108. <div
  109. class="mx-2 text-black/40 text-xs font-normal font-['PingFang SC'] leading-[10.18px]"
  110. >
  111. |
  112. </div>
  113. <div class="text-black/40 text-xs font-normal font-['PingFang SC'] leading-[10.18px]">
  114. 按时间
  115. </div>
  116. </view> -->
  117. </view>
  118. <!-- <view>
  119. <template v-if="data?.commentList.length">
  120. <template v-for="it of data?.commentList" :key="it.id">
  121. <CommentItem :options="it" :isChild="false"></CommentItem>
  122. <template v-for="child of it.childrens" :key="child.id">
  123. <CommentItem :options="child" :isChild="true"></CommentItem>
  124. </template>
  125. </template>
  126. </template>
  127. <template v-else>
  128. <view class="flex items-center justify-center mt-26 mb-36">
  129. <div class="text-black/40 text-xs font-normal font-['PingFang SC'] leading-[10.18px]">
  130. 这里空空的
  131. </div>
  132. <div
  133. class="ml-1.5 text-[#2f4471]/90 text-xs font-normal font-['PingFang SC'] leading-[10.18px]"
  134. >
  135. 点击评论~
  136. </div>
  137. </view>
  138. </template>
  139. </view> -->
  140. </view>
  141. <div
  142. class="fixed bottom-0 left-0 right-0 border-t border-t-solid border-[#ececec] h-[54px] bg-white flex items-center px-3.5"
  143. >
  144. <div class="w-[168px] bg-[#f6f6f6] rounded-[60px] px-3.5 py-2 flex items-center">
  145. <wd-input custom-class="bg-transparent!" no-border></wd-input>
  146. </div>
  147. <view class="flex justify-around flex-1">
  148. <view
  149. class="flex flex-col items-center text-[rgba(0,0,0,0.85)] text-3.5 font-400 line-height-5.5"
  150. >
  151. <wd-img width="15" height="15" src="/static/svgs/share.svg"></wd-img>
  152. <view class="">{{ data?.shareCount }}</view>
  153. </view>
  154. <view
  155. class="flex flex-col items-center text-[rgba(0,0,0,0.85)] text-3.5 font-400 line-height-5.5"
  156. >
  157. <wd-img width="15" height="15" src="/static/svgs/comment.svg"></wd-img>
  158. <view class="">{{ data?.reviewCount }}</view>
  159. </view>
  160. <view
  161. class="flex flex-col items-center text-[rgba(0,0,0,0.85)] text-3.5 font-400 line-height-5.5"
  162. >
  163. <wd-img width="15" height="15" :src="thumbsUp"></wd-img>
  164. <view>{{ data.upvoteCount }}</view>
  165. </view>
  166. </view>
  167. </div>
  168. </view>
  169. </template>