From 9f7ef906bdc125392a0fefbeec9633c3b7fb4607 Mon Sep 17 00:00:00 2001 From: kron Date: Thu, 3 Jul 2025 11:05:31 +0800 Subject: [PATCH] fix bug --- src/components/BowTarget.vue | 8 ++++---- src/components/Signin.vue | 9 +++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/components/BowTarget.vue b/src/components/BowTarget.vue index e728c03..37bf567 100644 --- a/src/components/BowTarget.vue +++ b/src/components/BowTarget.vue @@ -107,12 +107,12 @@ watch( ); function calcRealX(num) { - const len = 20 + num; - return `calc(${(len / 40) * 100}% - 8px)`; + const len = 20.4 + num; + return `calc(${(len / 40.8) * 100}% - 8px)`; } function calcRealY(num) { - const len = num < 0 ? Math.abs(num) + 20 : 20 - num; - return `calc(${(len / 40) * 100}% - 8px)`; + const len = num < 0 ? Math.abs(num) + 20.4 : 20.4 - num; + return `calc(${(len / 40.8) * 100}% - 8px)`; } const simulShoot = async () => { if (device.value.deviceId) await simulShootAPI(device.value.deviceId); diff --git a/src/components/Signin.vue b/src/components/Signin.vue index af41c88..33ee861 100644 --- a/src/components/Signin.vue +++ b/src/components/Signin.vue @@ -2,7 +2,7 @@ import { ref } from "vue"; import Avatar from "@/components/Avatar.vue"; import SButton from "@/components/SButton.vue"; -import { getMyDevicesAPI, loginAPI } from "@/apis"; +import { getMyDevicesAPI, loginAPI, getHomeData } from "@/apis"; import useStore from "@/store"; const store = useStore(); const { updateUser, updateDevice } = store; @@ -54,11 +54,8 @@ const handleLogin = () => { const avatarBase64 = fileManager.readFileSync(avatarUrl.value, "base64"); const base64Url = `data:image/png;base64,${avatarBase64}`; const result = await loginAPI(nickName.value, base64Url, code); - updateUser({ - ...result.user, - nickName: nickName.value, - avatarUrl: avatarUrl.value, - }); + const data = await getHomeData(); + if (data.user) updateUser(data.user); const devices = await getMyDevicesAPI(); if (devices.bindings && devices.bindings.length) { updateDevice(