Merge branch 'main' into test
This commit is contained in:
+8
-2
@@ -21,7 +21,9 @@
|
||||
import audioManager from "./audioManager";
|
||||
const store = useStore();
|
||||
const {
|
||||
user
|
||||
user,
|
||||
device,
|
||||
online
|
||||
} = storeToRefs(store);
|
||||
const {
|
||||
updateUser,
|
||||
@@ -68,7 +70,11 @@
|
||||
|
||||
async function emitUpdateOnline() {
|
||||
const data = await getDeviceBatteryAPI();
|
||||
updateOnline(data.online);
|
||||
const wasOnline = Boolean(online.value);
|
||||
const nextOnline = Boolean(data.online);
|
||||
updateOnline(nextOnline);
|
||||
if (!device.value.deviceId || wasOnline === nextOnline) return;
|
||||
audioManager.play(nextOnline ? "设备已连接" : "设备连接已断开");
|
||||
}
|
||||
|
||||
function onDeviceBindInvalid() {
|
||||
|
||||
@@ -4,6 +4,10 @@ export const AUDIO_INTERRUPTION_END_EVENT = "audio-interruption-end";
|
||||
export const audioFils = {
|
||||
tententen: "https://static.shelingxingqiu.com/shootmini/static/audio/tententen.mp3",
|
||||
点击按钮: "https://static.shelingxingqiu.com/shootmini/static/audio/%E7%82%B9%E5%87%BB%E6%8C%89%E9%92%AE.mp3",
|
||||
设备连接已断开:
|
||||
"https://static.shelingxingqiu.com/shootmini/static/audio/%E8%AE%BE%E5%A4%87%E8%BF%9E%E6%8E%A5%E5%B7%B2%E6%96%AD%E5%BC%80.MP3",
|
||||
设备已连接:
|
||||
"https://static.shelingxingqiu.com/shootmini/static/audio/%E8%AE%BE%E5%A4%87%E5%B7%B2%E8%BF%9E%E6%8E%A5.MP3",
|
||||
"20CM全环靶": "https://static.shelingxingqiu.com/shootmini/static/audio/20CM%E5%85%A8%E7%8E%AF%E9%9D%B6-%E6%97%A0%E6%95%88.mp3",
|
||||
"40CM全环靶": "https://static.shelingxingqiu.com/shootmini/static/audio/40CM%E5%85%A8%E7%8E%AF%E9%9D%B6-%E6%97%A0%E6%95%88.mp3",
|
||||
// 激光已校准:
|
||||
@@ -16,6 +20,8 @@ export const audioFils = {
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-17/dcutwrda0amn5kqr4j.mp3",
|
||||
距离不足:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-11-12/de6hr2faw28t0ianh0.mp3",
|
||||
"未发现靶纸,请瞄准靶纸射箭":
|
||||
"https://static.shelingxingqiu.com/shootmini/static/audio/%E6%9C%AA%E5%8F%91%E7%8E%B0%E9%9D%B6%E7%BA%B8%EF%BC%8C%E8%AF%B7%E7%9E%84%E5%87%86%E9%9D%B6%E7%BA%B8%E5%B0%84%E7%AE%AD.MP3",
|
||||
轮到你了:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-09-17/dcutzdrn4lxcpv8aqr.mp3",
|
||||
第一轮:
|
||||
@@ -102,6 +108,8 @@ const AUDIO_WARM_CONCURRENCY = 3;
|
||||
const AUDIO_WARM_RETRIES = 1;
|
||||
const AUDIO_WARM_PRIORITY_KEYS = [
|
||||
"点击按钮",
|
||||
"设备连接已断开",
|
||||
"设备已连接",
|
||||
"比赛开始",
|
||||
"练习开始",
|
||||
"练习结束",
|
||||
@@ -116,6 +124,7 @@ const AUDIO_WARM_PRIORITY_KEYS = [
|
||||
"请红方射箭",
|
||||
"距离合格",
|
||||
"距离不足",
|
||||
"未发现靶纸,请瞄准靶纸射箭",
|
||||
"未上靶",
|
||||
"X环",
|
||||
];
|
||||
|
||||
@@ -5,13 +5,19 @@ const props = defineProps({
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const getSum = (a, b, c) => {
|
||||
const sum = (Number(a) || 0) + (Number(b) || 0) + (Number(c) || 0);
|
||||
return sum > 0 ? sum + "环" : "-";
|
||||
const getSum = (...arrows) => {
|
||||
const recordedArrows = arrows.filter(Boolean);
|
||||
if (!recordedArrows.length) return "-";
|
||||
const sum = recordedArrows.reduce(
|
||||
(total, arrow) => total + (Number(arrow.ring) || 0),
|
||||
0
|
||||
);
|
||||
return `${sum}环`;
|
||||
};
|
||||
const roundsName = ["第一轮", "第二轮", "第三轮", "第四轮"];
|
||||
const getShowText = (arrow = {}) => {
|
||||
return arrow.ring ? (arrow.ringX ? "X" : arrow.ring + "环") : "-";
|
||||
const getShowText = (arrow) => {
|
||||
if (!arrow) return "-";
|
||||
return arrow.ringX ? "X" : `${Number(arrow.ring) || 0}环`;
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
|
||||
@@ -57,19 +57,22 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
const getRing = (arrow) => {
|
||||
if (!arrow) return "-";
|
||||
if (arrow.ringX) return "X";
|
||||
return arrow.ring ? arrow.ring : "-";
|
||||
return Number(arrow.ring) || 0;
|
||||
};
|
||||
|
||||
const arrows = computed(() => {
|
||||
const data = new Array(props.total).fill({ ring: 0 });
|
||||
const data = new Array(props.total).fill(null);
|
||||
(props.result.details || []).forEach((arrow, index) => {
|
||||
data[index] = arrow;
|
||||
});
|
||||
return data;
|
||||
});
|
||||
|
||||
const validArrows = computed(() => arrows.value.filter((a) => !!a.ring).length);
|
||||
const validArrows = computed(
|
||||
() => arrows.value.filter((a) => Number(a?.ring) > 0).length
|
||||
);
|
||||
const isMember = computed(() => user.value.vip === true || user.value.sVip === true);
|
||||
const openCoachComment = () => {
|
||||
if (!isMember.value) return;
|
||||
|
||||
@@ -51,8 +51,13 @@ onBeforeUnmount(() => {
|
||||
async function onReceiveMessage(msg) {
|
||||
if (Array.isArray(msg)) return;
|
||||
if (msg.type === MESSAGETYPESV2.TestDistance) {
|
||||
distance.value = Number((msg.shootData.distance / 100).toFixed(2));
|
||||
if (distance.value >= 5) audioManager.play("距离合格");
|
||||
const rawDistance = Number(msg.shootData?.distance);
|
||||
distance.value = Number.isFinite(rawDistance)
|
||||
? Number((rawDistance / 100).toFixed(2))
|
||||
: 0;
|
||||
if (rawDistance === 0) {
|
||||
audioManager.play("未发现靶纸,请瞄准靶纸射箭");
|
||||
} else if (distance.value >= 5) audioManager.play("距离合格");
|
||||
else audioManager.play("距离不足");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,6 +349,7 @@ function getShootResultAudioKeys(shootData) {
|
||||
function getTestDistanceAudioKeys(shootData) {
|
||||
const distance = Number(shootData?.distance ?? shootData?.dst);
|
||||
if (Number.isNaN(distance)) return [];
|
||||
if (distance === 0) return ["未发现靶纸,请瞄准靶纸射箭"];
|
||||
return [distance / 100 >= 5 ? "\u8ddd\u79bb\u5408\u683c" : "\u8ddd\u79bb\u4e0d\u8db3"];
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,10 @@ async function onReceiveMessage(msg) {
|
||||
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
|
||||
setTimeout(() => onOver(msg), 1500);
|
||||
} else if (msg.type === MESSAGETYPESV2.TestDistance && step.value === 3) {
|
||||
if (msg.shootData.distance / 100 >= 5) {
|
||||
const rawDistance = Number(msg.shootData?.distance);
|
||||
if (rawDistance === 0) {
|
||||
audioManager.play("未发现靶纸,请瞄准靶纸射箭");
|
||||
} else if (rawDistance / 100 >= 5) {
|
||||
audioManager.play("距离合格");
|
||||
btnDisabled.value = false;
|
||||
showGuide.value = true;
|
||||
|
||||
@@ -51,8 +51,13 @@ onBeforeUnmount(() => {
|
||||
async function onReceiveMessage(msg) {
|
||||
if (Array.isArray(msg)) return;
|
||||
if (msg.type === MESSAGETYPESV2.TestDistance) {
|
||||
distance.value = Number((msg.shootData.distance / 100).toFixed(2));
|
||||
if (distance.value >= 5) audioManager.play("距离合格");
|
||||
const rawDistance = Number(msg.shootData?.distance);
|
||||
distance.value = Number.isFinite(rawDistance)
|
||||
? Number((rawDistance / 100).toFixed(2))
|
||||
: 0;
|
||||
if (rawDistance === 0) {
|
||||
audioManager.play("未发现靶纸,请瞄准靶纸射箭");
|
||||
} else if (distance.value >= 5) audioManager.play("距离合格");
|
||||
else audioManager.play("距离不足");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user