金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
4.3 KiB

  1. <template>
  2. <!--快捷导航-->
  3. <view class="quick-nav" :style="'margin-bottom: ' + meta.margin_bottom + 'px'">
  4. <scroll-view :scroll-x="true" class="scroll-view" @scroll="scroll">
  5. <view class="nav-content">
  6. <view class="nav-item" v-for="(item, index) in navData" :key="index" @tap="_jumpImg" :data-src="item.link">
  7. <view class="top-info">
  8. <image :src="item.image"></image>
  9. </view>
  10. <view class="bottom-info">{{item.name}}</view>
  11. </view>
  12. </view>
  13. </scroll-view>
  14. <view class="indicator">
  15. <view class="percentage" :style="{width: per_width +'%'}"></view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. list: [{
  24. link: '/pages/index/category/category?current=0&type=0',
  25. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  26. name: '面部护肤'
  27. },{
  28. link: '/pages/index/category/category?current=0&type=3',
  29. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  30. name: '国际精品'
  31. },{
  32. link: '/pages/point/shoppingMall/shoppingMall',
  33. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  34. name: '积分商城'
  35. },{
  36. link: '/pages/index/category/category?current=0&type=4',
  37. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  38. name: '服装内衣'
  39. },{
  40. link: '/pages/index/category/category?current=0&type=6',
  41. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  42. name: '数码家电'
  43. },{
  44. link: '/pages/index/onlineMall/onlineMall?id=6',
  45. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  46. name: '黄金珠宝'
  47. },{
  48. link: '/pages/user/member/service',
  49. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  50. name: '会员服务'
  51. },{
  52. link: '/pages/index/activity/hot',
  53. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  54. name: '活动报名'
  55. },{
  56. link: '/pages/index/cateringFacilities/cateringFacilities',
  57. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  58. name: '餐饮配套'
  59. },{
  60. link: '/pages/index/collectCoupons/collectCoupons',
  61. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  62. name: '领券中心'
  63. },{
  64. link: '/pages/user/my/chatonline',
  65. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  66. name: '在线客服'
  67. },{
  68. link: '/pages/index/category/category?current=0&type=7',
  69. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  70. name: '鞋履箱包'
  71. },{
  72. link: '/pages/index/category/category?current=0&type=8',
  73. image: 'https://cdn.guojiang.club/storage/uploads/images/2020_06_05/rNCqCVUgi5GFYntpqmevHEaO1NYt5PZ2tgjEXRMU.png',
  74. name: '滋补保健'
  75. }],
  76. per_width: 14.285 * 5
  77. };
  78. },
  79. props: {
  80. navData: {
  81. type: Array,
  82. value: ''
  83. },
  84. meta: {
  85. type: Object,
  86. value: ""
  87. }
  88. },
  89. mounted(){
  90. },
  91. //组件的方法
  92. methods: {
  93. _jumpImg(e) {
  94. var src = e.currentTarget.dataset.src;
  95. if (!src || src == 'uto_miniprogram') return this.$msg('敬请期待');
  96. wx.navigateTo({
  97. url: src
  98. });
  99. },
  100. scroll(event){
  101. // todo 计算优化
  102. if(event.detail.scrollLeft < 112){
  103. this.per_width = 14.285 * 5;
  104. }else{
  105. this.per_width = 0.636 * event.detail.scrollLeft;
  106. }
  107. }
  108. },
  109. };
  110. </script>
  111. <style rel="stylesheet/less" lang="less">
  112. @import "index-nav";
  113. .scroll-view{
  114. width: 750rpx;
  115. height: max-content;
  116. padding: 0 32rpx;
  117. box-sizing: border-box;
  118. }
  119. .indicator{
  120. width: 100rpx;
  121. height: 10rpx;
  122. background-color: #e0e0e0;
  123. margin: 0 auto;
  124. border-radius: 20rpx;
  125. position: relative;
  126. overflow: hidden;
  127. .percentage{
  128. height: 10rpx;
  129. background-color: #186c6b;
  130. position: absolute;
  131. top: 0;
  132. left: 0;
  133. border-radius: 20rpx;
  134. }
  135. }
  136. </style>