diff --git a/src/components/BowData.vue b/src/components/BowData.vue
index 34ec99e..a0715db 100644
--- a/src/components/BowData.vue
+++ b/src/components/BowData.vue
@@ -53,6 +53,7 @@ const props = defineProps({
:total="arrows.length"
:scores="arrows.map((a) => a.ring)"
/>
+ 长按保存本次靶纸
@@ -69,6 +70,11 @@ const props = defineProps({
align-items: center;
z-index: 10;
}
+.container > text:last-child {
+ font-size: 14px;
+ color: #fff9;
+ margin-top: 20px;
+}
.header {
display: flex;
justify-content: space-between;
@@ -79,6 +85,7 @@ const props = defineProps({
.header > view:first-child {
display: flex;
align-items: center;
+ margin-left: 10px;
}
.header > view:first-child > view:last-child {
display: flex;
diff --git a/src/components/BowPower.vue b/src/components/BowPower.vue
index d43ce57..c42d641 100644
--- a/src/components/BowPower.vue
+++ b/src/components/BowPower.vue
@@ -8,7 +8,7 @@ defineProps({
-
+
电量{{ power }}%
diff --git a/src/components/BowTarget.vue b/src/components/BowTarget.vue
index 08bb0ae..bf26e7c 100644
--- a/src/components/BowTarget.vue
+++ b/src/components/BowTarget.vue
@@ -43,14 +43,16 @@ const props = defineProps({
const showRoundTips = ref(false);
const showLatestArrow = ref(false);
const prevLength = ref(0);
+const timer = ref(null);
watch(
() => props.scores,
(newVal) => {
if (newVal.length - prevLength.value === 1) {
+ if (timer.value) clearTimeout(timer.value);
showRoundTips.value = true;
showLatestArrow.value = true;
- setTimeout(() => {
+ timer.value = setTimeout(() => {
showRoundTips.value = false;
}, 1000);
}
@@ -80,7 +82,7 @@ function calcRealY(num) {
"/" +
totalRound
}}
-
+
view:nth-child(3) {
display: flex;
diff --git a/src/components/SButton.vue b/src/components/SButton.vue
index 8cd55de..7881366 100644
--- a/src/components/SButton.vue
+++ b/src/components/SButton.vue
@@ -50,5 +50,6 @@ const props = defineProps({
display: flex;
justify-content: center;
align-items: center;
+ color: #000;
}
diff --git a/src/components/Signin.vue b/src/components/Signin.vue
index 9f044ef..9f78069 100644
--- a/src/components/Signin.vue
+++ b/src/components/Signin.vue
@@ -96,6 +96,7 @@ const handleLogin = () => {
type="nickname"
class="nickname-input"
placeholder="请输入昵称"
+ placeholder-style="color: #ccc"
@change="onNicknameChange"
@blur="onNicknameBlur"
/>
diff --git a/src/pages/battle-room.vue b/src/pages/battle-room.vue
index 3f3e338..a90a9ae 100644
--- a/src/pages/battle-room.vue
+++ b/src/pages/battle-room.vue
@@ -90,7 +90,6 @@ async function onReceiveMessage(content) {
messages.forEach((msg) => {
if (
msg.roomNumber === roomNumber.value ||
- (battleId.value && msg.id === battleId.value) ||
msg.constructor === MESSAGETYPES.WaitForAllReady
) {
console.log("收到消息:", msg);
@@ -187,9 +186,9 @@ onMounted(() => {
onUnmounted(() => {
uni.$off("socket-inbox", onReceiveMessage);
if (owner.value) {
- destroyRoomAPI(room.value.id);
+ destroyRoomAPI(roomNumber.value);
} else {
- exitRoomAPI(room.value.id);
+ exitRoomAPI(roomNumber.value);
}
});
diff --git a/src/pages/first-try.vue b/src/pages/first-try.vue
index 1da48e1..7afc4c0 100644
--- a/src/pages/first-try.vue
+++ b/src/pages/first-try.vue
@@ -77,6 +77,9 @@ const nextStep = async () => {
scores.value = [];
await createPractise(total);
step.value = 4;
+ setTimeout(() => {
+ start.value = true;
+ }, 500);
} else if (step.value === 5) {
uni.navigateBack({
delta: 1,
diff --git a/src/pages/index.vue b/src/pages/index.vue
index e97af44..7d26d2f 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -11,7 +11,7 @@ import { storeToRefs } from "pinia";
const store = useStore();
const { updateConfig, updateUser, updateDevice } = store;
// 使用storeToRefs,用于UI里显示,保持响应性
-const { user } = storeToRefs(store);
+const { user, device } = storeToRefs(store);
const showModal = ref(false);
const toPage = (path) => {
@@ -68,7 +68,9 @@ onMounted(async () => {
mode="widthFix"
@click="() => toPage('/pages/my-device')"
/>
- 我的弓箭
+ {{
+ user.id && !device.deviceId ? "请绑定设备" : "我的弓箭"
+ }}
{
-
+
diff --git a/src/pages/melee-match.vue b/src/pages/melee-match.vue
index 4a7ed1f..6fca600 100644
--- a/src/pages/melee-match.vue
+++ b/src/pages/melee-match.vue
@@ -25,6 +25,7 @@ const totalRounds = ref(0);
const power = ref(0);
const scores = ref([]);
const tips = ref("即将开始...");
+const seq = ref(0);
const timerSeq = ref(0);
const players = ref([]);
const playersScores = ref({});
@@ -83,13 +84,14 @@ async function onReceiveMessage(content) {
if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
totalRounds.value = msg.groupUserStatus.config.maxRounds;
start.value = true;
+ seq.value += 1;
timerSeq.value = 0;
tips.value = "请在90秒内射完12支箭";
scores.value = [];
}
if (msg.constructor === MESSAGETYPES.ShootResult) {
if (msg.userId === user.value.id) {
- scores.value = [msg.target];
+ scores.value.push(msg.target);
power.value = msg.target.battery;
}
playersScores.value[msg.userId].push(msg.target);
@@ -125,7 +127,7 @@ onUnmounted(() => {
-
+
{
{
:avatar="user.avatarUrl"
:power="power"
:scores="scores"
+ :tips="
+ !start && scores.length > 0
+ ? `本次射程${scores[scores.length - 1].dst / 100}米,${
+ scores[scores.length - 1].dst / 100 >= 5 ? '已' : '未'
+ }达到距离要求`
+ : ''
+ "
/>
{
await createPractiseAPI(total);
start.value = true;
+ scores.value = [];
};
async function onReceiveMessage(content) {
const messages = JSON.parse(content).data.updates || [];
messages.forEach((msg) => {
- if (start.value && msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
+ if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
scores.value.push(msg.target);
+ power.value = msg.target.battery;
if (scores.value.length === total) {
showScore.value = true;
}
@@ -59,13 +61,24 @@ onUnmounted(() => {
-
+