update:修复日志和防抖

This commit is contained in:
2026-07-09 14:35:48 +08:00
parent f8efe4c4a4
commit 12729a1cef
5 changed files with 106 additions and 31 deletions
+22 -10
View File
@@ -27,6 +27,7 @@ const data = ref({});
const roomID = ref("");
const loading = ref(false);
const showLimitModal = ref(false);
const createRoomLoading = ref(false);
const isSVip = computed(() => user.value.sVip === true);
const isVip = computed(() => user.value.vip === true && !isSVip.value);
const challengeLimitText = computed(() =>
@@ -45,6 +46,7 @@ const enterRoom = debounce(async (number) => {
showModal.value = true;
return;
}
loading.value = true;
try {
const room = await getRoomAPI(number);
if (!room.number) {
@@ -63,7 +65,6 @@ const enterRoom = debounce(async (number) => {
return;
}
}
loading.value = true;
uni.navigateTo({
url: "/pages/battle-room?roomNumber=" + number,
});
@@ -71,16 +72,22 @@ const enterRoom = debounce(async (number) => {
loading.value = false;
}
});
const onCreateRoom = async () => {
const onCreateRoom = debounce(async () => {
if (createRoomLoading.value) return;
if (!canEenter(user.value, device.value, online.value)) return;
const countData = await loadDailyCount();
if (isLimitReached(countData.challenge)) {
showLimitModal.value = true;
return;
createRoomLoading.value = true;
try {
const countData = await loadDailyCount();
if (isLimitReached(countData.challenge)) {
showLimitModal.value = true;
return;
}
warnning.value = "";
showModal.value = true;
} finally {
createRoomLoading.value = false;
}
warnning.value = "";
showModal.value = true;
};
});
const closeLimitModal = () => {
showLimitModal.value = false;
@@ -208,7 +215,12 @@ onLoad(async (options) => {
<view v-if="challengeLimitText" class="pp-text">
{{ challengeLimitText }}
</view>
<SButton width="80%" :rounded="30" :onClick="() => $clickSound(onCreateRoom)">
<SButton
width="80%"
:rounded="30"
:disabled="createRoomLoading"
:onClick="() => { $clickSound(); return onCreateRoom(); }"
>
创建约战房
</SButton>
</view>