info-detail.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div class="main">
  3. <div class="content">
  4. <sub-header />
  5. <div class="left">
  6. <hero-sub-title />
  7. <div class="detail">
  8. <div class="detail-wrapper">
  9. <!-- {{ detail }} -->
  10. <div class="back" @click="$router.go(-1)"></div>
  11. <div class="info">
  12. <div class="show-case" v-if="detail.video">
  13. <video
  14. :src="domain + detail.video"
  15. playsinline
  16. controls
  17. ></video>
  18. </div>
  19. <h3 class="title">{{ detail.name }}</h3>
  20. <!-- <div class="label-list">
  21. <span>时代:土地革命时期</span>
  22. <span>来源:澄潭三星</span>
  23. <span>质地:纸质</span>
  24. <span>级别:二级</span>
  25. </div> -->
  26. <div class="time-container">
  27. <div class="time">
  28. <span>{{ detail.publishDate }}</span>
  29. <span>{{ typeLabel(detail.type) }} </span>
  30. </div>
  31. </div>
  32. <div class="text" v-html="detail.richText"></div>
  33. <div class="show-case" v-if="detail.thumb">
  34. <img :src="domain + detail.thumb" />
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. <side-menu />
  41. </div>
  42. </div>
  43. </template>
  44. <script setup>
  45. import { watchEffect, ref, onMounted, computed } from "vue";
  46. import subHeader from "../components/subHeader";
  47. import sideMenu from "../components/sideMenu";
  48. import heroSubTitle from "../components/heroSubTitle";
  49. import { useInfoStore } from "../store/info";
  50. const infoStore = useInfoStore();
  51. const detail = computed(() => infoStore.detail);
  52. const domain = ref(import.meta.env.VITE_DOMAIN_URL);
  53. const typeLabel = computed(() => (type) => {
  54. switch (type) {
  55. case "exhibition":
  56. return "展览";
  57. case "news":
  58. return "新闻";
  59. case "activity":
  60. return "活动";
  61. case "notice":
  62. return "通知";
  63. }
  64. });
  65. const props = defineProps({
  66. id: {
  67. type: [String, Number],
  68. default: () => null,
  69. required: true,
  70. },
  71. });
  72. onMounted(() => {
  73. if (props.id) {
  74. infoStore.getDetail(props.id);
  75. }
  76. });
  77. watchEffect(() => {
  78. if (unref(detail)) {
  79. document.title = unref(detail).name;
  80. }
  81. });
  82. </script>
  83. <style lang="scss" scoped>
  84. .detail {
  85. --main-show-case-background: #ddd5d5;
  86. --main-detail-margin: 1.875rem;
  87. --main-detail-padding: 1.875rem;
  88. // box-shadow: var(--main-box-shadow);
  89. margin: var(--main-detail-margin);
  90. margin-bottom: 0;
  91. flex: 1;
  92. border-radius: 0.8125rem;
  93. background: transparent;
  94. // padding: 2rem 3rem 4rem 3rem;
  95. background-image: var(--main-detail-background-img);
  96. background-size: cover;
  97. background-position: top 100%;
  98. background-repeat: no-repeat;
  99. overflow: hidden;
  100. .detail-wrapper {
  101. display: block;
  102. width: 100%;
  103. flex: 1;
  104. height: calc(100% - var(--main-detail-margin) - 10px);
  105. margin-top: var(--main-detail-margin);
  106. overflow-y: scroll;
  107. &::-webkit-scrollbar {
  108. display: none;
  109. }
  110. }
  111. .back {
  112. background-image: url("/img/back_arrow.png");
  113. width: 7.5rem;
  114. height: 1.875rem;
  115. background-repeat: no-repeat;
  116. background-size: contain;
  117. margin-bottom: 0.75rem;
  118. margin-left: 3rem;
  119. }
  120. .info {
  121. max-width: 66.8125rem;
  122. margin: 0 auto;
  123. font-size: 1.25rem;
  124. padding-bottom: 5rem;
  125. .title {
  126. font-size: 1.875rem;
  127. line-height: 3.75rem;
  128. margin: 1.2rem 0;
  129. text-align: center;
  130. }
  131. .time-container {
  132. display: inline-flex;
  133. width: 100%;
  134. justify-content: center;
  135. align-items: center;
  136. }
  137. .time {
  138. display: inline-flex;
  139. font-size: var(--base-font-size);
  140. width: 250px;
  141. flex-direction: row;
  142. align-items: center;
  143. justify-content: space-between;
  144. margin: 0 auto;
  145. }
  146. .label-list {
  147. margin-bottom: 1.5rem;
  148. display: inline-flex;
  149. flex-direction: row;
  150. justify-content: space-between;
  151. gap: 0 1.875rem;
  152. span {
  153. padding-left: 1.5625rem;
  154. background-image: url("/img/dot.png");
  155. background-repeat: no-repeat;
  156. background-size: 1.25rem 1.25rem;
  157. background-position: left center;
  158. }
  159. }
  160. .text {
  161. font-weight: 400;
  162. color: #6e6e6e;
  163. line-height: 2.125rem;
  164. font-size: 1.25rem;
  165. }
  166. }
  167. .show-case {
  168. max-width: 66.8125rem;
  169. height: 34.1875rem;
  170. background: var(--main-show-case-background);
  171. border-radius: 1.3125rem;
  172. video,
  173. img {
  174. width: 100%;
  175. height: 100%;
  176. object-fit: cover;
  177. border-radius: 1.3125rem;
  178. }
  179. }
  180. }
  181. </style>