navbars.vue 3.6 KB

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