imgCardLv1.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div class="mta-card-lv1">
  3. <div class="mta-card-content-pc mta-hidden-xs" :class="[img.order>contentOrder ? 'img-left': 'img-right']">
  4. <img :style="`order:${img.order}`" :src="img.url">
  5. <div class="card-info" :style="`order: ${contentOrder}`">
  6. <h5>{{title}}</h5>
  7. <p class="card-des">{{description}}</p>
  8. <div class="mta-card-row" v-for="(rowList,index) in tagesPc" :key="`pc-${index}`">
  9. <template v-for="(des,ind) in rowList">
  10. <!-- 站位div -->
  11. <span class="mta-card-row-item" v-if="des.type == 'empty'" :key="ind"></span>
  12. <span v-else class="mta-card-row-item" :key="ind"><i></i><span>{{des.value}}</span></span>
  13. </template>
  14. </div>
  15. <slot></slot>
  16. </div>
  17. </div>
  18. <div class="mta-card-content-h5 mta-hidden-sm">
  19. <img :src="img.url">
  20. <div class="card-info">
  21. <h5>{{title}}</h5>
  22. <em></em>
  23. <p class="card-des" v-if="description">{{description}}</p>
  24. <div class="mta-card-row" v-for="(rowList,index) in tagesH5" :key="`h5-${index}`">
  25. <template v-for="(des,ind) in rowList">
  26. <!-- 站位div -->
  27. <span class="mta-card-row-item" v-if="des.type == 'empty'" :key="ind"></span>
  28. <span v-else class="mta-card-row-item" :key="ind"><i></i><span>{{des.value}}</span></span>
  29. </template>
  30. </div>
  31. <slot></slot>
  32. </div>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. export default {
  38. name: "imgCardLv1",
  39. props: {
  40. option: {
  41. type: Object,
  42. required: true,
  43. },
  44. colPc: {
  45. type: Number,
  46. default: 3
  47. },
  48. colH5: {
  49. type: Number,
  50. default: 3
  51. }
  52. },
  53. computed: {
  54. img() {
  55. return {url: this.option.img.url, order: this.option.img.order}
  56. },
  57. title() {
  58. return this.option.content.title;
  59. },
  60. description() {
  61. return this.option.content.des;
  62. },
  63. contentOrder() {
  64. return this.option.content.order;
  65. },
  66. tagesPc() {
  67. const count = this.colPc;
  68. const list = this.option.content.list;
  69. const row = Math.ceil(list.length / count);
  70. const result = [];
  71. for (let i = 1; i <= row; i++) {
  72. const start = (i - 1) * count;
  73. const end = (i * count)
  74. const curList = list.slice(start, end);
  75. if (curList.length < count) {
  76. curList.push({type: 'empty'});
  77. }
  78. result.push(curList)
  79. }
  80. return result;
  81. },
  82. tagesH5() {
  83. const count = this.colH5;
  84. const list = this.option.content.list;
  85. const row = Math.ceil(list.length / count);
  86. const result = [];
  87. for (let i = 1; i <= row; i++) {
  88. const start = (i - 1) * count;
  89. const end = (i * count)
  90. const curList = list.slice(start, end);
  91. if (curList.length < count) {
  92. curList.push({type: 'empty'});
  93. }
  94. result.push(curList)
  95. }
  96. return result;
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .mta-card-lv1 {
  103. margin: 0 auto 120px;
  104. .mta-card-content-pc {
  105. display: flex;
  106. align-items: center;
  107. justify-content: center;
  108. img {
  109. width: 480px;
  110. height: 370px;
  111. }
  112. }
  113. .img-left {
  114. img {
  115. margin-left: 100px;
  116. }
  117. }
  118. .img-right {
  119. img {
  120. margin-right: 100px;
  121. }
  122. }
  123. .card-info {
  124. h5 {
  125. font-size: 24px;
  126. font-weight: 800;
  127. text-align: left;
  128. color: #333;
  129. margin-top: 40px;
  130. margin-bottom: 30px;
  131. }
  132. .card-des {
  133. font-size: 14px;
  134. line-height: 24px;
  135. color: #333;
  136. font-weight: 500;
  137. text-align: left;
  138. margin-bottom: 30px;
  139. }
  140. }
  141. .mta-card-row-item {
  142. font-size: 14px;
  143. font-weight: 500;
  144. color: #333;
  145. width: 160px;
  146. margin-bottom: 24px;
  147. i {
  148. display: inline-block;
  149. width:8px;
  150. height: 8px;
  151. background: #00b96b;
  152. margin-right: 13px;
  153. border-radius: 50%;
  154. }
  155. span {
  156. line-height: 24px;
  157. }
  158. }
  159. .mta-card-row {
  160. display: flex;
  161. }
  162. @media (max-width: 768px) {
  163. margin: 0 auto 60px;
  164. .mta-card-content-h5 {
  165. img {
  166. width: 80%;
  167. display: block;
  168. margin: 0 auto;
  169. text-align: center;
  170. }
  171. .card-info {
  172. width: 100%;
  173. h5 {
  174. font-size: 16px;
  175. margin: 20px 0 10px;
  176. }
  177. em {
  178. width: 35px;
  179. height: 3px;
  180. background: #00b96b;
  181. display: block;
  182. margin-bottom: 20px;
  183. }
  184. .card-des {
  185. font-size: 14px;
  186. margin: 20px 0 10px;
  187. text-align: justify;
  188. line-height: 22px;
  189. }
  190. }
  191. .mta-card-row {
  192. margin-bottom: 10px;
  193. > span {
  194. width: 44%;
  195. font-size: 14px;
  196. margin: 0 3%;
  197. }
  198. }
  199. }
  200. }
  201. }
  202. </style>