feat(settings): 设置与个人信息模块审计重构 — i18n + 服务注入解耦 + Error Boundary + 流式渲染

- 新增 SettingsService 接口 + Context 注入,组件层不再直接 import users/messaging actions

- 新增 resolveRoleSettingsConfig 配置驱动角色路由,删除 parent/student/teacher-settings-view 冗余文件

- 新增 SettingsSectionErrorBoundary,每个 TabsContent + profile 角色概览区块均包裹

- 新增 ProfileStudentOverview/ProfileTeacherOverview 异步 Server Component + 骨架屏,支持流式渲染

- 抽取 buildStudentOverviewData 等纯函数到 lib/student-overview-data.ts,便于单元测试

- 新增 settings.json 翻译文件(zh-CN + en),所有组件改用 useTranslations/getTranslations

- 重构 profile/page.tsx:i18n 适配 + Suspense 分区加载 + 业务逻辑抽离

- 同步更新架构图 004/005
This commit is contained in:
SpecialX
2026-06-22 16:15:36 +08:00
parent 21c7e65fee
commit 5d42495480
29 changed files with 2445 additions and 1094 deletions

View File

@@ -0,0 +1,280 @@
{
"title": "设置",
"backToDashboard": "返回仪表盘",
"tabs": {
"general": "通用",
"notifications": "通知",
"appearance": "外观",
"security": "安全",
"ai": "AI"
},
"profile": {
"title": "个人信息",
"description": "更新您的个人资料。",
"fields": {
"name": "姓名",
"namePlaceholder": "您的姓名",
"email": "邮箱",
"emailDisabled": "邮箱不可修改。",
"phone": "电话",
"phonePlaceholder": "+86 138 0000 0000",
"address": "地址",
"addressPlaceholder": "省市区街道",
"gender": "性别",
"genderPlaceholder": "选择性别",
"age": "年龄",
"role": "角色"
},
"save": "保存修改",
"saving": "保存中...",
"success": "个人资料更新成功",
"failure": "个人资料更新失败"
},
"notifications": {
"title": "通知偏好",
"description": "选择您希望接收通知的方式和时间。",
"channels": {
"title": "通知渠道",
"subtitle": "选择您希望接收通知的渠道。",
"push": "推送通知",
"pushDesc": "接收应用内和浏览器推送通知。",
"email": "邮件",
"emailDesc": "将通知发送到我的注册邮箱。",
"sms": "短信",
"smsDesc": "通过短信发送重要通知(可能产生费用)。"
},
"categories": {
"title": "通知类别",
"subtitle": "选择哪些事件应触发通知。",
"messages": "消息",
"messagesDesc": "新的私信和回复。",
"announcements": "公告",
"announcementsDesc": "学校、年级和班级公告。",
"homework": "作业",
"homeworkDesc": "新作业和提交提醒。",
"grades": "成绩",
"gradesDesc": "考试和作业成绩发布。",
"attendance": "考勤",
"attendanceDesc": "考勤记录和缺勤提醒。"
},
"quietHours": {
"title": "免打扰时段",
"subtitle": "每天在指定时段内暂停非紧急通知。",
"enable": "启用免打扰时段",
"enableDesc": "启用后,仅在指定时段内发送紧急通知。",
"start": "开始时间",
"end": "结束时间"
},
"save": "保存偏好",
"saving": "保存中...",
"success": "通知偏好已更新",
"failure": "通知偏好更新失败"
},
"appearance": {
"theme": {
"title": "主题",
"description": "选择此设备上的界面外观。",
"label": "配色主题",
"system": "跟随系统",
"light": "浅色",
"dark": "深色"
},
"language": {
"title": "语言",
"description": "选择界面语言。",
"label": "界面语言"
}
},
"security": {
"changePassword": {
"title": "修改密码",
"description": "使用强密码保护您的账户安全。",
"current": "当前密码",
"currentPlaceholder": "输入当前密码",
"new": "新密码",
"newPlaceholder": "输入新密码",
"confirm": "确认新密码",
"confirmPlaceholder": "再次输入新密码",
"strength": "密码强度",
"strengthWeak": "弱",
"strengthMedium": "中",
"strengthStrong": "强",
"requirements": "密码要求:",
"submit": "更新密码",
"updating": "更新中..."
},
"session": {
"title": "会话",
"description": "账户访问与会话管理。",
"signOut": "退出登录",
"signOutDesc": "返回登录页面。",
"confirmTitle": "确认退出",
"confirmDesc": "确定要退出登录吗?您将返回登录页面。",
"cancel": "取消",
"confirm": "确认退出"
},
"tips": {
"title": "安全提示",
"description": "保护账户安全的最佳实践。",
"tip1": "使用不与其他网站重复的独立密码。",
"tip2": "避免使用常见词汇、姓名或连续模式。",
"tip3": "定期更换密码。",
"tip4": "多次登录失败后账户将被临时锁定。"
}
},
"ai": {
"providers": {
"title": "AI 服务商",
"description": "管理 AI 供应商和默认模型配置。",
"existing": "已有服务商",
"selectPlaceholder": "新建或选择已有",
"createNew": "新建",
"keyStatus": "密钥状态",
"stored": "已存储",
"noKey": "未存储密钥",
"id": "ID",
"idDesc": "每个服务商自动生成。",
"provider": "服务商",
"providerPlaceholder": "选择服务商",
"baseUrl": "API 地址",
"baseUrlPlaceholder": "https://open.bigmodel.cn/api/paas/v4",
"baseUrlDesc": "输入基础地址,无需 /chat/completions 后缀。",
"model": "模型",
"modelPlaceholder": "gpt-4o-mini",
"apiKey": "API 密钥",
"apiKeyPlaceholder": "粘贴新密钥以替换",
"apiKeyDesc": "已有密钥不会显示。留空则保留当前密钥。",
"setDefault": "设为默认",
"test": "测试",
"testing": "测试中...",
"save": "保存修改",
"saving": "保存中...",
"testSuccess": "测试通过",
"testFailure": "测试失败",
"saveSuccess": "保存成功",
"saveFailure": "保存失败",
"loadFailure": "加载 AI 服务商失败",
"needKey": "请输入 API 密钥进行测试",
"needTest": "保存前请先测试配置"
}
},
"quickLinks": {
"title": "快捷链接",
"description": "您可能想访问的常用页面。",
"profile": "个人资料",
"dashboard": "仪表盘",
"children": "孩子",
"grades": "成绩",
"attendance": "考勤",
"assignments": "作业",
"schedule": "课表",
"textbooks": "教材",
"exams": "考试",
"homework": "作业"
},
"roleDescriptions": {
"admin": "管理您的账户和系统配置。",
"teacher": "管理您的个人信息、通知和教学偏好。",
"student": "管理您的个人信息、通知和学习偏好。",
"parent": "管理您的个人信息、通知和孩子关注偏好。"
},
"errors": {
"loadFailed": "页面加载失败",
"loadFailedDesc": "抱歉,页面加载时发生了意外错误。请稍后重试。",
"retry": "重试",
"sectionLoadFailed": "该区块加载失败",
"sectionLoadFailedDesc": "请稍后重试。"
},
"admin": {
"title": "系统设置",
"description": "管理系统基础信息与运行参数。",
"schoolInfo": {
"title": "学校信息",
"description": "学校的基础信息,将显示在系统各处。",
"name": "学校名称",
"namePlaceholder": "请输入学校名称",
"code": "学校代码",
"codePlaceholder": "请输入学校代码",
"phone": "联系电话",
"phonePlaceholder": "请输入联系电话",
"email": "联系邮箱",
"emailPlaceholder": "请输入联系邮箱",
"address": "学校地址",
"addressPlaceholder": "请输入学校地址",
"description2": "学校简介",
"descriptionPlaceholder": "请输入学校简介"
},
"securityPolicy": {
"title": "安全策略",
"description": "密码策略与会话管理。",
"passwordMinLength": "密码最小长度",
"sessionTimeout": "会话超时(分钟)",
"requireSpecialChar": "密码必须包含特殊字符",
"requireSpecialCharDesc": "要求用户密码中包含至少一个特殊字符",
"requireUppercase": "密码必须包含大写字母",
"requireUppercaseDesc": "要求用户密码中包含至少一个大写字母",
"forcePasswordChange": "首次登录强制修改密码",
"forcePasswordChangeDesc": "新用户或重置密码后首次登录时必须修改密码"
},
"fileUpload": {
"title": "文件上传",
"description": "文件上传限制与存储配置。",
"maxFileSize": "单文件最大大小MB",
"allowedTypes": "允许的文件类型",
"allowedTypesPlaceholder": "如jpg,png,pdf,docx"
},
"notificationConfig": {
"title": "通知配置",
"description": "系统通知的发送方式与触发条件。",
"notifyNewUser": "新用户注册通知管理员",
"notifyNewUserDesc": "有新用户注册时向管理员发送通知",
"notifyScheduleChange": "课表变更通知教师",
"notifyScheduleChangeDesc": "课表变更审批通过后通知相关教师",
"notifyAnnouncement": "公告发布通知目标用户",
"notifyAnnouncementDesc": "公告发布时向目标用户推送通知"
},
"save": "保存设置",
"saving": "保存中...",
"reset": "重置",
"saveSuccess": "设置已保存",
"saveFailure": "设置保存失败",
"loadFailure": "加载系统设置失败"
},
"profilePage": {
"title": "个人资料",
"description": "管理您的个人和账户信息。",
"editProfile": "编辑资料",
"personalInfo": {
"title": "个人信息",
"description": "基本个人资料。",
"fullName": "姓名",
"gender": "性别",
"age": "年龄",
"phone": "电话",
"address": "地址"
},
"accountInfo": {
"title": "账户信息",
"description": "系统账户详情。",
"email": "邮箱",
"role": "角色",
"memberSince": "注册时间",
"onboardedAt": "入职时间"
},
"studentOverview": {
"title": "学生概览",
"description": "您的学业表现和课表。"
},
"teacherOverview": {
"title": "教师概览",
"description": "您任教的科目和班级。",
"teachingSubjects": "任教科目",
"teachingSubjectsDesc": "您当前被分配教授的科目。",
"noSubjects": "暂无分配科目。",
"teachingClasses": "任教班级",
"teachingClassesDesc": "您当前管理的班级。",
"noClasses": "暂无分配班级。",
"view": "查看"
}
}
}