mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
wip: design leaderboard
This commit is contained in:
1 parent
a90b0a3c83
commit
790e09b315
3 files changed
+67
-7
No files matched your search
@@ -69,10 +69,17 @@ onMounted(async () => {
|
|||||||
class="text-text-tertiary h-full w-full"
|
class="text-text-tertiary h-full w-full"
|
||||||
/>
|
/>
|
||||||
</button> -->
|
</button> -->
|
||||||
<p
|
<button
|
||||||
id="HeaderText"
|
id="HeaderText"
|
||||||
class="text-text-primary inline-block font-bold whitespace-nowrap"
|
class="text-text-primary inline-block font-bold whitespace-nowrap"
|
||||||
style="font-size: 2vh"
|
style="font-size: 2vh"
|
||||||
|
>
|
||||||
|
Linux Odyssey
|
||||||
|
</button>
|
||||||
|
<p
|
||||||
|
id="HeaderText"
|
||||||
|
class="text-text inline-block font-bold whitespace-nowrap"
|
||||||
|
style="font-size: 2vh"
|
||||||
>
|
>
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
|
import DynamicBackground from '../components/DynamicBackground.vue'
|
||||||
|
import GameHeaderPart from '../components/GameHeaderPart.vue'
|
||||||
import api from '../utils/api'
|
import api from '../utils/api'
|
||||||
|
|
||||||
const leaderboard = ref([])
|
const leaderboard = ref([])
|
||||||
@@ -22,11 +24,57 @@ onMounted(async () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="w-screen h-screen bg-bg">
|
||||||
<h1 class="text-text-primary">Leaderboard</h1>
|
<DynamicBackground class="w-full h-full" />
|
||||||
<div>
|
<div
|
||||||
<div class="text-text" v-for="user in leaderboard" :key="user.username">
|
class="w-screen h-screen absolute top-0 left-0 flex flex-wrap justify-center content-center"
|
||||||
{{ user.username }}: {{ user.score }} {{ user.completedQuests }}
|
>
|
||||||
|
<div class="absolute top-0 h-[6vh] w-full">
|
||||||
|
<GameHeaderPart title="排行榜" />
|
||||||
|
</div>
|
||||||
|
<div class="w-fit h-full">
|
||||||
|
<div
|
||||||
|
class="bg-bg border-8 border-bg-primary flex flex-col items-center justify-center rounded-3xl p-10"
|
||||||
|
>
|
||||||
|
<h1 class="text-text-primary text-3xl mb-5">排行榜</h1>
|
||||||
|
<div class="max-h-300 overflow-y-auto">
|
||||||
|
<table class="w-full text-sm text-left text-text">
|
||||||
|
<thead
|
||||||
|
class="text-xs text-text-secondary uppercase bg-bg-secondary"
|
||||||
|
>
|
||||||
|
<tr>
|
||||||
|
<th scope="col" class="px-6 py-3">使用者名稱</th>
|
||||||
|
<th scope="col" class="px-6 py-3">分數</th>
|
||||||
|
<th scope="col" class="px-6 py-3">完成關卡</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr
|
||||||
|
v-for="user in leaderboard"
|
||||||
|
:key="user.username"
|
||||||
|
class="border-b bg-bg"
|
||||||
|
>
|
||||||
|
<th
|
||||||
|
scope="row"
|
||||||
|
class="px-6 py-4 font-medium text-text-primary whitespace-nowrap"
|
||||||
|
>
|
||||||
|
{{ user.username }}
|
||||||
|
</th>
|
||||||
|
<td class="px-6 py-4">{{ user.score }}</td>
|
||||||
|
<td class="px-6 py-4 text-text-secondary">
|
||||||
|
<span
|
||||||
|
class="mr-2"
|
||||||
|
v-for="quest in user.completedQuests"
|
||||||
|
:key="quest"
|
||||||
|
>
|
||||||
|
{{ quest }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,5 +8,10 @@ export default asyncHandler(async (req, res) => {
|
|||||||
completedQuests: user.completedQuests,
|
completedQuests: user.completedQuests,
|
||||||
score: user.score * 1000,
|
score: user.score * 1000,
|
||||||
}))
|
}))
|
||||||
res.json(response)
|
// duplicate the response 100 times
|
||||||
|
const fakeResponse = []
|
||||||
|
for (let i = 0; i < 100; i++) {
|
||||||
|
fakeResponse.push(...response)
|
||||||
|
}
|
||||||
|
res.json(fakeResponse)
|
||||||
})
|
})
|
||||||
Reference in new issue
Block a user