From a2ff5b065e0efc182cca9e13aaf55b39985bb9cb Mon Sep 17 00:00:00 2001 From: "fengchuanhn@gmail.com" Date: Fri, 22 May 2026 16:25:19 +0800 Subject: [PATCH] 1 --- src-tauri/src/api_client.rs | 16 +++---- src/api/oemUsers.js | 2 +- src/views/oem/OemCardKeysView.vue | 39 +++------------ src/views/oem/OemUsersView.vue | 79 +++++++++---------------------- 4 files changed, 37 insertions(+), 99 deletions(-) diff --git a/src-tauri/src/api_client.rs b/src-tauri/src/api_client.rs index a89ab3c..85e6ffc 100644 --- a/src-tauri/src/api_client.rs +++ b/src-tauri/src/api_client.rs @@ -160,19 +160,17 @@ pub async fn send_heartbeat(token: &str) -> Result<(), String> { let server_code = response_server_verify_code(&value); if server_code != Some(expected.as_str()) { - return Err("会员已过期".into()); } - if let Some(ok) = value.get("ok").and_then(|v| v.as_bool()) { - if !ok { - let msg = value - .get("message") - .and_then(|m| m.as_str()) - .unwrap_or("心跳校验失败"); - return Err(msg.to_string()); - } + if value.get("ok").and_then(|v| v.as_bool()) == Some(false) { + let msg = value + .get("message") + .and_then(|m| m.as_str()) + .unwrap_or("心跳校验失败"); + return Err(msg.to_string()); } + Ok(()) } diff --git a/src/api/oemUsers.js b/src/api/oemUsers.js index 0be1dc3..4b48330 100644 --- a/src/api/oemUsers.js +++ b/src/api/oemUsers.js @@ -25,7 +25,7 @@ function oemRequest(token, path, options = {}) { * roleId?: number | null, * }} [params] */ -export function listAgentUsersApi( +export function listOemUsersApi( token, { page = 1, pageSize = 20, username, oemId, agentId, roleId } = {}, ) { diff --git a/src/views/oem/OemCardKeysView.vue b/src/views/oem/OemCardKeysView.vue index 36e960d..04a31fe 100644 --- a/src/views/oem/OemCardKeysView.vue +++ b/src/views/oem/OemCardKeysView.vue @@ -7,7 +7,7 @@ import { updateAdminCardKeyApi, deleteAdminCardKeyApi, } from "../../api/oemCardKeys.js"; -import { listAgentUsersApi } from "../../api/oemUsers.js"; +import { listOemUsersApi } from "../../api/oemUsers.js"; const auth = useAuthStore(); @@ -93,7 +93,7 @@ function showMessage(severity, message) { async function loadFilterOptions() { const [ agentRes] = await Promise.all([ - listAgentUsersApi(auth.token, { page: 1, pageSize: 200, roleId: ROLE_AGENT }), + listOemUsersApi(auth.token, { page: 1, pageSize: 200, roleId: ROLE_AGENT }), ]); if (agentRes.ok && Array.isArray(agentRes.data?.items)) { @@ -304,16 +304,7 @@ onMounted(async () => { class="admin-users__search" @keyup.enter="applyFilters" /> - { - - - +