exhibition-detail.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <script setup lang='ts'>
  2. import { ExhibitionApi } from '@/api/api/exhibition';
  3. import { showToast } from 'vant';
  4. const route = useRoute()
  5. export type ExhibitionDetailType = {
  6. createTime: string,
  7. creatorId: number,
  8. creatorName: string,
  9. dateEnd: string,
  10. dateStart: string,
  11. description: string,
  12. id: number,
  13. link: string,
  14. location: string,
  15. name: string,
  16. publishDate: string,
  17. rtf: string,
  18. thumb:
  19. string,
  20. type: string,
  21. updateTime: string,
  22. videos: any[]
  23. }
  24. const exhibitionDetail = ref({} as ExhibitionDetailType)
  25. const isShowScene = ref(false)
  26. const getDetailById = async () => {
  27. const res: any = await ExhibitionApi.getDetailById(Number(route.params.id))
  28. if (res.code == 0) {
  29. exhibitionDetail.value = res.data.entity
  30. exhibitionDetail.value.videos = res.data.file.filter((item: any) => {
  31. return item.type == 'video'
  32. })
  33. } else {
  34. showToast(res.msg)
  35. }
  36. }
  37. onBeforeMount(() => {
  38. getDetailById()
  39. })
  40. </script>
  41. <template>
  42. <div class='detail-box'>
  43. <img class="thumb-box" :src="exhibitionDetail.thumb" alt="">
  44. <div class="content-box">
  45. <div class="name-box">{{ exhibitionDetail.name }}</div>
  46. <div class="time-box">
  47. <div class="location-box"> {{ exhibitionDetail.location }}</div>
  48. <div>{{ exhibitionDetail.dateStart }} - {{ exhibitionDetail.dateEnd }}</div>
  49. </div>
  50. <div class="rtf-box" v-html="exhibitionDetail.rtf"></div>
  51. <video :src="item" v-for="(item, index) in exhibitionDetail.videos" :key="index" controls></video>
  52. </div>
  53. <div class="online-box" @click="() => { isShowScene = true }">体验线上展厅</div>
  54. <div v-if="isShowScene" class="iframe-box">
  55. <img src="@/assets/images/sceneBack.png" @click="isShowScene = false" alt="">
  56. <iframe :src="exhibitionDetail.link" frameborder="0"></iframe>
  57. </div>
  58. </div>
  59. </template>
  60. <style lang='less' scoped>
  61. .detail-box {
  62. width: 100%;
  63. height: 100vh;
  64. max-width: 500px;
  65. position: relative;
  66. overflow: auto;
  67. .thumb-box {
  68. width: 100%;
  69. margin-bottom: 10px;
  70. height: 30vh;
  71. }
  72. .content-box {
  73. width: 100%;
  74. padding: 0 10px;
  75. box-sizing: border-box;
  76. height: calc(70vh + 25px);
  77. overflow: auto;
  78. border-radius: 20px 20px 0 0;
  79. margin-top: -40px;
  80. position: relative;
  81. z-index: 2;
  82. background: #F7F3E8;
  83. padding: 25px 20px;
  84. box-sizing: border-box;
  85. .name-box {
  86. width: 100%;
  87. font-size: 1.2em;
  88. font-weight: bold;
  89. color: #333333;
  90. font-family: 'SourceHanSansCN-Medium';
  91. line-height: 1.5em;
  92. margin-bottom: 10px;
  93. }
  94. .time-box {
  95. width: 100%;
  96. display: flex;
  97. justify-content: space-between;
  98. color: #9D4F0B;
  99. margin: 10px auto;
  100. font-size: 0.8em;
  101. align-items: center;
  102. .location-box {
  103. max-width: 50vw;
  104. }
  105. }
  106. .rtf-box {
  107. color: #88866F;
  108. }
  109. }
  110. video {
  111. width: 100%;
  112. margin-top: 10px;
  113. }
  114. .online-box {
  115. width: 80%;
  116. max-width: 400px;
  117. height: 60px;
  118. border-radius: 50px;
  119. background: url(@/assets/images/onlineBg.png);
  120. background-size: 100% 100%;
  121. color: #F1E9D4;
  122. position: fixed;
  123. left: 50%;
  124. transform: translateX(-50%);
  125. bottom: 3vh;
  126. display: flex;
  127. justify-content: center;
  128. align-items: center;
  129. letter-spacing: 2px;
  130. font-weight: bold;
  131. z-index: 2;
  132. }
  133. .back-icon {
  134. width: 40px;
  135. position: fixed;
  136. right: 10px;
  137. bottom: 10vh;
  138. }
  139. .iframe-box {
  140. width: 100%;
  141. height: 100%;
  142. position: absolute;
  143. top: 0;
  144. left: 0;
  145. z-index: 10;
  146. iframe {
  147. width: 100%;
  148. height: 100%;
  149. position: absolute;
  150. top: 0;
  151. left: 0;
  152. }
  153. img {
  154. width: 30px;
  155. height: 30px;
  156. position: absolute;
  157. top: 3%;
  158. left: 3%;
  159. z-index: 11;
  160. }
  161. }
  162. }
  163. </style>