CustomGallery.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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_cneter_${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_cneter_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_cneter_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: 36%;
  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. }
  107. .gallery > .gallery-item_B:nth-child(4) {
  108. width: 55px;
  109. height: 55px;
  110. line-height: 55px;
  111. bottom: 90px;
  112. left: 38%;
  113. }
  114. .gallery > .gallery-item_B:nth-child(5) {
  115. width: 50px;
  116. height: 50px;
  117. line-height: 50px;
  118. bottom: 70px;
  119. right: 38%;
  120. }
  121. .gallery-item__value_red {
  122. color: red;
  123. }
  124. .gallery-item__value_orange {
  125. color: orange;
  126. }
  127. .gallery-item__value_yellow {
  128. color: yellow;
  129. }
  130. .gallery-item__value_green {
  131. color: yellowgreen;
  132. }
  133. .gallery-item__value_blue {
  134. color: lightblue;
  135. }
  136. </style>