customer.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template name="headerNavbar">
  2. <!-- 自定义导航栏 -->
  3. <view
  4. class="navbar-wrap"
  5. :class="isScroll ? opacityNav : ''"
  6. :style="{
  7. height: CustomBar + 55 + 'px',
  8. paddingTop: StatusBar + 'px',
  9. }"
  10. >
  11. <view
  12. class="navbar-text"
  13. :style="{
  14. color: navbarData.textColor ? navbarData.textColor : '',
  15. lineHeight: CustomBar - StatusBar + 'px;',
  16. fontSize: fontSizeSetting + 'px;',
  17. paddingLeft: navbarData.textLeft ? '' : 12 + 'px'
  18. }"
  19. :class="platformClass"
  20. >
  21. {{ navbarData.title ? navbarData.title : ' ' }}
  22. </view>
  23. <view class="search-input">
  24. <view class="gosearch-btn" @click="this.$api.navigateTo(clickPath)">
  25. <view class="search-icon"><text class="iconfont icon-iconfonticonfontsousuo1"></text></view>
  26. <view class="search-text">{{ hotSearchText }}</view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. var self
  33. import btSearch from '@/components/uni-search/bt-search.vue'
  34. export default {
  35. name: 'headerNavbar',
  36. components: {
  37. btSearch
  38. },
  39. props: {
  40. navbarData: {
  41. // 由父页面传递的数据
  42. type: Object
  43. },
  44. isScroll: {
  45. type: Boolean,
  46. default: () => false
  47. }
  48. },
  49. data() {
  50. return {
  51. clickPath: '/pages/search/search',
  52. hotSearchText: '搜索商品/项目仪器',
  53. CustomBar: this.CustomBar, // 顶部导航栏高度
  54. StatusBar: this.StatusBar,
  55. fontSizeSetting: this.fontSizeSetting,
  56. screenWidth: this.screenWidth,
  57. capsule: this.capsule,
  58. platformClass: this.platformClass,
  59. opacityNav: 'opacityNav', // 渐变颜色
  60. }
  61. },
  62. created() {
  63. if (getCurrentPages().length === 1) {
  64. // 当只有一个页面时
  65. this.navbarData.haveBack = false
  66. } else {
  67. this.navbarData.haveBack = true
  68. }
  69. console.log(this.isScroll)
  70. },
  71. onLoad() {},
  72. onPageScroll(e) {
  73. console.log(e)
  74. },
  75. methods: {
  76. BackPage: function() {
  77. this.$emit('navigateBack')
  78. },
  79. _goSearchPath: function() {
  80. this.$emit('goSearchPath')
  81. },
  82. _goHome: function() {
  83. uni.switchTab({
  84. url: '/pages/tabBar/home/index'
  85. })
  86. }
  87. },
  88. onShow() {}
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .navbar-wrap {
  93. position: fixed;
  94. width: 100%;
  95. top: 0;
  96. z-index: 100000;
  97. box-sizing: border-box;
  98. background: url(https://static.caimei365.com/app/img/bg/new_home_cumres@2x.png) no-repeat;
  99. background-position-y: -50rpx;
  100. border-bottom: none;
  101. }
  102. .opacityNav {
  103. background: linear-gradient(180deg, #FF5B00 0%, rgba(255,91,0, 1) 100%) !important;
  104. }
  105. .navbar-text {
  106. font-size: 30rpx;
  107. color: #000000;
  108. font-weight: 500;
  109. }
  110. .navbar-text.center {
  111. text-align: center;
  112. }
  113. .navbar-text.left {
  114. text-align: left;
  115. padding-left: 45px;
  116. }
  117. .navbar-icon {
  118. position: fixed;
  119. display: flex;
  120. box-sizing: border-box;
  121. }
  122. .navbar-icon .iconfont {
  123. display: inline-block;
  124. overflow: hidden;
  125. font-size: 44rpx;
  126. padding-right: 40rpx;
  127. margin-top: 1px;
  128. }
  129. .navbar-icon .icon-iconfonticonfontsousuo1 {
  130. color: #000000;
  131. }
  132. .navbar-icon view {
  133. height: 18px;
  134. border-left: 0.5px solid rgba(0, 0, 0, 0.3);
  135. margin-top: 6px;
  136. }
  137. .navbar-loading {
  138. background: #fff;
  139. text-align: center;
  140. }
  141. .search-input {
  142. width: 100%;
  143. height: 110rpx;
  144. padding: 20rpx 24rpx;
  145. box-sizing: border-box;
  146. .gosearch-btn {
  147. width: 100%;
  148. height: 100%;
  149. border-radius: 40rpx;
  150. background: #f0f0f0;
  151. margin: 0 auto;
  152. font-size: 28rpx;
  153. line-height: 70rpx;
  154. color: #8a8a8a;
  155. background: #ffffff;
  156. position: relative;
  157. box-sizing: border-box;
  158. padding-left: 80rpx;
  159. .search-icon {
  160. width: 80rpx;
  161. height: 70rpx;
  162. position: absolute;
  163. left: 0;
  164. top: 2rpx;
  165. text-align: center;
  166. line-height: 70rpx;
  167. .icon-iconfonticonfontsousuo1 {
  168. margin: 0 6rpx;
  169. font-size: $font-size-34;
  170. color: #8a8a8a;
  171. z-index: 10;
  172. }
  173. }
  174. .search-text {
  175. font-size: $font-size-24;
  176. line-height: 70rpx;
  177. color: #8a8a8a;
  178. }
  179. }
  180. }
  181. </style>