diff --git a/src/components/app/t-gameNav.vue b/src/components/app/t-gameNav.vue
index ec3ae6c3..a047b79b 100644
--- a/src/components/app/t-gameNav.vue
+++ b/src/components/app/t-gameNav.vue
@@ -5,10 +5,11 @@
{{ navItem.name }}
-
-
+
+
mdi-code-tags-check
+
@@ -36,6 +37,7 @@ const model = defineModel({ default: 2 });
const actId = ref();
const showOverlay = ref(false);
+const loadCode = ref(false);
const nav = shallowRef>([]);
const codeData = shallowRef>([]);
const hasNav = computed(() => {
@@ -60,6 +62,7 @@ async function loadNav(): Promise {
try {
nav.value = await ApiHubReq.home(model.value);
console.debug(`[TGameNav][loadNav] 组件数据:`, nav.value);
+ if (loadCode.value) loadCode.value = false;
} catch (e) {
await TGLogger.Error(`[TGameNav][loadNav] 加载组件数据失败:${e}`);
}
@@ -70,9 +73,11 @@ async function loadNav(): Promise {
* @returns {Promise}
*/
async function tryGetCode(): Promise {
- if (!hasNav.value) return;
+ if (!hasNav.value || loadCode.value) return;
+ loadCode.value = true;
const actIdFind = new URL(hasNav.value.app_path).searchParams.get("act_id");
if (!actIdFind) {
+ loadCode.value = false;
showSnackbar.warn("未找到活动ID");
await TGLogger.Warn(`[TGameNav][tryGetCode] 未找到活动ID,链接:${hasNav.value.app_path}`);
return;
@@ -80,6 +85,7 @@ async function tryGetCode(): Promise {
actId.value = actIdFind;
const res = await OtherApi.code(actIdFind);
if (!Array.isArray(res)) {
+ loadCode.value = false;
showSnackbar.warn(`[${res.retcode}] ${res.message}`);
await TGLogger.Warn(`[TGameNav][tryGetCode] 获取兑换码失败:${JSON.stringify(res)}`);
return;
@@ -88,6 +94,7 @@ async function tryGetCode(): Promise {
console.debug(`[TGameNave][tryGetCode] 兑换码数据:`, codeData.value);
showSnackbar.success("获取兑换码成功");
showOverlay.value = true;
+ loadCode.value = false;
}
/**