index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="content">
  3. <!-- 导航 -->
  4. <view class="nav">
  5. <view class="leftView"></view>
  6. <view class="navTitle">门店学院</view>
  7. <view class="rightView">
  8. <image src="../../static/mobile/icona_fenlei@2x.png" mode="" class="rightImg"></image>
  9. <image src="../../static/mobile/icon_search@2x.png" mode="" class="rightImg"
  10. style="margin-left: 40rpx;"></image>
  11. </view>
  12. </view>
  13. <!-- 推荐 -->
  14. <view class="commend">
  15. <view class="top">
  16. <image src="../../static/mobile/icon_tuijian@2x.png" mode="" style="width: 28rpx; height: 28rpx;">
  17. <text class="tuijian">推荐文章</text>
  18. </image>
  19. </view>
  20. <!-- item -->
  21. <view class="scrollBg">
  22. <scroll-view scroll-x="true" @scroll="scroll">
  23. <view class="itemBg">
  24. <view v-for="(item,index) in bannerArr" :key="index" class="item">
  25. <image src="../../static/logo.png" mode="" class="swpImg"></image>
  26. <view class="title">文字标题</view>
  27. <view class="title2">小标题</view>
  28. </view>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. </view>
  33. <!-- 分类 -->
  34. <view v-for="(item,index) in itemArr" :key="index">
  35. <view class="fenleiBg">
  36. <!-- 头 -->
  37. <view class="fenTop">
  38. <view class="leftTop">
  39. <view class="tuijian">天空飘来5个字</view>
  40. <view class="sum">共9999篇文章</view>
  41. </view>
  42. <view class="rightTop">
  43. <view class="">查看全部
  44. <image src="../../static/mobile/icon_arrow@2x.png" mode=""
  45. style="width: 11rpx; height: 18rpx; margin-left: 10rpx;"></image>
  46. </view>
  47. </view>
  48. </view>
  49. <!-- item -->
  50. <view class="itemBg">
  51. <view v-for="(item,index) in bannerArr" :key="index" class="twoItem">
  52. <image src="../../static/logo.png" mode="" class="img2"></image>
  53. <view class="title">文字标题</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. data() {
  63. return {
  64. bannerArr: [1, 2, 3, 4, 5],
  65. scrollTop: 0,
  66. old: {
  67. scrollTop: 0
  68. },
  69. itemArr: [1, 2, 3, 4, 5, 6],
  70. }
  71. },
  72. onLoad() {
  73. },
  74. methods: {
  75. scroll: function(e) {
  76. console.log(e)
  77. this.old.scrollTop = e.detail.scrollTop
  78. },
  79. }
  80. }
  81. </script>
  82. <style scoped>
  83. .content {
  84. min-height: 100vh;
  85. background-color: #f4f5f7;
  86. padding-top: 88rpx;
  87. padding-bottom: 20rpx;
  88. }
  89. .nav {
  90. position: fixed;
  91. left: 0;
  92. top: 0;
  93. width: 100vw;
  94. height: 88rpx;
  95. background-color: #FFFFFF;
  96. display: flex;
  97. justify-content: space-between;
  98. align-items: center;
  99. z-index: 999;
  100. }
  101. .navTitle {
  102. font-size: 36rpx;
  103. font-weight: bold;
  104. color: #3c3c3c;
  105. }
  106. .leftView {
  107. width: 30%;
  108. }
  109. .rightView {
  110. width: 30%;
  111. display: flex;
  112. justify-content: flex-end;
  113. padding-right: 24rpx;
  114. }
  115. .rightImg {
  116. width: 40rpx;
  117. height: 40rpx;
  118. }
  119. .commend {
  120. background-color: #FFFFFF;
  121. margin: 20rpx 0;
  122. padding: 30rpx 25rpx;
  123. }
  124. .top {
  125. padding-bottom: 24rpx;
  126. }
  127. .tuijian {
  128. font-size: 32rpx;
  129. font-weight: bold;
  130. color: #3c3c3c;
  131. margin-left: 10rpx;
  132. }
  133. .scrollBg {
  134. background-color: #FFFFFF;
  135. }
  136. .scroll-view {
  137. white-space: nowrap;
  138. }
  139. .itemBg {
  140. display: flex;
  141. }
  142. .item {
  143. width: 300rpx;
  144. margin-right: 25rpx;
  145. }
  146. .swpImg {
  147. width: 300rpx;
  148. height: 200rpx;
  149. border-radius: 10rpx;
  150. }
  151. .title {
  152. font-size: 28rpx;
  153. font-weight: bold;
  154. color: #3c3c3c;
  155. /* 隐藏文字显示 ...不换行 */
  156. overflow: hidden;
  157. text-overflow: ellipsis;
  158. white-space: nowrap;
  159. margin: 14rpx 0;
  160. }
  161. .title2 {
  162. background: rgba(63, 144, 247, 0.1);
  163. font-size: 22rpx;
  164. color: #3F90F7;
  165. height: 36rpx;
  166. line-height: 36rpx;
  167. border-radius: 18rpx;
  168. padding: 3rpx 14rpx;
  169. width: 138rpx;
  170. margin-bottom: 10rpx;
  171. /* text-align: center; */
  172. }
  173. .fenleiBg {
  174. background-color: #FFFFFF;
  175. margin: 20rpx 0;
  176. padding: 30rpx 25rpx;
  177. }
  178. .fenTop {
  179. padding-bottom: 24rpx;
  180. display: flex;
  181. justify-content: space-between;
  182. align-items: center;
  183. }
  184. .leftTop {
  185. display: flex;
  186. align-items: center;
  187. }
  188. .sum {
  189. font-size: 24rpx;
  190. color: #999999;
  191. margin-left: 16rpx;
  192. }
  193. .twoItem {
  194. width: calc((100vw - 75rpx) / 2);
  195. margin-right: 25rpx;
  196. }
  197. .img2 {
  198. width: calc((100vw - 75rpx) / 2);
  199. height: 226rpx;
  200. }
  201. </style>