feat: 准备修改header的渲染

This commit is contained in:
zhangyi
2025-03-27 17:45:24 +08:00
parent b7a581fd16
commit 40e6241f26
3 changed files with 28 additions and 0 deletions
@@ -13,7 +13,10 @@ class TextDrawService {
this.ctx = ctx;
this.paperSize = 'A4';
this.options = {
appName: '涂鸦呀',
appHint: '涂色|识字|画画|认知',
title: '找一找 涂 色',
subTitle: '把相同的文字涂上相同的颜色',
radius: 80,
colors: ['#2196F3', '#FFEB3B', '#FF9800', '#F44336'],
characters: ['鱼', '鸟', '猫', '狗'],
@@ -30,6 +33,11 @@ class TextDrawService {
}
drawHeader() {
const { canvas, ctx } = this;
const { appName, appHint, title, subTitle } = this.options;
}
drawHeader2() {
const { canvas, ctx } = this;
const { title } = this.options;
+20
View File
@@ -15,3 +15,23 @@ export function setCanvasSize(canvas: Canvas, paperSize: PaperSize) {
console.log('canvas----:', canvas);
return canvas;
}
export async function getMiniCodeImagePath() {
return getImagePath('/assets/imgs/mini-code.jpg');
}
export async function getImagePath(path: string) {
return new Promise((resolve) => {
// 如果是网络图片,需配置downloadFile域名
wx.getImageInfo({
src: path, // 本地图片路径
success: (res) => {
resolve(res.path);
},
fail: (err) => {
console.error('图片加载失败:', err);
resolve(''); // 可设置默认占位图
},
});
});
}