navbars.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template name="navbars">
  2. <view class="navbar">
  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. if(index === 3){
  38. let linkPath = 'https://static.caimei365.com/app/caimei-activity-h5/html/2023/activity_02.html'
  39. this.$api.navigateTo(`/pages/h5/activity/activity?link=${linkPath}&linkId=382`)
  40. }else{
  41. /**
  42. * 页面跳转类型
  43. * 1、二级页面,2、搜索项目仪器,3、直播页面,4、自由页面,5、商品详情,6、仪器项目详情,7、供应商主页
  44. * 8、专题活动页,9、二手市场介绍,10、二手商品列表,11、二手商品发布,12、商品搜索,13、信息详情
  45. * 14、品牌招商介绍页,15、维修保养介绍页,16、首页,17、注册页,18、信息中心,19、供应商列表
  46. * 23、新活动专题页面
  47. **/
  48. if(pros.linkType){
  49. const typeMap = {
  50. 1:`/pages/goods/goods-instrument?linkId=${pros.linkParam.id}&title=${pros.name}`,
  51. 3:'/pages/h5/article/path-live',
  52. 4:'/pages/h5/other/brands',
  53. 10:'/pages/second/product/product-list',
  54. 14:'/pages/h5/other/brand',
  55. 15:'/pages/h5/other/repair',
  56. 18:`/pages/h5/article/path?link=${pros.link}`,
  57. 20:`/pages/goods/good-floor?linkId=${pros.linkParam.id}&title=${pros.name}`,
  58. 21:'/pages/h5/activity/meobohui',
  59. 22:`/pages/goods/good-floor-temp?linkId=${pros.linkParam.id}&title=${pros.name}`,
  60. 23:`/pages/h5/activity/activity-topic?linkId=${pros.linkParam.id}`, //活动专题页面
  61. 25:'/pages/goods/goods-doc-list' ,//美业资料
  62. 28:`/pages/h5/article/path?link=${pros.link}`, // 采美认证通
  63. 29:'/pages/user/coupon/coupon-collection',//领券中心
  64. }
  65. const url = typeMap[pros.linkType]
  66. this.$api.navigateTo(url)
  67. }
  68. }
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .navbar {
  75. background: #f7f7f7;
  76. display: flex;
  77. align-items: center;
  78. justify-content: center;
  79. }
  80. .navbars-content{
  81. width: 94%;
  82. height: auto;
  83. box-sizing: border-box;
  84. margin-top: 24rpx;
  85. padding: 32rpx 0;
  86. background-color: #fff;
  87. border-radius: 16rpx;
  88. .nav-item{
  89. width: 164rpx;
  90. height: auto;
  91. float: left;
  92. margin-bottom: 30rpx;
  93. margin-right: 15.3rpx;
  94. &:nth-child(4){
  95. margin-right: 0;
  96. }
  97. &:nth-child(8){
  98. margin-right: 0;
  99. }
  100. .icon{
  101. width: 110rpx;
  102. height: 110rpx;
  103. margin: 0 auto;
  104. position: relative;
  105. .icon-image{
  106. width: 110rpx;
  107. height: 110rpx;
  108. display: block;
  109. }
  110. .icon-new{
  111. width: 44rpx;
  112. height: 22rpx;
  113. display: block;
  114. position: absolute;
  115. right: 0;
  116. top: 20rpx;
  117. }
  118. }
  119. .name{
  120. width: 100%;
  121. height: 40rpx;
  122. line-height: 40rpx;
  123. text-align: center;
  124. font-size: $font-size-26;
  125. color: #666666;
  126. }
  127. .nav-cell-main{
  128. width: 100%;
  129. height: auto;
  130. position: absolute;
  131. right: 0;
  132. .nav-cell{
  133. width: 164rpx;
  134. height: auto;
  135. float: left;
  136. margin-bottom: 30rpx;
  137. margin-right: 15.3rpx;
  138. &:nth-child(4){
  139. margin-right: 0;
  140. }
  141. &:nth-child(8){
  142. margin-right: 0;
  143. }
  144. .icon{
  145. width: 130rpx;
  146. height: 130rpx;
  147. margin: 0 auto;
  148. position: relative;
  149. .icon-image{
  150. width: 130rpx;
  151. height: 130rpx;
  152. display: block;
  153. }
  154. .icon-new{
  155. width: 44rpx;
  156. height: 22rpx;
  157. display: block;
  158. position: absolute;
  159. right: 0;
  160. top: 20rpx;
  161. }
  162. }
  163. .name{
  164. width: 100%;
  165. height: 40rpx;
  166. line-height: 40rpx;
  167. text-align: center;
  168. font-size: $font-size-28;
  169. color: #666666;
  170. }
  171. }
  172. }
  173. }
  174. }
  175. </style>