|
|
@ -1,5 +1,5 @@
|
|
|
|
<script setup>
|
|
|
|
<script setup>
|
|
|
|
import {onMounted, ref, watch} from 'vue'
|
|
|
|
import {onMounted, ref, watch, reactive} from 'vue'
|
|
|
|
import {ElMessage, ElNotification} from 'element-plus'
|
|
|
|
import {ElMessage, ElNotification} from 'element-plus'
|
|
|
|
import {listStudent, rollCall, updatePoints} from "@/api/student.js";
|
|
|
|
import {listStudent, rollCall, updatePoints} from "@/api/student.js";
|
|
|
|
|
|
|
|
|
|
|
@ -9,11 +9,28 @@ const cards = ref([])
|
|
|
|
const canSelect = ref(true)
|
|
|
|
const canSelect = ref(true)
|
|
|
|
const isResetting = ref(false)
|
|
|
|
const isResetting = ref(false)
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
|
|
|
|
const dialogVisible2 = ref(false)
|
|
|
|
const cardResult = ref({})
|
|
|
|
const cardResult = ref({})
|
|
|
|
const studentTable = ref([])
|
|
|
|
const studentTable = ref([])
|
|
|
|
const avatarUrl = ref('https://api.aspark.cc')
|
|
|
|
const avatarUrl = ref('https://api.aspark.cc')
|
|
|
|
const avatarKey = ref(0)
|
|
|
|
const avatarKey = ref(0)
|
|
|
|
const pointChange = ref(0)
|
|
|
|
const pointChange = ref(0)
|
|
|
|
|
|
|
|
const pointChange2 = ref(0)
|
|
|
|
|
|
|
|
const randomEvents = ref([
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: "放他一马",
|
|
|
|
|
|
|
|
content: "有时候,放他一马,不是因为不在乎,而是因为明白,强求的结果只会让彼此更痛。放手的瞬间,心中隐隐作痛,却只能默默接受这无法改变的结局。(放过该同学,本次点名无效,请重新点名)"
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: "天选之子",
|
|
|
|
|
|
|
|
content: "成为天选之子,看似幸运加身,实则背负孤独。所有人羡慕你的光环,却无人懂得你走过的黑暗。被命运选中,不是因为强大,而是因为只能独自面对那些无人能解的重担。(同学化身天选之子,本次点名积分 +10 )"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const currentRandomEvent = ref({
|
|
|
|
|
|
|
|
title: '',
|
|
|
|
|
|
|
|
content: ''
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 洗牌
|
|
|
|
// 洗牌
|
|
|
@ -84,6 +101,7 @@ const selectCard = (index) => {
|
|
|
|
|
|
|
|
|
|
|
|
const handleRestart = () => {
|
|
|
|
const handleRestart = () => {
|
|
|
|
dialogVisible.value = false
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
|
|
|
dialogVisible2.value = false
|
|
|
|
if (isResetting.value) return
|
|
|
|
if (isResetting.value) return
|
|
|
|
isResetting.value = true
|
|
|
|
isResetting.value = true
|
|
|
|
canSelect.value = false
|
|
|
|
canSelect.value = false
|
|
|
@ -184,17 +202,36 @@ onMounted(() => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const handlePointsChange = async () => {
|
|
|
|
const handlePointsChange = async () => {
|
|
|
|
if (pointChange.value === 0) {
|
|
|
|
if (pointChange.value === 0 && pointChange2.value === 0) {
|
|
|
|
dialogVisible.value = false
|
|
|
|
dialogVisible.value = false
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const response = await updatePoints(cardResult.value.id, pointChange.value)
|
|
|
|
let response;
|
|
|
|
|
|
|
|
console.log(pointChange.value + ' ' + pointChange2.value)
|
|
|
|
|
|
|
|
if(pointChange2.value !== 0){
|
|
|
|
|
|
|
|
response = await updatePoints(cardResult.value.id, pointChange2.value)
|
|
|
|
|
|
|
|
pointChange2.value = 0
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
response = await updatePoints(cardResult.value.id, pointChange.value)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (response.code === 0) {
|
|
|
|
if (response.code === 0) {
|
|
|
|
ElMessage.error('失败,原因:' + response.msg)
|
|
|
|
ElMessage.error('失败,原因:' + response.msg)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dialogVisible.value = false
|
|
|
|
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) {
|
|
|
|
|
|
|
|
pointChange2.value = 10
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dialogVisible2.value = true;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
@ -278,6 +315,14 @@ const handlePointsChange = async () => {
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<i class="iconfont yaya-xmark" style="font-size: 24px;"/>
|
|
|
|
<i class="iconfont yaya-xmark" style="font-size: 24px;"/>
|
|
|
|
</el-button>
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
@click="luckThing"
|
|
|
|
|
|
|
|
class="round-button"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<i class="iconfont yaya-touzi" style="font-size: 24px;;" />
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
<el-button
|
|
|
|
<el-button
|
|
|
|
type="success"
|
|
|
|
type="success"
|
|
|
|
@click="handlePointsChange"
|
|
|
|
@click="handlePointsChange"
|
|
|
@ -289,6 +334,32 @@ const handlePointsChange = async () => {
|
|
|
|
<p class="profile-bio">Coding the World.</p>
|
|
|
|
<p class="profile-bio">Coding the World.</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-dialog>
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
|
|
|
|
v-model="dialogVisible2"
|
|
|
|
|
|
|
|
width="400px"
|
|
|
|
|
|
|
|
height="700px"
|
|
|
|
|
|
|
|
:align-center="true"
|
|
|
|
|
|
|
|
class="profile-dialog"
|
|
|
|
|
|
|
|
@close="handleRestart"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<div class="profile-content">
|
|
|
|
|
|
|
|
<!-- 显示随机事件的标题,原本头像位置替换为标题 -->
|
|
|
|
|
|
|
|
<h2 class="profile-name">{{ currentRandomEvent.title }}</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 显示随机事件的内容,原来积分区域替换为内容展示 -->
|
|
|
|
|
|
|
|
<p class="point-change-label">{{ currentRandomEvent.content }}</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="button-container">
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
type="success"
|
|
|
|
|
|
|
|
@click="handlePointsChange"
|
|
|
|
|
|
|
|
class="round-button"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<i class="iconfont yaya-duigou" style="font-size: 24px;" />
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</el-dialog>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
@ -458,7 +529,7 @@ body .el-dialog {
|
|
|
|
flex: 1;
|
|
|
|
flex: 1;
|
|
|
|
margin: 0 15px;
|
|
|
|
margin: 0 15px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.slider-button {
|
|
|
|
.slider-button {
|
|
|
|
width: 32px;
|
|
|
|
width: 32px;
|
|
|
|
height: 32px;
|
|
|
|
height: 32px;
|
|
|
|