CustomGallery.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <!-- 基准的画廊模块,通过不同的 type 展示不同的样式 -->
  4. <div class="gallery" :class="`gallery_${type}`">
  5. <!-- 部分类型的画廊需要加一张图片 -->
  6. <div :class="`gallery-item_center_${type}`"></div>
  7. <div v-for="item in galleryConfig" :key="item.prop" :class="`gallery-item_${type}`">
  8. <!-- 画廊项的具体内容填充剩余宽度 -->
  9. <div class="gallery-item__label">{{ item.label }}</div>
  10. <div class="gallery-item__value" :class="`gallery-item__value_${item.color}`">{{ item.value }}</div>
  11. </div>
  12. </div>
  13. </template>
  14. <script lang="ts" setup>
  15. // import { get } from 'lodash-es';
  16. // import { computed } from 'vue';
  17. withDefaults(
  18. defineProps<{
  19. galleryConfig: {
  20. value: string;
  21. color: string;
  22. label: string;
  23. prop: string;
  24. }[];
  25. type: string;
  26. }>(),
  27. {
  28. galleryConfig: () => [],
  29. type: 'A',
  30. }
  31. );
  32. // defineEmits(['click']);
  33. </script>
  34. <style lang="less" scoped>
  35. @import '@/design/vent/color.less';
  36. /* Timeline 相关的样式 */
  37. .gallery {
  38. position: relative;
  39. width: 100%;
  40. height: 100%;
  41. }
  42. .gallery-item_center_A {
  43. background: url(@/assets/images/home-container/configurable/gallery_center.png) no-repeat;
  44. width: 144px;
  45. height: 126px;
  46. left: calc(50% - 72px);
  47. top: calc(50% - 63px);
  48. position: absolute;
  49. background-size: 100% 100%;
  50. }
  51. .gallery > .gallery-item_A {
  52. background: url(@/assets/images/home-container/configurable/gallery_1.png) no-repeat;
  53. width: 90px;
  54. height: 90px;
  55. position: absolute;
  56. text-align: center;
  57. }
  58. .gallery > .gallery-item_A:nth-child(2) {
  59. top: 20px;
  60. left: 60px;
  61. }
  62. .gallery > .gallery-item_A:nth-child(3) {
  63. top: 20px;
  64. right: 60px;
  65. }
  66. .gallery > .gallery-item_A:nth-child(4) {
  67. bottom: 20px;
  68. left: 60px;
  69. }
  70. .gallery > .gallery-item_A:nth-child(5) {
  71. bottom: 20px;
  72. right: 60px;
  73. }
  74. .gallery-item_center_B {
  75. background: url(/@/assets/images/home-container/configurable/deco_2.png) no-repeat;
  76. width: 100%;
  77. height: 90%;
  78. top: 5%;
  79. position: absolute;
  80. background-position: center;
  81. background-size: auto 100%;
  82. }
  83. // .gallery .gallery-item__value {
  84. // display: none;
  85. // }
  86. .gallery > .gallery-item_B {
  87. background: url(/@/assets/images/home-container/configurable/deco_3.png) no-repeat;
  88. position: absolute;
  89. text-align: center;
  90. background-position: center;
  91. background-size: auto 100%;
  92. }
  93. .gallery > .gallery-item_B:nth-child(2) {
  94. width: 70px;
  95. height: 70px;
  96. line-height: 70px;
  97. top: 20px;
  98. left: calc(50% - 70px);
  99. }
  100. .gallery > .gallery-item_B:nth-child(3) {
  101. width: 60px;
  102. height: 60px;
  103. line-height: 60px;
  104. top: 50px;
  105. // right: 34%;
  106. right: calc(50% - 70px);
  107. }
  108. .gallery > .gallery-item_B:nth-child(4) {
  109. width: 55px;
  110. height: 55px;
  111. line-height: 55px;
  112. bottom: 90px;
  113. left: calc(50% - 55px);
  114. }
  115. .gallery > .gallery-item_B:nth-child(5) {
  116. width: 50px;
  117. height: 50px;
  118. line-height: 50px;
  119. bottom: 70px;
  120. right: calc(50% - 50px);
  121. }
  122. .gallery-item_B > .gallery-item__label {
  123. display: none;
  124. }
  125. .gallery-item_center_C {
  126. background: url(/@/assets/images/home-container/configurable/deco_4.png) no-repeat;
  127. width: 100%;
  128. height: 100%;
  129. // top: 5%;
  130. position: absolute;
  131. background-position: center;
  132. background-size: auto 100%;
  133. }
  134. .gallery_C {
  135. display: flex;
  136. flex-direction: column;
  137. align-items: center;
  138. justify-content: space-around;
  139. text-align: center;
  140. }
  141. .gallery-item_C > .gallery-item__value {
  142. font-size: 20px;
  143. }
  144. .gallery-item__value_red {
  145. color: red;
  146. }
  147. .gallery-item__value_orange {
  148. color: orange;
  149. }
  150. .gallery-item__value_yellow {
  151. color: yellow;
  152. }
  153. .gallery-item__value_green {
  154. color: yellowgreen;
  155. }
  156. .gallery-item__value_blue {
  157. color: lightblue;
  158. }
  159. </style>