feat(账号): 新建的号不再加 ks + 班号前缀,班级单独选;学生改不了真名了

- 批量建号先选班再贴名单,用户名就是名字;被别的班或注册的号占了自动加数字(xuyue2)。
  查重改成查「这个班里有没有同名的」,老号按剥掉 ks 前缀的名字比
- 后台编辑、新建用户能直接选班级;以前班级只能从用户名的 ks 前缀推,改不了
- 登录点名字时名单接口一并给出用户名,新号老号都登得上;本机记的班级兼容旧的 ks257 写法
- 筛选、抽人、「看看他们的写法」都按班级认人,不再拼 ks 前缀(新号拼出来永远圈不进去)
- 接口 PUT /me/profile 不再收真名:界面早没入口,但早几届有 44 人把真名改成了外号
- 0042:两个被推成非班号班级的老号(xrm、王仁杰)改成没填班级
- 老账号不改名,只认 ks 前缀的地方收在契约 username.ts 一处

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-11-02 23:22:20 +08:00
1 parent 48590eee60
commit 221d264701
25 files changed
+4234 -156

No files matched your search

+2 -2
View File
@@ -179,7 +179,7 @@ export function getSubmissionStatistics(
duration: { start?: string; end: string },
problemDisplayId?: string,
username?: string,
/** 班级(user.class_name)精确匹配。别再拼 `ks231` 塞进 username —— 会连带 2311、2312 班 */
/** 班级(user.class_name)精确匹配。别拿用户名前缀当班级 —— 新号不带 ks 前缀,老号 `ks231` 还会连带 2311、2312 班 */
className?: string,
) {
return api.get<SubmissionStatistics>('submissions/statistics', {
@@ -346,7 +346,7 @@ export function uploadAvatar(file: File) {
return api.post('me/avatar', form)
}
export function updateProfile(data: { realName?: string; mood?: string }) {
export function updateProfile(data: { mood?: string }) {
return api.put<Profile>('me/profile', data satisfies UpdateProfileRequest)
}
@@ -62,7 +62,7 @@ const rankLine = computed(() => {
return null
})
/** 「看看他们的写法」:同班的走 'ks' + 班级名的用户名前缀约定(设计文档第 13 节) */
/** 「看看他们的写法」:同班的按班级(class_name)筛,全站的不筛 */
function goAccepted() {
const r = rank.value
if (!r) return
@@ -73,7 +73,7 @@ function goAccepted() {
result: '0',
page: 1,
limit: 10,
...(r.className ? { username: 'ks' + r.className } : {}),
...(r.className ? { className: r.className } : {}),
},
}
// 协作中跳走这一页协作就断了
+3 -2
View File
@@ -8,7 +8,8 @@ import { useBreakpoints } from 'shared/composables/breakpoints'
import { useConfigStore } from 'shared/store/config'
import { useUserStore } from 'shared/store/user'
import { errorCode } from 'utils/api'
import { STORAGE_KEY, USERNAME_CLASS_RE } from 'utils/constants'
import { displayName } from '@oj2/contract'
import { STORAGE_KEY } from 'utils/constants'
import storage from 'utils/storage'
import ChampionList from './components/ChampionList.vue'
import ClassBattle from './components/ClassBattle.vue'
@@ -236,7 +237,7 @@ const daysLeft = computed(() => {
const trendLines = computed(() => {
const b = board.value
if (!b?.me) return []
const short = (row: RankRow) => row.user.username.replace(USERNAME_CLASS_RE, '') || row.user.username
const short = (row: RankRow) => displayName(row.user.username)
return [
...(b.behind ? [{ userId: b.behind.user.id, label: short(b.behind), color: palette.value.threat }] : []),
...(b.ahead ? [{ userId: b.ahead.user.id, label: short(b.ahead), color: palette.value.chase }] : []),