navbars.vue 3.6 KB

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