index-nav.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="">
  3. <view class="header" :style="[{'height': customBarH + 'px', 'padding-top': statusBarH + 'px'}]">
  4. <view class="header-left">
  5. <view class="left-text sys-color-black-0 sys-weight-600">筛选</view>
  6. <view class="left-img">
  7. <image class="down-img" src="/static/img/common/down.png" mode="aspectFill"></image>
  8. </view>
  9. </view>
  10. <view class="header-center">
  11. <view class="center-list">
  12. <view class="center-item sys-weight-600" @click="setTabNum(0)" :class="{'sys-color-black':tabNum===0,'sys-color-gray-9':tabNum!==0,}">发现</view>
  13. <view class="center-item sys-weight-600" @click="setTabNum(1)" :class="{'sys-color-black':tabNum===1,'sys-color-gray-9':tabNum!==1,}">附近</view>
  14. <view class="center-item sys-weight-600" @click="setTabNum(2)" :class="{'sys-color-black':tabNum===2,'sys-color-gray-9':tabNum!==2,}">匹配</view>
  15. </view>
  16. <view class="center-bg" :style="{'left':(tabNum*122)+'rpx'}"></view>
  17. </view>
  18. <view class="header-right">
  19. <image class="right-img" src="/static/img/index/pull-back.png" mode="aspectFill"></image>
  20. <image class="right-img" src="/static/img/index/exposure.png" mode="aspectFill"></image>
  21. </view>
  22. </view>
  23. <view class="box-title">
  24. <view class="" :style="[{'height': customBarH + 'px', 'padding-top': statusBarH + 'px'}]">
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. name: "index-nav",
  32. data() {
  33. return {
  34. statusBarH: 0,
  35. customBarH: 0,
  36. left: 35,
  37. isXcx:false,
  38. tabNum:0
  39. }
  40. },
  41. props: {
  42. },
  43. computed: {
  44. },
  45. watch: {
  46. },
  47. methods: {
  48. setTabNum(tabNum){
  49. if(this.tabNum!==tabNum){
  50. this.tabNum=tabNum
  51. this.$emit('setTabNum',tabNum)
  52. }
  53. }
  54. },
  55. created() {
  56. uni.getSystemInfo({
  57. success: (e) =>{
  58. this.statusBarH = e.statusBarHeight + 10
  59. let custom=0;
  60. //#ifdef MP-WEIXIN
  61. custom = wx.getMenuButtonBoundingClientRect()
  62. this.customBarH = custom.height
  63. //#endif
  64. //#ifdef H5
  65. this.customBarH = 34
  66. this.left=0
  67. //#endif
  68. // #ifdef APP-PLUS
  69. this.customBarH = 34
  70. this.left=0
  71. //#endif
  72. console.log('self.customBarH---------'+this.customBarH)
  73. console.log('self.statusBarH---------'+this.statusBarH)
  74. this.$emit('navHeight', this.customBarH+this.statusBarH)
  75. }
  76. })
  77. }
  78. }
  79. </script>
  80. <style scoped lang="scss">
  81. @import url("/static/css/en-common.css") ;
  82. .header {
  83. width: calc(100vw - 72rpx);
  84. position: fixed;
  85. left: 0;
  86. top: 0;
  87. z-index: 100;
  88. display: flex;
  89. justify-content: space-between;
  90. height: 88rpx;
  91. padding: 12rpx 36rpx;
  92. //box-sizing: border-box;
  93. background-color: #fff;
  94. .header-left{
  95. padding: 10rpx 0;
  96. height: 44rpx;
  97. display: flex;
  98. justify-content: flex-start;
  99. .left-text{
  100. height: 44rpx;
  101. line-height: 44rpx;
  102. font-size: 28rpx;
  103. }
  104. .left-img{
  105. padding: 0 6rpx;
  106. .down-img{
  107. width: 24rpx;
  108. height: 24rpx;
  109. }
  110. }
  111. }
  112. .header-center{
  113. width: 366rpx;
  114. height: 64rpx;
  115. background: #EEEEEE;
  116. border-radius: 200rpx;
  117. position: relative;
  118. .center-list{
  119. z-index: 112;
  120. display: flex;
  121. justify-content: space-between;
  122. height: 64rpx;
  123. .center-item{
  124. z-index: 113;
  125. width: 122rpx;
  126. height: 64rpx;
  127. line-height: 64rpx;
  128. text-align: center;
  129. font-size: 32rpx;
  130. }
  131. }
  132. .center-bg{
  133. z-index: 111;
  134. position: absolute;
  135. margin: 4rpx 2rpx;
  136. width: 120rpx;
  137. background-color: #fff;
  138. border-radius: 200rpx;
  139. height: 56rpx;
  140. left: 0;
  141. top: 0;
  142. transition: .5s ease;
  143. }
  144. }
  145. .header-right{
  146. height: 64rpx;
  147. display: flex;
  148. justify-content: flex-end;
  149. .right-img{
  150. padding: 6rpx 0;
  151. width: 52rpx;
  152. height: 52rpx;
  153. }
  154. .right-img:first-child{
  155. margin-right: 40rpx;
  156. }
  157. }
  158. }
  159. .box-title {
  160. width: 100vw;
  161. }
  162. </style>