完善个人练习分享

This commit is contained in:
kron
2026-02-10 11:47:20 +08:00
parent 812879d252
commit b0bf1880e4
3 changed files with 13 additions and 14 deletions

View File

@@ -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);

View File

@@ -69,7 +69,7 @@ const arrows = computed(() => {
return data;
});
const validArrows = computed(() => arrows.value.filter((a) => !!a.ring));
const validArrows = computed(() => arrows.value.filter((a) => !!a.ring).length);
</script>
<template>

View File

@@ -39,11 +39,11 @@ const toPage = async (path) => {
showModal.value = true;
return;
}
if (path === "/pages/first-try") {
// if (canEenter(user.value, device.value, online.value, path)) {
// await uni.$checkAudio();
// }
}
// if (path === "/pages/first-try") {
// if (canEenter(user.value, device.value, online.value, path)) {
// await uni.$checkAudio();
// }
// }
uni.navigateTo({ url: path });
};
@@ -75,7 +75,6 @@ onShow(async () => {
if ("823,209,293,257".indexOf(homeData.user.id) !== -1) {
const show = uni.getStorageSync("show-the-user");
if (!show) {
showTheUser.value = true;
uni.setStorageSync("show-the-user", true);
}
}