完善个人练习分享
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import { formatTimestamp } from "@/util";
|
||||||
|
|
||||||
const loadImage = (src) =>
|
const loadImage = (src) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
@@ -635,7 +637,7 @@ export function renderScores(ctx, arrows = [], bgImg) {
|
|||||||
}
|
}
|
||||||
renderText(
|
renderText(
|
||||||
ctx,
|
ctx,
|
||||||
item.ring,
|
item.ringX ? "X" : item.ring,
|
||||||
18,
|
18,
|
||||||
"#fed847",
|
"#fed847",
|
||||||
29.5 + (i % 9) * 30,
|
29.5 + (i % 9) * 30,
|
||||||
@@ -657,7 +659,7 @@ export function renderScores(ctx, arrows = [], bgImg) {
|
|||||||
}
|
}
|
||||||
renderText(
|
renderText(
|
||||||
ctx,
|
ctx,
|
||||||
item.ring,
|
item.ringX ? "X" : item.ring,
|
||||||
23,
|
23,
|
||||||
"#fed847",
|
"#fed847",
|
||||||
43 + rowIndex * 42,
|
43 + rowIndex * 42,
|
||||||
@@ -737,9 +739,7 @@ export async function sharePractiseData(canvasId, type, user, data) {
|
|||||||
|
|
||||||
let subTitle = "正式开启弓箭手之路";
|
let subTitle = "正式开启弓箭手之路";
|
||||||
if (type > 1) {
|
if (type > 1) {
|
||||||
subTitle = `今日弓箭练习打卡 ${data.createdAt
|
subTitle = `今日弓箭练习打卡 ${formatTimestamp(data.startTime)}`;
|
||||||
.split(" ")[0]
|
|
||||||
.replaceAll("-", ".")}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.drawImage(titleImg, (width - 160) / 2, 160, 160, 40);
|
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, subTitle, 18, "#fff", width / 2, 224, "center");
|
||||||
|
|
||||||
renderText(ctx, "共", 14, "#fff", 122, 300);
|
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, totalRing, 14, "#fed847", 148, 300, "center");
|
||||||
renderText(ctx, "环", 14, "#fff", 161, 300);
|
renderText(ctx, "环", 14, "#fff", 161, 300);
|
||||||
|
|
||||||
renderLine(ctx, 77);
|
renderLine(ctx, 77);
|
||||||
renderLine(ctx, 185);
|
renderLine(ctx, 185);
|
||||||
|
|
||||||
renderScores(ctx, data.arrows, scoreBgImg);
|
renderScores(ctx, data.details, scoreBgImg);
|
||||||
|
|
||||||
ctx.drawImage(qrCodeImg, width * 0.06, height * 0.87, 52, 52);
|
ctx.drawImage(qrCodeImg, width * 0.06, height * 0.87, 52, 52);
|
||||||
renderText(ctx, "射灵平台", 12, "#fff", width * 0.26, height * 0.9);
|
renderText(ctx, "射灵平台", 12, "#fff", width * 0.26, height * 0.9);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ const arrows = computed(() => {
|
|||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
|
|
||||||
const validArrows = computed(() => arrows.value.filter((a) => !!a.ring));
|
const validArrows = computed(() => arrows.value.filter((a) => !!a.ring).length);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -39,11 +39,11 @@ const toPage = async (path) => {
|
|||||||
showModal.value = true;
|
showModal.value = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (path === "/pages/first-try") {
|
// if (path === "/pages/first-try") {
|
||||||
// if (canEenter(user.value, device.value, online.value, path)) {
|
// if (canEenter(user.value, device.value, online.value, path)) {
|
||||||
// await uni.$checkAudio();
|
// await uni.$checkAudio();
|
||||||
// }
|
// }
|
||||||
}
|
// }
|
||||||
uni.navigateTo({ url: path });
|
uni.navigateTo({ url: path });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -75,7 +75,6 @@ onShow(async () => {
|
|||||||
if ("823,209,293,257".indexOf(homeData.user.id) !== -1) {
|
if ("823,209,293,257".indexOf(homeData.user.id) !== -1) {
|
||||||
const show = uni.getStorageSync("show-the-user");
|
const show = uni.getStorageSync("show-the-user");
|
||||||
if (!show) {
|
if (!show) {
|
||||||
showTheUser.value = true;
|
|
||||||
uni.setStorageSync("show-the-user", true);
|
uni.setStorageSync("show-the-user", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user