index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="container">
  3. <view class="swiper">
  4. <view class="swiper-box">
  5. <swiper circular="true" autoplay="true" @change="swiperChange">
  6. <swiper-item v-for="swiper in banner" :key="swiper.id" @click="ToBanner(swiper)"><image :src="swiper.pic"></image></swiper-item>
  7. </swiper>
  8. <view class="indicator"><view class="dots" v-for="(swiper, index) in banner" :class="[swiperCurrent >= index ? 'on' : '']" :key="index"></view></view>
  9. </view>
  10. </view>
  11. <view class="product-section">
  12. <view class="product-item" @click="navTo(1)">
  13. <view class="image-wrapper"><image src="../../static/img/img01.png" mode="scaleToFill"></image></view>
  14. <view class="title-box">
  15. <text class="title ellipsis">质押商品名称</text>
  16. <view class="price flex_item">¥8888</view>
  17. </view>
  18. </view>
  19. <view class="product-item" >
  20. <view class="image-wrapper"><image src="../../static/img/img01.png" mode="scaleToFill"></image></view>
  21. <view class="title-box">
  22. <text class="title ellipsis">质押商品名称</text>
  23. <view class="price flex_item">¥8888</view>
  24. </view>
  25. </view>
  26. <view class="product-item" >
  27. <view class="image-wrapper"><image src="../../static/img/img01.png" mode="scaleToFill"></image></view>
  28. <view class="title-box">
  29. <text class="title ellipsis">质押商品名称</text>
  30. <view class="price flex_item">¥8888</view>
  31. </view>
  32. </view>
  33. <view class="product-item" >
  34. <view class="image-wrapper"><image src="../../static/img/img01.png" mode="scaleToFill"></image></view>
  35. <view class="title-box">
  36. <text class="title ellipsis">质押商品名称</text>
  37. <view class="price flex_item">¥8888</view>
  38. </view>
  39. </view>
  40. <view class="product-item" >
  41. <view class="image-wrapper"><image src="../../static/img/img01.png" mode="scaleToFill"></image></view>
  42. <view class="title-box">
  43. <text class="title ellipsis">质押商品名称</text>
  44. <view class="price flex_item">¥8888</view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. // import { userinfo } from '@/api/user.js';
  52. export default {
  53. data() {
  54. return {
  55. swiperCurrent: 0,
  56. banner: [{
  57. pic:'/static/img/img01.png'
  58. }],
  59. };
  60. },
  61. onLoad(option){},
  62. onShow() {
  63. },
  64. //下拉刷新
  65. onPullDownRefresh() {
  66. this.loadData();
  67. },
  68. methods: {
  69. navTo(id){
  70. uni.navigateTo({
  71. url:'/pages/product/details?id='+id
  72. })
  73. },
  74. }
  75. };
  76. </script>
  77. <style lang="scss">
  78. page {
  79. min-height: 100%;
  80. background-color: #ffffff;
  81. .container {
  82. width: 100%;
  83. }
  84. }
  85. //轮播图
  86. .swiper {
  87. width: 100%;
  88. display: flex;
  89. justify-content: center;
  90. .swiper-box {
  91. width: 100%;
  92. height: 260rpx;
  93. padding: 0 30rpx;
  94. overflow: hidden;
  95. // box-shadow: 0upx 8upx 25upx rgba(0, 0, 0, 0.2);
  96. //兼容ios,微信小程序
  97. position: relative;
  98. z-index: 1;
  99. swiper {
  100. width: 100%;
  101. height: 100%;
  102. swiper-item {
  103. image {
  104. width: 100%;
  105. height: 100%;
  106. }
  107. }
  108. }
  109. .indicator {
  110. position: absolute;
  111. bottom: 20upx;
  112. left: 20upx;
  113. background-color: rgba(255, 255, 255, 0.4);
  114. width: 150upx;
  115. height: 5upx;
  116. border-radius: 3upx;
  117. overflow: hidden;
  118. display: flex;
  119. .dots {
  120. width: 0upx;
  121. background-color: rgba(255, 255, 255, 1);
  122. transition: all 0.3s ease-out;
  123. &.on {
  124. width: (100%/3);
  125. }
  126. }
  127. }
  128. }
  129. }
  130. /* 猜你喜欢 */
  131. .product-section {
  132. background-color: #ffffff;
  133. display: flex;
  134. flex-wrap: wrap;
  135. padding: 0 28rpx;
  136. margin-bottom: 20rpx;
  137. margin-top: 30rpx;
  138. .product-item {
  139. overflow: hidden;
  140. display: flex;
  141. flex-direction: column;
  142. width:48%;
  143. margin-bottom: 4%;
  144. &:nth-child(2n + 1) {
  145. margin-right: 4%;
  146. }
  147. }
  148. .image-wrapper {
  149. width: 100%;
  150. height: 267rpx;
  151. border-radius: 3px;
  152. overflow: hidden;
  153. image {
  154. width: 100%;
  155. height: 100%;
  156. opacity: 1;
  157. }
  158. }
  159. .title-box {
  160. padding: 25rpx 25rpx;
  161. }
  162. .title {
  163. color: #343434 !important;
  164. font-weight: bold;
  165. height: 80rpx;
  166. }
  167. .price {
  168. font-size:40rpx;
  169. font-weight: bold;
  170. color: #FB3A2F;
  171. border-top: 2rpx solid #f0f0f0;
  172. }
  173. }
  174. </style>