feat:完成生成打印纸的步骤

This commit is contained in:
2025-06-02 10:05:59 +08:00
parent 419818eb24
commit 82c55fece3
18 changed files with 726 additions and 46 deletions
@@ -1,3 +1,20 @@
export async function getMiniCodeImage(canvas: Canvas) {
return getImage(canvas, '/assets/imgs/mini-code.jpg');
}
export async function getImage(canvas: Canvas, path: string) {
return new Promise((resolve, reject) => {
const image = canvas.createImage();
image.onload = () => {
resolve(image);
};
image.onerror = () => {
reject('图片加载异常');
};
image.src = path;
});
}
export const formatTime = (date: Date) => {
const year = date.getFullYear();
const month = date.getMonth() + 1;