feat:完成首页、分类页内容管理功能开发
This commit is contained in:
@@ -62,7 +62,7 @@ page {
|
||||
box-shadow: @shadow;
|
||||
}
|
||||
|
||||
.ccm-stat + .ccm-stat {
|
||||
.ccm-stat+.ccm-stat {
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ page {
|
||||
// ── Worksheet List ──
|
||||
.ccm-page__list {
|
||||
margin-top: 24rpx;
|
||||
margin-bottom: 80rpx;
|
||||
}
|
||||
|
||||
.ws-card {
|
||||
@@ -125,11 +126,12 @@ page {
|
||||
}
|
||||
|
||||
.ws-card__img {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
width: 140rpx;
|
||||
height: 180rpx;
|
||||
border-radius: @radius;
|
||||
flex-shrink: 0;
|
||||
background: @bg-gray;
|
||||
border: @border;
|
||||
}
|
||||
|
||||
.ws-card__img--placeholder {
|
||||
@@ -144,6 +146,9 @@ page {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-left: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.ws-card__title {
|
||||
@@ -158,7 +163,6 @@ page {
|
||||
|
||||
.ws-card__subtitle {
|
||||
display: block;
|
||||
margin-top: 6rpx;
|
||||
font-size: 22rpx;
|
||||
color: @text-secondary;
|
||||
overflow: hidden;
|
||||
@@ -182,11 +186,20 @@ page {
|
||||
|
||||
.ws-card__id {
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
font-size: 20rpx;
|
||||
font-size: 22rpx;
|
||||
color: @text-gray;
|
||||
}
|
||||
|
||||
.ws-card__tags {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.ws-card__tags-text {
|
||||
font-size: 22rpx;
|
||||
color: @text-secondary;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.ws-card__footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -196,10 +209,13 @@ page {
|
||||
}
|
||||
|
||||
.ws-card__badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ws-card__badge--active {
|
||||
@@ -234,4 +250,4 @@ page {
|
||||
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
|
||||
background: @bg-header;
|
||||
box-shadow: 0 -4rpx 16rpx rgba(50, 46, 37, 0.06);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ type WorksheetItem = {
|
||||
ageMax: number;
|
||||
difficulty: 1 | 2 | 3 | 4;
|
||||
tags: string[];
|
||||
tagsText: string;
|
||||
status: 'draft' | 'active' | 'hidden';
|
||||
sortOrder: number;
|
||||
updatedAt: string;
|
||||
@@ -19,6 +20,7 @@ type WorksheetItem = {
|
||||
statusText: string;
|
||||
actionText: string;
|
||||
actionTarget: string;
|
||||
actionType: string;
|
||||
};
|
||||
|
||||
type Stats = {
|
||||
@@ -44,11 +46,11 @@ const DIFFICULTY_LABELS: Record<number, string> = {
|
||||
|
||||
const STATUS_CONFIG: Record<
|
||||
string,
|
||||
{ text: string; action: string; target: string }
|
||||
{ text: string; action: string; target: string; actionType: string }
|
||||
> = {
|
||||
draft: { text: '草稿', action: '激活', target: 'active' },
|
||||
active: { text: '线上', action: '下架', target: 'hidden' },
|
||||
hidden: { text: '已隐藏', action: '恢复', target: 'draft' },
|
||||
draft: { text: '草稿', action: '激活', target: 'active', actionType: 'green' },
|
||||
active: { text: '线上', action: '下架', target: 'hidden', actionType: 'default' },
|
||||
hidden: { text: '已隐藏', action: '恢复', target: 'draft', actionType: 'primary' },
|
||||
};
|
||||
|
||||
function formatWorksheet(raw: Record<string, unknown>): WorksheetItem {
|
||||
@@ -68,6 +70,7 @@ function formatWorksheet(raw: Record<string, unknown>): WorksheetItem {
|
||||
ageMax,
|
||||
difficulty,
|
||||
tags: Array.isArray(raw.tags) ? raw.tags.map(String) : [],
|
||||
tagsText: Array.isArray(raw.tags) ? raw.tags.map(String).join('、') : '',
|
||||
status: status as WorksheetItem['status'],
|
||||
sortOrder: Number(raw.sortOrder) || 0,
|
||||
updatedAt: raw.updatedAt ? String(raw.updatedAt) : '',
|
||||
@@ -76,6 +79,7 @@ function formatWorksheet(raw: Record<string, unknown>): WorksheetItem {
|
||||
statusText: cfg.text,
|
||||
actionText: cfg.action,
|
||||
actionTarget: cfg.target,
|
||||
actionType: cfg.actionType,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -59,21 +59,26 @@
|
||||
</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>
|
||||
<text class="ws-card__tag"
|
||||
>{{item.difficultyLabel}}</text
|
||||
>
|
||||
</view>
|
||||
<text class="ws-card__id">{{item._id}}</text>
|
||||
</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">
|
||||
<text class="ws-card__badge ws-card__badge--{{item.status}}">
|
||||
{{item.statusText}}
|
||||
</text>
|
||||
<view class="ws-card__badge ws-card__badge--{{item.status}}">
|
||||
<text>{{item.statusText}}</text>
|
||||
</view>
|
||||
<text class="ws-card__sort">排序 {{item.sortOrder}}</text>
|
||||
<toy-button
|
||||
type="primary"
|
||||
type="{{item.actionType}}"
|
||||
size="small"
|
||||
data-id="{{item._id}}"
|
||||
data-target="{{item.actionTarget}}"
|
||||
@@ -89,10 +94,11 @@
|
||||
<view class="ccm-page__build">
|
||||
<toy-button
|
||||
type="primary"
|
||||
width="100%"
|
||||
loading="{{building}}"
|
||||
disabled="{{building}}"
|
||||
bindtap="onBuildTap">
|
||||
{{building ? '生成中...' : '更新分类页数据'}}
|
||||
</toy-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user