feat: 完成文字涂色卡功能

This commit is contained in:
2025-07-01 11:27:50 +08:00
parent 654afced6f
commit 6d38a17652
21 changed files with 267 additions and 103 deletions
+4 -5
View File
@@ -49,7 +49,9 @@ Page({
this.boxHeight = boxHeight;
this.boxWidth = boxWidth;
this.initCanvas(boxWidth, boxHeight);
setTimeout(() => {
this.initCanvas(boxWidth, boxHeight);
}, 500);
}
})
.exec();
@@ -176,7 +178,6 @@ Page({
/** 下载打印 */
exportToPrint() {
console.log('this.canvas:', this.canvas);
if (this.canvas && this.data.cardList.length > 0) {
wx.canvasToTempFilePath({
canvas: this.canvas,
@@ -259,7 +260,7 @@ Page({
// 随机生成
refreshCardList() {
// 获取前4个分类的所有文字
const allWords = WORDS.slice(0, 4).reduce((acc, category) => {
const allWords = WORDS.slice(0, 2).reduce((acc, category) => {
return acc.concat(category.words);
}, [] as string[]);
@@ -286,7 +287,6 @@ Page({
color: selectedColors[index],
word
}));
console.log('cardList:', cardList);
this.drawCanvas(cardList);
},
openSelectWordPopup() {
@@ -303,7 +303,6 @@ Page({
onChangeWord(e: WechatMiniprogram.CustomEvent) {
const selectedWords = e.detail.selectedWords as string[];
console.log('selectedWords:', selectedWords);
const colors = [...WATER_COLORS.basic12];
const cardList = selectedWords.map((word, index) => ({