Files
2026-06-15 15:39:46 +08:00

109 lines
4.1 KiB
Plaintext

<view class="ccm-page">
<!-- Category Selector -->
<scroll-view class="ccm-page__categories" scroll-x enable-flex>
<view
wx:for="{{categories}}"
wx:key="id"
class="ccm-pill {{activeCategoryId === item.id ? 'ccm-pill--active' : ''}}"
data-id="{{item.id}}"
bindtap="onCategoryTap">
<text class="ccm-pill__icon">{{item.icon}}</text>
<text class="ccm-pill__text">{{item.name}}</text>
</view>
</scroll-view>
<!-- Stats -->
<view class="ccm-page__stats">
<view class="ccm-stat">
<text class="ccm-stat__num">{{stats.total}}</text>
<text class="ccm-stat__label">总数</text>
</view>
<view class="ccm-stat">
<text class="ccm-stat__num">{{stats.draft}}</text>
<text class="ccm-stat__label">草稿</text>
</view>
<view class="ccm-stat">
<text class="ccm-stat__num">{{stats.active}}</text>
<text class="ccm-stat__label">线上</text>
</view>
<view class="ccm-stat">
<text class="ccm-stat__num">{{stats.hidden}}</text>
<text class="ccm-stat__label">已隐藏</text>
</view>
</view>
<!-- Loading -->
<view wx:if="{{loading}}" class="ccm-page__loading">
正在加载 worksheet 数据...
</view>
<!-- Empty -->
<view wx:elif="{{!worksheets.length}}" class="ccm-page__empty">
当前分类下暂无 worksheet
</view>
<!-- Worksheet List -->
<view wx:else class="ccm-page__list">
<view
wx:for="{{worksheets}}"
wx:key="_id"
class="ws-card ws-card--{{item.status}}">
<view class="ws-card__header">
<image
wx:if="{{item.previewImg}}"
class="ws-card__img"
src="{{item.previewImg}}"
mode="aspectFill" />
<view wx:else class="ws-card__img ws-card__img--placeholder">
<text>无图</text>
</view>
<view class="ws-card__info">
<text class="ws-card__title">{{item.title}}</text>
<text class="ws-card__id">{{item._id}}</text>
<text class="ws-card__subtitle">{{item.subtitle}}</text>
<view class="ws-card__meta">
<text class="ws-card__tag">{{item.ageBand}}</text>
<text class="ws-card__tag"
>{{item.difficultyLabel}}</text
>
</view>
</view>
</view>
<view wx:if="{{item.tagsText}}" class="ws-card__tags">
<text class="ws-card__tags-text">{{item.tagsText}}</text>
</view>
<view class="ws-card__footer">
<view class="ws-card__badge ws-card__badge--{{item.status}}">
<text>{{item.statusText}}</text>
</view>
<text class="ws-card__sort">排序 {{item.sortOrder}}</text>
<text class="ws-card__sort"
>下载 {{item.downloads}} · 喜欢 {{item.likes}}</text
>
<toy-button
type="{{item.actionType}}"
size="small"
data-id="{{item._id}}"
data-target="{{item.actionTarget}}"
disabled="{{updatingId === item._id}}"
bindtap="onStatusTap">
{{updatingId === item._id ? '处理中...' : item.actionText}}
</toy-button>
</view>
</view>
</view>
<!-- [v3.0] 分类页已改为实时接口查询,不再需要手动更新分类数据
<view class="ccm-page__build">
<toy-button
type="primary"
width="100%"
loading="{{building}}"
disabled="{{building}}"
bindtap="onBuildTap">
{{building ? '生成中...' : '更新分类页数据'}}
</toy-button>
</view>
-->
</view>