feat: AI分析单页展示 + 主题切换 + 移动端适配

- AI分析页改为直接展示最新报告,历史存数据库
- 新增浅色/深色/系统自动主题切换
- 市场看板、AI分析页适配主题变量
- 移动端表格可滑动、按钮自动换行
- Mermaid图表支持
- Markdown表格渲染支持(remark-gfm)
This commit is contained in:
Sakurasan
2026-09-01 12:33:27 +08:00
parent 912a224b6b
commit 6478e0d403
16 changed files with 614 additions and 407 deletions
+12 -4
View File
@@ -24,14 +24,14 @@
<script>
// 在 React 加载前立即设置主题,避免闪烁
(function() {
const isInIframe = window.self !== window.top;
function applyThemeToDOM(theme) {
document.documentElement.classList.remove('light', 'dark');
document.documentElement.classList.add(theme);
document.documentElement.setAttribute('data-theme', theme);
}
var isInIframe = window.self !== window.top;
if (isInIframe) {
// 监听父窗口主动推送的主题消息
window.addEventListener('message', function(event) {
@@ -43,8 +43,16 @@
}
});
} else {
// 非 iframe 环境,使用默认 light 主题
applyThemeToDOM('light');
// 从 localStorage 读取用户选择
var saved = localStorage.getItem('theme');
var theme;
if (saved === 'light' || saved === 'dark') {
theme = saved;
} else {
// system: 跟随系统偏好
theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
applyThemeToDOM(theme);
}
})();
</script>