练习结果完善
This commit is contained in:
@@ -27,11 +27,14 @@ const stepButtonTexts = [
|
||||
"",
|
||||
"退出新手试炼",
|
||||
];
|
||||
const start = ref(false);
|
||||
const practiseResult = ref({});
|
||||
const power = ref(0);
|
||||
|
||||
const onReady = async () => {
|
||||
const result = await createPractiseAPI(total);
|
||||
const token = uni.getStorageSync("token");
|
||||
|
||||
start.value = true;
|
||||
websocket.createWebSocket(token, (content) => {
|
||||
const messages = JSON.parse(content).data.updates || [];
|
||||
messages.forEach((msg) => {
|
||||
@@ -39,9 +42,14 @@ const onReady = async () => {
|
||||
scores.value.push(msg.target);
|
||||
if (scores.value.length === total) {
|
||||
showScore.value = true;
|
||||
websocket.closeWebSocket();
|
||||
}
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.ShootSyncMePracticeID) {
|
||||
practiseResult.value = {
|
||||
...msg.practice,
|
||||
arrows: JSON.parse(msg.practice.arrows),
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -144,11 +152,11 @@ const onClose = () => {
|
||||
v-if="step === 4"
|
||||
tips="请开始连续射箭"
|
||||
:total="100"
|
||||
:start="true"
|
||||
:start="start"
|
||||
/>
|
||||
<BowTarget
|
||||
:avatar="user.avatarUrl"
|
||||
:power="45"
|
||||
:power="power"
|
||||
:debug="step === 2"
|
||||
v-if="step === 2 || step === 4"
|
||||
:tips="step === 4 ? '' : '本次射程5.2米,已达到距离要求'"
|
||||
@@ -166,7 +174,7 @@ const onClose = () => {
|
||||
:show="showScore"
|
||||
v-if="step === 4"
|
||||
:onClose="onClose"
|
||||
:scores="scores.map((s) => s.ring)"
|
||||
:result="practiseResult"
|
||||
/>
|
||||
<SButton v-if="step !== 4" :onClick="nextStep">{{
|
||||
stepButtonTexts[step]
|
||||
|
||||
Reference in New Issue
Block a user