Commit 9592f43b authored by haiyoucuv's avatar haiyoucuv

倒计时

parent b061625e
......@@ -15,7 +15,8 @@ class GameStore {
startInfo: {
userRecordId?: number | string
recordId?: number | string
countdownSeconds?: number
} = {}
async start() {
......@@ -57,7 +58,7 @@ class GameStore {
remainTimes: 0,
level: 0,
maxScore: 0,
cd: GameConfig.gameCd,
cd: this.startInfo.countdownSeconds || GameConfig.gameCd,
}
}
......@@ -78,31 +79,21 @@ class GameStore {
async submit(score: number) {
const startId = this.startInfo.userRecordId;
const recordId = this.startInfo.recordId;
const params: {
startId: string | number,
score: number,
param?: string,
} = {
startId,
score,
}
params.param = AESEncrypt(JSON.stringify({
const param = AESEncrypt(JSON.stringify({
timestamp: Date.now(),
...params,
}), "CPI851051A6AEA6F", "cDOiBC1n2QrkAY2P");
recordId,
score,
}), "3C8C48E792E9241B", "cDOiBC1n2QrkAY2P");
const {success, data} = await API.submit(params);
const { success, data } = await API.submit({ param });
if (!success) {
PageCtrl.changePage(HomePage);
return;
}
store.indexData.remainTimes = data.remainGameTimes;
if (data) {
} else {
}
......
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