feat: 新增作息报时器功能并替换短链接前缀为/to/

- 新增作息报时器独立模块,包含完整的日程管理、语音播报和待机功能
- 短链接正式前缀由/l/改为/to/,解决手机小屏下与I、i、1字形混淆问题
- 保留旧前缀/l/、/L/、/I/、/i/兼容已分发的旧短链
- 新增短码大小写兜底匹配,仅唯一匹配时生效避免歧义
- 新增防爆紧急替换功能,可轮换首页鉴权并替换短链接
- 新增多个调试和集成测试脚本,保障数据安全和功能回归
This commit is contained in:
yangxiangyuan
2026-10-09 14:04:37 +08:00
parent ac475b6659
commit a3e8911deb
131 changed files with 7695 additions and 60 deletions
+112 -2
View File
@@ -6,7 +6,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="theme-color" content="#080b12">
<title>框子 - 运动提醒宝</title>
<title>框子</title>
<link rel="icon" href="/tools/web_order_box/favicon.ico">
<link rel="stylesheet" href="/tools/web_order_box/order_box.css">
</head>
@@ -28,6 +28,16 @@
</div>
<svg class="kit-arrow" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
</button>
<button class="kit-card" id="btnEnterSchedule" disabled>
<div class="kit-icon-wrap">
<svg class="kit-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><polyline points="12 7 12 12 15.5 14"/></svg>
</div>
<div class="kit-info">
<span class="kit-name">作息报时器</span>
<span class="kit-desc">按「时:分」到点播报、重复提醒、大字时钟常驻待机。</span>
</div>
<svg class="kit-arrow" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
</button>
</div>
</div>
@@ -87,7 +97,7 @@
</div>
<!-- 底部 Tab -->
<div class="tab-bar">
<div class="tab-bar" id="motionTabBar">
<button class="tab-item active" data-tab="cards">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>
<span>卡片</span>
@@ -99,6 +109,80 @@
</div>
</div>
<!-- ===== 作息报时器 主容器 ===== -->
<div id="viewSchedule" class="view" style="display:none">
<div class="motion-header">
<button class="btn-back" id="btnBackHubFromSchedule">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 18 9 12 15 6"/></svg>
<span>返回框子</span>
</button>
</div>
<div class="motion-body">
<!-- 语音不可用预警(作息报时器独立一份) -->
<div id="schedVoiceWarning" class="stale-warning voice-warning" style="display:none">
<div class="stale-title">语音播报可能不可用</div>
<div class="stale-desc" id="schedVoiceWarningDesc">本机系统语音未启动,已尝试云端语音兜底。</div>
<button class="btn-stale-clean" id="btnSchedRetryVoice">重新检测</button>
</div>
<!-- 待机大屏 -->
<div class="standby-panel" id="schedStandbyPanel">
<div class="standby-clock" id="schedClock">--:--:--</div>
<div class="standby-date" id="schedDate">--</div>
<div class="standby-next" id="schedNext">请先选择一套日程</div>
<div class="standby-status" id="schedStatus">未待机</div>
<div class="standby-actions">
<button class="btn-primary standby-btn" id="btnSchedStandby"><span>开始待机</span></button>
</div>
</div>
<!-- 错过显示条 -->
<div id="schedMissed" class="stale-warning missed-warning" style="display:none">
<div class="stale-title">已错过以下时刻</div>
<div class="stale-desc" id="schedMissedDesc"></div>
<button class="btn-stale-clean" id="btnSchedMissedClear">知道了</button>
</div>
<!-- 日程页 -->
<div id="pageSchedules" class="page">
<div class="cards-toolbar">
<button class="btn-primary" id="btnNewSchedule">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
<span>新建日程</span>
</button>
</div>
<div id="schedulesList" class="cards-list"></div>
<div id="schedulesEmpty" class="empty-state" style="display:none">
<div class="empty-title">还没有作息日程</div>
<div class="empty-desc">建一套日程,把起床、做饭、喂鱼这些时刻按「时:分」排进去。</div>
</div>
<div id="schedulesLoading" class="loading-wrap"><div class="spinner"></div></div>
</div>
<!-- 播报记录页 -->
<div id="pageSchedLogs" class="page" style="display:none">
<div id="schedLogsList" class="history-list"></div>
<div id="schedLogsEmpty" class="empty-state" style="display:none">
<div class="empty-title">还没有播报记录</div>
<div class="empty-desc">开始待机并到点播报后,这里会出现记录。</div>
</div>
<div id="schedLogsLoading" class="loading-wrap"><div class="spinner"></div></div>
</div>
</div>
<div class="tab-bar" id="schedTabBar">
<button class="tab-item active" data-sched-tab="schedules">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="9"/><polyline points="12 7 12 12 15.5 14"/></svg>
<span>日程</span>
</button>
<button class="tab-item" data-sched-tab="logs">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 6h16M4 12h16M4 18h10"/></svg>
<span>记录</span>
</button>
</div>
</div>
<!-- ===== 卡片编辑器 Modal ===== -->
<div id="editorModal" class="modal-overlay" style="display:none">
<div class="modal-sheet">
@@ -121,6 +205,32 @@
</div>
</div>
<!-- ===== 作息日程编辑器 Modal ===== -->
<div id="schedEditorModal" class="modal-overlay" style="display:none">
<div class="modal-sheet">
<div class="sheet-header">
<span class="sheet-title" id="schedEditorTitle">新建作息日程</span>
<button class="btn-icon" id="btnSchedEditorClose">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
</button>
</div>
<div class="sheet-body" id="schedEditorBody">
<!-- 动态渲染 -->
</div>
</div>
</div>
<!-- ===== 作息播报全屏 Modal ===== -->
<div id="schedAlertModal" class="modal-overlay modal-fullscreen" style="display:none">
<div class="sched-alert-container">
<div class="sched-alert-badge">作息提醒</div>
<div class="sched-alert-time" id="schedAlertTime">--:--</div>
<div class="sched-alert-name" id="schedAlertName"></div>
<div class="sched-alert-repeat" id="schedAlertRepeat"></div>
<button class="btn-primary sched-alert-ack" id="btnSchedAck"><span>我知道了</span></button>
</div>
</div>
<!-- ===== 通用弹窗 ===== -->
<div id="dialogOverlay" class="dialog-overlay" style="display:none">
<div class="dialog-box" id="dialogBox">
+118 -8
View File
@@ -65,7 +65,9 @@ input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
/* ============================================================
视图骨架
============================================================ */
.view { min-height: 100dvh; display: flex; flex-direction: column; }
/* 老浏览器(如老版 iOS Safari)不支持 dvh / inset 简写,会整条丢弃该声明。
凡是用到这些新特性处,先写一份等效的传统写法兜底,再写新写法做渐进增强。 */
.view { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.page { animation: fadeUp 0.25s ease both; }
/* ============================================================
@@ -218,9 +220,12 @@ input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
/* ============================================================
Modal(底部抽屉 / 全屏)
============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.58); z-index: 100; display: flex; flex-direction: column; justify-content: flex-end; animation: fadeIn 0.2s ease both; }
/* 关键:inset: 0 在老 iOS(<14.1)不被支持,会被整条丢弃,
遮罩将失去定位而跑到文档静态位置(视口外)→ 全屏弹窗和按钮都看不见。
因此这里改写成四条独立定位,任何浏览器都认。 */
.modal-overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,0.58); z-index: 100; display: flex; flex-direction: column; justify-content: flex-end; animation: fadeIn 0.2s ease both; }
.modal-fullscreen { justify-content: stretch; align-items: stretch; }
.modal-sheet { width: 100%; background: var(--bg); border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 92dvh; display: flex; flex-direction: column; animation: slideUp 0.3s ease-out both; border-top: 1px solid var(--border); }
.modal-sheet { width: 100%; background: var(--bg); border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; animation: slideUp 0.3s ease-out both; border-top: 1px solid var(--border); }
.sheet-header { display: flex; flex-direction: row; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sheet-title { font-size: 18px; font-weight: 600; }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px; }
@@ -232,14 +237,14 @@ input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
/* ============================================================
通用弹窗 / 交互详情弹窗
============================================================ */
.dialog-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 200; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.15s ease both; }
.dialog-overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,0.6); z-index: 200; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.15s ease both; }
.dialog-box { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; max-width: 340px; width: calc(100% - 48px); animation: scaleIn 0.2s ease both; border: 1px solid var(--border); box-shadow: 0 16px 48px rgba(0,0,0,0.5); }
.dialog-title { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.dialog-body { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 20px; white-space: pre-wrap; word-break: break-word; }
.dialog-actions { display: flex; flex-direction: row; gap: 8px; justify-content: flex-end; }
.dialog-header-row { display: flex; flex-direction: row; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.dialog-header-row .dialog-title { margin-bottom: 0; }
.dialog-interaction { max-width: 420px; max-height: 80dvh; display: flex; flex-direction: column; }
.dialog-interaction { max-width: 420px; max-height: 80vh; max-height: 80dvh; display: flex; flex-direction: column; }
.interaction-content { flex: 1; overflow-y: auto; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border); padding: 12px; font-size: 12px; line-height: 1.5; color: var(--text-secondary); white-space: pre-wrap; word-break: break-all; margin-bottom: 16px; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.btn-copy { color: var(--text-secondary); }
.btn-copy:hover { color: var(--primary); }
@@ -361,7 +366,7 @@ input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
执行器(全屏)— 匹配 JS 实际 class 名
============================================================ */
.runner-container {
width: 100%; height: 100dvh; background: var(--bg);
width: 100%; height: 100vh; height: 100dvh; background: var(--bg);
display: flex; flex-direction: column; padding: 20px;
padding-top: calc(20px + env(safe-area-inset-top));
overflow-y: auto; animation: fadeIn 0.25s ease both;
@@ -438,11 +443,12 @@ input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
}
.runner-col-left .runner-next-card { margin-bottom: 0; }
.runner-timer {
font-size: 90px; /* 老浏览器兜底:不认识 clamp 时用这个 */
font-size: clamp(72px, 14vw, 128px);
margin: 8px 0 16px;
}
.runner-current { font-size: clamp(28px, 4.2vw, 46px); }
.runner-next { font-size: clamp(22px, 3vw, 34px); }
.runner-current { font-size: 34px; font-size: clamp(28px, 4.2vw, 46px); }
.runner-next { font-size: 26px; font-size: clamp(22px, 3vw, 34px); }
}
/* 当前动作名 — JS 用 .runner-current */
@@ -497,3 +503,107 @@ input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
.runner-global-stats { font-size: 13px; color: var(--text-secondary); text-align: center; font-variant-numeric: tabular-nums; display: flex; flex-direction: row; justify-content: center; gap: 4px; flex-wrap: wrap; }
.runner-global-divider { color: var(--text-disabled); }
.runner-global-remaining { color: var(--text-secondary); }
/* ============================================================
作息报时器 — 待机大屏
============================================================ */
.standby-panel {
margin-top: 8px; margin-bottom: 16px; padding: 24px 16px;
background: var(--surface); border: 1px solid var(--border);
border-radius: var(--radius-xl); text-align: center;
animation: fadeUp 0.3s ease both;
}
.standby-panel.is-live { border-color: rgba(74,222,128,0.35); }
.standby-clock {
/* 先给 vw 兜底(老浏览器不认识 clamp,会丢下一条,但认得 vw,取值一致);
再用 clamp 做上限控制,避免大屏上无限变大 */
font-size: 17vw; font-size: clamp(56px, 17vw, 104px);
font-weight: 700; color: var(--primary);
line-height: 1; letter-spacing: 2px; font-variant-numeric: tabular-nums;
text-shadow: 0 0 36px rgba(240,179,95,0.28);
}
.standby-date { font-size: 15px; color: var(--text-secondary); margin-top: 10px; }
.standby-next { font-size: 18px; font-weight: 600; margin-top: 16px; line-height: 1.4; word-break: break-word; }
.standby-status { font-size: 13px; color: var(--text-disabled); margin-top: 6px; }
.standby-panel.is-live .standby-status { color: var(--success); }
.standby-actions { margin-top: 18px; display: flex; justify-content: center; }
.standby-btn { padding: 12px 32px; font-size: 16px; }
/* 错过显示条:复用 stale-warning 结构,橙色警示 */
.missed-warning { background: rgba(251,191,36,0.05); }
.missed-line { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
/* ============================================================
作息报时器 — 日程卡片与时刻预览
============================================================ */
.sched-item-preview { margin-top: 8px; }
.sched-preview-line { font-size: 13px; color: var(--text-secondary); line-height: 1.6; font-variant-numeric: tabular-nums; }
.sched-preview-line .sched-preview-time { color: var(--primary); font-weight: 600; margin-right: 6px; }
.sched-preview-more { font-size: 13px; color: var(--text-disabled); font-style: italic; line-height: 1.6; }
.sched-active-tag {
display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
background: rgba(74,222,128,0.15); color: var(--success); margin-left: 8px;
}
/* ============================================================
作息报时器 — 编辑器
============================================================ */
.weekday-row { display: flex; flex-direction: row; gap: 6px; flex-wrap: wrap; }
.weekday-chip {
flex: 1; min-width: 0; padding: 10px 2px; text-align: center;
background: var(--surface-strong); border-radius: var(--radius-sm);
color: var(--text-secondary); font-size: 13px; white-space: nowrap;
transition: background 0.2s, color 0.2s, transform 0.15s;
}
.weekday-chip:hover { color: var(--text); }
.weekday-chip:active { transform: scale(0.94); }
.weekday-chip.active { background: var(--primary); color: #081018; font-weight: 600; }
.sched-item-editor {
background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary);
border-radius: var(--radius-md); padding: 14px; margin-bottom: 10px;
animation: fadeUp 0.25s ease both;
}
.sched-time-input {
width: 130px; font-size: 16px; padding: 10px 12px; background: var(--bg);
font-variant-numeric: tabular-nums; color-scheme: dark; margin-bottom: 8px;
}
.sched-item-editor .step-badge { background: var(--primary); color: #081018; }
.sched-item-editor .step-index { font-variant-numeric: tabular-nums; }
.sched-item-row-2 { display: flex; flex-direction: row; gap: 10px; margin-top: 8px; }
.sched-item-row-2 .sched-field { flex: 1; min-width: 0; }
.sched-field-label { display: block; font-size: 12px; color: var(--text-disabled); margin-bottom: 4px; }
.sched-number-input { width: 100%; font-size: 14px; padding: 10px 12px; background: var(--bg); }
.sched-item-hint { font-size: 12px; color: var(--text-disabled); margin-top: 8px; line-height: 1.5; }
/* ============================================================
作息报时器 — 播报全屏
============================================================ */
.sched-alert-container {
width: 100%; height: 100vh; height: 100dvh; background: var(--bg);
display: flex; flex-direction: column; align-items: center; justify-content: center;
gap: 14px; padding: 24px; padding-top: calc(24px + env(safe-area-inset-top));
text-align: center; animation: fadeIn 0.25s ease both;
}
.sched-alert-badge {
padding: 4px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
border: 1px solid var(--primary); color: var(--primary); background: var(--primary-soft);
}
.sched-alert-time {
font-size: 20vw; font-size: clamp(64px, 20vw, 128px);
font-weight: 700; color: var(--primary);
line-height: 1; letter-spacing: 2px; font-variant-numeric: tabular-nums;
text-shadow: 0 0 48px rgba(240,179,95,0.4);
}
.sched-alert-name { font-size: 34px; font-weight: 700; line-height: 1.25; word-break: break-word; }
.sched-alert-repeat { font-size: 15px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.sched-alert-ack {
margin-top: 24px; width: 100%; max-width: 360px; justify-content: center;
padding: 18px; font-size: 20px;
}
/* 记录页条目 */
.sched-log-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.sched-log-badge.badge-fired { background: rgba(240,179,95,0.15); color: var(--primary); }
.sched-log-badge.badge-acked { background: rgba(74,222,128,0.15); color: var(--success); }
.sched-log-badge.badge-missed { background: rgba(239,68,68,0.15); color: var(--error); }
File diff suppressed because it is too large Load Diff