update
This commit is contained in:
@@ -91,19 +91,31 @@ const circularArea = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 点击隐藏区域显示抽奖弹窗
|
// 点击隐藏区域显示抽奖弹窗
|
||||||
|
//防止多次点击
|
||||||
|
const isRequesting = ref(false)
|
||||||
const handleShowLottery = async () => {
|
const handleShowLottery = async () => {
|
||||||
|
// 如果已经在请求中,直接忽略后续点击
|
||||||
|
if (isRequesting.value) return
|
||||||
|
isRequesting.value = true;
|
||||||
|
|
||||||
const loading = weui.loading()
|
const loading = weui.loading()
|
||||||
globalToastEvent.emit(ToastType.SHOW_LOTTERY);
|
globalToastEvent.emit(ToastType.SHOW_LOTTERY);
|
||||||
|
|
||||||
// 点击隐藏区域后,游戏结束,再次调用game log接口
|
// 点击隐藏区域后,游戏结束,再次调用game log接口
|
||||||
const logId = globalStore.current_game_log_id;
|
try {
|
||||||
let gameLogRes = await Request("game/log", { source: globalStore.game_id, log_id: logId }, "POST");
|
const logId = globalStore.current_game_log_id
|
||||||
if (!gameLogRes || !gameLogRes.res || (gameLogRes.res.status !== 200 && gameLogRes.res.status !== 201)) {
|
const gameLogRes = await Request("game/log", { source: globalStore.game_id, log_id: logId }, "POST")
|
||||||
emit('close')
|
|
||||||
|
if (!gameLogRes || !gameLogRes.res || (gameLogRes.res.status !== 200 && gameLogRes.res.status !== 201)) {
|
||||||
|
emit('close')
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
console.log(gameLogRes)
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
// 不管成功失败,都关闭 loading,并允许再次点击
|
||||||
loading.hide()
|
loading.hide()
|
||||||
return
|
isRequesting.value = false
|
||||||
} else {
|
|
||||||
console.log(gameLogRes)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user