search2.vue 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view style="background-color: #f7f7f7;min-height: 100vh;">
  3. <tn-nav-bar fixed alpha customBack>
  4. <view slot="back" class='tn-custom-nav-bar__back'
  5. @click="goBack">
  6. <text class='icon tn-icon-left'></text>
  7. </view>
  8. <view slot="default">
  9. <view>
  10. <text :style="{fontSize:(wxFontSize)+'px'}">搜索</text>
  11. </view>
  12. </view>
  13. </tn-nav-bar>
  14. <view style="width: 100%;" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  15. <uni-search-bar radius="30" :focus="true" bgColor="#fff" v-model="brand" :fontSize="(wxFontSize-2)" placeholder="请输入您感兴趣的产品品牌(选填)" cancelButton="none">
  16. <template v-slot:searchIcon>
  17. <image src="../../static/tu/search.png" style="width: 26px;height: 26px"></image>
  18. </template>
  19. </uni-search-bar>
  20. <uni-search-bar radius="30" v-model="content" bgColor="#fff" :fontSize="(wxFontSize-2)" placeholder="请输入您感兴趣的服务内容(选填)" cancelButton="none">
  21. <template v-slot:searchIcon>
  22. <image src="../../static/tu/search.png" style="width: 26px;height: 26px"></image>
  23. </template>
  24. </uni-search-bar>
  25. <button type="primary" style="background-color:#005DA6;border-radius: 8px;margin: 16px;" :style="{fontSize:(wxFontSize-2)+'px'}" @click="searchProd">搜索</button>
  26. <!-- <button type="primary" style="border-radius:30px;background-color: #3a96d7;" radius @click="searchProd">搜索</button> -->
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {
  34. brand: '',
  35. content:'',
  36. wxFontSize: 17
  37. }
  38. },
  39. onLoad(){
  40. const appBaseInfo = wx.getAppBaseInfo();
  41. this.wxFontSize = uni.getStorageSync('fontSize')||appBaseInfo.fontSizeSetting||17;
  42. },
  43. methods: {
  44. goBack(){
  45. uni.navigateBack();
  46. },
  47. searchProd(){
  48. if(this.brand||this.content){
  49. uni.setStorageSync('searchProdValue2',this.brand+'/'+this.content)
  50. }else{
  51. uni.removeStorageSync('searchProdValue2');
  52. }
  53. uni.navigateBack();
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. /* 胶囊*/
  60. .tn-custom-nav-bar__back {
  61. width: 60%;
  62. height: 100%;
  63. position: relative;
  64. display: flex;
  65. justify-content: space-evenly;
  66. align-items: center;
  67. box-sizing: border-box;
  68. // background-color: rgba(0, 0, 0, 0.15);
  69. border-radius: 1000rpx;
  70. border: 1rpx solid rgba(255, 255, 255, 0.5);
  71. // color: #333;
  72. font-size: 18px;
  73. .icon {
  74. display: block;
  75. flex: 1;
  76. margin: auto;
  77. text-align: center;
  78. }
  79. }
  80. </style>