imgCardLv1_index.vue 5.0 KB

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