customer.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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 class="gosearch-kf">
  29. <!-- #ifdef MP-WEIXIN -->
  30. <button class="contact-btn" open-type="contact" @bindcontact="handleContact">
  31. <text class="iconfont icon-zixunrexian"></text>
  32. </button>
  33. <!-- #endif -->
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. var self
  40. import btSearch from '@/components/uni-search/bt-search.vue'
  41. export default {
  42. name: 'headerNavbar',
  43. components: {
  44. btSearch
  45. },
  46. props: {
  47. navbarData: {
  48. // 由父页面传递的数据
  49. type: Object
  50. },
  51. isScroll: {
  52. type: Boolean,
  53. default: () => false
  54. }
  55. },
  56. data() {
  57. return {
  58. clickPath: '/pages/search/search',
  59. hotSearchText: '搜索商品/项目仪器',
  60. CustomBar: this.CustomBar, // 顶部导航栏高度
  61. StatusBar: this.StatusBar,
  62. fontSizeSetting: this.fontSizeSetting,
  63. screenWidth: this.screenWidth,
  64. capsule: this.capsule,
  65. platformClass: this.platformClass,
  66. opacityNav: 'opacityNav', // 渐变颜色
  67. }
  68. },
  69. created() {
  70. if (getCurrentPages().length === 1) {
  71. // 当只有一个页面时
  72. this.navbarData.haveBack = false
  73. } else {
  74. this.navbarData.haveBack = true
  75. }
  76. console.log(this.isScroll)
  77. },
  78. onLoad() {},
  79. onPageScroll(e) {
  80. console.log(e)
  81. },
  82. methods: {
  83. BackPage: function() {
  84. this.$emit('navigateBack')
  85. },
  86. _goSearchPath: function() {
  87. this.$emit('goSearchPath')
  88. },
  89. _goHome: function() {
  90. uni.switchTab({
  91. url: '/pages/tabBar/home/index'
  92. })
  93. },
  94. handleContact(e) {
  95. console.log(e.detail.path)
  96. console.log(e.detail.query)
  97. }
  98. },
  99. onShow() {}
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. .navbar-wrap {
  104. position: fixed;
  105. width: 100%;
  106. top: 0;
  107. z-index: 100000;
  108. box-sizing: border-box;
  109. background: #FF5B00;
  110. background-position-y: -50rpx;
  111. border-bottom: none;
  112. }
  113. .opacityNav {
  114. background: #FF5B00;
  115. }
  116. .navbar-text {
  117. font-size: 30rpx;
  118. color: #000000;
  119. font-weight: 500;
  120. }
  121. .navbar-text.center {
  122. text-align: center;
  123. }
  124. .navbar-text.left {
  125. text-align: left;
  126. padding-left: 45px;
  127. }
  128. .navbar-icon {
  129. position: fixed;
  130. display: flex;
  131. box-sizing: border-box;
  132. }
  133. .navbar-icon .iconfont {
  134. display: inline-block;
  135. overflow: hidden;
  136. font-size: 44rpx;
  137. padding-right: 40rpx;
  138. margin-top: 1px;
  139. }
  140. .navbar-icon .icon-iconfonticonfontsousuo1 {
  141. color: #000000;
  142. }
  143. .navbar-icon view {
  144. height: 18px;
  145. border-left: 0.5px solid rgba(0, 0, 0, 0.3);
  146. margin-top: 6px;
  147. }
  148. .navbar-loading {
  149. background: #fff;
  150. text-align: center;
  151. }
  152. .search-input {
  153. width: 100%;
  154. height: 100rpx;
  155. padding: 20rpx 24rpx 10rpx 24rpx;
  156. box-sizing: border-box;
  157. .gosearch-btn {
  158. width: 632rpx;
  159. height: 100%;
  160. border-radius: 40rpx;
  161. background: #f0f0f0;
  162. font-size: 28rpx;
  163. line-height: 70rpx;
  164. color: #8a8a8a;
  165. background: #ffffff;
  166. position: relative;
  167. box-sizing: border-box;
  168. padding-left: 80rpx;
  169. float: left;
  170. .search-icon {
  171. width: 80rpx;
  172. height: 70rpx;
  173. position: absolute;
  174. left: 0;
  175. top: 2rpx;
  176. text-align: center;
  177. line-height: 70rpx;
  178. .icon-iconfonticonfontsousuo1 {
  179. margin: 0 6rpx;
  180. font-size: $font-size-34;
  181. color: #8a8a8a;
  182. z-index: 10;
  183. }
  184. }
  185. .search-text {
  186. font-size: $font-size-24;
  187. line-height: 70rpx;
  188. color: #8a8a8a;
  189. }
  190. }
  191. .gosearch-kf{
  192. width: 70rpx;
  193. height: 70rpx;
  194. border-radius: 50%;
  195. float: left;
  196. line-height: 70rpx;
  197. text-align: center;
  198. .contact-btn {
  199. width: 70rpx;
  200. height: 70rpx;
  201. background-color: rgba(0, 0, 0, 0);
  202. line-height: 70rpx;
  203. text-align: center;
  204. .iconfont {
  205. font-size: $font-size-48;
  206. color: #ffffff;
  207. }
  208. }
  209. }
  210. }
  211. </style>