Commit 9592f43b authored by haiyoucuv's avatar haiyoucuv

倒计时

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