From 7fff0b31b41694a2c18332f392e62a560a12dcab Mon Sep 17 00:00:00 2001 From: u2nyakim Date: Fri, 29 Aug 2025 10:16:25 +0800 Subject: [PATCH] =?UTF-8?q?up.=20=E4=BD=BF=E7=94=A8=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=99=A8=E7=AE=A1=E7=90=86=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- z_ele/src/layout/components/lock-dialog.vue | 38 +++++++++++++++------ z_ele/src/utils/request.ts | 17 ++++----- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/z_ele/src/layout/components/lock-dialog.vue b/z_ele/src/layout/components/lock-dialog.vue index cbccd14..cc4b7ea 100644 --- a/z_ele/src/layout/components/lock-dialog.vue +++ b/z_ele/src/layout/components/lock-dialog.vue @@ -18,7 +18,7 @@ placeholder="请输入临时锁定密码/为空则使用默认使用账号密码" />
- 锁定客户端
@@ -27,23 +27,39 @@ diff --git a/z_ele/src/utils/request.ts b/z_ele/src/utils/request.ts index fbcd20c..61b53b0 100644 --- a/z_ele/src/utils/request.ts +++ b/z_ele/src/utils/request.ts @@ -8,13 +8,21 @@ import { API_BASE_URL, LAYOUT_PATH } from '@/config/setting'; import type { ApiResult } from '@/api'; import router from '@/router'; import { isWhiteList } from '@/router/routes'; -import {getClientInfo, getToken, setToken} from './token-util'; +import { getToken, setToken } from './token-util'; import {logout, showLogoutConfirm, toURLSearch} from './common'; +import {useClientStore} from "@/store/modules/client"; /** * 请求拦截处理 */ export function requestInterceptor(config: InternalAxiosRequestConfig) { + // 添加客户端信息到header + const client = useClientStore(); + if(config.headers) { + config.headers['Client'] = client.clientName + config.headers['Client-Id'] = client.clientId; + config.headers['Client-Version'] = client.clientVersion; + } // 添加token到header const token = getToken(); if (token && config.headers) { @@ -25,13 +33,6 @@ export function requestInterceptor(config: InternalAxiosRequestConfig) { config.url = toURLSearch(config.params, config.url); config.params = {}; } - // 客户端信息 - let clientInfo = getClientInfo(); - if(clientInfo) { - config.headers['Client'] = clientInfo.name; - config.headers['Client-Id'] = clientInfo.id; - config.headers['Client-Version'] = clientInfo.version; - } } /**