@@ -16,7 +16,7 @@
|
|||||||
<div class="flex flex-col overflow-hidden">
|
<div class="flex flex-col overflow-hidden">
|
||||||
<span class="text-white">设备: {{ getDeviceTypeInfo(device.user_agent)?.type }}</span>
|
<span class="text-white">设备: {{ getDeviceTypeInfo(device.user_agent)?.type }}</span>
|
||||||
<span class="font-mono text-[11px] tracking-tighter uppercase"
|
<span class="font-mono text-[11px] tracking-tighter uppercase"
|
||||||
>SN: {{ device?.identifier?.slice(0, 4) }}{{ device.id }}
|
>SN: {{ device.device_no }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -36,6 +36,7 @@ interface Device {
|
|||||||
name: string
|
name: string
|
||||||
user_agent: string
|
user_agent: string
|
||||||
identifier: string
|
identifier: string
|
||||||
|
device_no: string
|
||||||
type: 'mobile' | 'desktop'
|
type: 'mobile' | 'desktop'
|
||||||
deviceId: string
|
deviceId: string
|
||||||
}
|
}
|
||||||
@@ -65,19 +66,18 @@ interface DeviceTypeInfo {
|
|||||||
* @param userAgent 浏览器代理字符串
|
* @param userAgent 浏览器代理字符串
|
||||||
*/
|
*/
|
||||||
const getDeviceTypeInfo = (userAgent: string): DeviceTypeInfo => {
|
const getDeviceTypeInfo = (userAgent: string): DeviceTypeInfo => {
|
||||||
// 转换为小写以便进行不区分大小写的匹配
|
|
||||||
const ua = userAgent.toLowerCase()
|
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')) {
|
if (ua.includes('android')) {
|
||||||
return { type: 'Android', iconComponent: Smartphone }
|
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 }
|
return { type: 'Mac', iconComponent: Laptop }
|
||||||
}
|
}
|
||||||
if (ua.includes('windows')) {
|
if (ua.includes('windows')) {
|
||||||
@@ -87,6 +87,6 @@ const getDeviceTypeInfo = (userAgent: string): DeviceTypeInfo => {
|
|||||||
return { type: 'Linux', iconComponent: Cpu }
|
return { type: 'Linux', iconComponent: Cpu }
|
||||||
}
|
}
|
||||||
|
|
||||||
return { type: 'Unknown', iconComponent: HelpCircle }
|
return { type: '未知设备', iconComponent: HelpCircle }
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -334,6 +334,7 @@ async function init() {
|
|||||||
.get('/api/v1/public/user/info')
|
.get('/api/v1/public/user/info')
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
devices.value = res.user_devices
|
devices.value = res.user_devices
|
||||||
|
console.log(res.user_devices)
|
||||||
const emailInfo = res.auth_methods?.find((item: any) => item.auth_type === 'email')
|
const emailInfo = res.auth_methods?.find((item: any) => item.auth_type === 'email')
|
||||||
if (emailInfo) {
|
if (emailInfo) {
|
||||||
userSubInfo.value.email = emailInfo.auth_identifier
|
userSubInfo.value.email = emailInfo.auth_identifier
|
||||||
|
|||||||
Reference in New Issue
Block a user