showingStand.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <div class="w-screen pad:w-full">
  3. <big-title>{{lang===langType.cn?"解决方案":getAbbrText("解决方案")}}</big-title>
  4. <div class="container mx-auto showing">
  5. <div
  6. v-for="(item,i) in showBlocks"
  7. :class="`chunk imgBox chunk${(i+1)}`"
  8. :key="item.id"
  9. >
  10. <!-- 实时管理(物联网) -->
  11. <img :src="item.filePath" alt="item.title">
  12. <p class="chunkText">
  13. <span class="title">{{lang===langType.cn?item.title:getAbbrText(item.title)}}</span>
  14. <span class="subTitle">{{lang===langType.cn?item.subTitle:getAbbrText(item.subTitle)}}</span>
  15. <span class="chunkMore">
  16. {{lang===langType.cn?"解决方案":getAbbrText("解决方案")}}
  17. </span>
  18. </p>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import langMap from "~/map/langMap";
  25. import {showingStandData} from "@/map/showingData";
  26. import BigTitle from "~/components/public/bigTitle.vue";
  27. export default {
  28. name: "showingStand",
  29. components: {BigTitle},
  30. props: {
  31. lang:{
  32. default: langMap.lang.cn
  33. },
  34. showBlocks:{
  35. default: []
  36. }
  37. },
  38. data(){
  39. return {
  40. langType: langMap.lang,
  41. // chunk 1-7
  42. chunkItems: showingStandData,
  43. baseWidth: 500,
  44. baseHeight: 350,
  45. }
  46. },
  47. directives: {
  48. // 为元素设定比例
  49. ratio: {
  50. bind: function (el, binding) {
  51. // 如果没有传入比例值,则默认为1
  52. let ratio = binding.value || 1;
  53. let width = el.offsetWidth;
  54. let finalHeight = width * ratio;
  55. // 防止高度过低导致影响美观
  56. if (width < 1000) {
  57. finalHeight+= 50;
  58. }
  59. el.style.height = finalHeight + 'px'
  60. }
  61. }
  62. },
  63. methods: {
  64. getLangText(str) {
  65. return langMap.getText(this.lang, str);
  66. },
  67. getAbbrText(str) {
  68. return langMap.getAbbrText(this.lang, str);
  69. },
  70. }
  71. }
  72. </script>
  73. <style scoped>
  74. .showing{
  75. display: flex;
  76. flex-direction: column;
  77. align-items: center;
  78. }
  79. .showing .chunk {
  80. box-shadow: 1px 1px 3px black;
  81. /*box-sizing: border-box;*/
  82. /*padding:5px;*/
  83. position: relative;
  84. overflow: hidden;
  85. cursor: pointer;
  86. width: 96%;
  87. aspect-ratio:500/350;
  88. margin-bottom: 10px;
  89. }
  90. .showing .chunk:hover > img{
  91. left: -20px;
  92. top: -20px;
  93. max-width: calc(100% + 40px);
  94. width: calc(100% + 40px);
  95. height: calc(100% + 40px);
  96. }
  97. .showing .chunk .chunkText{
  98. display: block;
  99. position: absolute;
  100. width: 100%;
  101. height: 150px;
  102. bottom: -50px;
  103. /*background: #000;*/
  104. color: white;
  105. transition: all .5s;
  106. padding: 0 15px;
  107. background-image: linear-gradient(rgba(0,0,0,0) 0,rgba(0,0,0,0.5) 75% );
  108. }
  109. .showing .chunk:hover .chunkText{
  110. bottom: 0;
  111. background-image: linear-gradient(rgba(0,0,0,0) 0,rgba(0,0,0,0.66) 66% 15% 80% );
  112. }
  113. .showing .chunk .chunkText .title{
  114. height: 40px;
  115. font-size: 1.5em;
  116. display: flex;
  117. /*justify-content: center;*/
  118. align-items: center;
  119. }
  120. .showing .chunk .chunkText .subTitle{
  121. padding: 5px 0;
  122. min-height: 35px;
  123. max-height: 80px;
  124. font-size: 1.2em;
  125. }
  126. .showing .chunk .chunkText .chunkMore{
  127. margin-top: 20px;
  128. height: 30px;
  129. font-size: 0.9em;
  130. color: #ff6e3f;
  131. }
  132. .showing .chunk .chunkText .chunkMore:hover{
  133. color: orangered;
  134. }
  135. .showing .chunk .chunkText > *{
  136. display: block;
  137. }
  138. .showing .chunk1 {
  139. grid-area: a;
  140. }
  141. .showing .chunk2{
  142. grid-area: b;
  143. }
  144. .showing .chunk3{
  145. grid-area: c;
  146. aspect-ratio:500/810;
  147. }
  148. .showing .chunk4{
  149. grid-area: d;
  150. aspect-ratio:870/400;
  151. }
  152. .showing .chunk5{
  153. grid-area: e;
  154. }
  155. .showing .chunk6{
  156. grid-area: f;
  157. }
  158. .showing .chunk7{
  159. grid-area: g;
  160. }
  161. @media screen and (min-width: 1024px) {
  162. /* 其他针对移动设备的样式 */
  163. .showing{
  164. display: grid;
  165. grid-template-columns: repeat(3, 500px);
  166. grid-template-rows: repeat(3, 410px);
  167. grid-template-areas:
  168. 'a b c'
  169. 'd d c'
  170. 'e f g';
  171. grid-gap: 20px;
  172. }
  173. .showing .chunk {
  174. box-shadow: 1px 1px 3px black;
  175. box-sizing: border-box;
  176. /*padding:5px;*/
  177. position: relative;
  178. overflow: hidden;
  179. cursor: pointer;
  180. aspect-ratio:500/410;
  181. margin-bottom: 0;
  182. width: 100%;
  183. }
  184. .showing .chunk:hover{
  185. box-shadow: 1px 1px 3px deepskyblue;
  186. }
  187. .showing .chunk3{
  188. grid-area: c;
  189. aspect-ratio:500/840;
  190. }
  191. .showing .chunk4{
  192. grid-area: d;
  193. aspect-ratio:870/350;
  194. }
  195. }
  196. </style>