showingAd.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div class="content">
  3. <div class="conBox showing">
  4. <a
  5. v-for="(item,i) in chunkItems"
  6. :class="`chunk imgBox chunk${(i+1)}`"
  7. :key="item.id"
  8. :href="item.href"
  9. >
  10. <!-- 实时管理(物联网) -->
  11. <img :src="item.img" alt="imgNotFound">
  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. </a>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import langMap from "~/map/langMap";
  25. import {showingStandData} from "@/map/showingData";
  26. export default {
  27. name: "showingAd",
  28. props: {
  29. lang:{
  30. default: langMap.lang.cn
  31. },
  32. },
  33. data(){
  34. return {
  35. langType: langMap.lang,
  36. // chunk 1-7
  37. chunkItems:showingStandData
  38. }
  39. },
  40. methods: {
  41. getLangText(str) {
  42. return langMap.getText(this.lang, str);
  43. },
  44. getAbbrText(str) {
  45. return langMap.getAbbrText(this.lang, str);
  46. },
  47. }
  48. }
  49. </script>
  50. <style scoped>
  51. .showing{
  52. margin-top: 20px;
  53. display: grid;
  54. grid-template-columns: repeat(3, 425px);
  55. grid-template-rows: repeat(3, 350px);
  56. grid-template-areas:
  57. 'a b c'
  58. 'd d c'
  59. 'e f g';
  60. grid-gap: 20px;
  61. }
  62. .showing .chunk {
  63. box-shadow: 1px 1px 3px black;
  64. /*box-sizing: border-box;*/
  65. /*padding:5px;*/
  66. position: relative;
  67. overflow: hidden;
  68. cursor: pointer;
  69. }
  70. .showing .chunk:hover{
  71. box-shadow: 1px 1px 3px deepskyblue;
  72. }
  73. .showing .chunk:hover > img{
  74. left: -20px;
  75. top: -20px;
  76. max-width: calc(100% + 40px);
  77. width: calc(100% + 40px);
  78. height: calc(100% + 40px);
  79. }
  80. .showing .chunk .chunkText{
  81. display: block;
  82. position: absolute;
  83. width: 100%;
  84. height: 150px;
  85. bottom: -50px;
  86. /*background: #000;*/
  87. color: white;
  88. transition: all .5s;
  89. padding: 0 15px;
  90. background-image: linear-gradient(rgba(0,0,0,0) 0,rgba(0,0,0,0.5) 75% );
  91. }
  92. .showing .chunk:hover .chunkText{
  93. bottom: 0;
  94. background-image: linear-gradient(rgba(0,0,0,0) 0,rgba(0,0,0,0.66) 66% 15% 80% );
  95. }
  96. .showing .chunk .chunkText .title{
  97. height: 40px;
  98. font-size: 1.5em;
  99. display: flex;
  100. /*justify-content: center;*/
  101. align-items: center;
  102. }
  103. .showing .chunk .chunkText .subTitle{
  104. padding: 5px 0;
  105. min-height: 35px;
  106. max-height: 80px;
  107. font-size: 1.2em;
  108. }
  109. .showing .chunk .chunkText .chunkMore{
  110. margin-top: 20px;
  111. height: 30px;
  112. font-size: 0.9em;
  113. color: #ff6e3f;
  114. }
  115. .showing .chunk .chunkText .chunkMore:hover{
  116. color: orangered;
  117. }
  118. .showing .chunk .chunkText > *{
  119. display: block;
  120. }
  121. .showing .chunk1 {
  122. grid-area: a;
  123. }
  124. .showing .chunk2{
  125. grid-area: b;
  126. }
  127. .showing .chunk3{
  128. grid-area: c;
  129. }
  130. .showing .chunk4{
  131. grid-area: d;
  132. }
  133. .showing .chunk5{
  134. grid-area: e;
  135. }
  136. .showing .chunk6{
  137. grid-area: f;
  138. }
  139. .showing .chunk7{
  140. grid-area: g;
  141. }
  142. </style>