diff --git a/miniprogram/assets/imgs/mini-code.jpg b/miniprogram/assets/imgs/mini-code.jpg new file mode 100644 index 0000000..dd87ba3 Binary files /dev/null and b/miniprogram/assets/imgs/mini-code.jpg differ diff --git a/miniprogram/canvasService/textDrawService.ts b/miniprogram/canvasService/textDrawService.ts index 47a76aa..775372d 100644 --- a/miniprogram/canvasService/textDrawService.ts +++ b/miniprogram/canvasService/textDrawService.ts @@ -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; diff --git a/miniprogram/canvasService/utils.ts b/miniprogram/canvasService/utils.ts index f0c2da1..e05a9d7 100644 --- a/miniprogram/canvasService/utils.ts +++ b/miniprogram/canvasService/utils.ts @@ -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(''); // 可设置默认占位图 + }, + }); + }); +}