imgCardLv1_index.vue 5.0 KB

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