added api connect, refactor styles

This commit is contained in:
Kostya
2024-04-06 16:52:12 +03:00
parent d8977ae282
commit 2f424a8e4e
3 changed files with 62 additions and 24 deletions

View File

@@ -1,6 +1,5 @@
.jackpot-history__content { .jackpot-history__content {
display: flex; display: flex;
flex-wrap: wrap;
max-width: 80%; max-width: 80%;
max-height: 800px; max-height: 800px;
overflow-y: auto; overflow-y: auto;
@@ -8,6 +7,9 @@
} }
.jackpot-history__element { .jackpot-history__element {
display: flex;
flex-direction: column;
flex-wrap: wrap;
margin: 15px; margin: 15px;
} }

View File

@@ -85,3 +85,25 @@ export async function JoinJackpotGame(userData, amount) {
console.log('Fetch error') console.log('Fetch error')
} }
} }
export async function getJackpotHistoryGame () {
try {
const response = await fetch(`${BackendApiUrl}/GameJackpot/GetNewestJackpotGames`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
redirect: "follow"
})
if (!response.ok) {
console.log('Fetch error:', response.status)
}
console.log(response)
return await response.json()
}
catch (error) {
console.log('Fetch error')
}
}

View File

@@ -8,44 +8,58 @@ t<template>
<div class="jackpot-history"> <div class="jackpot-history">
<div class="jackpot-history__content"> <div class="jackpot-history__content">
<!-- TEMPLATE --> <ul class="jackpot-history__element">
<li v-for="(game, index) in historyGame" :key="index">
<div class="jackpot-history__element"> <div class="jackpot-history__element">
<div class="element-info"> <div class="element-info">
<div class="element-info__icon"> <div class="element-info__icon">
<img src="@/assets/icons-test/user-icon-test.png"> <img :src="`https://avatar.spworlds.ru/face/55/${game.winnerUserName}`">
</div> </div>
<div class="element-info__user-info"> <div class="element-info__user-info">
<h2 class="username">FUpir</h2> <h2 class="username">{{ game.winnerUserName }}</h2>
<h2 class="user-deposit"> <h2 class="user-deposit">
1000 {{ game.winStake }}
<span class="img-width"><img src="@/assets/icons-profile/icon-diamond-ore.png"></span> <span class="img-width"><img src="@/assets/icons-profile/icon-diamond-ore.png"></span>
</h2> </h2>
</div> </div>
</div> </div>
<div class="element-chance"> <div class="element-chance">
<h2> <h2>
Шанс <span class="chance-style">15.55%</span> Шанс <span class="chance-style">{{ game.winnerPercentage.toFixed(2) }}%</span>
</h2> </h2>
</div> </div>
</div> </div>
</li>
<!-- TEMPLATE --> </ul>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { onMounted, reactive } from "vue";
import ChatComponent from "@/components/ChatComponent.vue"; import ChatComponent from "@/components/ChatComponent.vue";
import AsideBarElement from "@/components/AsidebarComponent.vue"; import AsideBarElement from "@/components/AsidebarComponent.vue";
import HeaderElementPage from "@/components/HeaderComponent.vue"; import HeaderElementPage from "@/components/HeaderComponent.vue";
import '@/assets/css/PagesStyles/jackpot-history.css' import '@/assets/css/PagesStyles/jackpot-history.css'
import {getJackpotHistoryGame} from "@/assets/js/jackpot/JackpotLogic";
export default { export default {
components: {HeaderElementPage, ChatComponent, AsideBarElement} components: {HeaderElementPage, ChatComponent, AsideBarElement},
setup() {
let historyGame = reactive({})
onMounted(() => {
getJackpotHistoryGame()
.then(response => {
Object.assign(historyGame, response)
})
})
return { historyGame }
}
} }
</script> </script>