add alert for double

This commit is contained in:
Hepatica
2024-04-07 03:50:35 +02:00
parent 5d7e3db011
commit d58772127f

View File

@@ -13,13 +13,25 @@
<p>Крути, ставь, побеждай!</p> <p>Крути, ставь, побеждай!</p>
<div class="saper-start__choises diamonds diamonds-input__margin"> <div class="saper-start__choises diamonds diamonds-input__margin">
<h3>Цвет победной ячейки</h3> <h3>Цвет победной ячейки</h3>
<button class="bet-button red" :class="{ active: activeButton === 'red' }" @click="handleClick('red')"> <button
class="bet-button red"
:class="{ active: activeButton === 'red' }"
@click="handleClick('red')"
>
x2 x2
</button> </button>
<button class="bet-button green" :class="{ active: activeButton === 'green' }" @click="handleClick('green')"> <button
class="bet-button green"
:class="{ active: activeButton === 'green' }"
@click="handleClick('green')"
>
x20 x20
</button> </button>
<button class="bet-button black" :class="{ active: activeButton === 'black' }" @click="handleClick('black')"> <button
class="bet-button black"
:class="{ active: activeButton === 'black' }"
@click="handleClick('black')"
>
x2 x2
</button> </button>
@@ -235,7 +247,10 @@ import AsideBarComponent from "@/components/AsidebarComponent.vue";
import HeaderComponent from "@/components/HeaderComponent.vue"; import HeaderComponent from "@/components/HeaderComponent.vue";
import ChatComponent from "@/components/ChatComponent.vue"; import ChatComponent from "@/components/ChatComponent.vue";
import JackpotNumbers from "@/mocks/JackpotNumbers"; import JackpotNumbers from "@/mocks/JackpotNumbers";
import { GetNewestDoubleGames,JoinGame } from "@/assets/js/games/double/DoubleApi"; import {
GetNewestDoubleGames,
JoinGame,
} from "@/assets/js/games/double/DoubleApi";
import { GetCurrentMoney } from "@/assets/js/rest/RestMethods"; import { GetCurrentMoney } from "@/assets/js/rest/RestMethods";
import { GetCookie } from "@/assets/js/storage/CookieStorage"; import { GetCookie } from "@/assets/js/storage/CookieStorage";
import { Carousel, Slide } from "vue3-carousel"; import { Carousel, Slide } from "vue3-carousel";
@@ -267,7 +282,7 @@ export default {
JackpotNumbers, JackpotNumbers,
clickedColor: "", clickedColor: "",
amountDeposit: 0, amountDeposit: 0,
activeButton: null activeButton: null,
}; };
}, },
methods: { methods: {
@@ -291,8 +306,7 @@ export default {
async handleClick(color) { async handleClick(color) {
this.clickedColor = color; this.clickedColor = color;
this.activeButton = color; this.activeButton = color;
} },
,
async clickPlayBtn() { async clickPlayBtn() {
this.v$.$touch(); this.v$.$touch();
this.offBtn = true; this.offBtn = true;
@@ -303,10 +317,9 @@ export default {
) { ) {
this.textError = "Некорректное значение. Введите целое число."; this.textError = "Некорректное значение. Введите целое число.";
this.offBtn = false; this.offBtn = false;
this.errorPlayButton();
} }
await JoinGame(this.amountDeposit,this.clickedColor).then((response) => { await JoinGame(this.amountDeposit, this.clickedColor).then((response) => {
if ( if (
response === `You can't join to started or ended game` || response === `You can't join to started or ended game` ||
response === "Player alredy in the game." response === "Player alredy in the game."
@@ -315,22 +328,22 @@ export default {
if (response === `You can't join to started or ended game`) { if (response === `You can't join to started or ended game`) {
this.textError = "Игра уже началась или только закончилась!"; this.textError = "Игра уже началась или только закончилась!";
this.errorPlayButton(); alert("Пожалуйста подождите");
} else if (response === "Player alredy in the game.") { } else if (response === "Player alredy in the game.") {
this.textError = "Вы уже в игре!"; this.textError = "Вы уже в игре!";
this.errorPlayButton(); alert("Пожалуйста подождите");
} }
return; return;
} }
// if (response.ok) { if (!response.ok) {
// this.offBtn = false; this.textError = "Пожалуйста подождите";
// this.startGame = true; alert("Пожалуйста подождите");
// } }
}); });
this.offBtn = false; this.offBtn = false;
} },
}, },
validations() { validations() {
return { return {