Commit dcd11f47 authored by haiyoucuv's avatar haiyoucuv

21

parent 80b7f20e
...@@ -182,10 +182,22 @@ const API = generateAPI({ ...@@ -182,10 +182,22 @@ const API = generateAPI({
rankInfo:`zqdn/rankIndex.do`, rankInfo:`zqdn/rankIndex.do`,
////////////////////////////// Game ////////////////////////////// ////////////////////////////// Game //////////////////////////////
start:`/zqdn/start.do`, start: {
suggest:`/zqdn/suggest.do`, uri: `/zqdn/start.do`,
middleSubmit:`/zqdn/middleSubmit.do`, withToken: true,
submit:`/zqdn/submit.do`, },
suggest: {
uri: `/zqdn/suggest.do`,
withToken: true,
},
middleSubmit: {
uri: `/zqdn/middleSubmit.do`,
withToken: true,
},
submit: {
uri: `/zqdn/submit.do`,
withToken: true,
},
}) })
......
import { makeAutoObservable, } from 'mobx'; import { makeAutoObservable, } from 'mobx';
import { LevelArr } from "@/pages/GamePage/Level/LevelConfig.ts"; import { LevelArr } from "@/pages/GamePage/Level/LevelConfig.ts";
import API from "@/api";
class GameStore { class GameStore {
...@@ -10,12 +11,22 @@ class GameStore { ...@@ -10,12 +11,22 @@ class GameStore {
gameInfo = { gameInfo = {
levelIndex: -1, levelIndex: -1,
levelIdxArr: [], levelIdxArr: [],
countdownSeconds: 180,
remainTipTimes: 0,
} }
async start() { async start() {
const { success, data } = await API.start();
if (!success) return false;
this.gameInfo.levelIdxArr = LevelArr.map((_, index) => index); this.gameInfo.levelIdxArr = LevelArr.map((_, index) => index);
this.gameInfo.levelIdxArr.sort(() => Math.random() - 0.5); this.gameInfo.levelIdxArr.sort(() => Math.random() - 0.5);
this.gameInfo.levelIndex = -1; this.gameInfo.levelIndex = -1;
this.gameInfo.countdownSeconds = data.countdownSeconds;
this.gameInfo.remainTipTimes = data.remainTipTimes
return success;
} }
async submit() { async submit() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment