index-nav.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. width: 244rpx;
  115. height: 64rpx;
  116. background: #EEEEEE;
  117. border-radius: 200rpx;
  118. position: relative;
  119. .center-list{
  120. z-index: 112;
  121. display: flex;
  122. justify-content: space-between;
  123. height: 64rpx;
  124. .center-item{
  125. z-index: 113;
  126. width: 122rpx;
  127. height: 64rpx;
  128. line-height: 64rpx;
  129. text-align: center;
  130. font-size: 32rpx;
  131. }
  132. }
  133. .center-bg{
  134. z-index: 111;
  135. position: absolute;
  136. margin: 4rpx 2rpx;
  137. width: 120rpx;
  138. background-color: #fff;
  139. border-radius: 200rpx;
  140. height: 56rpx;
  141. left: 0;
  142. top: 0;
  143. transition: .5s ease;
  144. }
  145. }
  146. .header-right{
  147. height: 64rpx;
  148. display: flex;
  149. justify-content: flex-end;
  150. .right-img{
  151. padding: 6rpx 0;
  152. width: 52rpx;
  153. height: 52rpx;
  154. }
  155. .right-img:first-child{
  156. margin-right: 40rpx;
  157. }
  158. }
  159. }
  160. .box-title {
  161. width: 100vw;
  162. }
  163. </style>