Skip to content

feat: 完善个人主页账户设置与真实学习统计 - #31

Merged
suerzzh merged 63 commits into
mainfrom
feat/profile-account-checkin
Aug 3, 2026
Merged

feat: 完善个人主页账户设置与真实学习统计#31
suerzzh merged 63 commits into
mainfrom
feat/profile-account-checkin

Conversation

@suerzzh

@suerzzh suerzzh commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

改动说明

本次 PR 完成个人主页账户与设置中心改造,接入用户资料、真实学习统计、自动打卡、头像管理和密码修改等功能。

主要改动

  • 支持修改用户昵称,并接入后端真实数据。
  • 支持上传和更换头像,使用七牛云 Kodo 私有对象存储。
  • 支持修改密码,修改成功后通过 auth_version 使全部旧登录状态失效。
  • 优化个人主页左侧栏布局,固定用户信息、导航和退出登录区域。
  • 调整头像、昵称和邮箱信息的展示尺寸及头像编辑按钮位置。
  • 接入本周学习时长、连续学习天数和近七天练习节奏真实统计。
  • 已保存学习资产数量直接使用训练记录次数,点击统计卡片可跳转到学习资产页面。
  • 以成功生成五维评分报告作为自动打卡依据,不新增独立打卡表。
  • 新增 practice_session 会话事实记录,通过会话开始和结束时间计算学习时长。
  • 单次正常完成且达到 30 秒的练习计入学习时长。
  • 补充接口契约、数据库变更、七牛云配置和部署文档。

数据库变更

  • "user" 表新增 avatar_object_key 字段。
  • 新增 practice_session 表,记录:
    • 用户与场景
    • 场景类型
    • 会话状态
    • 会话开始时间
    • 会话结束时间
  • 不新增打卡表,不使用 Redis 保存打卡记录。

现有环境可以执行:

psql "$DATABASE_URL" -f deploy/postgres/profile.sql

suerzzh added 30 commits July 31, 2026 15:32

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue found: the nickname length limit is inconsistent between the new profile UI/docs and the backend schema/validator.

onClose();
};

return <Modal onClose={submitting ? undefined : onClose} className="profile-edit-modal"><p className="eyebrow">EDIT PROFILE</p><h2>编辑个人资料</h2><p className="modal-lead">修改你的展示用户名或个人头像。</p><form className="profile-edit-form" onSubmit={submit}><div className="profile-edit-avatar"><img src={previewUrl} alt="头像预览" /><div><strong>个人头像</strong><small>支持 JPEG、PNG,文件不超过 2 MiB</small><label className="profile-avatar-picker">选择新头像<input type="file" accept="image/jpeg,image/png" disabled={submitting} onChange={selectAvatar} /></label></div></div><label className="profile-edit-name">用户名<input type="text" minLength={1} maxLength={80} required disabled={submitting} value={nickname} onChange={(event) => setNickname(event.target.value)} /></label>{error && <p className="form-error" role="alert">{error}</p>}<div className="modal-actions"><Button type="button" variant="secondary" disabled={submitting} onClick={onClose}>取消</Button><Button type="submit" disabled={submitting}>{submitting ? "正在保存" : "保存修改"}</Button></div></form></Modal>;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The profile edit dialog allows 80 characters here, but UpdateProfileRequest and the user.nickname column cap nicknames at 32. Users can enter a value that the API will reject on submit, so the UI limit should match the backend contract.

@yydounai1234 yydounai1234 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@suerzzh
suerzzh merged commit 36ab6c6 into main Aug 3, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants