showingStand.vue 4.2 KB

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