active-detail.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <script setup lang='ts'>
  2. import { ActiveBookingApi } from '@/api/api/activeBooking';
  3. import { showToast } from 'vant';
  4. const route = useRoute()
  5. const router = useRouter()
  6. export type activeDetailType = {
  7. createTime: string,
  8. creatorId: number,
  9. creatorName: string,
  10. dirCode: string,
  11. fileIds: string,
  12. id: number,
  13. isNeed: number,
  14. name: string,
  15. publishDate: string,
  16. rtf: string,
  17. thumb: string,
  18. type: string,
  19. updateTime: string
  20. }
  21. const activeDetail = ref({} as activeDetailType)
  22. const videos = ref([] as any)
  23. const getDetailById = async () => {
  24. const res: any = await ActiveBookingApi.getDetailById(Number(route.params.id))
  25. if (res.code == 0) {
  26. activeDetail.value = res.data.entity
  27. videos.value = res.data.entity.filter((item: any) => {
  28. return item.filePath.includes('mp4')
  29. })
  30. } else {
  31. showToast(res.msg)
  32. }
  33. }
  34. const goBooking = () => {
  35. router.push({
  36. name: 'activeBookInfo',
  37. params: {
  38. id: activeDetail.value.id,
  39. title: activeDetail.value.name
  40. }
  41. })
  42. }
  43. onBeforeMount(() => {
  44. getDetailById()
  45. })
  46. </script>
  47. <template>
  48. <div class='detail-box'>
  49. <img class="themb-box" :src="activeDetail.thumb" alt="">
  50. <div class="content-box">
  51. <div class="title-box">{{ activeDetail.name }}</div>
  52. <div class="time-box">发布时间:{{ activeDetail.publishDate }}</div>
  53. <div class="rtf-box" v-html="activeDetail.rtf"></div>
  54. <div class="video-box">
  55. <video :src="item" controls v-for="(item, index) in videos" :key="index"></video>
  56. </div>
  57. </div>
  58. <div class="booking-btn" v-if="activeDetail.isNeed" @click="goBooking()">
  59. 发起预约
  60. </div>
  61. <img class="back-icon" @click="() => { router.back() }" src="@/assets/images/back.png" alt="">
  62. </div>
  63. </template>
  64. <style lang='less' scoped>
  65. .detail-box {
  66. width: 100%;
  67. background: #F7F3E8;
  68. min-height: 100%;
  69. .themb-box {
  70. width: 100%;
  71. height: 30vh;
  72. margin-bottom: 10px;
  73. }
  74. .content-box {
  75. width: 100%;
  76. height: calc(70vh + 10px);
  77. background: #F7F3E8;
  78. border-radius: 20px 20px 0 0;
  79. margin-top: -30px;
  80. position: relative;
  81. z-index: 2;
  82. padding: 8% 15px;
  83. box-sizing: border-box;
  84. overflow: auto;
  85. .title-box {
  86. font-size: 1.4em;
  87. font-weight: bold;
  88. line-height: 1.5em;
  89. color: #333333;
  90. margin-bottom: 10px;
  91. padding: 0 10px;
  92. font-family: 'SourceHanSansCN-Medium';
  93. margin-bottom: 5px;
  94. }
  95. .time-box {
  96. color: #9D4F0B;
  97. font-size: 0.9em;
  98. margin-bottom: 15px;
  99. padding: 0 10px;
  100. font-family: 'SourceHanSansCN-Regular';
  101. }
  102. .abstract-box {
  103. color: rgba(128, 128, 128, 0.664);
  104. font-size: 1em;
  105. margin-bottom: 10px;
  106. padding: 0 10px;
  107. }
  108. .rtf-box {
  109. white-space: pre;
  110. margin-bottom: 10px;
  111. padding: 0 10px;
  112. color: #88866F;
  113. }
  114. }
  115. .video-box {
  116. width: 100%;
  117. video {
  118. width: 100%;
  119. margin-bottom: 10px;
  120. }
  121. }
  122. .booking-btn {
  123. width: 80%;
  124. height: 60px;
  125. border-radius: 50px;
  126. background: url(@/assets/images/onlineBg.png);
  127. background-size: 100% 100%;
  128. color: #F1E9D4;
  129. position: fixed;
  130. left: 50%;
  131. transform: translateX(-50%);
  132. bottom: 3vh;
  133. display: flex;
  134. justify-content: center;
  135. align-items: center;
  136. letter-spacing: 2px;
  137. font-weight: bold;
  138. z-index: 2;
  139. }
  140. .back-icon {
  141. width: 40px;
  142. position: fixed;
  143. right: 10px;
  144. bottom: 10vh;
  145. }
  146. }
  147. </style>