From bc60d227826398066b3b20db447d6cc44269d2c5 Mon Sep 17 00:00:00 2001 From: speakeloudest Date: Thu, 17 Sep 2026 11:28:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=BE=E5=A4=87=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/user-center/DeviceList.vue | 20 ++++++++++---------- src/pages/UserCenter/index.vue | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/user-center/DeviceList.vue b/src/components/user-center/DeviceList.vue index 4a7f156..c3e5457 100644 --- a/src/components/user-center/DeviceList.vue +++ b/src/components/user-center/DeviceList.vue @@ -16,7 +16,7 @@
设备: {{ getDeviceTypeInfo(device.user_agent)?.type }} SN: {{ device?.identifier?.slice(0, 4) }}{{ device.id }} + >SN: {{ device.device_no }}
@@ -36,6 +36,7 @@ interface Device { name: string user_agent: string identifier: string + device_no: string type: 'mobile' | 'desktop' deviceId: string } @@ -65,19 +66,18 @@ interface DeviceTypeInfo { * @param userAgent 浏览器代理字符串 */ const getDeviceTypeInfo = (userAgent: string): DeviceTypeInfo => { - // 转换为小写以便进行不区分大小写的匹配 const ua = userAgent.toLowerCase() - if (ua.includes('ipad')) { - return { type: 'iPad', iconComponent: Tablet } - } - if (ua.includes('iphone') || ua.includes('ios')) { - return { type: 'iPhone', iconComponent: Smartphone } - } if (ua.includes('android')) { return { type: 'Android', iconComponent: Smartphone } } - if (ua.includes('mac') || ua.includes('macos')) { + if (userAgent.includes('iPhone') || ua.includes('ios')) { + return { type: 'iPhone', iconComponent: Smartphone } + } + if (userAgent.includes('iPad')) { + return { type: 'iPad', iconComponent: Tablet } + } + if (ua.includes('mac')) { return { type: 'Mac', iconComponent: Laptop } } if (ua.includes('windows')) { @@ -87,6 +87,6 @@ const getDeviceTypeInfo = (userAgent: string): DeviceTypeInfo => { return { type: 'Linux', iconComponent: Cpu } } - return { type: 'Unknown', iconComponent: HelpCircle } + return { type: '未知设备', iconComponent: HelpCircle } } diff --git a/src/pages/UserCenter/index.vue b/src/pages/UserCenter/index.vue index 88bca7b..876c050 100644 --- a/src/pages/UserCenter/index.vue +++ b/src/pages/UserCenter/index.vue @@ -334,6 +334,7 @@ async function init() { .get('/api/v1/public/user/info') .then((res: any) => { devices.value = res.user_devices + console.log(res.user_devices) const emailInfo = res.auth_methods?.find((item: any) => item.auth_type === 'email') if (emailInfo) { userSubInfo.value.email = emailInfo.auth_identifier