navbars.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template name="navbars">
  2. <view>
  3. <view class="navbars-content clearfix">
  4. <view class="nav-item" v-for="(item,index) in navList" :key="index" @click="NavToDetailPage(item,index)">
  5. <view class="icon">
  6. <image class="icon-image" :src="item.icon" mode="widthFix"></image>
  7. </view>
  8. <view class="name">{{ item.name }}</view>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default{
  15. name:'navbars',
  16. props:{
  17. list:{
  18. type:Array
  19. }
  20. },
  21. data() {
  22. return{
  23. current:100,
  24. navList:[]
  25. }
  26. },
  27. created(){
  28. this.initData(this.list)
  29. },
  30. computed: {
  31. },
  32. methods:{
  33. initData(list){
  34. this.navList = list
  35. },
  36. NavToDetailPage(pros,index) {//跳转
  37. /**
  38. * 页面跳转类型
  39. * 1、二级页面,2、搜索项目仪器,3、直播页面,4、自由页面,5、商品详情,6、仪器项目详情,7、供应商主页
  40. * 8、专题活动页,9、二手市场介绍,10、二手商品列表,11、二手商品发布,12、商品搜索,13、信息详情
  41. * 14、品牌招商介绍页,15、维修保养介绍页,16、首页,17、注册页,18、信息中心,19、供应商列表
  42. * 23、新活动专题页面
  43. **/
  44. console.log(pros)
  45. if(pros.linkType){
  46. const typeMap = {
  47. 1:`/pages/goods/goods-instrument?linkId=${pros.linkParam.id}&title=${pros.name}`,
  48. 3:'/pages/h5/article/path-live',
  49. 4:'/pages/h5/other/brands',
  50. 10:'/pages/second/product/product-list',
  51. 14:'/pages/h5/other/brand',
  52. 15:'/pages/h5/other/repair',
  53. 18:`/pages/h5/article/path?link=${pros.link}`,
  54. 20:`/pages/goods/good-floor?linkId=${pros.linkParam.id}&title=${pros.name}`,
  55. 21:'/pages/h5/activity/meobohui',
  56. 22:`/pages/goods/good-floor-temp?linkId=${pros.linkParam.id}&title=${pros.name}`,
  57. 23:`/pages/h5/activity/activity-topic?linkId=${pros.linkParam.id}`, //活动专题页面
  58. 25:'/pages/goods/goods-doc-list' ,//美业资料
  59. 28:`/pages/h5/article/path?link=${pros.link}`, // 采美认证通
  60. 29:'/pages/user/coupon/coupon-collection',//领券中心
  61. }
  62. const url = typeMap[pros.linkType]
  63. this.$api.navigateTo(url)
  64. }
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss">
  70. .navbars-content{
  71. width: 100%;
  72. height: auto;
  73. box-sizing: border-box;
  74. padding: 0 24rpx;
  75. margin-top: 24rpx;
  76. .nav-item{
  77. width: 164rpx;
  78. height: auto;
  79. float: left;
  80. margin-bottom: 30rpx;
  81. margin-right: 15.3rpx;
  82. &:nth-child(4){
  83. margin-right: 0;
  84. }
  85. &:nth-child(8){
  86. margin-right: 0;
  87. }
  88. .icon{
  89. width: 110rpx;
  90. height: 110rpx;
  91. margin: 0 auto;
  92. position: relative;
  93. .icon-image{
  94. width: 110rpx;
  95. height: 110rpx;
  96. display: block;
  97. }
  98. .icon-new{
  99. width: 44rpx;
  100. height: 22rpx;
  101. display: block;
  102. position: absolute;
  103. right: 0;
  104. top: 20rpx;
  105. }
  106. }
  107. .name{
  108. width: 100%;
  109. height: 40rpx;
  110. line-height: 40rpx;
  111. text-align: center;
  112. font-size: $font-size-26;
  113. color: #666666;
  114. }
  115. .nav-cell-main{
  116. width: 100%;
  117. height: auto;
  118. position: absolute;
  119. right: 0;
  120. .nav-cell{
  121. width: 164rpx;
  122. height: auto;
  123. float: left;
  124. margin-bottom: 30rpx;
  125. margin-right: 15.3rpx;
  126. &:nth-child(4){
  127. margin-right: 0;
  128. }
  129. &:nth-child(8){
  130. margin-right: 0;
  131. }
  132. .icon{
  133. width: 130rpx;
  134. height: 130rpx;
  135. margin: 0 auto;
  136. position: relative;
  137. .icon-image{
  138. width: 130rpx;
  139. height: 130rpx;
  140. display: block;
  141. }
  142. .icon-new{
  143. width: 44rpx;
  144. height: 22rpx;
  145. display: block;
  146. position: absolute;
  147. right: 0;
  148. top: 20rpx;
  149. }
  150. }
  151. .name{
  152. width: 100%;
  153. height: 40rpx;
  154. line-height: 40rpx;
  155. text-align: center;
  156. font-size: $font-size-28;
  157. color: #666666;
  158. }
  159. }
  160. }
  161. }
  162. }
  163. </style>