navbars.vue 3.3 KB

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