sh-adv.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="adv-box u-m-y-10 u-m-x-20">
  3. <!-- 模板1-->
  4. <view class="u-flex" v-if="advType === 1">
  5. <image style="width:710rpx;height:220rpx;border-radius: 10rpx;" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image>
  6. </view>
  7. <!-- 模板2-->
  8. <view class="type1 u-flex" v-if="advType === 2">
  9. <image class="type1-img u-m-r-10" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image>
  10. <image class="type1-img" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
  11. </view>
  12. <!-- 模板3-->
  13. <view class="type2 u-flex" v-if="advType === 3">
  14. <view class="type2-img1 u-m-r-10"><image class="type2-img1 " @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image></view>
  15. <view class="type2-box">
  16. <image class="type2-img2" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
  17. <image class="type2-img2" @tap="jump(advList[2].path)" :src="advList[2].image" mode="aspectFill"></image>
  18. </view>
  19. </view>
  20. <!-- 模板4-->
  21. <view class="type3 u-flex" v-if="advType === 4">
  22. <view class="type3-box">
  23. <image class="type3-img1" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image>
  24. <image class="type3-img1" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
  25. </view>
  26. <view class="type3-img2 u-m-l-10"><image class="type3-img2" @tap="jump(advList[2].path)" :src="advList[2].image" mode="aspectFill"></image></view>
  27. </view>
  28. <!-- 模板5-->
  29. <view class="type4 " v-if="advType === 5">
  30. <view class="type4-box u-flex">
  31. <image class="type4-img1 u-m-r-10" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image>
  32. <image class="type4-img1" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
  33. </view>
  34. <view class="type4-img2 u-m-t-10"><image class="type4-img2" @tap="jump(advList[2].path)" :src="advList[2].image" mode="aspectFill"></image></view>
  35. </view>
  36. <!-- 模板6-->
  37. <view class="type5" v-if="advType === 6">
  38. <view class="type5-img1 u-m-b-10"><image class="type5-img1" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image></view>
  39. <view class="type5-box u-flex">
  40. <image class="type5-img2 u-m-r-10" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
  41. <image class="type5-img2" @tap="jump(advList[2].path)" :src="advList[2].image" mode="aspectFill"></image>
  42. </view>
  43. </view>
  44. <!-- 模板7-->
  45. <view class="type6" v-if="advType === 7">
  46. <view class="u-flex type6-box1 u-m-b-10">
  47. <image class="type6-img1 u-m-r-10" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image>
  48. <image class="type6-img1" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
  49. </view>
  50. <view class="u-flex type6-box2">
  51. <image class="type6-img2 u-m-r-10" @tap="jump(advList[2].path)" :src="advList[2].image" mode="aspectFill"></image>
  52. <image class="type6-img2 u-m-r-10" @tap="jump(advList[3].path)" :src="advList[3].image" mode="aspectFill"></image>
  53. <image class="type6-img2" @tap="jump(advList[4].path)" :src="advList[4].image" mode="aspectFill"></image>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. /**
  60. * 自定义之广告魔方
  61. * @property {Object} detail -广告魔方信息
  62. */
  63. export default {
  64. components: {},
  65. data() {
  66. return {
  67. advType: this.detail.style ,// 模板样式
  68. advList:this.detail.list // adv数据
  69. };
  70. },
  71. props: {
  72. detail: {}
  73. },
  74. computed: {},
  75. created() {},
  76. methods: {
  77. // 路由跳转
  78. jump(path) {
  79. this.$tools.routerTo(path);
  80. }
  81. }
  82. };
  83. </script>
  84. <style lang="scss">
  85. @mixin grid($row: 1) {
  86. width: (710 - ($row - 1) * 10) / $row + rpx;
  87. border-radius: 10rpx;
  88. }
  89. .adv-box {
  90. .type1 {
  91. .type1-img {
  92. @include grid(2);
  93. height: 220rpx;
  94. }
  95. }
  96. .type2 {
  97. .type2-img1 {
  98. height: 350rpx;
  99. @include grid(2);
  100. }
  101. .type2-box {
  102. height: 350rpx;
  103. @include grid(2);
  104. .type2-img2 {
  105. height: 170rpx;
  106. @include grid(2);
  107. }
  108. }
  109. }
  110. .type3 {
  111. .type3-box {
  112. height: 350rpx;
  113. @include grid(2);
  114. .type3-img1 {
  115. height: 170rpx;
  116. @include grid(2);
  117. }
  118. }
  119. .type3-img2 {
  120. height: 350rpx;
  121. @include grid(2);
  122. }
  123. }
  124. .type4 {
  125. .type4-box {
  126. .type4-img1 {
  127. height: 170rpx;
  128. @include grid(2);
  129. }
  130. }
  131. .type4-img2 {
  132. @include grid(1);
  133. height: 220rpx;
  134. }
  135. }
  136. .type5 {
  137. .type5-img1 {
  138. @include grid(1);
  139. height: 220rpx;
  140. }
  141. .type5-box {
  142. .type5-img2 {
  143. height: 170rpx;
  144. @include grid(2);
  145. }
  146. }
  147. }
  148. .type6 {
  149. .type6-box1 {
  150. .type6-img1 {
  151. height: 170rpx;
  152. @include grid(2);
  153. }
  154. }
  155. .type6-box2 {
  156. .type6-img2 {
  157. height: 170rpx;
  158. @include grid(3);
  159. }
  160. }
  161. }
  162. }
  163. </style>