index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <view class="content">
  3. <swiper class="swiper-box" :current="current" autoplay circular>
  4. <swiper-item v-for="(item, index) in info" :key="index">
  5. <view :class="item.colorClass" class="swiper-item">
  6. <image class="image" :src="item.url" mode="aspectFill" :draggable="false" @click="onBanner(index)" />
  7. </view>
  8. </swiper-item>
  9. </swiper>
  10. <view class="sticky-top">
  11. <van-search class='top-search' shape="round" background="#4fc08d" placeholder="请输入搜索关键词" />
  12. <van-icon name="scan" size="30px" @click="scanCode" />
  13. </view>
  14. <view class="sticky">
  15. <view class="grid">
  16. <view class="grid-item" @click="comname=`xueche`">
  17. <van-icon name="/static/img/home/学车@3x.png" size="20px" />
  18. <text class="text">精选</text>
  19. </view>
  20. <view class="grid-item" @click="comname=`applist`">
  21. <van-icon name="/static/img/home/买车@3x.png" size="20px" />
  22. <text class="text">买车</text>
  23. </view>
  24. <view class="grid-item" @click="comname=`applist`">
  25. <van-icon name="/static/img/home/美食@3x.png" size="20px" />
  26. <text class="text">美食</text>
  27. </view>
  28. <view class="grid-item" @click="comname=`applist`">
  29. <van-icon name="/static/img/home/房产@3x.png" size="20px" />
  30. <text class="text">房产</text>
  31. </view>
  32. <view class="grid-item" @click="comname=`applist`">
  33. <van-icon name="/static/img/home/宠物@3x.png" size="20px" />
  34. <text class="text">宠物</text>
  35. </view>
  36. <view class="grid-item" @click="comname=`applist`">
  37. <van-icon name="/static/img/home/影院@3x.png" size="20px" />
  38. <text class="text">院线</text>
  39. </view>
  40. </view>
  41. </view>
  42. <view class='list-item' v-for="(item, index) in 15" :key="index">
  43. <image class="avatar" mode="aspectFit" src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png">
  44. <view class="item-right">
  45. <view class="top">
  46. <van-icon class="icon" name="/static/img/列表/收藏@2x.png" size='15' />
  47. <van-icon class="icon" name="/static/img/列表/转发@2x.png" size='14' />
  48. <van-icon class="icon" name="/static/img/列表/不喜欢@2x.png" size='12' />
  49. </view>
  50. <view class="center">
  51. <text class="details">牛肉论斤吃!XXXXX资助火锅,单刃仅需998元起!牛肉论斤吃!XXXXX资助火锅,单刃仅需998元起!</text>
  52. </view>
  53. <view class="bottom">
  54. <text class="title">ABC丑食</text>
  55. <view class="right" v-if="false">
  56. <view class="flex">
  57. <van-icon class="icon" name="/static/img/列表/评论@2x.png" size='15' />
  58. <text>54</text>
  59. </view>
  60. <view class="flex">
  61. <van-icon class="icon" name="/static/img/列表/好评率@2x.png" size='15' />
  62. <text>99%</text>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. comname: 'xueche',
  75. active: 0,
  76. info: [{
  77. colorClass: 'uni-bg-red',
  78. url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
  79. content: '内容 A'
  80. },
  81. {
  82. colorClass: 'uni-bg-green',
  83. url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
  84. content: '内容 B'
  85. },
  86. {
  87. colorClass: 'uni-bg-blue',
  88. url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
  89. content: '内容 C'
  90. }
  91. ],
  92. current: 0,
  93. mode: 'round',
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .content {
  100. padding-bottom: 1rpx;
  101. }
  102. .swiper-box{
  103. position: sticky;
  104. top: 0px;
  105. left: 0;
  106. height: 422rpx;
  107. z-index: 9;
  108. }
  109. .sticky-top {
  110. position: sticky;
  111. top: 192rpx;
  112. left: 0;
  113. margin: 30rpx 30rpx;
  114. border-radius: 20rpx;
  115. overflow: hidden;
  116. background-color: #4fc08d;
  117. z-index: 10;
  118. display: flex;
  119. justify-content: center;
  120. align-items: center;
  121. // border-top-left-radius: 14px;
  122. // border-top-right-radius: 14px;
  123. padding-right: 3%;
  124. .top-search {
  125. flex: 1;
  126. }
  127. }
  128. .sticky {
  129. position: sticky;
  130. top: 295rpx;
  131. left: 0;
  132. background-color: #fff;
  133. z-index: 9;
  134. margin: 30rpx 30rpx;
  135. border-radius: 20rpx;
  136. .grid {
  137. display: flex;
  138. justify-content: space-between;
  139. padding: 1% 2%;
  140. margin-bottom: 2%;
  141. border-bottom-left-radius: 10px;
  142. border-bottom-right-radius: 10px;
  143. .grid-item {
  144. width: 50px;
  145. height: 60px;
  146. display: flex;
  147. justify-content: center;
  148. flex-direction: column;
  149. align-items: center;
  150. font-size: 12px;
  151. }
  152. }
  153. }
  154. .list-item {
  155. display: flex;
  156. align-items: center;
  157. justify-content: space-between;
  158. background-color: #FFFFFF;
  159. height: 170rpx;
  160. padding: 34rpx;
  161. margin: 24rpx 30rpx;
  162. border-radius: 20rpx;
  163. .avatar {
  164. flex-shrink: 0;
  165. width: 161rpx;
  166. height: 161rpx;
  167. margin-right: 16rpx;
  168. }
  169. .item-right {
  170. flex: 1;
  171. display: flex;
  172. flex-direction: column;
  173. justify-content: space-between;
  174. height: 200rpx;
  175. .top {
  176. .icon {
  177. margin-left: 35rpx;
  178. }
  179. display: flex;
  180. justify-content: flex-end;
  181. }
  182. .center {
  183. align-self: flex-start;
  184. .details {
  185. width: 436rpx;
  186. height: 70rpx;
  187. font-size: 26rpx;
  188. font-family: PingFang SC;
  189. font-weight: 400;
  190. color: #0F0404;
  191. display: -webkit-box;
  192. margin-bottom: 20rpx;
  193. overflow: hidden;
  194. text-overflow: ellipsis;
  195. word-wrap: break-word;
  196. white-space: normal !important;
  197. -webkit-line-clamp: 2;
  198. -webkit-box-orient: vertical;
  199. }
  200. }
  201. .bottom {
  202. display: flex;
  203. justify-content: space-between;
  204. align-items: center;
  205. .title {
  206. padding: 3rpx 12rpx;
  207. height: 30rpx;
  208. background: #FFE6E6;
  209. border: 1rpx solid #E31818;
  210. border-radius: 2rpx;
  211. font-size: 20rpx;
  212. font-family: PingFang SC;
  213. font-weight: 400;
  214. color: #E31818;
  215. line-height: 20rpx;
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. }
  220. .right {
  221. width: 170rpx;
  222. display: flex;
  223. justify-content: space-between;
  224. align-items: center;
  225. font-size: 22rpx;
  226. font-family: PingFang SC;
  227. font-weight: 400;
  228. color: #999999;
  229. line-height: 35rpx;
  230. .flex {
  231. display: flex;
  232. justify-content: center;
  233. .icon {
  234. margin-right: 5rpx;
  235. }
  236. }
  237. }
  238. }
  239. }
  240. }
  241. </style>