navbars.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. **/
  43. if(pros.linkType){
  44. const typeMap = {
  45. 1:`/pages/goods/goods-instrument?linkId=${pros.linkParam.id}&title=${pros.name}`,
  46. 3:`/h5/pages/article/path-live`,
  47. 10:`/second/pages/product/product-list`,
  48. 14:`/h5/pages/other/brand`,
  49. 15:`/h5/pages/other/repair`,
  50. 18:`/h5/pages/article/path?link=${pros.link}`,
  51. 20:`/pages/goods/good-floor?linkId=${pros.linkParam.id}&title=${pros.name}`
  52. }
  53. const url = typeMap[pros.linkType];
  54. this.$api.navigateTo(url)
  55. }
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss">
  61. .navbars-content{
  62. width: 100%;
  63. height: auto;
  64. box-sizing: border-box;
  65. padding: 0 24rpx;
  66. margin-top: 30rpx;
  67. .nav-item{
  68. width: 164rpx;
  69. height: auto;
  70. float: left;
  71. margin-bottom: 30rpx;
  72. margin-right: 15.3rpx;
  73. &:nth-child(4){
  74. margin-right: 0;
  75. }
  76. &:nth-child(8){
  77. margin-right: 0;
  78. }
  79. .icon{
  80. width: 110rpx;
  81. height: 110rpx;
  82. margin: 0 auto;
  83. position: relative;
  84. .icon-image{
  85. width: 110rpx;
  86. height: 110rpx;
  87. display: block;
  88. }
  89. .icon-new{
  90. width: 44rpx;
  91. height: 22rpx;
  92. display: block;
  93. position: absolute;
  94. right: 0;
  95. top: 20rpx;
  96. }
  97. }
  98. .name{
  99. width: 100%;
  100. height: 40rpx;
  101. line-height: 40rpx;
  102. text-align: center;
  103. font-size: $font-size-26;
  104. color: #666666;
  105. }
  106. .nav-cell-main{
  107. width: 100%;
  108. height: auto;
  109. position: absolute;
  110. right: 0;
  111. .nav-cell{
  112. width: 164rpx;
  113. height: auto;
  114. float: left;
  115. margin-bottom: 30rpx;
  116. margin-right: 15.3rpx;
  117. &:nth-child(4){
  118. margin-right: 0;
  119. }
  120. &:nth-child(8){
  121. margin-right: 0;
  122. }
  123. .icon{
  124. width: 130rpx;
  125. height: 130rpx;
  126. margin: 0 auto;
  127. position: relative;
  128. .icon-image{
  129. width: 130rpx;
  130. height: 130rpx;
  131. display: block;
  132. }
  133. .icon-new{
  134. width: 44rpx;
  135. height: 22rpx;
  136. display: block;
  137. position: absolute;
  138. right: 0;
  139. top: 20rpx;
  140. }
  141. }
  142. .name{
  143. width: 100%;
  144. height: 40rpx;
  145. line-height: 40rpx;
  146. text-align: center;
  147. font-size: $font-size-28;
  148. color: #666666;
  149. }
  150. }
  151. }
  152. }
  153. }
  154. </style>