2026-09-12 15:19:13 +08:00
|
|
|
|
import type { NotificationPriority, UserRole } from './types.js';
|
2026-09-11 21:57:38 +08:00
|
|
|
|
|
|
|
|
|
|
/** API 前缀 */
|
|
|
|
|
|
export const API_PREFIX = '/api';
|
|
|
|
|
|
|
|
|
|
|
|
/** REST 路径集中管理,避免前端散落硬编码字符串 */
|
|
|
|
|
|
export const API_PATHS = {
|
|
|
|
|
|
auth: {
|
|
|
|
|
|
login: '/auth/login',
|
|
|
|
|
|
logout: '/auth/logout',
|
|
|
|
|
|
me: '/auth/me',
|
|
|
|
|
|
changePassword: '/auth/password',
|
|
|
|
|
|
},
|
|
|
|
|
|
classes: '/classes',
|
|
|
|
|
|
courses: '/courses',
|
|
|
|
|
|
schedules: '/schedules',
|
|
|
|
|
|
homeworks: '/homeworks',
|
|
|
|
|
|
notifications: '/notifications',
|
2026-09-12 13:57:46 +08:00
|
|
|
|
/** 叫人:老师点名让学生过来 */
|
|
|
|
|
|
calls: '/calls',
|
2026-09-11 21:57:38 +08:00
|
|
|
|
grades: '/grades',
|
|
|
|
|
|
students: '/students',
|
|
|
|
|
|
teachers: '/teachers',
|
2026-09-12 15:35:01 +08:00
|
|
|
|
/** 导入:模板下载 / 表格导入 / ClassIsland 课表时间配置 */
|
|
|
|
|
|
imports: '/imports',
|
2026-09-27 14:59:12 +08:00
|
|
|
|
/** ClassIsland 联动:设备接入、状态上报、通知下发 */
|
|
|
|
|
|
integrations: '/integrations',
|
2026-09-11 21:57:38 +08:00
|
|
|
|
dashboard: '/dashboard/summary',
|
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
|
|
/** 用户角色 */
|
|
|
|
|
|
export const USER_ROLES: readonly UserRole[] = ['ADMIN', 'TEACHER', 'STUDENT'];
|
|
|
|
|
|
|
|
|
|
|
|
export const ROLE_LABELS: Record<UserRole, string> = {
|
|
|
|
|
|
ADMIN: '系统管理员',
|
|
|
|
|
|
TEACHER: '教师',
|
|
|
|
|
|
STUDENT: '学生',
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** 通知优先级 */
|
|
|
|
|
|
export const NOTIFICATION_PRIORITIES: readonly NotificationPriority[] = ['LOW', 'NORMAL', 'HIGH', 'URGENT'];
|
|
|
|
|
|
|
|
|
|
|
|
export const PRIORITY_LABELS: Record<NotificationPriority, string> = {
|
|
|
|
|
|
LOW: '低',
|
|
|
|
|
|
NORMAL: '普通',
|
|
|
|
|
|
HIGH: '重要',
|
|
|
|
|
|
URGENT: '紧急',
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** Element Plus tag 类型,三端统一文案与配色 */
|
|
|
|
|
|
export const PRIORITY_TAG_TYPES: Record<NotificationPriority, 'info' | 'primary' | 'warning' | 'danger'> = {
|
|
|
|
|
|
LOW: 'info',
|
|
|
|
|
|
NORMAL: 'primary',
|
|
|
|
|
|
HIGH: 'warning',
|
|
|
|
|
|
URGENT: 'danger',
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** 星期:1=周一 ... 7=周日(与数据库 dayOfWeek 一致) */
|
|
|
|
|
|
export const WEEKDAY_LABELS: Record<number, string> = {
|
|
|
|
|
|
1: '周一',
|
|
|
|
|
|
2: '周二',
|
|
|
|
|
|
3: '周三',
|
|
|
|
|
|
4: '周四',
|
|
|
|
|
|
5: '周五',
|
|
|
|
|
|
6: '周六',
|
|
|
|
|
|
7: '周日',
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const WEEKDAYS: readonly number[] = [1, 2, 3, 4, 5, 6, 7];
|
|
|
|
|
|
|
2026-09-13 08:39:11 +08:00
|
|
|
|
/**
|
2026-09-13 10:34:46 +08:00
|
|
|
|
* 统一授课科目目录(**全校固定**):作业、课表、成绩的"科目"都从这里选,
|
|
|
|
|
|
* 不需要按班级一个个建课 —— 选中后由前端自动为该班建好同名课程(已存在则复用)。
|
|
|
|
|
|
* 顺序按用户给定的作息习惯:文化课 → 技术 → 体艺 → 班会与早晚读 → 通用技术 → 听力。
|
2026-09-13 08:39:11 +08:00
|
|
|
|
*/
|
|
|
|
|
|
export const SUBJECT_CATALOG: readonly string[] = [
|
|
|
|
|
|
'语文',
|
|
|
|
|
|
'数学',
|
|
|
|
|
|
'英语',
|
|
|
|
|
|
'政治',
|
|
|
|
|
|
'历史',
|
2026-09-13 10:34:46 +08:00
|
|
|
|
'物理',
|
|
|
|
|
|
'化学',
|
2026-09-13 08:39:11 +08:00
|
|
|
|
'地理',
|
2026-09-13 10:34:46 +08:00
|
|
|
|
'生物',
|
2026-09-13 08:39:11 +08:00
|
|
|
|
'信息技术',
|
|
|
|
|
|
'体育',
|
|
|
|
|
|
'美术',
|
2026-09-13 10:34:46 +08:00
|
|
|
|
'音乐',
|
|
|
|
|
|
'班会',
|
|
|
|
|
|
'早读',
|
|
|
|
|
|
'晚读',
|
|
|
|
|
|
'通用技术',
|
|
|
|
|
|
'听力',
|
2026-09-13 08:39:11 +08:00
|
|
|
|
] as const;
|
|
|
|
|
|
|
2026-09-12 23:48:59 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 单双周标签与取值(课表用)。
|
|
|
|
|
|
* 语义与 ClassIsland 课表一致:WeekCountDivTotal=1 → 每周;=2 时 WeekCountDiv=1 → 单周、=2 → 双周。
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const WEEK_PARITY_LABELS: Record<'ALL' | 'ODD' | 'EVEN', string> = {
|
|
|
|
|
|
ALL: '每周',
|
|
|
|
|
|
ODD: '单周',
|
|
|
|
|
|
EVEN: '双周',
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const WEEK_PARITY_VALUES: readonly ('ALL' | 'ODD' | 'EVEN')[] = ['ALL', 'ODD', 'EVEN'];
|
|
|
|
|
|
|
|
|
|
|
|
/** 一个学期按多少周为一个单双周循环(ClassIsland WeekCountDivTotal 的默认值) */
|
|
|
|
|
|
export const WEEK_PARITY_CYCLE = 2;
|
|
|
|
|
|
|
2026-09-12 15:19:13 +08:00
|
|
|
|
/** 灵动岛默认外观(设置页个性化项的初始值,也是区间校验的单一来源) */
|
|
|
|
|
|
export const DEFAULT_ISLAND_APPEARANCE = {
|
|
|
|
|
|
height: 44,
|
|
|
|
|
|
width: 268,
|
|
|
|
|
|
radius: 20,
|
|
|
|
|
|
opacity: 1,
|
2026-09-12 17:41:05 +08:00
|
|
|
|
/** 默认强调色采用 Apple 系统蓝(与 WinIsland 的系统色体系一致) */
|
|
|
|
|
|
accent: '#0a84ff',
|
2026-09-12 15:19:13 +08:00
|
|
|
|
fontSize: 13,
|
|
|
|
|
|
animations: true,
|
|
|
|
|
|
speed: 1,
|
|
|
|
|
|
position: 'top-center',
|
|
|
|
|
|
alwaysOnTop: true,
|
2026-09-12 17:41:05 +08:00
|
|
|
|
/** 纯黑底(WinIsland default 风格) */
|
|
|
|
|
|
style: 'black',
|
|
|
|
|
|
/** 空闲时完全隐藏(与原行为一致;打开后空闲会留一条细缝) */
|
|
|
|
|
|
idleSliver: false,
|
2026-09-27 16:34:01 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 距屏幕左右边缘的距离(px):停靠左/右时生效。
|
|
|
|
|
|
* 默认与原行为一致(8px)—— 加这个设置是为了能调,不是为了改默认外观。
|
|
|
|
|
|
*/
|
|
|
|
|
|
marginX: 8,
|
|
|
|
|
|
/** 距屏幕上下边缘的距离(px):停靠顶/底时生效 */
|
|
|
|
|
|
marginY: 8,
|
|
|
|
|
|
/** 是否跟随鼠标所在屏幕(多显示器教室电脑:鼠标在哪块屏就在哪块屏显示) */
|
|
|
|
|
|
followCursorDisplay: false,
|
2026-09-12 15:19:13 +08:00
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
|
|
/** 个性化设置项的合法区间(前端滑块与后端校验共用,避免越界导致布局错乱) */
|
|
|
|
|
|
export const ISLAND_APPEARANCE_RANGES = {
|
|
|
|
|
|
height: { min: 36, max: 72 },
|
|
|
|
|
|
width: { min: 220, max: 420 },
|
|
|
|
|
|
radius: { min: 8, max: 32 },
|
|
|
|
|
|
opacity: { min: 0.4, max: 1 },
|
2026-09-12 17:41:05 +08:00
|
|
|
|
fontSize: { min: 11, max: 20 },
|
2026-09-12 15:19:13 +08:00
|
|
|
|
speed: { min: 0.5, max: 2 },
|
2026-09-27 16:34:01 +08:00
|
|
|
|
marginX: { min: 0, max: 200 },
|
|
|
|
|
|
marginY: { min: 0, max: 160 },
|
2026-09-12 15:19:13 +08:00
|
|
|
|
} as const;
|
|
|
|
|
|
|
2026-09-12 17:41:05 +08:00
|
|
|
|
/** 停靠位置可选值(与 WinIsland 的 DockPosition 一致:顶/底 × 左/中/右) */
|
|
|
|
|
|
export const ISLAND_POSITIONS = [
|
|
|
|
|
|
'top-center',
|
|
|
|
|
|
'top-left',
|
|
|
|
|
|
'top-right',
|
|
|
|
|
|
'bottom-center',
|
|
|
|
|
|
'bottom-left',
|
|
|
|
|
|
'bottom-right',
|
|
|
|
|
|
] as const;
|
2026-09-12 15:19:13 +08:00
|
|
|
|
|
|
|
|
|
|
export const ISLAND_POSITION_LABELS: Record<(typeof ISLAND_POSITIONS)[number], string> = {
|
|
|
|
|
|
'top-center': '顶部居中',
|
|
|
|
|
|
'top-left': '左上角',
|
|
|
|
|
|
'top-right': '右上角',
|
|
|
|
|
|
'bottom-center': '底部居中',
|
2026-09-12 17:41:05 +08:00
|
|
|
|
'bottom-left': '左下角',
|
|
|
|
|
|
'bottom-right': '右下角',
|
2026-09-12 15:19:13 +08:00
|
|
|
|
};
|
2026-09-12 17:41:05 +08:00
|
|
|
|
|
|
|
|
|
|
/** 视觉风格可选值(参考 WinIsland 的 island_style) */
|
|
|
|
|
|
export const ISLAND_STYLES = ['black', 'glass', 'tinted'] as const;
|
|
|
|
|
|
|
|
|
|
|
|
export const ISLAND_STYLE_LABELS: Record<(typeof ISLAND_STYLES)[number], string> = {
|
|
|
|
|
|
black: '纯黑(灵动岛默认)',
|
2026-09-27 18:08:51 +08:00
|
|
|
|
glass: '毛玻璃(半透明)',
|
2026-09-12 17:41:05 +08:00
|
|
|
|
tinted: '主题色渐变',
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 空闲细缝尺寸(参考 WinIsland hidden_width = 5:空闲态是一条很窄的圆角柱)。
|
|
|
|
|
|
* 宽度固定 6px,高度取胶囊高度的一部分,视觉上就是一条"小黑条"。
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const ISLAND_SLIVER_WIDTH = 6;
|
|
|
|
|
|
|
2026-09-12 18:46:20 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 各形态相对"胶囊"的尺寸增量(**单一事实来源**,主进程与渲染进程共用):
|
|
|
|
|
|
* - 主进程据此计算"固定包围盒窗口"有多大(窗口只为最大形态留位置,开合时不改窗口);
|
|
|
|
|
|
* - 渲染进程据此计算岛的目标尺寸并做弹簧形变。
|
|
|
|
|
|
* 取值参考 WinIsland:胶囊 120×27 → 展开 360×200(宽 ×3、高 ×7.4),我们按内容需要取略小的比例。
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const ISLAND_SIZE_DELTA = {
|
|
|
|
|
|
expanded: { width: 156, height: 186 },
|
|
|
|
|
|
urgent: { width: 172, height: 202 },
|
|
|
|
|
|
call: { width: 188, height: 218 },
|
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
|
|
/** 阴影/光晕留白(窗口比最大形态多出的透明边,保证投影不被窗口裁掉) */
|
|
|
|
|
|
export const ISLAND_SHADOW_PAD = 10;
|
|
|
|
|
|
|
2026-09-12 17:41:05 +08:00
|
|
|
|
/** 岛内文本的排版系数(相对基础字号,集中在这里方便统一调整) */
|
|
|
|
|
|
export const ISLAND_TYPE_SCALE = {
|
|
|
|
|
|
/** 展开卡标题 */
|
|
|
|
|
|
title: 1.08,
|
|
|
|
|
|
/** 正文 */
|
|
|
|
|
|
body: 0.95,
|
|
|
|
|
|
/** 次要说明 / 元信息 */
|
|
|
|
|
|
meta: 0.78,
|
|
|
|
|
|
/** 徽标 / 按钮 */
|
|
|
|
|
|
badge: 0.76,
|
|
|
|
|
|
/** 胶囊主标题 */
|
|
|
|
|
|
pillTitle: 0.92,
|
|
|
|
|
|
/** 胶囊副标题 */
|
|
|
|
|
|
pillSub: 0.74,
|
|
|
|
|
|
} as const;
|
2026-09-11 21:57:38 +08:00
|
|
|
|
/** 默认学期周次上限 */
|
|
|
|
|
|
export const DEFAULT_WEEK_COUNT = 20;
|
|
|
|
|
|
|
|
|
|
|
|
/** WebSocket 事件名(服务端广播 / 客户端监听保持一致) */
|
|
|
|
|
|
export const SOCKET_EVENTS = {
|
|
|
|
|
|
notificationNew: 'notification:new',
|
|
|
|
|
|
homeworkNew: 'homework:new',
|
|
|
|
|
|
homeworkUpdated: 'homework:updated',
|
|
|
|
|
|
homeworkStatus: 'homework:status',
|
|
|
|
|
|
gradeUpdated: 'grade:updated',
|
|
|
|
|
|
scheduleUpdated: 'schedule:updated',
|
|
|
|
|
|
classUpdated: 'class:updated',
|
2026-09-12 13:57:46 +08:00
|
|
|
|
/** "叫人":老师点名让某位同学去找他(定向到 user:{studentId} 房间) */
|
|
|
|
|
|
callNew: 'call:new',
|
2026-09-27 14:59:12 +08:00
|
|
|
|
/** ClassIsland 联动:设备状态上报(Web 端实时展示当前课程) */
|
|
|
|
|
|
classislandState: 'classisland:state',
|
|
|
|
|
|
/** ClassIsland 联动:教师发起的提醒已下发(插件据此全屏弹出) */
|
|
|
|
|
|
classislandNotification: 'classisland:notification',
|
2026-09-11 21:57:38 +08:00
|
|
|
|
connected: 'connected',
|
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
2026-09-27 14:59:12 +08:00
|
|
|
|
/** ClassIsland 联动:设备接入令牌的前缀(便于识别与日志排查) */
|
|
|
|
|
|
export const CLASSISLAND_DEVICE_TOKEN_PREFIX = 'chci_';
|
|
|
|
|
|
|
|
|
|
|
|
/** ClassIsland 联动:ClassIsland 的时间点类型(与 TimeLayoutItem.TimeType 一致) */
|
|
|
|
|
|
export const CLASSISLAND_TIME_TYPES = {
|
|
|
|
|
|
class: 0,
|
|
|
|
|
|
break: 1,
|
|
|
|
|
|
divider: 2,
|
|
|
|
|
|
action: 3,
|
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* ClassIsland 的时间点类型 -> 本系统的节次类型。
|
|
|
|
|
|
* 3(行动)在本系统里按"分割线"处理:它不占课时,只做视觉分隔。
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const CLASSISLAND_TIME_TYPE_LABELS: Record<number, string> = {
|
|
|
|
|
|
0: '上课',
|
|
|
|
|
|
1: '课间',
|
|
|
|
|
|
2: '分割线',
|
|
|
|
|
|
3: '行动',
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** ClassIsland TimeState 字符串 -> 中文(插件上报 → Web 端展示) */
|
|
|
|
|
|
export const CLASSISLAND_TIME_STATE_LABELS: Record<string, string> = {
|
|
|
|
|
|
None: '空闲',
|
|
|
|
|
|
OnClass: '上课中',
|
|
|
|
|
|
PrepareOnClass: '预备铃',
|
|
|
|
|
|
Breaking: '课间休息',
|
|
|
|
|
|
AfterSchool: '已放学',
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 通知的显示位置(由**教室的班级客户端**在设置页里选,存在班级上)。
|
|
|
|
|
|
*
|
|
|
|
|
|
* - `both`:ClassHelper 客户端弹(弹窗 + 灵动岛),同时推给教室的 ClassIsland;
|
|
|
|
|
|
* - `client`:只在 ClassHelper 客户端弹,不打扰 ClassIsland;
|
|
|
|
|
|
* - `classisland`:只在 ClassIsland 上弹(客户端只进通知中心,不弹窗、不上岛)。
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const CLASSISLAND_NOTIFICATION_CHANNELS = ['both', 'client', 'classisland'] as const;
|
|
|
|
|
|
|
|
|
|
|
|
export const CLASSISLAND_NOTIFICATION_CHANNEL_LABELS: Record<string, string> = {
|
2026-09-27 16:34:01 +08:00
|
|
|
|
both: '两者都弹',
|
|
|
|
|
|
client: '灵动岛(ClassHelper 客户端)',
|
|
|
|
|
|
classisland: 'ClassIsland',
|
2026-09-27 14:59:12 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const CLASSISLAND_NOTIFICATION_CHANNEL_HINTS: Record<string, string> = {
|
2026-09-27 16:34:01 +08:00
|
|
|
|
both: '灵动岛与 ClassIsland 都会提醒老师发的内容(默认)',
|
|
|
|
|
|
client: '只在 ClassHelper 客户端的灵动岛提醒,不推送到 ClassIsland',
|
|
|
|
|
|
classisland: '只推送到 ClassIsland 全屏提醒,灵动岛不弹(通知中心仍留记录)',
|
2026-09-27 14:59:12 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** 默认显示位置:两端都弹 */
|
|
|
|
|
|
export const DEFAULT_CLASSISLAND_NOTIFICATION_CHANNEL = 'both';
|
2026-09-27 16:34:01 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 作业录入的默认快捷短语(客户端「设置 → 作业录入」可增删)。
|
|
|
|
|
|
*
|
|
|
|
|
|
* 教室里老师录作业的常见口径:科目简称(P=拼音)、本子类型(大本/小本)、
|
|
|
|
|
|
* 作业动作(背诵/默写/听写/预习/订正)—— 点一下就追加到内容里,少打字。
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const HOMEWORK_PHRASE_DEFAULTS = [
|
|
|
|
|
|
'P',
|
|
|
|
|
|
'大本',
|
|
|
|
|
|
'小本',
|
|
|
|
|
|
'卷子',
|
|
|
|
|
|
'背诵',
|
|
|
|
|
|
'默写',
|
|
|
|
|
|
'听写',
|
|
|
|
|
|
'预习',
|
|
|
|
|
|
'订正',
|
|
|
|
|
|
'读书',
|
|
|
|
|
|
] as const;
|
|
|
|
|
|
|
|
|
|
|
|
/** 单条快捷短语的最大长度(防止把整篇作业粘进去) */
|
|
|
|
|
|
export const HOMEWORK_PHRASE_MAX_LENGTH = 20;
|
|
|
|
|
|
|
|
|
|
|
|
/** 快捷短语最多几条 */
|
|
|
|
|
|
export const HOMEWORK_PHRASE_MAX_COUNT = 24;
|
|
|
|
|
|
|
2026-09-27 14:59:12 +08:00
|
|
|
|
/** 默认提醒显示时长(秒),后端与插件共用同一口径 */
|
|
|
|
|
|
export const CLASSISLAND_NOTIFICATION_DEFAULT_DURATION = 8;
|
|
|
|
|
|
export const CLASSISLAND_NOTIFICATION_MAX_DURATION = 120;
|
|
|
|
|
|
|
2026-09-12 13:57:46 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* "叫人"快捷短语(Web 管理端一键选择,学生端灵动岛同步展示)。
|
|
|
|
|
|
* 自定义消息会替换/补全这些短语;`message` 为空时用短语本身。
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const CALL_QUICK_PHRASES: readonly string[] = [
|
|
|
|
|
|
'请到办公室找我',
|
|
|
|
|
|
'请到讲台找我',
|
|
|
|
|
|
'请带上作业本找我',
|
|
|
|
|
|
'请带上试卷找我',
|
|
|
|
|
|
'请到实验室找我',
|
|
|
|
|
|
'请到门卫处找我',
|
|
|
|
|
|
'请到教室门口等我',
|
|
|
|
|
|
'请马上来一趟',
|
|
|
|
|
|
] as const;
|
|
|
|
|
|
|
|
|
|
|
|
/** 叫人消息标题模板:请 XXX 同学找 XXX 老师(老师名字已含"老师"时不重复追加) */
|
|
|
|
|
|
export function buildCallTitle(studentName: string, teacherName: string): string {
|
|
|
|
|
|
const teacher = /老师|教师|主任|校长/.test(teacherName) ? teacherName : `${teacherName} 老师`;
|
|
|
|
|
|
return `请 ${studentName} 同学找 ${teacher}`;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-11 21:57:38 +08:00
|
|
|
|
/** Socket.IO 房间名生成规则:与后端保持一致,客户端订阅时复用 */
|
|
|
|
|
|
export const SOCKET_ROOMS = {
|
|
|
|
|
|
class: (classId: string): string => `class:${classId}`,
|
|
|
|
|
|
user: (userId: string): string => `user:${userId}`,
|
|
|
|
|
|
teacher: (teacherId: string): string => `teacher:${teacherId}`,
|
|
|
|
|
|
role: (role: UserRole): string => `role:${role}`,
|
|
|
|
|
|
students: 'students',
|
|
|
|
|
|
teachers: 'teachers',
|
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
|
|
/** 本地持久化键(Web 端 localStorage / EXE 端 IndexedDB 命名空间) */
|
|
|
|
|
|
export const STORAGE_KEYS = {
|
|
|
|
|
|
token: 'classhelper.token',
|
|
|
|
|
|
user: 'classhelper.user',
|
|
|
|
|
|
serverUrl: 'classhelper.serverUrl',
|
|
|
|
|
|
cachePrefix: 'classhelper.cache',
|
|
|
|
|
|
lastSyncAt: 'classhelper.lastSyncAt',
|
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
|
|
/** 桌面客户端默认后端地址 */
|
|
|
|
|
|
export const DEFAULT_SERVER_URL = 'http://127.0.0.1:4000';
|
|
|
|
|
|
|
|
|
|
|
|
/** 默认端口与分页 */
|
|
|
|
|
|
export const DEFAULT_SERVER_PORT = 4000;
|
|
|
|
|
|
export const DEFAULT_PAGE_SIZE = 20;
|
|
|
|
|
|
export const MAX_PAGE_SIZE = 200;
|
|
|
|
|
|
|
|
|
|
|
|
/** 教师与管理员角色集合,便于 RBAC 判断 */
|
|
|
|
|
|
export const STAFF_ROLES: readonly UserRole[] = ['ADMIN', 'TEACHER'];
|