CustomGallery.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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. /** A | B | C | D */
  26. type: string;
  27. }>(),
  28. {
  29. galleryConfig: () => [],
  30. type: 'A',
  31. }
  32. );
  33. // defineEmits(['click']);
  34. </script>
  35. <style lang="less" scoped>
  36. @import '@/design/vent/color.less';
  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_D {
  145. display: flex;
  146. align-items: center;
  147. justify-content: center;
  148. }
  149. .gallery-item_center_D {
  150. background: url(/@/assets/images/home-container/configurable/firehome/img-2.png) no-repeat;
  151. background-size: auto 100%;
  152. width: 100px;
  153. height: 100px;
  154. }
  155. .gallery > .gallery-item_D {
  156. background-image: url(/@/assets/images/home-container/configurable/firehome/img-1.png);
  157. background-size: 100% auto;
  158. width: 213px;
  159. height: 87px;
  160. text-align: center;
  161. // line-height: 35px;
  162. padding-top: 17px;
  163. padding-left: 40px;
  164. display: none;
  165. .gallery-item__value {
  166. font-size: 24px;
  167. }
  168. }
  169. .gallery > .gallery-item_D:nth-child(2) {
  170. display: block;
  171. }
  172. .gallery-item_center_E {
  173. background: url(/@/assets/images/home-container/configurable/dusthome/img-8.png) no-repeat;
  174. width: 200px;
  175. height: 200px;
  176. left: calc(50% - 100px);
  177. top: calc(50% - 100px);
  178. position: absolute;
  179. background-size: 100% auto;
  180. }
  181. .gallery > .gallery-item_E {
  182. background: url(/@/assets/images/home-container/configurable/dusthome/img-9.png) no-repeat;
  183. width: 100px;
  184. height: 90px;
  185. position: absolute;
  186. text-align: center;
  187. background-size: 100% 100%;
  188. .gallery-item__label {
  189. height: 60px;
  190. text-align: center;
  191. background-size: 30px 30px;
  192. background-position: center top;
  193. background-repeat: no-repeat;
  194. padding-top: 30px;
  195. }
  196. }
  197. .gallery > .gallery-item_E:nth-child(2) {
  198. top: calc(50% - 100px);
  199. // top: 20px;
  200. left: calc(50% - 150px);
  201. // left: 80px;
  202. .gallery-item__label {
  203. background-image: url(/@/assets/images/home-container/configurable/dusthome/sbzs.png);
  204. }
  205. }
  206. .gallery > .gallery-item_E:nth-child(3) {
  207. top: calc(50% - 100px);
  208. right: calc(50% - 150px);
  209. .gallery-item__label {
  210. background-image: url(/@/assets/images/home-container/configurable/dusthome/pwkqs.png);
  211. }
  212. }
  213. .gallery > .gallery-item_E:nth-child(4) {
  214. bottom: calc(50% - 100px);
  215. left: calc(50% - 150px);
  216. .gallery-item__label {
  217. background-image: url(/@/assets/images/home-container/configurable/dusthome/lwsl.png);
  218. }
  219. }
  220. .gallery > .gallery-item_E:nth-child(5) {
  221. bottom: calc(50% - 100px);
  222. right: calc(50% - 150px);
  223. .gallery-item__label {
  224. background-image: url(/@/assets/images/home-container/configurable/dusthome/dwsl.png);
  225. }
  226. }
  227. // .gallery-item_center_F {
  228. // }
  229. .gallery > .gallery-item_F {
  230. width: 120px;
  231. height: 60px;
  232. position: absolute;
  233. text-align: center;
  234. padding-left: 20px;
  235. padding-top: 5px;
  236. background-size: 100% 100%;
  237. background-repeat: no-repeat;
  238. background-position: center;
  239. background-image: url(/@/assets/images/home-container/configurable/firehome/img-1.png);
  240. .gallery-item__value {
  241. font-size: 20px;
  242. }
  243. }
  244. .gallery > .gallery-item_F:nth-child(2) {
  245. top: calc(50% - 60px);
  246. left: calc(50% - 180px);
  247. width: 120px;
  248. height: 120px;
  249. line-height: 120px;
  250. padding: 0;
  251. background-image: url(/@/assets/images/home-container/configurable/dusthome/img-7.png);
  252. .gallery-item__label {
  253. display: none;
  254. }
  255. }
  256. .gallery > .gallery-item_F:nth-child(3) {
  257. top: calc(50% - 62px);
  258. left: calc(50% - 60px);
  259. }
  260. .gallery > .gallery-item_F:nth-child(4) {
  261. top: calc(50% - 62px);
  262. left: calc(50% + 60px);
  263. }
  264. .gallery > .gallery-item_F:nth-child(5) {
  265. bottom: calc(50% - 62px);
  266. left: calc(50% - 60px);
  267. }
  268. .gallery > .gallery-item_F:nth-child(6) {
  269. bottom: calc(50% - 62px);
  270. left: calc(50% + 60px);
  271. }
  272. .gallery > .gallery-item_G {
  273. width: 120px;
  274. height: 120px;
  275. position: absolute;
  276. text-align: center;
  277. padding-top: 34px;
  278. background-size: 100% 100%;
  279. background-repeat: no-repeat;
  280. background-position: center;
  281. background-image: url(/@/assets/images/home-container/configurable/firehome/img-4.png);
  282. .gallery-item__value {
  283. font-size: 20px;
  284. }
  285. }
  286. .gallery > .gallery-item_G:nth-child(2) {
  287. top: calc(50% - 60px);
  288. left: calc(50% - 60px);
  289. }
  290. .gallery > .gallery-item_G:nth-child(3) {
  291. top: calc(50% - 60px);
  292. left: calc(50% - 160px);
  293. transform: scale(0.8);
  294. }
  295. .gallery > .gallery-item_G:nth-child(4) {
  296. top: calc(50% - 60px);
  297. right: calc(50% - 160px);
  298. transform: scale(0.8);
  299. }
  300. .gallery > .gallery-item_G:nth-child(5) {
  301. top: calc(50% - 110px);
  302. left: calc(50% - 230px);
  303. transform: scale(0.7);
  304. }
  305. .gallery > .gallery-item_G:nth-child(6) {
  306. bottom: calc(50% - 110px);
  307. left: calc(50% - 230px);
  308. transform: scale(0.7);
  309. }
  310. .gallery > .gallery-item_G:nth-child(7) {
  311. top: calc(50% - 110px);
  312. right: calc(50% - 230px);
  313. transform: scale(0.7);
  314. }
  315. .gallery > .gallery-item_G:nth-child(8) {
  316. bottom: calc(50% - 110px);
  317. right: calc(50% - 230px);
  318. transform: scale(0.7);
  319. }
  320. .gallery-item__value_red {
  321. color: red;
  322. }
  323. .gallery-item__value_orange {
  324. color: orange;
  325. }
  326. .gallery-item__value_yellow {
  327. color: yellow;
  328. }
  329. .gallery-item__value_green {
  330. color: yellowgreen;
  331. }
  332. .gallery-item__value_blue {
  333. color: #009bff;
  334. }
  335. .gallery-item__value_white {
  336. color: white;
  337. }
  338. </style>