diff --git a/luckydiamond/src/pages/games-pages/CrashgamePage.vue b/luckydiamond/src/pages/games-pages/CrashgamePage.vue index 92021fa..8dc5010 100644 --- a/luckydiamond/src/pages/games-pages/CrashgamePage.vue +++ b/luckydiamond/src/pages/games-pages/CrashgamePage.vue @@ -33,9 +33,9 @@

{{ textError }}

- + - +
@@ -106,7 +106,19 @@ export default { crashObject: '', textError: '', startGame: false, - prizeUser: 0, + offBtn: false + } + }, + computed: { + getUserPrize() { + const currentUser = this.crashObject.Players.find(player => player.UserName === GetCookie('SpUserName')); + + if (currentUser) { + return currentUser.Bid * this.crashObject.CurrentX + } + else { + return 0 + } } }, setup() { @@ -124,13 +136,8 @@ export default { console.error(e) } - if (this.crashObject.CurrentX !== null && this.crashObject.Players.some(player => player.UserName === GetCookie('SpUserName'))) { - this.getUserPrizer() - } - if (this.crashObject.Status === 'GameEnd' && this.startGame === true && this.crashObject.Players.some(player => player.UserName === GetCookie('SpUserName'))) { this.startGame = false - this.prizeUser = 0 this.updateUserMoney() } if ( @@ -230,22 +237,13 @@ export default { }) } }, - async getUserPrizer() { - const currentUser = this.crashObject.Players.find(player => player.UserName === GetCookie('SpUserName')); - - if (currentUser) { - setTimeout(async () => { - this.prizeUser = currentUser.Bid * this.crashObject.CurrentX - }, 100) - } else { - return 0 - } - }, async clickPlayBtn() { this.v$.$touch() + this.offBtn = true if (this.v$.amountDeposit.$error) { this.textError = 'Ошибка введении данных' + this.offBtn = false this.errorPlayButton() } @@ -260,6 +258,7 @@ export default { console.log(this.balance) console.log(response) if (response === `You can't join to started or ended game` || response === 'Player alredy in the game.') { + this.offBtn = false if (response === `You can't join to started or ended game`) { this.textError = 'Игра уже началась или только закончилась!' @@ -273,8 +272,12 @@ export default { return } - this.startGame = true + if (response.ok) { + this.offBtn = false + this.startGame = true + } }) + this.offBtn = false } }, errorPlayButton() {