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