Files
JayuCloud/WeChatProgram/pages/products/index.wxml
T

89 lines
3.7 KiB
Plaintext

<navigation-bar title="作品库" showBack="{{false}}" isTabPage="{{true}}" color="#2d2430" background="{{navThemeBackground || '#FFF7F9'}}"></navigation-bar>
<view class="page-shell product-page {{keyboardVisible ? 'keyboard-active' : ''}}" style="{{themeVars}}">
<view class="page-content product-page-content" style="{{keyboardVisible ? 'padding-bottom: ' + keyboardInsetRpx + 'rpx;' : ''}}">
<view class="sticky-filter-bar">
<view class="filter-surface">
<view class="search-row">
<input
class="search-input"
placeholder="搜索标题、标签或描述"
placeholder-class="field-placeholder"
value="{{searchKeyword}}"
bindinput="handleSearchInput"
bindconfirm="handleSearchConfirm"
bindfocus="handleSearchFocus"
bindblur="handleSearchBlur"
data-keyboard-anchor="products-search-anchor"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
confirm-type="search"
/>
<view class="search-btn" bindtap="handleSearchConfirm">搜索</view>
</view>
<scroll-view class="category-scroll" scroll-x enable-flex show-scrollbar="false">
<view class="category-list">
<view
class="category-item {{selectedCategory === '全部' ? 'active' : ''}}"
data-category="全部"
data-tag-id=""
bindtap="handleSelectCategory"
>
全部
</view>
<view wx:for="{{filterGroups}}" wx:for-item="group" wx:key="groupName" class="filter-group">
<view class="filter-group-title">{{group.groupName}}</view>
<view
wx:for="{{group.tags}}"
wx:for-item="tag"
wx:key="id"
class="category-item {{selectedTagId === tag.idText ? 'active' : ''}}"
data-category="{{tag.displayName || tag.tagName}}"
data-tag-id="{{tag.idText}}"
bindtap="handleSelectCategory"
>
{{tag.displayName || tag.tagName}}
</view>
</view>
</view>
</scroll-view>
<view class="results-head">
<view class="results-meta">
<view class="results-count">{{products.length ? products.length : 0}} 个</view>
<view wx:if="{{filterSummaryText}}" class="filter-summary-chip">{{filterSummaryText}}</view>
</view>
<view wx:if="{{searchKeyword || selectedCategory !== '全部'}}" class="ghost-btn results-reset" bindtap="handleResetFilters">重置</view>
</view>
</view>
</view>
<view wx:if="{{products.length}}" class="product-grid">
<view wx:for="{{products}}" wx:key="id" class="product-grid-item">
<product-card
item="{{item}}"
show-stats="{{true}}"
show-quick-add="{{true}}"
in-cart="{{item.inCart}}"
bindselect="handleProductSelect"
bindquickadd="handleQuickAdd"
></product-card>
</view>
</view>
<view wx:if="{{products.length && (loadingMore || !hasMore)}}" class="load-state">
<text class="load-state-text">{{loadingMore ? '正在加载更多作品...' : '已经到底了'}}</text>
</view>
<view wx:elif="{{loading}}" class="page-card empty-card">
<text class="empty-title">正在加载作品</text>
</view>
<view wx:else class="page-card empty-card">
<text class="empty-title">暂时没有匹配的作品</text>
<text class="empty-desc">换个关键词试试。</text>
<view class="ghost-btn" bindtap="handleResetFilters">查看全部</view>
</view>
</view>
</view>