diff --git a/modules/M22-bulletin/README.md b/modules/M22-bulletin/README.md new file mode 100644 index 00000000..5284c076 --- /dev/null +++ b/modules/M22-bulletin/README.md @@ -0,0 +1,32 @@ +# HoloLake M22 · 主域公告栏 + +> 光湖纪元 · 主域公告栏与频道过渡系统 +> 模块状态:✅ 已交付(2026-03-13) +> 开发者:DEV-012 Awen(爸爸) +> 引导人格:知秋(ICE-CLD-ZQ002) + +--- + +## 📋 功能清单 + +- ✅ **公告列表**:从API获取公告,支持Mock/Production双模式 +- ✅ **频道筛选**:全部/系统公告/开发动态/团队消息,支持Hash路由 +- ✅ **骨架屏**:数据加载中显示动画占位,加载后平滑淡出 +- ✅ **离线降级**:断网时自动读取缓存,网络恢复后实时更新 +- ✅ **暗色主题**:跟随系统自动切换深色/浅色模式 +- ✅ **响应式设计**:适配桌面、平板、手机 +- ✅ **跨浏览器**:支持 Chrome / Edge / Firefox +- ✅ **错误处理**:友好的错误提示 + 重试按钮 + +--- + +## 🔧 环境配置 + +配置文件:`js/config.js` + +```javascript +// 环境开关:'mock' 或 'production' +env: 'mock', // 🟡 当前为Mock模式,待后端就绪后改为production + +// API地址(production模式使用) +apiBaseUrl: 'https://api.example.com/v1', // 待替换为真实地址 \ No newline at end of file diff --git a/modules/M22-bulletin/css/style.css b/modules/M22-bulletin/css/style.css new file mode 100644 index 00000000..9c5d2f84 --- /dev/null +++ b/modules/M22-bulletin/css/style.css @@ -0,0 +1,334 @@ +/* ===== CSS 变量定义(浅色/深色主题)===== */ +:root { + --bg-primary: #ffffff; + --bg-secondary: #f5f7fa; + --bg-tertiary: #eef1f5; + --text-primary: #1e293b; + --text-secondary: #475569; + --text-tertiary: #64748b; + --accent-primary: #3b82f6; + --accent-secondary: #2563eb; + --border-color: #e2e8f0; +} + +/* 深色主题 */ +@media (prefers-color-scheme: dark) { + :root { + --bg-primary: #0f172a; + --bg-secondary: #1e293b; + --bg-tertiary: #334155; + --text-primary: #f1f5f9; + --text-secondary: #cbd5e1; + --text-tertiary: #94a3b8; + --accent-primary: #60a5fa; + --accent-secondary: #3b82f6; + --border-color: #334155; + } +} + +/* ===== 基础样式 ===== */ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; + background: var(--bg-primary); + color: var(--text-primary); + line-height: 1.5; + transition: background-color 0.3s, color 0.3s; +} + +.app-container { + max-width: 1200px; + margin: 0 auto; + padding: 20px; +} + +/* ===== 头部样式 ===== */ +.header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 20px 0; + border-bottom: 1px solid var(--border-color); + margin-bottom: 20px; +} + +.header h1 { + font-size: 1.8rem; + font-weight: 600; + background: linear-gradient(135deg, #3b82f6, #8b5cf6); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; +} + +.header-actions { + display: flex; + gap: 12px; + align-items: center; +} + +.lang-switcher { + display: flex; + gap: 4px; +} + +.lang-btn { + padding: 6px 12px; + border: 1px solid var(--border-color); + background: var(--bg-secondary); + color: var(--text-secondary); + border-radius: 6px; + cursor: pointer; + font-size: 0.9rem; +} + +.lang-btn:hover { + background: var(--accent-primary); + color: white; +} + +.pinned-badge { + background: #fef3c7; + color: #92400e; + padding: 4px 10px; + border-radius: 20px; + font-size: 0.85rem; +} + +.subscribe-btn { + background: var(--accent-primary); + color: white; + border: none; + padding: 8px 16px; + border-radius: 8px; + cursor: pointer; + font-weight: 500; +} + +/* ===== 频道栏 ===== */ +.channel-bar { + display: flex; + gap: 10px; + margin-bottom: 24px; + flex-wrap: wrap; +} + +.channel-tab { + padding: 8px 20px; + border: none; + background: var(--bg-secondary); + color: var(--text-secondary); + border-radius: 30px; + cursor: pointer; + font-size: 0.95rem; + transition: all 0.2s; +} + +.channel-tab.active { + background: var(--accent-primary); + color: white; +} + +.channel-tab:hover:not(.active) { + background: var(--bg-tertiary); +} + +/* ===== 骨架屏样式(加强版)===== */ +#skeleton-container { + display: block; + margin: 20px 0; +} + +.skeleton-card { + background: var(--bg-secondary); + border-radius: 12px; + padding: 24px; + margin-bottom: 20px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); + border: 1px solid var(--border-color); +} + +.skeleton { + background: linear-gradient( + 90deg, + var(--bg-tertiary) 0%, + #d1d5db 25%, + var(--bg-tertiary) 50%, + #d1d5db 75%, + var(--bg-tertiary) 100% + ); + background-size: 200% 100%; + animation: skeleton-loading 1.2s infinite ease-in-out; + border-radius: 8px; +} + +@keyframes skeleton-loading { + 0% { background-position: 200% 0; } + 100% { background-position: -200% 0; } +} + +.skeleton-title { + width: 60%; + height: 28px; + margin-bottom: 16px; +} + +.skeleton-text { + width: 100%; + height: 18px; + margin-bottom: 12px; +} + +.skeleton-text.short { + width: 40%; +} + +/* ===== 公告列表样式 ===== */ +.bulletin-container { + margin: 20px 0; + min-height: 300px; +} + +.bulletin-item { + background: var(--bg-secondary); + border-radius: 12px; + padding: 24px; + margin-bottom: 20px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); + border: 1px solid var(--border-color); + animation: fadeIn 0.3s ease; +} + +@keyframes fadeIn { + from { opacity: 0; transform: translateY(10px); } + to { opacity: 1; transform: translateY(0); } +} + +.bulletin-title { + font-size: 1.3rem; + margin-bottom: 10px; + color: var(--text-primary); +} + +.bulletin-meta { + display: flex; + gap: 16px; + margin-bottom: 16px; + color: var(--text-tertiary); + font-size: 0.9rem; +} + +.bulletin-channel { + background: var(--bg-tertiary); + padding: 2px 10px; + border-radius: 20px; + color: var(--text-secondary); +} + +.bulletin-date { + color: var(--text-tertiary); +} + +.bulletin-content { + color: var(--text-secondary); + line-height: 1.7; +} + +/* ===== 底部样式 ===== */ +.footer { + margin-top: 40px; + padding-top: 20px; + border-top: 1px solid var(--border-color); + display: flex; + justify-content: space-between; + color: var(--text-tertiary); + font-size: 0.9rem; +} + +/* ===== 错误状态 ===== */ +.error-state { + text-align: center; + padding: 4rem 2rem; + background: var(--bg-secondary); + border-radius: 12px; + margin: 2rem 0; +} + +.error-icon { + font-size: 3rem; + margin-bottom: 1rem; +} + +.error-title { + font-size: 1.3rem; + font-weight: 600; + color: var(--text-primary); + margin-bottom: 0.5rem; +} + +.error-message { + color: var(--text-secondary); + margin-bottom: 1rem; +} + +.error-suggestion { + color: var(--text-tertiary); + font-size: 0.9rem; + margin-bottom: 1.5rem; +} + +.retry-btn { + background: var(--accent-primary); + color: white; + border: none; + padding: 0.8rem 2rem; + border-radius: 8px; + font-size: 1rem; + cursor: pointer; + transition: all 0.2s; +} + +.retry-btn:hover { + background: var(--accent-secondary); + transform: translateY(-2px); +} + +/* ===== 离线标记 ===== */ +.offline-badge { + background: #ffd966; + color: #856404; + padding: 0.5rem 1rem; + border-radius: 20px; + font-size: 0.9rem; + display: inline-block; + margin-bottom: 1rem; +} + +/* ===== 空状态 ===== */ +.empty-state { + text-align: center; + padding: 4rem 2rem; + background: var(--bg-secondary); + border-radius: 12px; + margin: 2rem 0; +} + +.empty-icon { + font-size: 3rem; + margin-bottom: 1rem; + opacity: 0.6; +} + +.empty-title { + font-size: 1.2rem; + color: var(--text-secondary); + margin-bottom: 0.5rem; +} + +.empty-desc { + color: var(--text-tertiary); +} \ No newline at end of file diff --git a/modules/M22-bulletin/data/mock-announcements.json b/modules/M22-bulletin/data/mock-announcements.json new file mode 100644 index 00000000..e69de29b diff --git a/modules/M22-bulletin/index.html b/modules/M22-bulletin/index.html index e81addec..a765ccea 100644 --- a/modules/M22-bulletin/index.html +++ b/modules/M22-bulletin/index.html @@ -4,11 +4,8 @@