diff --git a/src/components/Container.vue b/src/components/Container.vue
index f0dcc02..7096157 100644
--- a/src/components/Container.vue
+++ b/src/components/Container.vue
@@ -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",
+ });
+};
@@ -139,12 +142,8 @@ const goBack = () => {
-
diff --git a/src/pages/index.vue b/src/pages/index.vue
index 6c2207a..2058279 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -24,6 +24,7 @@ const { updateConfig, updateUser, updateDevice, updateRank, getLvlName } =
const { user, device, rankData } = storeToRefs(store);
const showModal = ref(false);
const showGuide = ref(false);
+const calibration = ref(false);
const toPage = (path) => {
if (!user.value.id) {
@@ -39,6 +40,9 @@ const toPage = (path) => {
icon: "none",
});
}
+ if (!calibration.value) {
+ return uni.$showHint(4);
+ }
if ("/pages/first-try".indexOf(path) === -1 && !user.value.trio) {
return uni.showToast({
title: "请先完成新手试炼",
@@ -99,12 +103,9 @@ onMounted(async () => {
console.log("全局配置:", config);
});
-const comingSoon = () => {
- uni.showToast({
- title: "敬请期待",
- icon: "none",
- });
-};
+onShow(() => {
+ calibration.value = uni.getStorageSync("calibration");
+});
onShareAppMessage(() => {
return {
@@ -234,59 +235,6 @@ onShareTimeline(() => {
-
@@ -439,60 +387,6 @@ onShareTimeline(() => {
margin-left: 2px;
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 {
display: flex;
margin-top: 20px;
diff --git a/src/pages/ranking.vue b/src/pages/ranking.vue
index 9bc3bd4..2456390 100644
--- a/src/pages/ranking.vue
+++ b/src/pages/ranking.vue
@@ -26,6 +26,7 @@ const seasonData = ref([]);
const rankData = ref({ user: {} });
const showSeasonList = ref(false);
const currentSeasonData = ref(defaultSeasonData);
+const calibration = ref(false);
const handleSelect = (index) => {
selectedIndex.value = index;
@@ -47,6 +48,9 @@ const toMatchPage = async (gameType, teamSize) => {
icon: "none",
});
}
+ if (!calibration.value) {
+ return uni.$showHint(4);
+ }
if (!user.value.trio) {
return uni.showToast({
title: "请先完成新手试炼",
@@ -117,6 +121,7 @@ const updateData = () => {
}
};
onShow(async () => {
+ calibration.value = uni.getStorageSync("calibration");
const result = await getHomeData();
rankData.value = result;
handleSelect(selectedIndex.value);