视觉统一(Zen Minimal × Future Organic 白皮书语言,全站浅色单主题): - 登录页:品牌→由壹点·品牌中心,白纸底+发丝线+柔光光晕,黑按钮 - 作品过稿:深灰头→白皮书,返回链接→返回创意资产库 - 绩效考核:桌面+移动双头部换白皮书,标题改绩效考核,返回改链接 - 组织架构:BoardShell+页面 76 处调色板全量替换(#eef1f4→#fafafa 等) - admin 后台:MaterialsHeader(面包屑治理与设置),Tab 栏墨色高亮 - 深色主题废弃:globals.css 移除媒体查询,tailwind darkMode:'class' 不挂 .dark - 设计文档同步更新:AGENTS.md UI 基线/DESIGN.md/PRODUCT.md/README.md/design-qa.md 个人档案(原个人中心): - API 合并权威人员档案(getEmployeeByUserId → 花名/工号/部门/职位/M-P等级/主管/状态) - 页面白皮书化:权威档案卡(只读 HR 字段)+ 账号区(头像上传)+ 素材/收藏 顶栏平台化: - MaterialsHeader 双模式:首页(五板块导航+全套工具+菜单)/板块(面包屑) - 菜单重排:我的档案/绩效考核/作品过稿看板‖更新记录/提交反馈‖治理与设置‖退出 - 菜单头身份行:花名+职位·部门(权威档案) - 首页排序:01 创意资产库(全员)→ 02 组织管理(管理员)→ 03-05 规划中 - 素材库改名创意资产库,全站同步(索引/导航/卡片/按钮/页脚) - 排行榜换白皮书(白底发丝线+琥珀前三名) 构建修复: - tsconfig 排除 output/(本地审计临时文件不再卡类型检查) - 存储边界门禁豁免 output/(与 .dockerignore 对齐)
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { getServerSession } from 'next-auth';
|
|
import { authOptions } from '@/lib/auth';
|
|
import { prisma } from '@/lib/prisma';
|
|
import { getEmployeeByUserId } from '@/lib/employee-directory';
|
|
|
|
// GET - 获取当前用户信息(账号字段 + 权威人员档案合并)
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
const session = await getServerSession(authOptions);
|
|
const userId = session?.user ? (session.user as any).id : undefined;
|
|
|
|
if (!userId) {
|
|
return NextResponse.json({ error: '未登录' }, { status: 401 });
|
|
}
|
|
|
|
const user = await prisma.user.findUnique({
|
|
where: { id: userId },
|
|
select: {
|
|
id: true,
|
|
username: true,
|
|
email: true,
|
|
avatar: true,
|
|
realName: true,
|
|
phone: true,
|
|
createdAt: true,
|
|
},
|
|
});
|
|
|
|
if (!user) {
|
|
return NextResponse.json({ error: '用户不存在' }, { status: 404 });
|
|
}
|
|
|
|
// 权威人员档案(钉钉绑定 → HR 花名册视图);未绑定者为 null
|
|
const employee = await getEmployeeByUserId(user.id);
|
|
|
|
return NextResponse.json({
|
|
...user,
|
|
// 旧 department 字符串已淘汰,不再返回
|
|
employee: employee
|
|
? {
|
|
displayName: employee.displayName,
|
|
realName: employee.realName,
|
|
flowerName: employee.flowerName,
|
|
jobNumber: employee.jobNumber,
|
|
departmentPath: employee.departmentPath,
|
|
positionTitle: employee.positionTitle,
|
|
positionLevel: employee.positionLevel,
|
|
levelType: employee.levelType,
|
|
managerName: employee.managerName,
|
|
employmentStatus: employee.employmentStatus,
|
|
}
|
|
: null,
|
|
});
|
|
} catch (error) {
|
|
console.error('[UserProfile] GET error:', error);
|
|
return NextResponse.json(
|
|
{ error: '获取用户信息失败' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|