diff --git a/RollCallClient/.vite/deps_temp_9dc25f22/package.json b/RollCallClient/.vite/deps_temp_9dc25f22/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/RollCallClient/.vite/deps_temp_9dc25f22/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/RollCallClient/.vite/deps_temp_d842c71c/package.json b/RollCallClient/.vite/deps_temp_d842c71c/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/RollCallClient/.vite/deps_temp_d842c71c/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/RollCallClient/src/views/RollCall.vue b/RollCallClient/src/views/RollCall.vue index 094964c..c121923 100644 --- a/RollCallClient/src/views/RollCall.vue +++ b/RollCallClient/src/views/RollCall.vue @@ -7,6 +7,7 @@ import {listStudent, rollCall, updatePoints} from "@/api/student.js"; const loading = ref(false) const cards = ref([]) const canSelect = ref(true) +const disableClick = ref(false) const isResetting = ref(false) const dialogVisible = ref(false) const dialogVisible2 = ref(false) @@ -16,6 +17,7 @@ const avatarUrl = ref('https://api.aspark.cc') const avatarKey = ref(0) const pointChange = ref(0) const pointChange2 = ref(0) +const nothingToDo = ref(false) const randomEvents = ref([ { title: "放他一马", @@ -24,6 +26,10 @@ const randomEvents = ref([ { title: "天选之子", content: "成为天选之子,看似幸运加身,实则背负孤独。所有人羡慕你的光环,却无人懂得你走过的黑暗。被命运选中,不是因为强大,而是因为只能独自面对那些无人能解的重担。(同学化身天选之子,本次点名积分 +10 )" + }, + { + title: "无事发生", + content: "有时候,无事发生比风浪更让人心酸。日子在静默中悄然滑过,没有意外,也没有惊喜,连时间都像失去了温度。原以为平静是安全的,却不知这无声的流逝中,埋藏着无数未曾到来的期望和悄然消散的热情。" } ]) @@ -104,8 +110,7 @@ const handleRestart = () => { dialogVisible2.value = false if (isResetting.value) return isResetting.value = true - canSelect.value = false - + disableClick.value = false cards.value.forEach(card => { card.isFlipped = false }) @@ -207,7 +212,7 @@ const handlePointsChange = async () => { return } let response; - console.log(pointChange.value + ' ' + pointChange2.value) + // console.log(pointChange.value + ' ' + pointChange2.value) if(pointChange2.value !== 0){ response = await updatePoints(cardResult.value.id, pointChange2.value) pointChange2.value = 0 @@ -221,17 +226,33 @@ const handlePointsChange = async () => { dialogVisible.value = false } - const luckThing = () => { - const lens = randomEvents.value.length - const randomIndex = Math.floor(Math.random() * lens); - currentRandomEvent.value = randomEvents.value[randomIndex] - if (randomIndex === 1) { + disableClick.value = true + const lens = 3 + let randomIndex = Math.floor((Date.now() * Math.random()) % lens); + console.log(randomIndex) + if (randomIndex === 1) { pointChange2.value = 10 + } else if (randomIndex >= 2) { + nothingToDo.value = true + randomIndex = 2 } + currentRandomEvent.value = randomEvents.value[randomIndex] dialogVisible2.value = true; }; +const handleRandomEvents = () => { + console.log(disableClick.value) + console.log() + if (!nothingToDo.value) { + handleRestart() + handlePointsChange() + } else { + dialogVisible2.value = false + nothingToDo.value = false + } +} +