wip: 🚧 个人中心临时提交
This commit is contained in:
@@ -1,25 +1,90 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="6">
|
||||||
<el-card>
|
<el-tabs tab-position="left">
|
||||||
<el-avatar :src="userProfile.avatar" size="large" />
|
<el-tab-pane label="账号信息">
|
||||||
|
<el-card>
|
||||||
|
<div class="">
|
||||||
|
<div class="relative w-100px h-100px flex-center">
|
||||||
|
<el-avatar :src="userProfile.avatar" :size="100" />
|
||||||
|
<el-button
|
||||||
|
type="info"
|
||||||
|
class="absolute bottom-0 right-0 cursor-pointer"
|
||||||
|
circle
|
||||||
|
:icon="Camera"
|
||||||
|
size="small"
|
||||||
|
@click="triggerFileUpload"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
ref="fileInput"
|
||||||
|
style="display: none"
|
||||||
|
@change="handleFileChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="mt-5">
|
||||||
|
{{ userProfile.nickname }}
|
||||||
|
<el-icon class="align-middle cursor-pointer">
|
||||||
|
<Edit />
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<el-form />
|
<el-descriptions :column="1" class="mt-10">
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<el-icon class="align-middle"><User /></el-icon>
|
||||||
|
用户名
|
||||||
|
</template>
|
||||||
|
{{ userProfile.username }}
|
||||||
|
|
||||||
<div class="profile-info">
|
<el-icon
|
||||||
<h2>{{ userProfile.username }}</h2>
|
v-if="userProfile.gender === 1"
|
||||||
<h2>{{ userProfile.nickname }}</h2>
|
class="align-middle color-blue"
|
||||||
<p>{{ userProfile.email }}</p>
|
>
|
||||||
<el-button type="primary" @click="handleOpenDialog">
|
<Male />
|
||||||
编辑个人信息
|
</el-icon>
|
||||||
</el-button>
|
<el-icon v-else class="align-middle color-pink">
|
||||||
<el-button @click="handleOpenDialog">修改密码</el-button>
|
<Female />
|
||||||
</div>
|
</el-icon>
|
||||||
</el-card>
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<el-icon class="align-middle"><Phone /></el-icon>
|
||||||
|
手机号码
|
||||||
|
</template>
|
||||||
|
{{ userProfile.mobile }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<el-icon class="align-middle"><Message /></el-icon>
|
||||||
|
邮箱
|
||||||
|
</template>
|
||||||
|
{{ userProfile.email }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<el-icon class="align-middle"><User /></el-icon>
|
||||||
|
部门
|
||||||
|
</template>
|
||||||
|
{{ userProfile.email }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item>
|
||||||
|
<template #label>
|
||||||
|
<el-icon class="align-middle"><User /></el-icon>
|
||||||
|
角色
|
||||||
|
</template>
|
||||||
|
{{ userProfile.email }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-card>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="安全设置">Config</el-tab-pane>
|
||||||
|
<el-tab-pane label="偏好设置">Role</el-tab-pane>
|
||||||
|
<el-tab-pane label="接收设置">Task</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="24" />
|
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-dialog title="修改密码" v-model:visible="dialogVisible">
|
<el-dialog title="修改密码" v-model:visible="dialogVisible">
|
||||||
@@ -58,7 +123,7 @@ import UserAPI, {
|
|||||||
PasswordChangeForm,
|
PasswordChangeForm,
|
||||||
} from "@/api/user";
|
} from "@/api/user";
|
||||||
import { useUserStore } from "@/store/modules/user";
|
import { useUserStore } from "@/store/modules/user";
|
||||||
|
import { Camera } from "@element-plus/icons-vue";
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
@@ -91,19 +156,40 @@ const handleChangePassword = async () => {
|
|||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fileInput = ref<HTMLInputElement | null>(null);
|
||||||
|
|
||||||
|
const triggerFileUpload = () => {
|
||||||
|
fileInput.value?.click();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFileChange = (event: Event) => {
|
||||||
|
const target = event.target as HTMLInputElement;
|
||||||
|
const file = target.files ? target.files[0] : null;
|
||||||
|
if (file) {
|
||||||
|
// Handle the file upload here
|
||||||
|
console.log("Selected file:", file);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const data = await UserAPI.getProfile(userStore.user.userId);
|
const data = await UserAPI.getProfile(userStore.user.userId);
|
||||||
userProfile.value = data;
|
userProfile.value = data;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.profile-info {
|
/** 关闭tag标签 */
|
||||||
margin-left: 20px;
|
.app-container {
|
||||||
|
/* 50px = navbar = 50px */
|
||||||
|
height: calc(100vh - 50px);
|
||||||
|
background: var(--el-fill-color-blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-card {
|
/** 开启tag标签 */
|
||||||
display: flex;
|
.hasTagsView {
|
||||||
padding: 20px;
|
.app-container {
|
||||||
|
/* 84px = navbar + tags-view = 50px + 34px */
|
||||||
|
height: calc(100vh - 84px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user