navbars.vue 3.4 KB

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