solution-layout.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <!-- 解决方案 -->
  2. <template>
  3. <div id="solution-layout">
  4. <div class="solution-box">
  5. <div class="item" v-for="(item,index) in this.datas" :key="index" :style="{ backgroundImage:'url('+(item.img?item.img:require('../../assets/images/index/solution-4.png'))+')'}">
  6. <template>
  7. <!-- <div class="bg-div"></div> -->
  8. <div class="title text-over">{{item.title}}</div>
  9. <div class="content text-over">{{item.desc}}</div>
  10. <div class="btn" @click="gotoUrl(item.url)">查看详细</div>
  11. </template>
  12. </div>
  13. <template v-if="surplus>0">
  14. <div class="item" v-for="(child,i) in surplus" :key="'surplus-'+i"></div>
  15. </template>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. export default {
  21. props:{
  22. datas: {
  23. type: Array,
  24. default: () => ([])
  25. },
  26. },
  27. data () {
  28. return {
  29. surplus:0
  30. };
  31. },
  32. activated() {},
  33. components: {},
  34. computed: {},
  35. mounted() {
  36. this.surplus = 4 - this.datas.length;
  37. },
  38. methods: {
  39. gotoUrl(_url){
  40. if(_url){
  41. window.location.href = _url;
  42. }
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang='scss' rel='stylesheet/scss' scoped>
  48. #solution-layout{
  49. width: 100%;
  50. .solution-box{
  51. width: 100%;
  52. height: 350px;
  53. display: grid;
  54. grid-template-columns: repeat(4, 1fr);
  55. grid-column-gap: 32px;
  56. // overflow: hidden;
  57. .item{
  58. width: 100%;
  59. display: flex;
  60. flex-direction: column;
  61. justify-content: space-between;
  62. align-items: center;
  63. color: #ffffff;
  64. padding: 28px;
  65. box-sizing: border-box;
  66. overflow: hidden;
  67. position: relative;
  68. background-blend-mode: screen;
  69. border-radius: 4px;
  70. cursor:pointer;
  71. .bg-div{
  72. width: 100%;
  73. height: 100%;
  74. position: absolute;
  75. top: 0;
  76. left: 0;
  77. background: transparent;
  78. }
  79. .title{
  80. width: 100%;
  81. font-size: 22px;
  82. font-weight: bold;
  83. -webkit-line-clamp: 2;
  84. }
  85. .content{
  86. width: 100%;
  87. line-height: 32px;
  88. font-size: 14px;
  89. font-weight: 400;
  90. -webkit-line-clamp: 5;
  91. }
  92. .text-over{
  93. text-shadow: 0px 1px 0px rgba(153, 153, 153, 0.4);
  94. overflow: hidden;
  95. text-overflow: ellipsis;
  96. display: -webkit-box;
  97. -webkit-box-orient: vertical;
  98. letter-spacing: 2px;
  99. }
  100. .btn{
  101. width: 150px;
  102. height: 44px;
  103. text-align: center;
  104. line-height: 44px;
  105. background-color: rgba($color: #fff, $alpha: 0.25);
  106. border-radius: 2px;
  107. box-shadow: 0px 0px 15px -10px rgba(4, 0, 0, 0.4);
  108. text-shadow: 0px 1px 2px #2f2f2f;
  109. &:hover{
  110. background: #fff;
  111. color: #000;
  112. text-shadow: none;
  113. }
  114. }
  115. &:nth-child(1){
  116. background-image:url(../../assets/images/index/solution-1.png);
  117. }
  118. &:nth-child(2){
  119. background-image:url(../../assets/images/index/solution-2.png);
  120. }
  121. &:nth-child(3){
  122. background-image:url(../../assets/images/index/solution-3.png);
  123. }
  124. &:nth-child(4){
  125. background-image:url(../../assets/images/index/solution-4.png);
  126. }
  127. &:hover{
  128. // cursor:pointer;
  129. box-shadow: 6px 8px 15px 0px rgba(4, 0, 0, 0.4);
  130. }
  131. &{
  132. background-size: 100% 100%;
  133. }
  134. }
  135. }
  136. }
  137. </style>