82 lines
2.5 KiB
Vue
82 lines
2.5 KiB
Vue
<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'
|
||
|
||
// 布局容器:左侧用户卡 + 菜单(x155 起 245 宽),右侧内容卡(x400 起 1400 宽)
|
||
// 数据只经 store
|
||
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>
|
||
// 设计稿(个人中心 1920×1568)锚点:
|
||
// 面包屑 y23 h26 · 左列 x155 宽 245 · 右卡 x400 y98 1400×532 · 页脚 y1087
|
||
// 内容区顶 98 = 顶栏 72 + 上留白 26
|
||
.profile {
|
||
min-height: 737px; // 内容区 y98→835
|
||
background: @profile-page-bg;
|
||
|
||
&__container {
|
||
padding-top: 26px; // 顶栏 72 → 内容区 98
|
||
// 个人中心系独立基准(视觉核对定版 x155/1600),不随全站 70/1780 联动
|
||
padding-left: clamp(@spacing-base, calc((100% - @profile-content) / 2), @profile-gutter);
|
||
padding-right: clamp(@spacing-base, calc((100% - @profile-content) / 2), @profile-gutter);
|
||
}
|
||
|
||
&__body {
|
||
.flex(row, flex-start, stretch);
|
||
width: 100%;
|
||
}
|
||
|
||
// 左列 200:用户卡 + 菜单白卡,两卡间距 6
|
||
// (设计稿左列 245、右卡 1400,合计 1645 超出内容宽 1595,按比例收左列到 200 保右卡 1400)
|
||
&__aside {
|
||
.flex(column, flex-start, stretch);
|
||
gap: 6px;
|
||
flex: 0 0 200px;
|
||
width: 200px;
|
||
margin-right: 0;
|
||
}
|
||
|
||
// 右内容卡 1400:白底 + 浅灰描边
|
||
&__main {
|
||
flex: 1 1 auto;
|
||
min-width: 0;
|
||
min-height: 425px;
|
||
margin-left: 40px; // 左列 200 → 右卡起点 240(设计稿比例:160/245 ≈ 0.65)
|
||
padding: 24px 24px 0; // 卡内左缩进:卡 → 标题 +28
|
||
border: 1px solid @profile-card-border;
|
||
border-radius: @radius-lg;
|
||
background: @white;
|
||
box-sizing: border-box;
|
||
}
|
||
}
|
||
</style>
|