93 lines
3.1 KiB
Plaintext
93 lines
3.1 KiB
Plaintext
<!-- 搜索页面 -->
|
|
<view class="container">
|
|
<!-- 搜索栏 -->
|
|
<view class="search-bar">
|
|
<view class="search-input-wrap">
|
|
<image class="search-icon" src="/images/icons/search.png" mode="aspectFit"></image>
|
|
<input class="search-input"
|
|
type="text"
|
|
placeholder="搜索练习表..."
|
|
value="{{keyword}}"
|
|
focus="{{true}}"
|
|
confirm-type="search"
|
|
bindinput="onInput"
|
|
bindconfirm="doSearch" />
|
|
<image class="clear-icon"
|
|
wx:if="{{keyword}}"
|
|
src="/images/icons/clear.png"
|
|
mode="aspectFit"
|
|
bindtap="clearKeyword"></image>
|
|
</view>
|
|
<text class="cancel-btn" bindtap="goBack">取消</text>
|
|
</view>
|
|
|
|
<!-- 搜索历史 -->
|
|
<view class="history-section" wx:if="{{!hasSearched && history.length > 0}}">
|
|
<view class="section-header">
|
|
<text class="section-title">搜索历史</text>
|
|
<image class="delete-icon" src="/images/icons/delete.png" mode="aspectFit" bindtap="clearHistory"></image>
|
|
</view>
|
|
<view class="history-tags">
|
|
<view class="history-tag"
|
|
wx:for="{{history}}"
|
|
wx:key="index"
|
|
bindtap="searchHistory"
|
|
data-keyword="{{item}}">
|
|
{{item}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 热门搜索 -->
|
|
<view class="hot-section" wx:if="{{!hasSearched}}">
|
|
<view class="section-header">
|
|
<text class="section-title">热门搜索</text>
|
|
</view>
|
|
<view class="hot-tags">
|
|
<view class="hot-tag"
|
|
wx:for="{{hotKeywords}}"
|
|
wx:key="index"
|
|
bindtap="searchHistory"
|
|
data-keyword="{{item}}">
|
|
{{item}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 搜索结果 -->
|
|
<view class="result-section" wx:if="{{hasSearched}}">
|
|
<view class="result-header" wx:if="{{worksheets.length > 0}}">
|
|
<text>找到 {{total}} 个相关结果</text>
|
|
</view>
|
|
|
|
<view class="worksheet-list">
|
|
<view class="worksheet-item"
|
|
wx:for="{{worksheets}}"
|
|
wx:key="id"
|
|
bindtap="goDetail"
|
|
data-id="{{item.id}}">
|
|
<image class="item-cover" src="{{dataBaseUrl}}{{item.coverurl}}" mode="aspectFill"></image>
|
|
<view class="item-info">
|
|
<text class="item-title text-ellipsis-2">{{item.title}}</text>
|
|
<text class="item-e-title text-ellipsis">{{item.e_title}}</text>
|
|
<text class="item-category">{{item.category_name}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 加载状态 -->
|
|
<view class="load-status" wx:if="{{worksheets.length > 0}}">
|
|
<text wx:if="{{loading}}">加载中...</text>
|
|
<text wx:elif="{{!hasMore}}">已加载全部</text>
|
|
<text wx:else bindtap="loadMore">加载更多</text>
|
|
</view>
|
|
|
|
<!-- 无结果 -->
|
|
<view class="empty-result" wx:if="{{!loading && worksheets.length === 0}}">
|
|
<image class="empty-img" src="/images/icons/empty-search.png" mode="aspectFit"></image>
|
|
<text class="empty-text">未找到相关练习表</text>
|
|
<text class="empty-tip">换个关键词试试吧</text>
|
|
</view>
|
|
</view>
|
|
</view>
|