index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div class="exItem" @click="onClickExItem(exData)">
  3. <!-- <img :src="require('@/assets/images/resource/exItem.jpg')" alt="" /> -->
  4. <template v-if="currentRouteName=='gdmuseum'">
  5. <img :src="`http://gdbwg.4dage.com${exData.thumb}`" alt="" />
  6. <p class="title">{{ exData.name }}</p>
  7. <p v-if="exData.type!='long'" class="date">{{ exData.timeEnd }}</p>
  8. </template>
  9. <div v-else class="heng">
  10. <div class="img" :style="{backgroundImage:`url(http://gdbwg.4dage.com${exData.thumb})`}"></div>
  11. <div class="info">
  12. <p class="title">{{ exData.name }}</p>
  13. <p v-if="exData.type!='long'" class="date">{{ exData.timeEnd }}</p>
  14. <span class="type">{{exData.type=='long'?'常设展览':'临时展览'}}</span>
  15. </div>
  16. <div class="viewbtn">查看详情</div>
  17. </div>
  18. </div>
  19. </template>
  20. <script setup>
  21. import { defineProps, computed, watch, nextTick, ref } from "vue";
  22. import { useRouter, useRoute } from "vue-router";
  23. const router = useRouter();
  24. const route = useRoute();
  25. const currentRouteName = computed(() => route.name)
  26. const props = defineProps({
  27. exData: {
  28. type: Object,
  29. default: () => {
  30. return {}
  31. },
  32. }
  33. });
  34. let onClickExItem = (data) => {
  35. console.log(data);
  36. router.push({ name: 'zhanlan', params: { id: data.id } })
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. .exItem {
  41. padding: 38px 0 56px;
  42. margin-bottom: 20px;
  43. cursor: pointer;
  44. .title {
  45. font-size: 30px;
  46. font-weight: 400;
  47. color: #333333;
  48. margin: 28px 0 16px;
  49. }
  50. > img {
  51. max-height: 700px;
  52. max-width: 1400px;
  53. object-fit: contain;
  54. }
  55. .date {
  56. font-size: 20px;
  57. color: #999999;
  58. }
  59. .heng{
  60. display: flex;
  61. .img{
  62. flex: 0 0 auto;
  63. width: 300px;
  64. height: 150px;
  65. background-position: center;
  66. background-size: cover;
  67. }
  68. .info{
  69. flex: 1 1 1px;
  70. margin-left: 30px;
  71. display: flex;
  72. flex-direction: column;
  73. position: relative;
  74. .title{
  75. margin: 0 0 10px 0;
  76. }
  77. .date{
  78. font-size: 16px;
  79. }
  80. .type{
  81. position: absolute;
  82. left: 0;
  83. bottom: 4px;
  84. color: #B61E22;
  85. }
  86. }
  87. .viewbtn{
  88. flex: 0 0 auto;
  89. position: absolute;
  90. right: 0;
  91. top: 50%;
  92. transform: translateY(-50%);
  93. width: 120px;
  94. height: 36px;
  95. background: #fff;
  96. color: #999999;
  97. border: 1px solid #999999;
  98. border-radius: 60px;
  99. text-align: center;
  100. line-height: 36px;
  101. &:hover{
  102. background: var(--main-color);
  103. color: var(--font-active);
  104. border: 1px solid var(--main-color);
  105. }
  106. }
  107. }
  108. }
  109. @media screen and (max-width: 1000px) {
  110. .exItem {
  111. padding: 20px 0;
  112. margin-bottom: 20px;
  113. cursor: pointer;
  114. .title {
  115. font-size: 20px;
  116. margin: 10px 0;
  117. }
  118. >img {
  119. width: 100%;
  120. }
  121. .date {
  122. font-size: 14px;
  123. color: #999999;
  124. }
  125. .heng{
  126. display: block;
  127. .img{
  128. width: 100%;
  129. height: 150px;
  130. background-position: center;
  131. background-size: cover;
  132. }
  133. .info{
  134. margin-left: 0;
  135. display: flex;
  136. position: relative;
  137. width: 100%;
  138. .title{
  139. margin: 10px 0;
  140. }
  141. .date{
  142. font-size: 16px;
  143. }
  144. .type{
  145. position: absolute;
  146. right: 0;
  147. left: unset;
  148. font-size: 14px;
  149. top: 50%;
  150. transform: translateY(-50%);
  151. color: #B61E22;
  152. }
  153. }
  154. .viewbtn{
  155. display: none;
  156. position: absolute;
  157. right: 0;
  158. top: 50%;
  159. transform: translateY(-50%);
  160. width: 120px;
  161. height: 36px;
  162. background: #fff;
  163. color: #999999;
  164. border: 1px solid #999999;
  165. border-radius: 60px;
  166. text-align: center;
  167. line-height: 36px;
  168. &:hover{
  169. background: var(--main-color);
  170. color: var(--font-active);
  171. border: 1px solid var(--main-color);
  172. }
  173. }
  174. }
  175. }
  176. }
  177. </style>