diff --git a/src/api/monitor/online/index.ts b/src/api/monitor/online/index.ts index 3d9034a..7484702 100644 --- a/src/api/monitor/online/index.ts +++ b/src/api/monitor/online/index.ts @@ -18,3 +18,19 @@ export function forceLogout(tokenId: string) { method: 'delete' }); } + +// 获取当前用户登录在线设备 +export function getOnline() { + return request({ + url: '/monitor/online', + method: 'get' + }); +} + +// 删除当前在线设备 +export function delOnline(tokenId: string) { + return request({ + url: '/monitor/online/' + tokenId, + method: 'post' + }); +} diff --git a/src/views/system/user/profile/index.vue b/src/views/system/user/profile/index.vue index 0c8b527..426fca8 100644 --- a/src/views/system/user/profile/index.vue +++ b/src/views/system/user/profile/index.vue @@ -58,6 +58,9 @@ + + + @@ -70,8 +73,10 @@ import UserAvatar from './userAvatar.vue'; import UserInfo from './userInfo.vue'; import ResetPwd from './resetPwd.vue'; import ThirdParty from './thirdParty.vue'; +import OnlinDevice from './onlineDevice.vue'; import { getAuthList } from '@/api/system/social/auth'; import { getUserProfile } from '@/api/system/user'; +import { getOnline } from '@/api/monitor/online'; import { UserVO } from '@/api/system/user/types'; const activeTab = ref('userinfo'); @@ -80,12 +85,14 @@ interface State { roleGroup: string; postGroup: string; auths: any; + devices: any; } const state = ref({ user: {}, roleGroup: '', postGroup: '', - auths: [] + auths: [], + devices: [] }); const userForm = ref({}); @@ -102,9 +109,14 @@ const getAuths = async () => { const res = await getAuthList(); state.value.auths = res.data; }; +const getOnlines = async () => { + const res = await getOnline(); + state.value.devices = res.rows; +}; onMounted(() => { getUser(); getAuths(); + getOnlines(); }); diff --git a/src/views/system/user/profile/onlineDevice.vue b/src/views/system/user/profile/onlineDevice.vue new file mode 100644 index 0000000..479e89a --- /dev/null +++ b/src/views/system/user/profile/onlineDevice.vue @@ -0,0 +1,59 @@ + + +