search.wxml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!--为搜索页面-->
  2. <view class="search" style="background-color:#ffffff;">
  3. <view class="search-inside secondary-background-color" style="display: flex; align-items: center;">
  4. <icon type="search" size="20"></icon>
  5. <input class="search-input" style="width: {{searchEnable ? 550 : 650}}rpx;" value="{{searchText}}" placeholder="搜索"
  6. confirm-type="search" bindinput="update" bindfocus="focus" bindconfirm="search"></input>
  7. </view>
  8. <view wx:if="{{searchEnable}}" class="cancel-button" bindtap="cancel">取消</view>
  9. </view>
  10. <scroll-view class="hot-block" scroll-y>
  11. <view class="hot-tag-block">
  12. <view class="hot-tag-title primary-text-color">历史搜索</view>
  13. <view class="hot-tags secondary-text-color">
  14. <view class="hot-tag" wx:for="{{searchHistory}}" wx:for-item="keyword" wx:key="*this"
  15. data-search-tag="{{keyword}}" bindtap="searchTag">{{keyword}}</view>
  16. </view>
  17. </view>
  18. <view class="hot-tag-block">
  19. <view class="hot-tag-title primary-text-color">热门搜索</view>
  20. <view class="hot-tags secondary-text-color">
  21. <view class="hot-tag" wx:for="{{hotTagData}}" wx:for-item="tag" wx:key="_id" data-search-tag="{{tag._id}}"
  22. bindtap="searchTag">{{tag._id}}</view>
  23. </view>
  24. </view>
  25. <view class="hot-bar-block">
  26. <text class="hot-bar-title primary-background-color white-text-color">实时热点</text>
  27. <view class="hot-bar" wx:for="{{hotBarData}}" wx:key="rank" wx:for-item="bar" wx:for-index="index" wx:key="_id"
  28. data-message="{{bar.message}}" bindtap="viewMessage">
  29. <view class="hot-bar-text">
  30. <view class="primary-text-color" style="width: 20rpx; text-align: right;">{{index + 1}}</view>
  31. <view class="secondary-text-color" style="margin-left: 30rpx;">{{bar.message.hot_name}}</view>
  32. </view>
  33. <image class="more" src="/images/more.png" mode="aspectFill"></image>
  34. </view>
  35. </view>
  36. </scroll-view>
  37. <scroll-view wx:if="{{searchEnable}}" class="search-block secondary-background-color" scroll-y bindtap="blur"
  38. bindscrolltolower="loadMore">
  39. <view class="result-bar">
  40. <view wx:for="{{searchResult}}" wx:for-item="msg" wx:key="_id">
  41. <itemCard item="{{msg}}" />
  42. </view>
  43. </view>
  44. <view wx:if="{{searchText == '' && searchResult.length == 0}}" wx:for="{{searchHistory}}" wx:for-item="keyword"
  45. wx:key="*this" class="search-history" data-search-tag="{{keyword}}" catchtap="searchTag">
  46. <view>{{keyword}}</view>
  47. <view data-search-tag="{{keyword}}" catchtap="removeHistory">×</view>
  48. </view>
  49. </scroll-view>