From a63543a5c793c8954fa2f9da0ee4fb215c62d8c2 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期一, 20 五月 2024 10:26:46 +0800
Subject: [PATCH] !118 ♥️发布 5.2.0-BETA 公测版本 Merge pull request !118 from 疯狂的狮子Li/dev

---
 src/views/system/user/profile/index.vue |   71 ++++++++++++++++++++++-------------
 1 files changed, 45 insertions(+), 26 deletions(-)

diff --git a/src/views/system/user/profile/index.vue b/src/views/system/user/profile/index.vue
index 47a6632..426fca8 100644
--- a/src/views/system/user/profile/index.vue
+++ b/src/views/system/user/profile/index.vue
@@ -3,14 +3,14 @@
     <el-row :gutter="20">
       <el-col :span="6" :xs="24">
         <el-card class="box-card">
-          <template v-slot:header>
+          <template #header>
             <div class="clearfix">
               <span>涓汉淇℃伅</span>
             </div>
           </template>
           <div>
             <div class="text-center">
-              <userAvatar/>
+              <userAvatar />
             </div>
             <ul class="list-group list-group-striped">
               <li class="list-group-item">
@@ -27,7 +27,7 @@
               </li>
               <li class="list-group-item">
                 <svg-icon icon-class="tree" />鎵�灞為儴闂�
-                <div class="pull-right" v-if="state.user.dept">{{ state.user.dept.deptName }} / {{ state.postGroup }}</div>
+                <div v-if="state.user.deptName" class="pull-right">{{ state.user.deptName }} / {{ state.postGroup }}</div>
               </li>
               <li class="list-group-item">
                 <svg-icon icon-class="peoples" />鎵�灞炶鑹�
@@ -43,7 +43,7 @@
       </el-col>
       <el-col :span="18" :xs="24">
         <el-card>
-          <template v-slot:header>
+          <template #header>
             <div class="clearfix">
               <span>鍩烘湰璧勬枡</span>
             </div>
@@ -58,6 +58,9 @@
             <el-tab-pane label="绗笁鏂瑰簲鐢�" name="thirdParty">
               <thirdParty :auths="state.auths" />
             </el-tab-pane>
+            <el-tab-pane label="鍦ㄧ嚎璁惧" name="onlinDevice">
+              <onlinDevice :devices="state.devices" />
+            </el-tab-pane>
           </el-tabs>
         </el-card>
       </el-col>
@@ -66,38 +69,54 @@
 </template>
 
 <script setup name="Profile" lang="ts">
-import UserAvatar from "./userAvatar.vue";
-import UserInfo from "./userInfo.vue";
-import ResetPwd from "./resetPwd.vue";
-import ThirdParty from "./thirdParty.vue";
-import { getAuthList } from "@/api/system/social/auth";
-import { getUserProfile } from "@/api/system/user";
+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");
-const state = ref<Record<string, any>>({
-    user: {},
-    roleGroup: '',
-    postGroup: '',
-    auths: []
+const activeTab = ref('userinfo');
+interface State {
+  user: Partial<UserVO>;
+  roleGroup: string;
+  postGroup: string;
+  auths: any;
+  devices: any;
+}
+const state = ref<State>({
+  user: {},
+  roleGroup: '',
+  postGroup: '',
+  auths: [],
+  devices: []
 });
 
 const userForm = ref({});
 
 const getUser = async () => {
-    const res = await getUserProfile();
-    state.value.user = res.data.user;
-    userForm.value = { ...res.data.user }
-    state.value.roleGroup = res.data.roleGroup;
-    state.value.postGroup = res.data.postGroup;
+  const res = await getUserProfile();
+  state.value.user = res.data.user;
+  userForm.value = { ...res.data.user };
+  state.value.roleGroup = res.data.roleGroup;
+  state.value.postGroup = res.data.postGroup;
 };
 
 const getAuths = async () => {
-    const res = await getAuthList();
-    state.value.auths = res.data;
+  const res = await getAuthList();
+  state.value.auths = res.data;
+};
+const getOnlines = async () => {
+  const res = await getOnline();
+  state.value.devices = res.rows;
 };
 
 onMounted(() => {
-    getUser();
-    getAuths();
-})
+  getUser();
+  getAuths();
+  getOnlines();
+});
 </script>

--
Gitblit v1.9.3