添加射箭前校准提示
This commit is contained in:
@@ -68,39 +68,36 @@ onShow(() => {
|
||||
|
||||
const backToGame = debounce(async () => {
|
||||
if (isLoading.value) return; // 防止重复点击
|
||||
|
||||
|
||||
try {
|
||||
isLoading.value = true;
|
||||
|
||||
|
||||
// 设置请求超时
|
||||
const timeoutPromise = new Promise((_, reject) => {
|
||||
setTimeout(() => reject(new Error('请求超时')), 10000); // 10秒超时
|
||||
setTimeout(() => reject(new Error("请求超时")), 10000); // 10秒超时
|
||||
});
|
||||
|
||||
const result = await Promise.race([
|
||||
getCurrentGameAPI(),
|
||||
timeoutPromise
|
||||
]);
|
||||
|
||||
|
||||
const result = await Promise.race([getCurrentGameAPI(), timeoutPromise]);
|
||||
|
||||
// 处理返回结果
|
||||
if (result && result.gameId) {
|
||||
// 跳转到游戏页面
|
||||
uni.navigateTo({
|
||||
url: `/pages/battle-room?gameId=${result.gameId}`
|
||||
url: `/pages/battle-room?gameId=${result.gameId}`,
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '没有进行中的对局',
|
||||
icon: 'none'
|
||||
title: "没有进行中的对局",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
showHint.value = false;
|
||||
} catch (error) {
|
||||
console.error('获取当前游戏失败:', error);
|
||||
console.error("获取当前游戏失败:", error);
|
||||
uni.showToast({
|
||||
title: error.message || '网络请求失败,请重试',
|
||||
icon: 'none'
|
||||
title: error.message || "网络请求失败,请重试",
|
||||
icon: "none",
|
||||
});
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
@@ -110,6 +107,12 @@ const backToGame = debounce(async () => {
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
const goCalibration = () => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/calibration",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -139,12 +142,8 @@ const goBack = () => {
|
||||
<button hover-class="none" @click="() => (showHint = false)">
|
||||
不进入
|
||||
</button>
|
||||
<button
|
||||
hover-class="none"
|
||||
@click="backToGame"
|
||||
:disabled="isLoading"
|
||||
>
|
||||
{{ isLoading ? '加载中...' : '进入' }}
|
||||
<button hover-class="none" @click="backToGame" :disabled="isLoading">
|
||||
{{ isLoading ? "加载中..." : "进入" }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -167,6 +166,15 @@ const goBack = () => {
|
||||
<button hover-class="none" @click="goBack">确认</button>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="hintType === 4" class="tip-content">
|
||||
<text>完成智能弓校准,即可解锁全部功能</text>
|
||||
<view>
|
||||
<button hover-class="none" @click="() => (showHint = false)">
|
||||
取消
|
||||
</button>
|
||||
<button hover-class="none" @click="goCalibration">去校准</button>
|
||||
</view>
|
||||
</view>
|
||||
</ScreenHint>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user