完善个人练习分享
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { formatTimestamp } from "@/util";
|
||||
|
||||
const loadImage = (src) =>
|
||||
new Promise((resolve, reject) => {
|
||||
try {
|
||||
@@ -635,7 +637,7 @@ export function renderScores(ctx, arrows = [], bgImg) {
|
||||
}
|
||||
renderText(
|
||||
ctx,
|
||||
item.ring,
|
||||
item.ringX ? "X" : item.ring,
|
||||
18,
|
||||
"#fed847",
|
||||
29.5 + (i % 9) * 30,
|
||||
@@ -657,7 +659,7 @@ export function renderScores(ctx, arrows = [], bgImg) {
|
||||
}
|
||||
renderText(
|
||||
ctx,
|
||||
item.ring,
|
||||
item.ringX ? "X" : item.ring,
|
||||
23,
|
||||
"#fed847",
|
||||
43 + rowIndex * 42,
|
||||
@@ -737,9 +739,7 @@ export async function sharePractiseData(canvasId, type, user, data) {
|
||||
|
||||
let subTitle = "正式开启弓箭手之路";
|
||||
if (type > 1) {
|
||||
subTitle = `今日弓箭练习打卡 ${data.createdAt
|
||||
.split(" ")[0]
|
||||
.replaceAll("-", ".")}`;
|
||||
subTitle = `今日弓箭练习打卡 ${formatTimestamp(data.startTime)}`;
|
||||
}
|
||||
|
||||
ctx.drawImage(titleImg, (width - 160) / 2, 160, 160, 40);
|
||||
@@ -748,14 +748,14 @@ export async function sharePractiseData(canvasId, type, user, data) {
|
||||
renderText(ctx, subTitle, 18, "#fff", width / 2, 224, "center");
|
||||
|
||||
renderText(ctx, "共", 14, "#fff", 122, 300);
|
||||
const totalRing = data.arrows.reduce((last, next) => last + next.ring, 0);
|
||||
const totalRing = data.details.reduce((last, next) => last + next.ring, 0);
|
||||
renderText(ctx, totalRing, 14, "#fed847", 148, 300, "center");
|
||||
renderText(ctx, "环", 14, "#fff", 161, 300);
|
||||
|
||||
renderLine(ctx, 77);
|
||||
renderLine(ctx, 185);
|
||||
|
||||
renderScores(ctx, data.arrows, scoreBgImg);
|
||||
renderScores(ctx, data.details, scoreBgImg);
|
||||
|
||||
ctx.drawImage(qrCodeImg, width * 0.06, height * 0.87, 52, 52);
|
||||
renderText(ctx, "射灵平台", 12, "#fff", width * 0.26, height * 0.9);
|
||||
|
||||
Reference in New Issue
Block a user