From d9d62e8f8c2cbba40e97c6b62d335521b74727ab Mon Sep 17 00:00:00 2001 From: Sunwuyuan Date: Sun, 16 Nov 2025 14:46:17 +0800 Subject: [PATCH] Refactor API client to remove password handling in token revocation and authorization methods; update UI components to eliminate password input fields and related logic; streamline device management and password management functionalities. --- src/components/DeviceAuthDialog.vue | 46 +- src/components/DeviceSwitcher.vue | 396 +++++++++++++++ src/components/EditDeviceNameDialog.vue | 30 +- src/components/FeatureNavigation.vue | 9 - src/components/ResetDevicePasswordDialog.vue | 274 ---------- src/lib/api.js | 168 +------ src/pages/authorize.vue | 35 +- src/pages/device-management.vue | 32 +- src/pages/index.vue | 271 +++------- src/pages/password-manager.vue | 503 +------------------ 10 files changed, 488 insertions(+), 1276 deletions(-) create mode 100644 src/components/DeviceSwitcher.vue delete mode 100644 src/components/ResetDevicePasswordDialog.vue diff --git a/src/components/DeviceAuthDialog.vue b/src/components/DeviceAuthDialog.vue index 0cb86de..e55c69e 100644 --- a/src/components/DeviceAuthDialog.vue +++ b/src/components/DeviceAuthDialog.vue @@ -24,7 +24,7 @@ const props = defineProps({ }, description: { type: String, - default: '请输入设备 UUID 和密码' + default: '请输入设备 UUID' }, closable: { type: Boolean, @@ -35,9 +35,9 @@ const props = defineProps({ const emit = defineEmits(['update:modelValue', 'success']) const isLoading = ref(false) -const showPassword = ref(false) + const deviceUuid = ref('') -const devicePassword = ref('') + // 监听对话框打开,自动填充 UUID watch(() => props.modelValue, (isOpen) => { @@ -62,21 +62,17 @@ const handleAuth = async () => { toast.error('请输入设备 UUID') return } - if (!devicePassword.value) { - toast.error('请输入设备密码') - return - } isLoading.value = true try { - // 尝试通过 UUID 和密码验证设备 - const deviceInfo = await apiClient.verifyDevicePassword(deviceUuid.value, devicePassword.value) + // 尝试通过 UUID 验证设备 + const deviceInfo = await apiClient.getDeviceInfo(deviceUuid.value) // 验证成功,保存到 deviceStore deviceStore.setDeviceUuid(deviceUuid.value) toast.success('认证成功') - emit('success', deviceUuid.value, devicePassword.value, deviceInfo) + emit('success', deviceUuid.value, deviceInfo) } catch (error) { toast.error('认证失败:' + error.message) } finally { @@ -84,10 +80,7 @@ const handleAuth = async () => { } } -// 切换密码可见性 -const togglePasswordVisibility = () => { - showPassword.value = !showPassword.value -} +