activity.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view>
  3. <view v-if="isShow" class="specialArea acea-row row-between-wrapper">
  4. <view class="assemble skeleton-rect" hover-class="none" @click="gopage(activityOne.info[2].value)">
  5. <image :src="activityOne.img" alt="img" />
  6. <!-- <view class="text" v-if="activityOne.info">
  7. <view class="name">{{ activityOne.info[0].value }}</view>
  8. <view class="infor">{{ activityOne.info[1].value }}</view>
  9. </view> -->
  10. </view>
  11. <view class="list acea-row row-column-between">
  12. <view class="item skeleton-rect" v-for="(item, index) in activity" :key="index" @click="gopage(item.info[2].value)">
  13. <image :src="item.img" alt="img" />
  14. <!-- <view class="text">
  15. <view class="name">{{ item.info[0].value }}</view>
  16. <view class="infor">{{ item.info[1].value}}</view>
  17. </view> -->
  18. </view>
  19. </view>
  20. </view>
  21. <view v-if="!isShow && isIframe" class="specialArea acea-row row-between-wrapper">
  22. <view class="assemble" hover-class="none" @click="gopage(activityOne.info[2].value)">
  23. <image :src="activityOne.img" alt="img" />
  24. <!-- <view class="text" v-if="activityOne.info">
  25. <view class="name">{{ activityOne.info[0].value }}</view>
  26. <view class="infor">{{ activityOne.info[1].value }}</view>
  27. </view> -->
  28. </view>
  29. <view class="list acea-row row-column-between">
  30. <view class="item" v-for="(item, index) in activity" :key="index" @click="gopage(item.info[2].value)">
  31. <image :src="item.img" alt="img" />
  32. <!-- <view class="text">
  33. <view class="name">{{ item.info[0].value }}</view>
  34. <view class="infor">{{ item.info[1].value}}</view>
  35. </view> -->
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. let app = getApp()
  43. import {
  44. goPage
  45. } from '@/libs/order.js'
  46. export default {
  47. name: 'activity',
  48. props: {
  49. dataConfig: {
  50. type: Object,
  51. default: () => {}
  52. }
  53. },
  54. watch: {
  55. dataConfig: {
  56. immediate: true,
  57. handler(nVal, oVal) {
  58. if (nVal) {
  59. let data = JSON.parse(JSON.stringify(nVal.imgList.list))
  60. this.activityOne = nVal.imgList.list[0]
  61. data.splice(0, 1)
  62. this.activity = data
  63. this.isShow = nVal.isShow.val
  64. }
  65. }
  66. }
  67. },
  68. data() {
  69. return {
  70. activity: [],
  71. activityOne: {},
  72. name: this.$options.name,
  73. isShow: true,
  74. isIframe: app.globalData.isIframe
  75. }
  76. },
  77. created() {},
  78. methods: {
  79. gopage(url) {
  80. goPage().then(res => {
  81. if (url.indexOf("http") != -1) {
  82. // #ifdef H5
  83. location.href = url
  84. // #endif
  85. } else {
  86. if (['/pages/goods_cate/goods_cate', '/pages/order_addcart/order_addcart',
  87. '/pages/user/index'
  88. ].indexOf(url) ==
  89. -1) {
  90. uni.navigateTo({
  91. url: url
  92. })
  93. } else {
  94. uni.navigateTo({
  95. url: url
  96. })
  97. }
  98. }
  99. })
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. .specialArea {
  106. background: linear-gradient(180deg, #fff 0%, #f5f5f5 100%);
  107. // background-color: $uni-bg-color;
  108. padding: 0 $uni-index-margin-col 0 $uni-index-margin-col;
  109. border-radius: $uni-border-radius-index;
  110. // box-shadow: $uni-index-box-shadow;
  111. }
  112. .specialArea .assemble {
  113. width: 336rpx;
  114. height: 300rpx;
  115. position: relative;
  116. }
  117. .specialArea .assemble image {
  118. width: 100%;
  119. height: 100%;
  120. border-radius: 5rpx;
  121. }
  122. .specialArea .assemble .text {
  123. position: absolute;
  124. top: 37rpx;
  125. left: 22rpx;
  126. }
  127. .specialArea .name {
  128. font-size: 30rpx;
  129. color: #fff;
  130. }
  131. .specialArea .infor {
  132. font-size: 22rpx;
  133. color: rgba(255, 255, 255, 0.8);
  134. margin-top: 5rpx;
  135. }
  136. .specialArea .list {
  137. width: 344rpx;
  138. height: 300rpx;
  139. }
  140. .specialArea .item {
  141. width: 100%;
  142. height: 146rpx;
  143. position: relative;
  144. }
  145. .specialArea .item img {
  146. width: 100%;
  147. height: 100%;
  148. }
  149. .specialArea .item .text {
  150. position: absolute;
  151. top: 23rpx;
  152. left: 28rpx;
  153. }
  154. .specialArea .item image {
  155. width: 100%;
  156. height: 100%;
  157. }
  158. .specialArea .item .text {
  159. position: absolute;
  160. top: 23rpx;
  161. left: 28rpx;
  162. }
  163. </style>