feat(device): 实现设备与账号绑定管理机制
- 引入 ClientAccountDevice 表管理设备与账号绑定关系 - 重构设备注册逻辑,支持多账号绑定同一设备 - 新增设备配额检查,基于账号维度限制设备数量 -优化设备移除逻辑,仅解除绑定而非物理删除- 改进设备列表查询,通过账号ID关联获取设备信息 - 更新心跳任务,支持向设备绑定的所有账号发送心跳 - 调整设备API参数,增加username字段用于权限校验 -修复HTTP请求编码问题,统一使用UTF-8字符集 - 增强错误处理,携带错误码信息便于前端识别 - 移除设备表中的username字段,解耦设备与用户名关联
This commit is contained in:
@@ -13,6 +13,7 @@ interface Emits {
|
||||
(e: 'update:modelValue', value: boolean): void
|
||||
(e: 'loginSuccess', data: { token: string; permissions?: string; expireTime?: string; accountType?: string; deviceTrialExpired?: boolean }): void
|
||||
(e: 'showRegister'): void
|
||||
(e: 'deviceConflict', username: string): void
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
@@ -49,8 +50,14 @@ async function handleAuth() {
|
||||
})
|
||||
ElMessage.success('登录成功')
|
||||
resetForm()
|
||||
} catch (err) {
|
||||
ElMessage.error((err as Error).message)
|
||||
} catch (err: any) {
|
||||
// 设备冲突/数量达上限:触发设备管理
|
||||
if (err.code === 501 ) {
|
||||
emit('deviceConflict', authForm.value.username)
|
||||
resetForm()
|
||||
} else {
|
||||
ElMessage.error(err.message || '登录失败')
|
||||
}
|
||||
} finally {
|
||||
authLoading.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user