From 41f3d37db102e87fceb3f49eb47ae38747decc43 Mon Sep 17 00:00:00 2001
From: LiuHao <liuhaoai545@gmail.com>
Date: 星期一, 15 四月 2024 14:00:39 +0800
Subject: [PATCH] update 优化首页打开topNav不展开菜单问题
---
src/views/system/user/profile/index.vue | 83 +++++++++++++++++++++++++----------------
1 files changed, 51 insertions(+), 32 deletions(-)
diff --git a/src/views/system/user/profile/index.vue b/src/views/system/user/profile/index.vue
index 73496b3..0c8b527 100644
--- a/src/views/system/user/profile/index.vue
+++ b/src/views/system/user/profile/index.vue
@@ -1,44 +1,16 @@
-<script setup name="Profile" lang="ts">
-import userAvatar from "./userAvatar.vue";
-import userInfo from "./userInfo.vue";
-import resetPwd from "./resetPwd.vue";
-import { getUserProfile } from "@/api/system/user";
-
-const activeTab = ref("userinfo");
-const state = ref<{ user: any; roleGroup: string; postGroup: string}>({
- user: {},
- roleGroup: '',
- postGroup: ''
-});
-
-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;
-};
-
-onMounted(() => {
- getUser();
-})
-</script>
-
<template>
<div class="p-2">
<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 :user="state.user" />
+ <userAvatar />
</div>
<ul class="list-group list-group-striped">
<li class="list-group-item">
@@ -55,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" />鎵�灞炶鑹�
@@ -71,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>
@@ -83,9 +55,56 @@
<el-tab-pane label="淇敼瀵嗙爜" name="resetPwd">
<resetPwd />
</el-tab-pane>
+ <el-tab-pane label="绗笁鏂瑰簲鐢�" name="thirdParty">
+ <thirdParty :auths="state.auths" />
+ </el-tab-pane>
</el-tabs>
</el-card>
</el-col>
</el-row>
</div>
</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 { UserVO } from '@/api/system/user/types';
+
+const activeTab = ref('userinfo');
+interface State {
+ user: Partial<UserVO>;
+ roleGroup: string;
+ postGroup: string;
+ auths: any;
+}
+const state = ref<State>({
+ user: {},
+ roleGroup: '',
+ postGroup: '',
+ auths: []
+});
+
+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 getAuths = async () => {
+ const res = await getAuthList();
+ state.value.auths = res.data;
+};
+
+onMounted(() => {
+ getUser();
+ getAuths();
+});
+</script>
--
Gitblit v1.9.3