feat: AI分析单页展示 + 主题切换 + 移动端适配
- AI分析页改为直接展示最新报告,历史存数据库 - 新增浅色/深色/系统自动主题切换 - 市场看板、AI分析页适配主题变量 - 移动端表格可滑动、按钮自动换行 - Mermaid图表支持 - Markdown表格渲染支持(remark-gfm)
This commit is contained in:
+12
-4
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user