home.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view style="background-color: #f7f7f5;overflow: hidden;">
  3. <view class="top-bg"></view>
  4. <view class="section carousel-wrapper">
  5. <swiper class="carousel" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" circular>
  6. <swiper-item>
  7. <view class="swiper-item">
  8. <image class="image" src="../../static/images/material/carousel01.png" mode=""></image>
  9. </view>
  10. </swiper-item>
  11. <swiper-item>
  12. <view class="swiper-item">
  13. <image class="image" src="../../static/images/material/carousel02.png" mode=""></image>
  14. </view>
  15. </swiper-item>
  16. </swiper>
  17. </view>
  18. <view class="section">
  19. <view class="col-title">
  20. <image class="icon" style="width: 38rpx;height: 43rpx;" src="../../static/images/hot.png" mode="scaleToFill"></image>
  21. <text>今日拿货榜单</text>
  22. </view>
  23. <view class="hot-rank">
  24. <scroll-view scroll-x="true" :show-scrollbar="false" :enable-flex="true" style="white-space: nowrap;">
  25. <product-item type="swiper" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  26. <product-item type="swiper" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  27. <product-item type="swiper" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  28. <product-item type="swiper" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  29. </scroll-view>
  30. </view>
  31. </view>
  32. <view class="section">
  33. <view class="col-title">
  34. <image class="icon" style="width: 47rpx;height: 47rpx;" src="../../static/images/sale.png" mode="scaleToFill"></image>
  35. <text>最新上线</text>
  36. </view>
  37. <view class="new-rank">
  38. <scroll-view scroll-x="true" :show-scrollbar="false" :enable-flex="true" style="white-space: nowrap;">
  39. <product-item type="swiper" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  40. <product-item type="swiper" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  41. <product-item type="swiper" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  42. <product-item type="swiper" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  43. </scroll-view>
  44. </view>
  45. </view>
  46. <view class="section" style="margin-top: 40upx;">
  47. <view class="col-img-title">
  48. <image src="../../static/images/like.png" mode="scaleToFill" style="height: 28rpx;width: 363rpx;"></image>
  49. </view>
  50. <view class="like">
  51. <product-item type="list" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  52. <product-item type="list" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  53. <product-item type="list" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  54. <product-item type="list" image="https://img.alicdn.com/imgextra/i3/2930255252/O1CN0159ouF21ofSiQ3kPq2_!!2930255252.jpg"></product-item>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. title: 'Hello',
  64. }
  65. },
  66. components: {},
  67. onLoad() {
  68. console.log(this.$http)
  69. },
  70. onShow() {
  71. this.$http.get({
  72. url: "/demo/test",
  73. data: {
  74. category: 'test'
  75. },
  76. success: (res) => {
  77. }
  78. })
  79. },
  80. onNavigationBarButtonTap(e) {
  81. // console.log(e)
  82. switch (e.index) {
  83. case 0:
  84. uni.navigateTo({
  85. url: '/pages/message/message'
  86. });
  87. break;
  88. default:
  89. break;
  90. }
  91. },
  92. methods: {}
  93. }
  94. </script>
  95. <style lang="scss">
  96. .search {
  97. background-color: #FFFFFF;
  98. width: 100%;
  99. height: 60rpx;
  100. line-height: 60rpx;
  101. border-radius: 30rpx;
  102. text-align: center;
  103. color: #999999;
  104. }
  105. .top-bg {
  106. position: absolute;
  107. top: 0;
  108. width: 100%;
  109. height: 300rpx;
  110. background-color: $primary-color;
  111. overflow: hidden;
  112. }
  113. .top-bg::after {
  114. background: #F8F8F8;
  115. position: absolute;
  116. border-radius: 2000rpx;
  117. content: "";
  118. width: 4000rpx;
  119. height: 4000rpx;
  120. top: 260rpx;
  121. left: -1625rpx;
  122. }
  123. .carousel-wrapper {
  124. margin-top: 20rpx;
  125. .carousel {
  126. margin: auto;
  127. overflow: hidden;
  128. border-radius: 20rpx;
  129. transform: translateY(0);
  130. width: 702rpx;
  131. height: 340rpx;
  132. .image {
  133. width: 702rpx;
  134. height: 340rpx;
  135. }
  136. }
  137. }
  138. .section {
  139. // padding: 20rpx;
  140. }
  141. .col-title {
  142. height: 60rpx;
  143. line-height: 60rpx;
  144. font-weight: bold;
  145. display: flex;
  146. align-items: center;
  147. padding: 20upx 20upx 10upx 20upx;
  148. .icon {
  149. // vertical-align: middle;
  150. margin-right: 12rpx;
  151. }
  152. }
  153. .col-img-title {
  154. text-align: center;
  155. background: white;
  156. height: 80upx;
  157. line-height: 80upx;
  158. }
  159. .hot-rank .product-item,
  160. .new-rank .product-item {
  161. margin: 5rpx;
  162. &:first-child {
  163. margin-left: 20upx;
  164. }
  165. &:last-child {
  166. margin-right: 20upx;
  167. }
  168. }
  169. .like {
  170. display: flex;
  171. justify-content: space-between;
  172. flex-wrap: wrap;
  173. padding: 10upx 20upx;
  174. }
  175. .like .product-item {
  176. margin-bottom: 10upx;
  177. }
  178. </style>