- 完整实现Apple HIG 2025设计系统 - 添加Modal弹窗组件(毛玻璃效果、流畅动画) - 添加FileUpload文件上传组件(拖拽、批量上传、进度显示) - 实现产品上传功能(支持DWG/GLB/GLTF文件) - 优化产品列表展示(可折叠的产品+SKU结构) - 实现Tab切换功能(3D模型管理、五金件、BOM、文档) - 修复主题系统hydration错误 - 优化按钮和间距,符合Apple设计规范 - 添加分享页面的Apple风格重设计 - 创建测试数据脚本
120 lines
3.2 KiB
HTML
120 lines
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN" data-theme="light">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>主题测试</title>
|
|
<style>
|
|
/* 复制 globals.css 中的 CSS 变量定义 */
|
|
:root,
|
|
[data-theme="light"] {
|
|
--color-blue: #007AFF;
|
|
--color-background-primary: #FFFFFF;
|
|
--color-label-primary: #000000;
|
|
}
|
|
|
|
[data-theme="dark"] {
|
|
--color-blue: #0A84FF;
|
|
--color-background-primary: #000000;
|
|
--color-label-primary: #FFFFFF;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
|
|
background-color: var(--color-background-primary);
|
|
color: var(--color-label-primary);
|
|
padding: 40px;
|
|
transition: all 0.3s;
|
|
}
|
|
|
|
.test-button {
|
|
background-color: var(--color-blue);
|
|
color: white;
|
|
padding: 12px 24px;
|
|
border: none;
|
|
border-radius: 10px;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
margin: 10px;
|
|
}
|
|
|
|
.info-box {
|
|
background: #f0f0f0;
|
|
padding: 20px;
|
|
border-radius: 10px;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
[data-theme="dark"] .info-box {
|
|
background: #2c2c2e;
|
|
}
|
|
|
|
.color-sample {
|
|
width: 100px;
|
|
height: 100px;
|
|
background-color: var(--color-blue);
|
|
border-radius: 10px;
|
|
margin: 10px 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>主题系统测试页面</h1>
|
|
|
|
<div class="info-box">
|
|
<h2>当前状态</h2>
|
|
<p>主题: <strong id="current-theme">-</strong></p>
|
|
<p>--color-blue 值: <strong id="blue-value">-</strong></p>
|
|
<p>按钮背景色: <strong id="button-bg">-</strong></p>
|
|
</div>
|
|
|
|
<h2>测试按钮</h2>
|
|
<button class="test-button" onclick="alert('按钮点击成功!')">
|
|
测试按钮(应该是蓝色)
|
|
</button>
|
|
|
|
<h2>颜色样本</h2>
|
|
<div class="color-sample"></div>
|
|
<p>这个方块应该显示 --color-blue 的颜色</p>
|
|
|
|
<h2>主题切换</h2>
|
|
<button class="test-button" onclick="toggleTheme()">
|
|
切换主题
|
|
</button>
|
|
|
|
<script>
|
|
function updateInfo() {
|
|
const theme = document.documentElement.getAttribute('data-theme');
|
|
const blueValue = getComputedStyle(document.documentElement).getPropertyValue('--color-blue');
|
|
const button = document.querySelector('.test-button');
|
|
const buttonBg = getComputedStyle(button).backgroundColor;
|
|
|
|
document.getElementById('current-theme').textContent = theme;
|
|
document.getElementById('blue-value').textContent = blueValue;
|
|
document.getElementById('button-bg').textContent = buttonBg;
|
|
|
|
console.log('主题:', theme);
|
|
console.log('--color-blue:', blueValue);
|
|
console.log('按钮背景色:', buttonBg);
|
|
}
|
|
|
|
function toggleTheme() {
|
|
const current = document.documentElement.getAttribute('data-theme');
|
|
const newTheme = current === 'light' ? 'dark' : 'light';
|
|
document.documentElement.setAttribute('data-theme', newTheme);
|
|
updateInfo();
|
|
}
|
|
|
|
// 页面加载时更新信息
|
|
updateInfo();
|
|
|
|
// 监听主题变化
|
|
const observer = new MutationObserver(updateInfo);
|
|
observer.observe(document.documentElement, {
|
|
attributes: true,
|
|
attributeFilter: ['data-theme']
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|