index-nav.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="">
  3. <view class="header" :style="[{'height': customBarH + 'px', 'padding-top': statusBarH + 'px'}]">
  4. <view class="header-left" @click="goToUrl(1)">
  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. goToUrl(type){
  49. if(type===1){
  50. uni.navigateTo({
  51. 'url':'/pages/index/model/screen-item'
  52. })
  53. }
  54. },
  55. setTabNum(tabNum){
  56. if(this.tabNum!==tabNum){
  57. this.tabNum=tabNum
  58. this.$emit('setTabNum',tabNum)
  59. }
  60. }
  61. },
  62. created() {
  63. uni.getSystemInfo({
  64. success: (e) =>{
  65. this.statusBarH = e.statusBarHeight + 10
  66. let custom=0;
  67. //#ifdef MP-WEIXIN
  68. custom = wx.getMenuButtonBoundingClientRect()
  69. this.customBarH = custom.height
  70. //#endif
  71. //#ifdef H5
  72. this.customBarH = 34
  73. this.left=0
  74. //#endif
  75. // #ifdef APP-PLUS
  76. this.customBarH = 34
  77. this.left=0
  78. //#endif
  79. console.log('self.customBarH---------'+this.customBarH)
  80. console.log('self.statusBarH---------'+this.statusBarH)
  81. this.$emit('navHeight', this.customBarH+this.statusBarH)
  82. }
  83. })
  84. }
  85. }
  86. </script>
  87. <style scoped lang="scss">
  88. @import url("/static/css/en-common.css") ;
  89. .header {
  90. width: calc(100vw - 72rpx);
  91. position: fixed;
  92. left: 0;
  93. top: 0;
  94. z-index: 100;
  95. display: flex;
  96. justify-content: space-between;
  97. height: 88rpx;
  98. padding: 12rpx 36rpx;
  99. //box-sizing: border-box;
  100. background-color: #fff;
  101. .header-left{
  102. padding: 10rpx 0;
  103. height: 44rpx;
  104. display: flex;
  105. justify-content: flex-start;
  106. .left-text{
  107. height: 44rpx;
  108. line-height: 44rpx;
  109. font-size: 28rpx;
  110. }
  111. .left-img{
  112. padding: 0 6rpx;
  113. .down-img{
  114. width: 24rpx;
  115. height: 24rpx;
  116. }
  117. }
  118. }
  119. .header-center{
  120. //width: 366rpx;
  121. width: 244rpx;
  122. height: 64rpx;
  123. background: #EEEEEE;
  124. border-radius: 200rpx;
  125. position: relative;
  126. .center-list{
  127. z-index: 112;
  128. display: flex;
  129. justify-content: space-between;
  130. height: 64rpx;
  131. .center-item{
  132. z-index: 113;
  133. width: 122rpx;
  134. height: 64rpx;
  135. line-height: 64rpx;
  136. text-align: center;
  137. font-size: 32rpx;
  138. }
  139. }
  140. .center-bg{
  141. z-index: 111;
  142. position: absolute;
  143. margin: 4rpx 2rpx;
  144. width: 120rpx;
  145. background-color: #fff;
  146. border-radius: 200rpx;
  147. height: 56rpx;
  148. left: 0;
  149. top: 0;
  150. transition: .5s ease;
  151. }
  152. }
  153. .header-right{
  154. height: 64rpx;
  155. display: flex;
  156. justify-content: flex-end;
  157. .right-img{
  158. padding: 6rpx 0;
  159. width: 52rpx;
  160. height: 52rpx;
  161. }
  162. .right-img:first-child{
  163. margin-right: 40rpx;
  164. }
  165. }
  166. }
  167. .box-title {
  168. width: 100vw;
  169. }
  170. </style>