feat(electron-vue-template):重构认证与设备管理模块

- 统一token存取逻辑,封装getToken/setToken/removeToken方法
-优化设备ID获取逻辑,调整API路径
- 完善设备管理接口类型定义,增强类型安全
- 调整SSE连接逻辑,使用统一配置管理- 重构HTTP客户端,集中管理后端服务配置
- 更新认证相关API接口,完善请求/响应类型
- 优化设备列表展示逻辑,移除冗余字段
- 调整图片代理路径,统一API前缀
- 完善用户反馈列表展示功能,增强交互体验
- 移除冗余的错误处理逻辑,简化代码结构
This commit is contained in:
2025-10-16 10:37:00 +08:00
parent 6f04658265
commit 132299c4b7
37 changed files with 2193 additions and 682 deletions

View File

@@ -1,28 +1,37 @@
import { http } from './http'
export interface DeviceItem {
deviceId: string
name?: string
os?: string
status: 'online' | 'offline'
lastActiveAt?: string
isCurrent?: boolean
}
export interface DeviceQuota {
limit: number
used: number
}
export const deviceApi = {
getQuota(username: string) {
// 直接调用 RuoYi 后端的设备配额接口
return http.get('/monitor/device/quota', { username })
return http.get<{ data: DeviceQuota }>('/monitor/device/quota', { username })
},
list(username: string) {
// 直接调用 RuoYi 后端的设备列表接口
return http.get('/monitor/device/list', { username })
return http.get<{ data: DeviceItem[] }>('/monitor/device/list', { username })
},
register(payload: { username: string }) {
// 直接调用 RuoYi 后端的设备注册接口
register(payload: { username: string; deviceId: string; os?: string }) {
return http.post('/monitor/device/register', payload)
},
remove(payload: { deviceId: string }) {
// 直接调用 RuoYi 后端的设备移除接口
return http.post('/monitor/device/remove', payload)
},
offline(payload: { deviceId: string }) {
// 直接调用 RuoYi 后端的离线接口
return http.post('/monitor/device/offline', payload)
}
}