This commit is contained in:
2025-04-14 15:39:19 +08:00
parent fc859afe59
commit 4aaec10e61

View File

@@ -74,16 +74,17 @@ async function listRanks() {
async function getRandom() { async function getRandom() {
const res = await randomUser10(query.classroom) const res = await randomUser10(query.classroom)
if (!res.data.length) return false
const name = res.data[res.data.length - 1] const name = res.data[res.data.length - 1]
luckyGuy.value = name.split(query.classroom)[1] luckyGuy.value = name.split(query.classroom)[1]
return true
} }
async function getRandomModal() { async function getRandomModal() {
const ok = await getRandom() try {
if (ok) showModal.value = true await getRandom()
else message.error("没有学生") showModal.value = true
} catch (error) {
message.error("没有学生")
}
} }
watch(() => query.page, listRanks) watch(() => query.page, listRanks)