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