home.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <div class="main">
  3. <div class="left">
  4. <!-- post -->
  5. <n-carousel
  6. dot-placement="bottom"
  7. style="width: 100%; height: 100%"
  8. autoplay
  9. draggable
  10. >
  11. <img
  12. class="carousel-img"
  13. style="width: 100%; height: 100%; object-fit: cover"
  14. src="img/show_banner.png"
  15. />
  16. <template v-for="item in posters">
  17. <img
  18. class="carousel-img"
  19. style="width: 100%; height: 100%; object-fit: cover"
  20. :src="domain + item.filePath"
  21. />
  22. </template>
  23. </n-carousel>
  24. </div>
  25. <div class="right">
  26. <div class="home_logo">
  27. <img :src="Logo" />
  28. </div>
  29. <n-space class="navigate" justify="flex-start" align="center">
  30. <n-button class="btn btn_1" @click="push('/info')" text>
  31. 场馆资讯</n-button
  32. >
  33. <n-button class="btn btn_2" @click="push('/exhibition')" text>
  34. 展厅导览</n-button
  35. >
  36. <n-button class="btn btn_3" @click="push('/collect')" text>
  37. 馆藏精品
  38. </n-button>
  39. <n-button class="btn btn_4" @click="push('/survey')" text>
  40. 问卷调查</n-button
  41. >
  42. <n-button class="btn btn_5" @click="push('/feedback')" text>
  43. 留言反馈</n-button
  44. >
  45. </n-space>
  46. </div>
  47. </div>
  48. </template>
  49. <script setup>
  50. import { computed, onBeforeMount, onMounted, ref } from "vue";
  51. import { useRoute, useRouter } from "vue-router";
  52. import { useInfoStore } from "../store/info";
  53. import Logo from "../assets/logo.png";
  54. const { push } = useRouter();
  55. const InfoStore = useInfoStore();
  56. const posters = computed(() => InfoStore.poster.data || []);
  57. const domain = ref(import.meta.env.VITE_DOMAIN_URL);
  58. onMounted(async () => {
  59. await InfoStore.getPoster();
  60. });
  61. </script>
  62. <style>
  63. .main {
  64. --main-home-left-background: #e2caa3;
  65. --main-home-right-background: #910000;
  66. --main-right-border: 10px;
  67. --main-right-bg-img: url("/img/h_banner_bg.png");
  68. --main-right-bg-btn1: url("/img/guide_1.png");
  69. --main-right-bg-btn2: url("/img/guide_2.png");
  70. --main-right-bg-btn3: url("/img/guide_3.png");
  71. --main-right-bg-btn4: url("/img/guide_4.png");
  72. --main-right-bg-btn5: url("/img/guide_5.png");
  73. --main-navigate-btn-width: 11.3125rem;
  74. --main-navigate-btn-height: 6.3125rem;
  75. }
  76. </style>
  77. <style lang="scss" scoped>
  78. .main {
  79. width: 100%;
  80. height: 100%;
  81. display: flex;
  82. flex-direction: row;
  83. }
  84. .left {
  85. flex: 1 1 70%;
  86. background-color: var(--main-home-left-background);
  87. }
  88. .right {
  89. flex: 0 0 416px;
  90. width: 416px;
  91. // background-color: var(--main-home-right-background);
  92. border-top: var(--main-right-border) solid var(--main-home-right-background);
  93. border-bottom: var(--main-right-border) solid
  94. var(--main-home-right-background);
  95. background-image: var(--main-right-bg-img);
  96. background-size: cover;
  97. background-repeat: no-repeat;
  98. background-position: bottom right;
  99. display: flex;
  100. align-items: center;
  101. justify-content: center;
  102. flex-direction: column;
  103. position: relative;
  104. .home_logo {
  105. position: absolute;
  106. top: 0;
  107. left: 0;
  108. width: 100%;
  109. display: flex;
  110. align-items: center;
  111. justify-content: center;
  112. img {
  113. display: block;
  114. margin-top: 46px;
  115. height: 4.5rem;
  116. }
  117. }
  118. .navigate {
  119. margin-top: 30px;
  120. width: calc(var(--main-navigate-btn-width) * 2 + 16px);
  121. }
  122. :deep(.btn) {
  123. color: transparent;
  124. width: var(--main-navigate-btn-width);
  125. height: var(--main-navigate-btn-height);
  126. background-size: contain;
  127. background-repeat: no-repeat;
  128. padding: 0;
  129. margin: 0;
  130. &:hover {
  131. border: none;
  132. }
  133. &.btn_1 {
  134. background-image: var(--main-right-bg-btn1);
  135. }
  136. &.btn_2 {
  137. background-image: var(--main-right-bg-btn2);
  138. }
  139. &.btn_3 {
  140. background-image: var(--main-right-bg-btn3);
  141. }
  142. &.btn_4 {
  143. background-image: var(--main-right-bg-btn4);
  144. }
  145. &.btn_5 {
  146. background-image: var(--main-right-bg-btn5);
  147. }
  148. }
  149. }
  150. :deep(.n-carousel .n-carousel__dots.n-carousel__dots--dot .n-carousel__dot) {
  151. width: 3.25rem;
  152. border-radius: 10px;
  153. --n-dot-color: #c5c5c5;
  154. --n-dot-color-active: var(--main-primary-color);
  155. }
  156. </style>