feat: 准备修改header的渲染
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
@@ -13,7 +13,10 @@ class TextDrawService {
|
|||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
this.paperSize = 'A4';
|
this.paperSize = 'A4';
|
||||||
this.options = {
|
this.options = {
|
||||||
|
appName: '涂鸦呀',
|
||||||
|
appHint: '涂色|识字|画画|认知',
|
||||||
title: '找一找 涂 色',
|
title: '找一找 涂 色',
|
||||||
|
subTitle: '把相同的文字涂上相同的颜色',
|
||||||
radius: 80,
|
radius: 80,
|
||||||
colors: ['#2196F3', '#FFEB3B', '#FF9800', '#F44336'],
|
colors: ['#2196F3', '#FFEB3B', '#FF9800', '#F44336'],
|
||||||
characters: ['鱼', '鸟', '猫', '狗'],
|
characters: ['鱼', '鸟', '猫', '狗'],
|
||||||
@@ -30,6 +33,11 @@ class TextDrawService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawHeader() {
|
drawHeader() {
|
||||||
|
const { canvas, ctx } = this;
|
||||||
|
const { appName, appHint, title, subTitle } = this.options;
|
||||||
|
}
|
||||||
|
|
||||||
|
drawHeader2() {
|
||||||
const { canvas, ctx } = this;
|
const { canvas, ctx } = this;
|
||||||
const { title } = this.options;
|
const { title } = this.options;
|
||||||
|
|
||||||
|
|||||||
@@ -15,3 +15,23 @@ export function setCanvasSize(canvas: Canvas, paperSize: PaperSize) {
|
|||||||
console.log('canvas----:', canvas);
|
console.log('canvas----:', canvas);
|
||||||
return 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(''); // 可设置默认占位图
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user