search2.vue 2.3 KB

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