| | |
| | | <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="app-container"> |
| | | <div class="p-2"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="6" :xs="24"> |
| | | <el-card class="box-card"> |
| | |
| | | </template> |
| | | <el-tabs v-model="activeTab"> |
| | | <el-tab-pane label="基本资料" name="userinfo"> |
| | | <userInfo :user="state.user" /> |
| | | <userInfo :user="userForm" /> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="修改密码" name="resetPwd"> |
| | | <resetPwd /> |
| | |
| | | </el-row> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="Profile"> |
| | | import userAvatar from "./userAvatar"; |
| | | import userInfo from "./userInfo"; |
| | | import resetPwd from "./resetPwd"; |
| | | import { getUserProfile } from "@/api/system/user"; |
| | | |
| | | const activeTab = ref("userinfo"); |
| | | const state = reactive({ |
| | | user: {}, |
| | | roleGroup: {}, |
| | | postGroup: {} |
| | | }); |
| | | |
| | | function getUser() { |
| | | getUserProfile().then(response => { |
| | | state.user = response.data.user; |
| | | state.roleGroup = response.data.roleGroup; |
| | | state.postGroup = response.data.postGroup; |
| | | }); |
| | | }; |
| | | |
| | | getUser(); |
| | | </script> |