feat: v2.9.0 终端实时面板,学习时长与学分统计
新增 runner/tui.mjs(~470 行):前台运行时自动开一块实时面板, 框线布局显示状态 / 课程 / 学时 / 课时 / 视频进度条 / 进度 / 最近日志。 - 学习统计 runner/study.mjs:只累计视频真在播的时长(暂停、重试退避、 页面加载都不计),学分按课程去重(重试 / 刷新不重复计) - 页面侧新增 credit 快照:平台只把本门学分写在倒计时文案里, 学完文案就消失,所以边播边记 - log.mjs 增加 setConsoleSink:面板接管终端那一路,日志文件仍是纯文本 - 面板里按 q 等价 Ctrl+C,走 stop.request 同一条优雅收尾路径 - 尺寸自适应:宽度跟随终端(不封顶 120 列),无 resize 事件的平台 靠定时刷新发现尺寸变化;变窄时按旧帧在新宽度下的折行数回退光标, 折完超过窗口高就整屏重置;宽度 / 高度不足按重要性丢字段 - 非 TTY(重定向 / 管道 / 计划任务 / --check)自动降级为逐行日志, 不写 ANSI 控制字符;--no-tui / YUN_XUE_TANG_TUI=0 可手动关闭, --no-color / NO_COLOR 关颜色 - 监控轮询从 2000ms 调到 1000ms,与面板刷新对齐 - supervisor 收尾时先收面板再逐行打退出日志,并汇总本次学习时长 / 学分 - check.mjs 增加裸 CR 检查:脚本里的 config\runner 曾被写成裸 CR, 变成 config<CR>unner 导致找不到配置文件 自测:npm run test:tui(渲染 / 列宽 / 极端尺寸)、npm run test:study(假时钟口径)
This commit is contained in:
1 parent
c1e883d67f
commit
65bf63ea6a
17 files changed
+1608
-28
No files matched your search
@@ -7,7 +7,7 @@ rem it report nonsense like "'npm' is not recognized".
|
||||
rem All Chinese messages come from the Node runner output instead.
|
||||
rem
|
||||
rem Usage:
|
||||
rem scripts\start-headless.cmd use config␍unner.config.mjs
|
||||
rem scripts\start-headless.cmd use config\runner.config.mjs
|
||||
rem scripts\start-headless.cmd --help print all options
|
||||
rem scripts\start-headless.cmd --max 3 command line overrides config file
|
||||
rem ---------------------------------------------------------------
|
||||
@@ -25,12 +25,12 @@ call npm run build
|
||||
if errorlevel 1 goto build_fail
|
||||
|
||||
:have_build
|
||||
if not exist "config␍unner.config.mjs" goto no_config
|
||||
echo [config] config␍unner.config.mjs found, editing it is enough (no rebuild needed)
|
||||
if not exist "config\runner.config.mjs" goto no_config
|
||||
echo [config] config\runner.config.mjs found, editing it is enough (no rebuild needed)
|
||||
goto run
|
||||
|
||||
:no_config
|
||||
echo [warn] config␍unner.config.mjs not found, built-in defaults will be used
|
||||
echo [warn] config\runner.config.mjs not found, built-in defaults will be used
|
||||
|
||||
:run
|
||||
echo [run] headless runner starting, press Ctrl+C to stop
|
||||
|
||||
Reference in new issue
Block a user