细节优化
This commit is contained in:
@@ -10,6 +10,7 @@ import ScorePanel from "@/components/ScorePanel.vue";
|
||||
import Container from "@/components/Container.vue";
|
||||
import Avatar from "@/components/Avatar.vue";
|
||||
import BowPower from "@/components/BowPower.vue";
|
||||
import StartCountdown from "@/components/StartCountdown.vue";
|
||||
import { createPractiseAPI, getHomeData } from "@/apis";
|
||||
import { MESSAGETYPES } from "@/constants";
|
||||
import useStore from "@/store";
|
||||
@@ -30,6 +31,7 @@ const stepButtonTexts = [
|
||||
"退出新手试炼",
|
||||
];
|
||||
const title = ref("新手试炼场");
|
||||
const startCount = ref(false);
|
||||
const start = ref(false);
|
||||
const practiseResult = ref({});
|
||||
const power = ref(0);
|
||||
@@ -39,6 +41,11 @@ const createPractise = async (arrows) => {
|
||||
const result = await createPractiseAPI(arrows);
|
||||
};
|
||||
|
||||
const onStart = () => {
|
||||
start.value = true;
|
||||
scores.value = [];
|
||||
};
|
||||
|
||||
async function onReceiveMessage(content) {
|
||||
const messages = JSON.parse(content).data.updates || [];
|
||||
messages.forEach((msg) => {
|
||||
@@ -54,6 +61,7 @@ async function onReceiveMessage(content) {
|
||||
}
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.ShootSyncMePracticeID) {
|
||||
start.value = false;
|
||||
practiseResult.value = {
|
||||
...msg.practice,
|
||||
arrows: JSON.parse(msg.practice.arrows),
|
||||
@@ -86,9 +94,7 @@ const nextStep = async () => {
|
||||
scores.value = [];
|
||||
await createPractise(total);
|
||||
step.value = 4;
|
||||
setTimeout(() => {
|
||||
start.value = true;
|
||||
}, 500);
|
||||
startCount.value = true;
|
||||
} else if (step.value === 5) {
|
||||
const result = await getHomeData();
|
||||
if (result.user) updateUser(result.user);
|
||||
@@ -216,6 +222,7 @@ const onClose = () => {
|
||||
:onClose="onClose"
|
||||
:result="practiseResult"
|
||||
/>
|
||||
<StartCountdown :start="startCount" :onFinish="onStart" />
|
||||
</view>
|
||||
<view :style="{ marginBottom: '20px' }">
|
||||
<SButton v-if="step !== 4" :onClick="nextStep" :disabled="btnDisabled">{{
|
||||
|
||||
Reference in New Issue
Block a user