navbars.vue 3.6 KB

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