brandSearch.ttml 2.7 KB
  <view class="searchContainer">
      <view class="search">
          <image class="serachIcon" src="../index/images/home_search@2x.png"></image>
          <input class="serachInput" placeholder="搜索结果" bindinput="inputChanged" bindfocus="focusChanged" bindconfirm="inputConfirmed" placeholder-class="placeholder" auto-focus/>
      </view>
       <text class="cancelButton" bindtap="cancelSearch">取消</text> 
  </view>


<view class="searchResult">
  <block tt:if="{{showResult}}"> 
    <view class='NoResult' tt:if="{{!hasResult}}">无结果</view>
    <block tt:for="{{result}}" tt:key="{{index}}" tt:for-item="item">
      <view id="{{index == '0-9' ? 'last' : index}}" class='search_sessionTitle'>
        <text class='search_sessionText'>{{index == '0-9' ? '0' : index}}</text> 
      </view>
      <block tt:for="{{item}}" tt:key="{{unique}}" tt:for-item="item">
        <view class='search_row' tt:if="{{item.type == 2}}" bindtap="search_brandItemTapped" data-brand-item="{{item}}">
          <view class='search_rowContent'>
            <text class='search_title'>{{item.brand_name}}</text> 
            <view class='search_new' tt:if="{{item.is_show_new == 'Y'}}">
              <text class='search_text'>NEW</text> 
            </view>
            <view class='search_hot' tt:if="{{item.is_hot == 'Y'}}">
              <text class='search_text'>HOT</text> 
            </view>
          </view>
          <view class='search_spaceLine'/>
        </view>
      </block>
    </block>
  </block>
  <block tt:else>
    
    <view class="searchHistoryContainer" hidden="{{(searchHistory.length > 0) ? false : true}}">
        <text class="hotKeyword">最近搜索</text>
        <image class='deleteButton' bindtap='clearSearchHistory' src='../search/images/rubbish-ic@2x.png'></image>
        <view class="hotKeywordItemContainer">
            <block tt:for="{{searchHistory}}" tt:key="{{index}}">
                <view class="hotKeywordItem" bindtap="historyKeywordItemTapped" data-item="{{item}}">
                    <text class="hotKeywordTitle">{{item.brand_name}}</text>          
                </view>
            </block>
        </view>
    </view>

    <view class='hotHistorySeparator' hidden="{{(searchHistory.length > 0) ? false : true}}"></view>

    <view class="hotKeywordContainer">
        <text class="hotKeyword">热门搜索</text>
        <view class="hotKeywordItemContainer">
            <block tt:for="{{hotKeyword['data']}}" tt:key="{{index}}">
                <view class="hotKeywordItem" bindtap="hotKeywordItemTapped" data-item="{{item}}">
                    <text class="hotKeywordTitle">{{item.brandName}}</text>          
                </view>
            </block>
        </view>
    </view>


  </block>
</view>