Files
cz-web/src/views/profile/index.vue
2026-10-13 15:12:51 +08:00

72 lines
1.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- 页面:个人中心(Profile) -->
<script setup lang="ts">
import { onMounted } from 'vue'
import { storeToRefs } from 'pinia'
import { useProfileStore } from '@/stores/modules/profile'
import ProfileSider from './cpns/ProfileSider.vue'
import ProfileUserCard from './cpns/ProfileUserCard.vue'
const profileStore = useProfileStore()
const { profile } = storeToRefs(profileStore)
function onSaveNickname(name: string): void {
void profileStore.saveNickname(name)
}
onMounted(() => {
void profileStore.fetchProfile()
})
</script>
<template>
<div class="profile">
<div class="profile__container container">
<div class="profile__body">
<aside class="profile__aside">
<ProfileUserCard :profile="profile" @save-nickname="onSaveNickname" />
<ProfileSider />
</aside>
<main class="profile__main">
<RouterView />
</main>
</div>
</div>
</div>
</template>
<style lang="less" scoped>
.profile {
min-height: 100%;
padding-bottom: @spacing-page-bottom;
background: @bg-color;
&__container {
padding-top: @spacing-lg;
}
&__body {
.flex(row, flex-start, stretch);
gap: @spacing-lg;
width: 100%;
}
&__aside {
.flex(column, flex-start, stretch);
gap: @spacing-base;
flex: 0 0 200px;
width: 200px;
}
&__main {
flex: 1 1 auto;
min-width: 0;
min-height: 480px;
margin-left: 0;
padding: @spacing-lg @spacing-xl;
border-radius: @radius-base;
background: @white;
box-sizing: border-box;
}
}
</style>