navbars.vue 3.7 KB

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