mirror of
https://gitee.com/qingqing-coconut-tea/RcKtFezyRAZX
synced 2026-07-21 10:32:32 +08:00
100 lines
3.4 KiB
Plaintext
100 lines
3.4 KiB
Plaintext
<!-- pages/search/search.wxml -->
|
||
<!-- 搜索视图 -->
|
||
|
||
<view class="search-container">
|
||
<!-- 搜索框 -->
|
||
<view class="search-bar">
|
||
<view class="search-input-wrapper">
|
||
<text class="iconfont icon-search search-icon"></text>
|
||
<input
|
||
class="search-input"
|
||
type="text"
|
||
placeholder="搜索文章、用户..."
|
||
bindinput="onSearchInput"
|
||
bindconfirm="onSearch"
|
||
value="{{keyword}}"
|
||
focus="{{true}}"
|
||
/>
|
||
<text class="iconfont icon-close" wx:if="{{keyword}}" bindtap="onClear"></text>
|
||
</view>
|
||
<text class="cancel-btn" bindtap="onCancel">取消</text>
|
||
</view>
|
||
|
||
<!-- 搜索结果 -->
|
||
<view class="search-result" wx:if="{{showResult}}">
|
||
<view class="result-list">
|
||
<view class="result-item" wx:for="{{searchResult}}" wx:key="id" bindtap="goToDetail" data-id="{{item.id}}">
|
||
<image class="result-cover" wx:if="{{item.coverImage}}" src="{{item.coverImage}}" mode="aspectFill" />
|
||
<view class="result-info">
|
||
<text class="result-title">{{item.title}}</text>
|
||
<text class="result-summary">{{item.summary}}</text>
|
||
<view class="result-meta">
|
||
<text class="author">{{item.authorName}}</text>
|
||
<text class="time">{{item.createTime}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="loading-more" wx:if="{{loading}}">
|
||
<text>加载中...</text>
|
||
</view>
|
||
<view class="no-more" wx:if="{{!hasMore && searchResult.length > 0}}">
|
||
<text>没有更多了</text>
|
||
</view>
|
||
<view class="empty-state" wx:if="{{!loading && searchResult.length === 0}}">
|
||
<text class="iconfont icon-search empty-icon"></text>
|
||
<text class="empty-text">未找到相关结果</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 搜索历史和热门搜索 -->
|
||
<view class="search-content" wx:if="{{!showResult}}">
|
||
<!-- 搜索历史 -->
|
||
<view class="history-section" wx:if="{{historyList.length > 0}}">
|
||
<view class="section-header">
|
||
<text class="section-title">搜索历史</text>
|
||
<text class="iconfont icon-trash" bindtap="clearHistory"></text>
|
||
</view>
|
||
<view class="history-list">
|
||
<text
|
||
class="history-item"
|
||
wx:for="{{historyList}}"
|
||
wx:key="index"
|
||
bindtap="onHistorySearchTap"
|
||
data-keyword="{{item}}"
|
||
>{{item}}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 热门搜索 -->
|
||
<view class="hot-section">
|
||
<view class="section-header">
|
||
<text class="section-title">热门搜索</text>
|
||
<text class="iconfont icon-fire hot-icon"></text>
|
||
</view>
|
||
<view class="hot-list">
|
||
<view
|
||
class="hot-item"
|
||
wx:for="{{hotSearchList}}"
|
||
wx:key="id"
|
||
bindtap="onHotSearchTap"
|
||
data-keyword="{{item.keyword}}"
|
||
>
|
||
<text class="rank {{index < 3 ? 'top' : ''}}">{{index + 1}}</text>
|
||
<view class="hot-info">
|
||
<text class="hot-keyword">{{item.keyword}}</text>
|
||
<text class="hot-count">{{item.searchCount}}次搜索</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
/**
|
||
* @联系作者:16768118056
|
||
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
|
||
* @访问:https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415,查看完整运行演示。
|
||
*/
|