feat: 完成分龄页开发

This commit is contained in:
R524809
2026-05-06 17:28:51 +08:00
parent 50394154f7
commit 9bdf850f20
54 changed files with 3499 additions and 1021 deletions
+17 -1
View File
@@ -8,6 +8,7 @@ import {
} from './registry';
import { getPublishMetaByFocusState } from './focusDraw.config';
import type { DebugPublishMeta } from '../../utils/debugPublish';
import { incrementWorksheetLikes } from '../../utils/worksheetStats';
const TYPE_LIST = FOCUS_TYPE_CONFIGS.map((t) => ({
id: t.id,
@@ -120,6 +121,7 @@ createFocusPage({
selectedTypeId: id,
functionId: id,
pageTitle: title,
isPreviewFavorite: false,
showActions: !!typeConfig.actions,
currentActions: typeConfig.actions || [],
actionsTitle: typeConfig.actionsTitle || '选择模式',
@@ -156,6 +158,7 @@ createFocusPage({
this.setData({
currentMode: value,
pageTitle: title,
isPreviewFavorite: false,
});
this.initPageInfo(this.data.functionId, title);
@@ -196,15 +199,28 @@ createFocusPage({
this.onRandom();
},
onPreviewFavorite() {
async onPreviewFavorite() {
const next = !this.data.isPreviewFavorite;
this.setData({ isPreviewFavorite: next });
if (next) {
const id = this.getWorksheetStatsId();
if (id) incrementWorksheetLikes(id);
}
wx.showToast({
title: next ? '收藏成功' : '已取消收藏',
icon: 'none',
});
},
getWorksheetStatsId(): string {
const meta = getPublishMetaByFocusState(
this.data.functionId,
this.data.selectedTypeId,
this.data.currentMode,
);
return meta?.id || this.data.functionId;
},
getPublishMeta(): DebugPublishMeta {
const meta = getPublishMetaByFocusState(
this.data.functionId,