imgCardLv1_index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div>
  3. <div class="mta-card-lv1 client-container">
  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. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .mta-card-lv1 {
  106. padding: 60px 0 60px 0;
  107. .mta-card-content-pc {
  108. display: flex;
  109. align-items: center;
  110. justify-content: center;
  111. img {
  112. width: 480px;
  113. height: 370px;
  114. }
  115. }
  116. .img-left {
  117. img {
  118. margin-left: 100px;
  119. }
  120. }
  121. .img-right {
  122. img {
  123. margin-right: 100px;
  124. }
  125. }
  126. .card-info {
  127. h5 {
  128. font-size: 24px;
  129. font-weight: 800;
  130. text-align: left;
  131. color: #333;
  132. margin-top: 40px;
  133. margin-bottom: 30px;
  134. }
  135. .card-des {
  136. font-size: 14px;
  137. line-height: 24px;
  138. color: #333;
  139. font-weight: 500;
  140. text-align: left;
  141. margin-bottom: 30px;
  142. }
  143. }
  144. .mta-card-row-item {
  145. font-size: 14px;
  146. font-weight: 500;
  147. color: #333;
  148. width: 160px;
  149. margin-bottom: 24px;
  150. i {
  151. display: inline-block;
  152. width: 8px;
  153. height: 8px;
  154. background: #00b96b;
  155. margin-right: 13px;
  156. border-radius: 50%;
  157. }
  158. span {
  159. line-height: 24px;
  160. }
  161. }
  162. .mta-card-row {
  163. display: flex;
  164. }
  165. @media (max-width: 768px) {
  166. margin: 0 auto 3%;
  167. padding: 20px;
  168. .mta-card-content-h5 {
  169. img {
  170. width: 80%;
  171. display: block;
  172. margin: 0 auto;
  173. text-align: center;
  174. }
  175. .card-info {
  176. width: 100%;
  177. h5 {
  178. font-size: 16px;
  179. margin: 20px 0 10px;
  180. }
  181. em {
  182. width: 35px;
  183. height: 3px;
  184. background: #00b96b;
  185. display: block;
  186. margin-bottom: 20px;
  187. }
  188. .card-des {
  189. font-size: 14px;
  190. margin: 20px 0 10px;
  191. text-align: justify;
  192. line-height: 22px;
  193. }
  194. }
  195. .mta-card-row {
  196. margin-bottom: 10px;
  197. > span {
  198. width: 44%;
  199. font-size: 14px;
  200. margin: 0 3%;
  201. }
  202. }
  203. }
  204. }
  205. }
  206. </style>