From bcece552386ea4ec236dfea4d599f3bea68c9788 Mon Sep 17 00:00:00 2001 From: R524809 Date: Fri, 22 May 2026 11:00:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B1=89=E5=AD=97=E6=AF=8F=E6=97=A5?= =?UTF-8?q?=E6=89=93=E5=8D=A1=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handwritingSheet.config.ts | 2 +- .../handwritingSheet/handwritingSheet.ts | 12 ++--- .../chinesePages/wordColoring/wordColoring.ts | 10 ++-- .../word-picker/word-picker.less | 52 +++++++++++++------ miniprogram/core/data/words.ts | 19 +++++++ miniprogram/core/draw/baseDraw.ts | 25 ++++++++- .../letterTracing/draw/tripleDraw.ts | 2 +- 7 files changed, 95 insertions(+), 27 deletions(-) diff --git a/miniprogram/chinesePages/handwritingSheet/handwritingSheet.config.ts b/miniprogram/chinesePages/handwritingSheet/handwritingSheet.config.ts index 782d149..1da2ecf 100644 --- a/miniprogram/chinesePages/handwritingSheet/handwritingSheet.config.ts +++ b/miniprogram/chinesePages/handwritingSheet/handwritingSheet.config.ts @@ -38,7 +38,7 @@ export const HANDWRITING_SHEET_WORKSHEET_DEFINITIONS: HandwritingSheetWorksheetD ageMin: 5, ageMax: 8, difficulty: 2, - tags: ['汉字', '每日练习', '打卡', '拼音', '笔顺'], + tags: ['汉字', '每日练习', '每日打卡', '打卡', '拼音', '笔顺'], sortOrder: 36, }, ]; diff --git a/miniprogram/chinesePages/handwritingSheet/handwritingSheet.ts b/miniprogram/chinesePages/handwritingSheet/handwritingSheet.ts index 740441d..d31ce39 100644 --- a/miniprogram/chinesePages/handwritingSheet/handwritingSheet.ts +++ b/miniprogram/chinesePages/handwritingSheet/handwritingSheet.ts @@ -8,7 +8,7 @@ import { pickPrimaryPinyin, HanziReadingsMap, } from '../shared/getWordsSvgJson'; -import { WORDS } from '../../core/data/words'; +import { WORDS, getCategoryTabIndex } from '../../core/data/words'; import { CharacterItem } from '../../types/characterType'; import tracker from '../../utils/tracker'; import { createPage } from '../../base/pageMixin'; @@ -179,7 +179,7 @@ createPage( currentMode: mode, functionId: mode, pickerMax: max, - showCustomPanel: !isCheckin, + showCustomPanel: true, }, () => { this.initPageInfo(mode); @@ -300,7 +300,7 @@ createPage( const categoryId = Number(e.currentTarget.dataset.categoryId); this.setData({ showSelectWordPopup: true, - pickerCurrentTab: categoryId, + pickerCurrentTab: getCategoryTabIndex(categoryId), }); }, @@ -428,9 +428,9 @@ createPage( this.setData( { words: supported, - inputWords: isCheckin ? [] : supported, - selectedWords: isCheckin ? supported : [], - inputValue: isCheckin ? '' : supported.join(''), + inputWords: supported, + selectedWords: [], + inputValue: supported.join(''), }, () => this.renderPracticeContent().catch(console.error), ); diff --git a/miniprogram/chinesePages/wordColoring/wordColoring.ts b/miniprogram/chinesePages/wordColoring/wordColoring.ts index a35cd19..d4126b9 100644 --- a/miniprogram/chinesePages/wordColoring/wordColoring.ts +++ b/miniprogram/chinesePages/wordColoring/wordColoring.ts @@ -1,5 +1,9 @@ import { WATER_COLORS } from '../../constants/colors'; -import { WORDS } from '../../core/data/words'; +import { + WORDS, + collectCategoryWords, + getCategoryTabIndex, +} from '../../core/data/words'; import { DrawServiceFactory, type IDrawService, @@ -195,7 +199,7 @@ createPage( /** 随机生成文字卡片 */ refreshCardList() { const allWords = WORDS.slice(0, 2).reduce( - (acc, cat) => acc.concat(cat.words), + (acc, cat) => acc.concat(collectCategoryWords(cat)), [] as string[], ); const selected: string[] = []; @@ -312,7 +316,7 @@ createPage( const categoryId = Number(e.currentTarget.dataset.categoryId); this.setData({ showSelectWordPopup: true, - pickerCurrentTab: categoryId, + pickerCurrentTab: getCategoryTabIndex(categoryId), }); }, diff --git a/miniprogram/components3.0/word-picker/word-picker.less b/miniprogram/components3.0/word-picker/word-picker.less index 5800c3d..c7e7785 100644 --- a/miniprogram/components3.0/word-picker/word-picker.less +++ b/miniprogram/components3.0/word-picker/word-picker.less @@ -33,34 +33,56 @@ } .word-list-wrapper { - padding: 28rpx 0; + padding: 20rpx 0; overflow-y: auto; height: 500rpx; + // 一二年级等有上下册分区的 tab .word-section { - margin-bottom: 36rpx; + margin-bottom: 12rpx; + padding-top: 12rpx; + + &:first-child { + padding-top: 4rpx; + } &:last-child { - margin-bottom: 0; + margin-bottom: 6rpx; } .word-section-title { - font-size: 26rpx; - color: #888888; - padding-left: 28rpx; - margin-bottom: 20rpx; - font-weight: bold; display: flex; align-items: center; + justify-content: center; + text-align: center; + font-size: 34rpx; + font-weight: bold; + color: #453900; + letter-spacing: 4rpx; + margin: 26rpx 0 24rpx; + // padding: 0 28rpx; + + &::before, + &::after { + content: ""; + flex: 1; + max-width: 80rpx; + height: 2rpx; + background: linear-gradient(90deg, + transparent, + rgba(147, 211, 51, 0.65)); + border-radius: 2rpx; + } &::before { - content: ""; - display: inline-block; - width: 6rpx; - height: 24rpx; - background-color: #93d333; - margin-right: 12rpx; - border-radius: 3rpx; + margin-right: 20rpx; + } + + &::after { + margin-left: 20rpx; + background: linear-gradient(90deg, + rgba(147, 211, 51, 0.65), + transparent); } } } diff --git a/miniprogram/core/data/words.ts b/miniprogram/core/data/words.ts index 9e169ad..d78b58c 100644 --- a/miniprogram/core/data/words.ts +++ b/miniprogram/core/data/words.ts @@ -255,3 +255,22 @@ export const WORDS = [ words: ['个', '只', '匹', '条', '朵', '棵', '片', '张', '本', '杯', '块', '双'], }, ]; + +/** 将 categoryId 转为 word-picker / van-tabs 使用的数组下标 */ +export function getCategoryTabIndex(categoryId: number): number { + const index = WORDS.findIndex((cat) => cat.categoryId === categoryId); + return index >= 0 ? index : 0; +} + +/** 汇总分类下全部汉字(含一二年级 sections) */ +export function collectCategoryWords( + cat: (typeof WORDS)[number], +): string[] { + if (cat.words?.length) { + return cat.words; + } + if (cat.sections?.length) { + return cat.sections.flatMap((section) => section.words); + } + return []; +} diff --git a/miniprogram/core/draw/baseDraw.ts b/miniprogram/core/draw/baseDraw.ts index 98cff08..ee18810 100644 --- a/miniprogram/core/draw/baseDraw.ts +++ b/miniprogram/core/draw/baseDraw.ts @@ -113,10 +113,11 @@ export class BaseDrawService { } /** + * 暂未使用 * 页脚:顶部分割线 + 居中 `doodle-footer.png`(小鸭与「涂鸦丫」品牌图)。 * 图片底边与纸张底边留白对齐,便于「探头」视觉。请在整页正文绘制完成后调用,避免被内容覆盖。 */ - async drawPrintFooter(): Promise { + async drawPrintImageFooter(): Promise { const { ctx, canvasWidth, canvasHeight } = this; const margin = 24; const bottomMargin = 2; @@ -172,6 +173,28 @@ export class BaseDrawService { } } + /** + * 页脚:页面底部居中绘制品牌文案「涂鸦丫小程序」(粗体)。 + * 请在整页正文绘制完成后调用,避免被内容覆盖。 + */ + async drawPrintFooter(): Promise { + const { ctx, canvasWidth, canvasHeight } = this; + const text = '涂鸦丫小程序'; + const bottomMargin = 12; + const fontSize = 13; + const font = `bold ${fontSize}px "Microsoft Yahei", sans-serif`; + const textColor = '#7C766A'; + + ctx.save(); + ctx.font = font; + ctx.fillStyle = textColor; + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + const y = canvasHeight - bottomMargin - fontSize / 2; + ctx.fillText(text, canvasWidth / 2, y); + ctx.restore(); + } + /** * 绘制分割线(逻辑像素,尺寸除以3) */ diff --git a/miniprogram/englishPages/letterTracing/draw/tripleDraw.ts b/miniprogram/englishPages/letterTracing/draw/tripleDraw.ts index 342ba30..2cd14bb 100644 --- a/miniprogram/englishPages/letterTracing/draw/tripleDraw.ts +++ b/miniprogram/englishPages/letterTracing/draw/tripleDraw.ts @@ -51,7 +51,7 @@ export default class TripleDraw extends BaseDrawService { loadLetterFont(PRINT_CLEARLY_DASHED), ]); this.drawContent(data.sections); - this.drawPrintFooter(); + // this.drawPrintFooter(); } private drawContent(sections: TripleSection[]) {