添加射箭前校准提示
This commit is contained in:
@@ -68,39 +68,36 @@ onShow(() => {
|
|||||||
|
|
||||||
const backToGame = debounce(async () => {
|
const backToGame = debounce(async () => {
|
||||||
if (isLoading.value) return; // 防止重复点击
|
if (isLoading.value) return; // 防止重复点击
|
||||||
|
|
||||||
try {
|
try {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
|
|
||||||
// 设置请求超时
|
// 设置请求超时
|
||||||
const timeoutPromise = new Promise((_, reject) => {
|
const timeoutPromise = new Promise((_, reject) => {
|
||||||
setTimeout(() => reject(new Error('请求超时')), 10000); // 10秒超时
|
setTimeout(() => reject(new Error("请求超时")), 10000); // 10秒超时
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await Promise.race([
|
const result = await Promise.race([getCurrentGameAPI(), timeoutPromise]);
|
||||||
getCurrentGameAPI(),
|
|
||||||
timeoutPromise
|
|
||||||
]);
|
|
||||||
|
|
||||||
// 处理返回结果
|
// 处理返回结果
|
||||||
if (result && result.gameId) {
|
if (result && result.gameId) {
|
||||||
// 跳转到游戏页面
|
// 跳转到游戏页面
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/battle-room?gameId=${result.gameId}`
|
url: `/pages/battle-room?gameId=${result.gameId}`,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '没有进行中的对局',
|
title: "没有进行中的对局",
|
||||||
icon: 'none'
|
icon: "none",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showHint.value = false;
|
showHint.value = false;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取当前游戏失败:', error);
|
console.error("获取当前游戏失败:", error);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.message || '网络请求失败,请重试',
|
title: error.message || "网络请求失败,请重试",
|
||||||
icon: 'none'
|
icon: "none",
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
@@ -110,6 +107,12 @@ const backToGame = debounce(async () => {
|
|||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const goCalibration = () => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/calibration",
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -139,12 +142,8 @@ const goBack = () => {
|
|||||||
<button hover-class="none" @click="() => (showHint = false)">
|
<button hover-class="none" @click="() => (showHint = false)">
|
||||||
不进入
|
不进入
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button hover-class="none" @click="backToGame" :disabled="isLoading">
|
||||||
hover-class="none"
|
{{ isLoading ? "加载中..." : "进入" }}
|
||||||
@click="backToGame"
|
|
||||||
:disabled="isLoading"
|
|
||||||
>
|
|
||||||
{{ isLoading ? '加载中...' : '进入' }}
|
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -167,6 +166,15 @@ const goBack = () => {
|
|||||||
<button hover-class="none" @click="goBack">确认</button>
|
<button hover-class="none" @click="goBack">确认</button>
|
||||||
</view>
|
</view>
|
||||||
</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>
|
</ScreenHint>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const { updateConfig, updateUser, updateDevice, updateRank, getLvlName } =
|
|||||||
const { user, device, rankData } = storeToRefs(store);
|
const { user, device, rankData } = storeToRefs(store);
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
const showGuide = ref(false);
|
const showGuide = ref(false);
|
||||||
|
const calibration = ref(false);
|
||||||
|
|
||||||
const toPage = (path) => {
|
const toPage = (path) => {
|
||||||
if (!user.value.id) {
|
if (!user.value.id) {
|
||||||
@@ -39,6 +40,9 @@ const toPage = (path) => {
|
|||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (!calibration.value) {
|
||||||
|
return uni.$showHint(4);
|
||||||
|
}
|
||||||
if ("/pages/first-try".indexOf(path) === -1 && !user.value.trio) {
|
if ("/pages/first-try".indexOf(path) === -1 && !user.value.trio) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: "请先完成新手试炼",
|
title: "请先完成新手试炼",
|
||||||
@@ -99,12 +103,9 @@ onMounted(async () => {
|
|||||||
console.log("全局配置:", config);
|
console.log("全局配置:", config);
|
||||||
});
|
});
|
||||||
|
|
||||||
const comingSoon = () => {
|
onShow(() => {
|
||||||
uni.showToast({
|
calibration.value = uni.getStorageSync("calibration");
|
||||||
title: "敬请期待",
|
});
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onShareAppMessage(() => {
|
onShareAppMessage(() => {
|
||||||
return {
|
return {
|
||||||
@@ -234,59 +235,6 @@ onShareTimeline(() => {
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="region-stats">
|
|
||||||
<view
|
|
||||||
v-for="(region, index) in [
|
|
||||||
{ name: '广东', score: 4291 },
|
|
||||||
{ name: '湖南', score: 3095 },
|
|
||||||
{ name: '内蒙', score: 2342 },
|
|
||||||
{ name: '海南', score: 1812 },
|
|
||||||
{ name: '四川', score: 1293 },
|
|
||||||
]"
|
|
||||||
:key="index"
|
|
||||||
class="region-item"
|
|
||||||
@click="comingSoon"
|
|
||||||
>
|
|
||||||
<image src="../static/region-bg.png" mode="widthFix" />
|
|
||||||
<image
|
|
||||||
v-if="index === 0"
|
|
||||||
src="../static/region-1.png"
|
|
||||||
mode="widthFix"
|
|
||||||
/>
|
|
||||||
<image
|
|
||||||
v-if="index === 1"
|
|
||||||
src="../static/region-2.png"
|
|
||||||
mode="widthFix"
|
|
||||||
/>
|
|
||||||
<image
|
|
||||||
v-if="index === 2"
|
|
||||||
src="../static/region-3.png"
|
|
||||||
mode="widthFix"
|
|
||||||
/>
|
|
||||||
<image
|
|
||||||
v-if="index === 3"
|
|
||||||
src="../static/region-4.png"
|
|
||||||
mode="widthFix"
|
|
||||||
/>
|
|
||||||
<image
|
|
||||||
v-if="index === 4"
|
|
||||||
src="../static/region-5.png"
|
|
||||||
mode="widthFix"
|
|
||||||
/>
|
|
||||||
<text>{{ region.name }}</text>
|
|
||||||
<view>
|
|
||||||
<text :style="{ color: '#fff', marginRight: '2px' }">{{
|
|
||||||
region.score
|
|
||||||
}}</text>
|
|
||||||
<text>分</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="region-more" @click="comingSoon">
|
|
||||||
<image src="../static/region-more.png" mode="widthFix" />
|
|
||||||
<text>...</text>
|
|
||||||
<text>更多</text>
|
|
||||||
</view>
|
|
||||||
</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<SModal :show="showModal" :onClose="() => (showModal = false)">
|
<SModal :show="showModal" :onClose="() => (showModal = false)">
|
||||||
@@ -439,60 +387,6 @@ onShareTimeline(() => {
|
|||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.region-stats {
|
|
||||||
display: flex;
|
|
||||||
grid-template-columns: repeat(6, 1fr);
|
|
||||||
margin-top: 20px;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.region-item,
|
|
||||||
.region-more {
|
|
||||||
border-radius: 10px;
|
|
||||||
text-align: center;
|
|
||||||
position: relative;
|
|
||||||
width: 13vw;
|
|
||||||
height: 13vw;
|
|
||||||
overflow: hidden;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
color: #c5c5c5;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
.region-item > text {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
.region-more {
|
|
||||||
width: 8vw;
|
|
||||||
height: 13vw;
|
|
||||||
}
|
|
||||||
.region-item > image:first-child,
|
|
||||||
.region-more > image:first-child {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
.region-item > image:nth-of-type(2) {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 18px;
|
|
||||||
}
|
|
||||||
.region-item > view:last-child {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
.region-more > text:first-of-type {
|
|
||||||
font-size: 30px;
|
|
||||||
line-height: 20px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
.my-data {
|
.my-data {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ const seasonData = ref([]);
|
|||||||
const rankData = ref({ user: {} });
|
const rankData = ref({ user: {} });
|
||||||
const showSeasonList = ref(false);
|
const showSeasonList = ref(false);
|
||||||
const currentSeasonData = ref(defaultSeasonData);
|
const currentSeasonData = ref(defaultSeasonData);
|
||||||
|
const calibration = ref(false);
|
||||||
|
|
||||||
const handleSelect = (index) => {
|
const handleSelect = (index) => {
|
||||||
selectedIndex.value = index;
|
selectedIndex.value = index;
|
||||||
@@ -47,6 +48,9 @@ const toMatchPage = async (gameType, teamSize) => {
|
|||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (!calibration.value) {
|
||||||
|
return uni.$showHint(4);
|
||||||
|
}
|
||||||
if (!user.value.trio) {
|
if (!user.value.trio) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: "请先完成新手试炼",
|
title: "请先完成新手试炼",
|
||||||
@@ -117,6 +121,7 @@ const updateData = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
onShow(async () => {
|
onShow(async () => {
|
||||||
|
calibration.value = uni.getStorageSync("calibration");
|
||||||
const result = await getHomeData();
|
const result = await getHomeData();
|
||||||
rankData.value = result;
|
rankData.value = result;
|
||||||
handleSelect(selectedIndex.value);
|
handleSelect(selectedIndex.value);
|
||||||
|
|||||||
Reference in New Issue
Block a user