From 8c6cf5bc434f1f236b9a12c45c05636a3903f8c7 Mon Sep 17 00:00:00 2001 From: AprilWind <2100166581@qq.com> Date: Fri, 19 Apr 2024 05:02:14 +0000 Subject: [PATCH] =?UTF-8?q?!104=20add=20=E6=96=B0=E5=A2=9E=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E7=99=BB=E5=BD=95=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20*=20update=20=E5=9C=A8=E7=BA=BF=E7=99=BB=E5=BD=95=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=AE=A1=E7=90=86=E5=88=A0=E9=99=A4=E6=9D=83=E9=99=90?= =?UTF-8?q?=20*=20add=20=E6=96=B0=E5=A2=9E=E5=9C=A8=E7=BA=BF=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/monitor/online/index.ts | 16 +++++ src/views/system/user/profile/index.vue | 14 ++++- .../system/user/profile/onlineDevice.vue | 59 +++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 src/views/system/user/profile/onlineDevice.vue 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 @@ + + + + + + + + + + + + + + + {{ parseTime(scope.row.loginTime) }} + + + + + + + + + + + + + + +