update:优化个人练习
This commit is contained in:
+2
-2
@@ -273,8 +273,8 @@ export const createPractiseV2API = (arrows, time, target, deviceId) => {
|
|||||||
}, PRACTICE_BASE_URL);
|
}, PRACTICE_BASE_URL);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const startPractiseAPI = () => {
|
export const startPractiseAPI = (id) => {
|
||||||
return request("POST", "/user/practice/begin");
|
return request("POST", "/user/practice/begin", { id });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const endPractiseAPI = () => {
|
export const endPractiseAPI = () => {
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ async function onReceiveMessage(msg) {
|
|||||||
}
|
}
|
||||||
let key = [];
|
let key = [];
|
||||||
key.push(arrow.ring ? `${arrow.ringX ? "X" : arrow.ring}环` : "未上靶");
|
key.push(arrow.ring ? `${arrow.ringX ? "X" : arrow.ring}环` : "未上靶");
|
||||||
if (arrow.angle !== null)
|
if (arrow.angle)
|
||||||
key.push(`向${getDirectionText(arrow.angle)}调整`);
|
key.push(`向${getDirectionText(arrow.angle)}调整`);
|
||||||
audioManager.play(key, false);
|
audioManager.play(key, false);
|
||||||
} else if (msg.type === MESSAGETYPESV2.HalfRest) {
|
} else if (msg.type === MESSAGETYPESV2.HalfRest) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import audioManager from "@/audioManager";
|
|||||||
import {
|
import {
|
||||||
createPractiseAPI,
|
createPractiseAPI,
|
||||||
getPractiseAPI,
|
getPractiseAPI,
|
||||||
|
startPractiseAPI,
|
||||||
laserAimAPI,
|
laserAimAPI,
|
||||||
laserCloseAPI,
|
laserCloseAPI,
|
||||||
} from "@/apis";
|
} from "@/apis";
|
||||||
@@ -134,6 +135,18 @@ const onOver = async (message) => {
|
|||||||
start.value = false;
|
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) {
|
async function onReceiveMessage(msg) {
|
||||||
if (msg.type === MESSAGETYPESV2.ShootResult) {
|
if (msg.type === MESSAGETYPESV2.ShootResult) {
|
||||||
isSvip.value = msg.sVip === true;
|
isSvip.value = msg.sVip === true;
|
||||||
@@ -229,6 +242,8 @@ const nextStep = async () => {
|
|||||||
title.value = "-小试牛刀";
|
title.value = "-小试牛刀";
|
||||||
} else if (step.value === 4) {
|
} else if (step.value === 4) {
|
||||||
title.value = "小试牛刀";
|
title.value = "小试牛刀";
|
||||||
|
const result = await beginPractise();
|
||||||
|
if (!result) return;
|
||||||
scores.value = [];
|
scores.value = [];
|
||||||
isSvip.value = false;
|
isSvip.value = false;
|
||||||
step.value = 5;
|
step.value = 5;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import audioManager from "@/audioManager";
|
|||||||
import {
|
import {
|
||||||
createPractiseAPI,
|
createPractiseAPI,
|
||||||
getPractiseAPI,
|
getPractiseAPI,
|
||||||
|
startPractiseAPI,
|
||||||
} from "@/apis";
|
} from "@/apis";
|
||||||
import { connectMatchWebSocket, closeMatchWebSocket } from "@/matchWebsocket";
|
import { connectMatchWebSocket, closeMatchWebSocket } from "@/matchWebsocket";
|
||||||
import { sharePractiseData } from "@/canvas";
|
import { sharePractiseData } from "@/canvas";
|
||||||
@@ -71,7 +72,21 @@ const createPractise = async () => {
|
|||||||
return result;
|
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 onReady = async () => {
|
||||||
|
const result = await beginPractise();
|
||||||
|
if (!result) return;
|
||||||
scores.value = [];
|
scores.value = [];
|
||||||
isSvip.value = false;
|
isSvip.value = false;
|
||||||
xRingStreak.value = 0; // 新一局开始,重置 X 环连续计数
|
xRingStreak.value = 0; // 新一局开始,重置 X 环连续计数
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import audioManager from "@/audioManager";
|
|||||||
import {
|
import {
|
||||||
createPractiseAPI,
|
createPractiseAPI,
|
||||||
getPractiseAPI,
|
getPractiseAPI,
|
||||||
|
startPractiseAPI,
|
||||||
} from "@/apis";
|
} from "@/apis";
|
||||||
import { connectMatchWebSocket, closeMatchWebSocket } from "@/matchWebsocket";
|
import { connectMatchWebSocket, closeMatchWebSocket } from "@/matchWebsocket";
|
||||||
import { sharePractiseData } from "@/canvas";
|
import { sharePractiseData } from "@/canvas";
|
||||||
@@ -70,7 +71,21 @@ const createPractise = async () => {
|
|||||||
return result;
|
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 onReady = async () => {
|
||||||
|
const result = await beginPractise();
|
||||||
|
if (!result) return;
|
||||||
scores.value = [];
|
scores.value = [];
|
||||||
isSvip.value = false;
|
isSvip.value = false;
|
||||||
xRingStreak.value = 0; // 新一局开始,重置 X 环连续计数
|
xRingStreak.value = 0; // 新一局开始,重置 X 环连续计数
|
||||||
|
|||||||
Reference in New Issue
Block a user