cm-custom.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template name="headerNavbar">
  2. <!-- 自定义导航栏 -->
  3. <view class='navbar-wrap' :style="{height:(CustomBar+55)+'px',paddingTop:StatusBar+'px'}" @touchmove.stop.prevent="discard" @tap="hideBubble">
  4. <view class="navbar-text"
  5. :style="{color:navbarData.textColor ? navbarData.textColor:'',lineHeight:(CustomBar - StatusBar)+'px;',fontSize:fontSizeSetting+'px;',paddingLeft:navbarData.textLeft ? '' : 12+'px'}" :class="platformClass">
  6. {{navbarData.title ? navbarData.title : " "}}
  7. </view>
  8. <view class="search-input">
  9. <view class="search-tab">
  10. <view class="search-tab-btn" @click="topBubble">
  11. <text>{{ tabValue }}</text>
  12. <text class="iconfont icon-xiangxiajiantou"></text>
  13. </view>
  14. <tui-bubble-popup :show="show" :mask="true" position="absolute" direction="top" @close="topBubble" width="140rpx"
  15. left="10rpx" bottom="0rpx" translateY="100%" triangleRight="60rpx" triangleTop="-22rpx" :maskBgColor="maskBgColor">
  16. <view class="tui-menu-item" @tap="selectTabs(1)">产品</view>
  17. <view class="tui-menu-item" @tap="selectTabs(2)">供应商</view>
  18. <view class="tui-menu-item" @tap="selectTabs(3)">项目仪器</view>
  19. </tui-bubble-popup>
  20. </view>
  21. <view class="gosearch-btn" @click="this.$api.navigateTo(clickPath)">
  22. <text class="iconfont icon-iconfonticonfontsousuo1"></text>
  23. <input class="input" type="text" v-model="SearchText" value="" placeholder="你想要的这里都有"/>
  24. </view>
  25. <view class="search-service">
  26. <!-- #ifdef MP-WEIXIN -->
  27. <button class="contact-btn" open-type="contact" @bindcontact="handleContact">
  28. <text class="iconfont icon-liuyan"></text>
  29. </button>
  30. <!-- #endif -->
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. var self;
  37. import btSearch from '@/components/uni-search/bt-search.vue'
  38. export default{
  39. name:'headerNavbar',
  40. components:{
  41. btSearch,
  42. },
  43. props:{
  44. navbarData: { // 由父页面传递的数据
  45. type: Object
  46. },
  47. maskBgColor: {//遮罩背景色
  48. type: String,
  49. default: 'transparent'
  50. },
  51. },
  52. data() {
  53. return{
  54. show:false,
  55. clickPath:'/search/pages/search/search',
  56. SearchText:'',
  57. tabValue:'产品',
  58. CustomBar:this.CustomBar,// 顶部导航栏高度
  59. StatusBar: this.StatusBar,
  60. fontSizeSetting:this.fontSizeSetting,
  61. screenWidth:this.screenWidth,
  62. capsule:this.capsule,
  63. platformClass:this.platformClass,
  64. }
  65. },
  66. created() {
  67. if (getCurrentPages().length === 1) { // 当只有一个页面时
  68. this.navbarData.haveBack = false;
  69. } else {
  70. this.navbarData.haveBack = true;
  71. }
  72. },
  73. onLoad(){
  74. },
  75. methods:{
  76. handleContact(e){
  77. console.log(e.detail.path)
  78. console.log(e.detail.query)
  79. },
  80. topBubble() {
  81. this.show = !this.show;
  82. },
  83. selectTabs(index){
  84. this.show = false
  85. switch(index){
  86. case 1:
  87. this.tabValue='产品'
  88. break;
  89. case 2:
  90. this.tabValue='供应商'
  91. break;
  92. case 3:
  93. this.tabValue='项目仪器'
  94. break;
  95. }
  96. },
  97. hideBubble(){
  98. this.shwo = false
  99. },
  100. discard(){
  101. //丢弃
  102. },
  103. },
  104. onShow(){
  105. }
  106. }
  107. </script>
  108. <style lang="scss">
  109. .navbar-wrap {
  110. position: fixed;
  111. width: 100%;
  112. top: 0;
  113. z-index: 100000;
  114. box-sizing: border-box;
  115. background: url(https://img.caimei365.com/group1/M00/03/B0/Cmis217Z9LCAF_anAADHlsIu3aE475.png);
  116. background-size: cover;
  117. border-bottom:none;
  118. }
  119. .navbar-text {
  120. width: 100%;
  121. font-size: 30rpx;
  122. color: #000000;
  123. font-weight: 500;
  124. }
  125. .navbar-text.center{
  126. text-align: center;
  127. }
  128. .navbar-text.left{
  129. text-align: left;
  130. padding-left: 45px;
  131. }
  132. .navbar-icon {
  133. position: fixed;
  134. display: flex;
  135. box-sizing: border-box;
  136. }
  137. .navbar-icon .iconfont {
  138. display: inline-block;
  139. overflow: hidden;
  140. font-size: 44rpx;
  141. padding-right:40rpx;
  142. margin-top: 1px;
  143. }
  144. .navbar-icon .icon-iconfonticonfontsousuo1 {
  145. color: #000000;
  146. }
  147. .navbar-icon view {
  148. height: 18px;
  149. border-left: 0.5px solid rgba(0,0,0, 0.3);
  150. margin-top: 6px;
  151. }
  152. .navbar-loading {
  153. background: #fff;
  154. text-align: center;
  155. }
  156. .search-input{
  157. width: 100%;
  158. height: 70rpx;
  159. padding: 20rpx 0;
  160. .search-tab{
  161. width: 180rpx;
  162. height: 70rpx;
  163. line-height: 70rpx;
  164. color: #FFFFFF;
  165. font-size: $font-size-28;
  166. text-align: center;
  167. float: left;
  168. position: relative;
  169. .icon-xiangxiajiantou{
  170. margin-left: 10rpx;
  171. }
  172. }
  173. .gosearch-btn{
  174. width: 470rpx;
  175. height: 100%;
  176. float: left;
  177. border-radius: 40rpx;
  178. background: #F0F0F0;
  179. margin: 0 auto;
  180. padding:0 20rpx;
  181. font-size: 28rpx;
  182. line-height: 70rpx;
  183. padding-left: 70rpx;
  184. color: #8A8A8A;
  185. background: #FFFFFF;
  186. position: relative;
  187. box-sizing: border-box;
  188. .icon-iconfonticonfontsousuo1{
  189. width: 70rpx;
  190. height: 70rpx;
  191. line-height: 70rpx;
  192. text-align: center;
  193. display: block;
  194. position: absolute;
  195. left: 0;
  196. top: 0;
  197. font-size: 34rpx;
  198. color: #8A8A8A;
  199. z-index: 10;
  200. }
  201. .input{
  202. width: 400rpx;
  203. height: 100%;
  204. float: left;
  205. }
  206. }
  207. .search-service{
  208. width: 100rpx;
  209. height: 70rpx;
  210. line-height: 70rpx;
  211. float: right;
  212. text-align: center;
  213. color: #FFFFFF;
  214. .contact-btn{
  215. width: 100%;
  216. height: 70rpx;
  217. background-color: rgba(0,0,0,0);
  218. line-height: 70rpx;
  219. .icon-liuyan{
  220. font-size: 64rpx;
  221. color: #FFFFFF;
  222. }
  223. }
  224. }
  225. }
  226. </style>