diff --git a/src/App.vue b/src/App.vue
index ee7e9d8..ac36a21 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -167,4 +167,31 @@ button::after {
top: -1000px;
left: 0;
}
+.round-end-tip {
+ width: 100%;
+ color: #fff;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+}
+.round-end-tip > view:nth-child(2) {
+ margin: 15px 0;
+ font-size: 24px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+.round-end-tip > view:nth-child(2) > text:nth-child(2),
+.round-end-tip > view:nth-child(2) > text:nth-child(4) {
+ color: #fed847;
+ width: 30px;
+ text-align: center;
+ font-size: 30px;
+}
+.round-end-tip > text:nth-child(3),
+.round-end-tip > text:nth-child(4) {
+ color: #fff9;
+ font-size: 14px;
+ margin-bottom: 10px;
+}
diff --git a/src/components/AppFooter.vue b/src/components/AppFooter.vue
index e698de0..deddac7 100644
--- a/src/components/AppFooter.vue
+++ b/src/components/AppFooter.vue
@@ -18,7 +18,7 @@ const tabs = [
];
function handleTabClick(index) {
- if (index !== 2 && !user.value.id) return props.signin();
+ if (index !== 0 && !user.value.id) return props.signin();
if (index === 0) {
uni.navigateTo({
url: "/pages/be-vip",
diff --git a/src/components/SButton.vue b/src/components/SButton.vue
index 9389502..b36eb85 100644
--- a/src/components/SButton.vue
+++ b/src/components/SButton.vue
@@ -1,5 +1,6 @@
diff --git a/src/components/Swiper.vue b/src/components/Swiper.vue
index 671bbae..97e1b14 100644
--- a/src/components/Swiper.vue
+++ b/src/components/Swiper.vue
@@ -50,9 +50,8 @@ const handleChange = (e) => {
diff --git a/src/pages/be-vip.vue b/src/pages/be-vip.vue
index 289fb6f..b91e3cc 100644
--- a/src/pages/be-vip.vue
+++ b/src/pages/be-vip.vue
@@ -6,14 +6,12 @@ import SButton from "@/components/SButton.vue";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
-const { user } = storeToRefs(store);
+const { user, config } = storeToRefs(store);
-const vipChoosen = ref(0);
-
-const vips = [1, 3, 6, 12];
+const selectedVIP = ref(0);
const chooseVip = (index) => {
- vipChoosen.value = index;
+ selectedVIP.value = index;
};
const onPay = () => {
@@ -61,19 +59,19 @@ const onPay = () => {
- {{ item }}个月会员
+ {{ item.name }}
@@ -140,15 +138,15 @@ const onPay = () => {
}
.vip-items {
width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
+ display: grid;
+ grid-template-columns: repeat(4, 23.5%);
padding: 10px;
+ row-gap: 5%;
+ column-gap: 2%;
}
.vip-items > view {
border: 1px solid #eee;
padding: 12px 0;
- width: 23%;
border-radius: 10px;
text-align: center;
}
diff --git a/src/pages/friend-battle.vue b/src/pages/friend-battle.vue
index 57380ba..f6d9e7f 100644
--- a/src/pages/friend-battle.vue
+++ b/src/pages/friend-battle.vue
@@ -11,12 +11,13 @@ import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
+import { debounce } from "@/util";
const showModal = ref(false);
const warnning = ref("");
const roomNumber = ref("");
-const enterRoom = async () => {
+const enterRoom = debounce(async () => {
if (!roomNumber.value) {
warnning.value = "请输入房间号";
showModal.value = true;
@@ -28,6 +29,7 @@ const enterRoom = async () => {
);
if (!alreadyIn) await joinRoomAPI(roomNumber.value);
roomNumber.value = "";
+ showModal.value = false;
uni.navigateTo({
url: `/pages/battle-room?roomNumber=${room.number}`,
});
@@ -36,8 +38,8 @@ const enterRoom = async () => {
showModal.value = true;
}
}
-};
-const createRoom = () => {
+});
+const onCreateRoom = () => {
warnning.value = "";
showModal.value = true;
};
@@ -74,7 +76,7 @@ const createRoom = () => {
-
+
创建约战房
diff --git a/src/pages/my-device.vue b/src/pages/my-device.vue
index 074c99b..fa8ca55 100644
--- a/src/pages/my-device.vue
+++ b/src/pages/my-device.vue
@@ -42,7 +42,7 @@ const handleScan = () => {
};
const confirmBind = async () => {
- if (addDevice.value.id) {
+ if (!justBind.value && addDevice.value.id) {
await bindDeviceAPI(addDevice.value);
updateDevice(addDevice.value.id, addDevice.value.name);
confirmBindTip.value = false;
diff --git a/src/pages/team-match.vue b/src/pages/team-match.vue
index 73c7c45..89a5b68 100644
--- a/src/pages/team-match.vue
+++ b/src/pages/team-match.vue
@@ -216,31 +216,4 @@ onUnmounted(() => {
.container {
width: 100%;
}
-.round-end-tip {
- width: 100%;
- color: #fff;
- display: flex;
- flex-direction: column;
- align-items: center;
-}
-.round-end-tip > view:nth-child(2) {
- margin: 15px 0;
- font-size: 24px;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-.round-end-tip > view:nth-child(2) > text:nth-child(2),
-.round-end-tip > view:nth-child(2) > text:nth-child(4) {
- color: #fed847;
- width: 30px;
- text-align: center;
- font-size: 30px;
-}
-.round-end-tip > text:nth-child(3),
-.round-end-tip > text:nth-child(4) {
- color: #fff9;
- font-size: 14px;
- margin-bottom: 10px;
-}
diff --git a/src/util.js b/src/util.js
index 4235f97..7e3f990 100644
--- a/src/util.js
+++ b/src/util.js
@@ -1,3 +1,20 @@
+export const debounce = (fn, delay = 300) => {
+ let timer = null;
+ return async (...args) => {
+ if (timer) clearTimeout(timer);
+ return new Promise((resolve) => {
+ timer = setTimeout(async () => {
+ try {
+ const result = await fn(...args);
+ resolve(result);
+ } finally {
+ timer = null;
+ }
+ }, delay);
+ });
+ };
+};
+
export function renderScores(ctx, arrows = []) {
let rowIndex = 0;
arrows.forEach((item, i) => {