update:优化个人练习

This commit is contained in:
2026-07-09 18:29:04 +08:00
parent 82eedc3ab8
commit 58a7bb2017
5 changed files with 48 additions and 3 deletions
+2 -2
View File
@@ -273,8 +273,8 @@ export const createPractiseV2API = (arrows, time, target, deviceId) => {
}, PRACTICE_BASE_URL);
};
export const startPractiseAPI = () => {
return request("POST", "/user/practice/begin");
export const startPractiseAPI = (id) => {
return request("POST", "/user/practice/begin", { id });
};
export const endPractiseAPI = () => {
+1 -1
View File
@@ -155,7 +155,7 @@ async function onReceiveMessage(msg) {
}
let key = [];
key.push(arrow.ring ? `${arrow.ringX ? "X" : arrow.ring}` : "未上靶");
if (arrow.angle !== null)
if (arrow.angle)
key.push(`${getDirectionText(arrow.angle)}调整`);
audioManager.play(key, false);
} else if (msg.type === MESSAGETYPESV2.HalfRest) {
+15
View File
@@ -16,6 +16,7 @@ import audioManager from "@/audioManager";
import {
createPractiseAPI,
getPractiseAPI,
startPractiseAPI,
laserAimAPI,
laserCloseAPI,
} from "@/apis";
@@ -134,6 +135,18 @@ const onOver = async (message) => {
start.value = false;
};
const beginPractise = async () => {
if (!practiseId.value) {
uni.showToast({
title: "练习未创建,请重试",
icon: "none",
});
return false;
}
await startPractiseAPI(practiseId.value);
return true;
};
async function onReceiveMessage(msg) {
if (msg.type === MESSAGETYPESV2.ShootResult) {
isSvip.value = msg.sVip === true;
@@ -229,6 +242,8 @@ const nextStep = async () => {
title.value = "-小试牛刀";
} else if (step.value === 4) {
title.value = "小试牛刀";
const result = await beginPractise();
if (!result) return;
scores.value = [];
isSvip.value = false;
step.value = 5;
+15
View File
@@ -16,6 +16,7 @@ import audioManager from "@/audioManager";
import {
createPractiseAPI,
getPractiseAPI,
startPractiseAPI,
} from "@/apis";
import { connectMatchWebSocket, closeMatchWebSocket } from "@/matchWebsocket";
import { sharePractiseData } from "@/canvas";
@@ -71,7 +72,21 @@ const createPractise = async () => {
return result;
};
const beginPractise = async () => {
if (!practiseId.value) {
uni.showToast({
title: "练习未创建,请重试",
icon: "none",
});
return false;
}
await startPractiseAPI(practiseId.value);
return true;
};
const onReady = async () => {
const result = await beginPractise();
if (!result) return;
scores.value = [];
isSvip.value = false;
xRingStreak.value = 0; // 新一局开始,重置 X 环连续计数
+15
View File
@@ -15,6 +15,7 @@ import audioManager from "@/audioManager";
import {
createPractiseAPI,
getPractiseAPI,
startPractiseAPI,
} from "@/apis";
import { connectMatchWebSocket, closeMatchWebSocket } from "@/matchWebsocket";
import { sharePractiseData } from "@/canvas";
@@ -70,7 +71,21 @@ const createPractise = async () => {
return result;
};
const beginPractise = async () => {
if (!practiseId.value) {
uni.showToast({
title: "练习未创建,请重试",
icon: "none",
});
return false;
}
await startPractiseAPI(practiseId.value);
return true;
};
const onReady = async () => {
const result = await beginPractise();
if (!result) return;
scores.value = [];
isSvip.value = false;
xRingStreak.value = 0; // 新一局开始,重置 X 环连续计数