|
|
|
@ -10,8 +10,13 @@
|
|
|
|
|
@rollCompleted="handleRollCompleted(index)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<button class="button" @click="toggleScrolling">
|
|
|
|
|
{{ isScrolling ? '停止点名' : '开始点名' }}
|
|
|
|
|
<button
|
|
|
|
|
class="button"
|
|
|
|
|
@click="toggleScrolling"
|
|
|
|
|
:disabled="isButtonPressed"
|
|
|
|
|
:class="{ 'button-pressed': isButtonPressed }"
|
|
|
|
|
>
|
|
|
|
|
{{ isScrolling ? '停止' : '开始点名' }}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
@ -33,8 +38,15 @@ const durations = ref(
|
|
|
|
|
|
|
|
|
|
const completedRolls = ref(new Array(stopNumbers.value.length).fill(false))
|
|
|
|
|
const confirmed = ref(false)
|
|
|
|
|
const isButtonPressed = ref(false)
|
|
|
|
|
|
|
|
|
|
const toggleScrolling = () => {
|
|
|
|
|
isButtonPressed.value = true
|
|
|
|
|
if (isScrolling.value == false) {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
isButtonPressed.value = false
|
|
|
|
|
}, 10)
|
|
|
|
|
}
|
|
|
|
|
isScrolling.value = !isScrolling.value // 切换 isScrolling 的值
|
|
|
|
|
if (isScrolling.value) {
|
|
|
|
|
completedRolls.value = new Array(stopNumbers.value.length).fill(false) // 重置 completedRolls 数组
|
|
|
|
@ -49,6 +61,7 @@ const handleRollCompleted = (index) => {
|
|
|
|
|
!confirmed.value
|
|
|
|
|
) {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
isButtonPressed.value = false // 确认弹窗出现后,重置按钮按下状态
|
|
|
|
|
if (
|
|
|
|
|
!confirmed.value &&
|
|
|
|
|
confirm(`抽到了: ${stopNumbers.value.join('')},确定后跳转`)
|
|
|
|
@ -73,7 +86,7 @@ onUnmounted(() => {
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
gap: 20px; /* 设置按钮与RollingNumber部分之间的间距 */
|
|
|
|
|
gap: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.rolling-numbers {
|
|
|
|
@ -98,14 +111,24 @@ onUnmounted(() => {
|
|
|
|
|
transform 0.1s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.button:hover {
|
|
|
|
|
.button-pressed {
|
|
|
|
|
background-color: #0056b3;
|
|
|
|
|
box-shadow: inset 2px 2px 8px rgba(0, 0, 0, 0.3);
|
|
|
|
|
transform: translateY(2px);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.button:hover:not(:disabled) {
|
|
|
|
|
background-color: #1e90ff;
|
|
|
|
|
box-shadow: inset -4px -4px 10px rgba(0, 0, 0, 0.2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.button:active {
|
|
|
|
|
.button:active:not(:disabled) {
|
|
|
|
|
background-color: #0056b3;
|
|
|
|
|
box-shadow: inset 2px 2px 8px rgba(0, 0, 0, 0.3);
|
|
|
|
|
transform: translateY(2px);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.button:disabled {
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|