diff --git a/client/src/App.vue b/client/src/App.vue
index 91a03f3..f5e5729 100644
--- a/client/src/App.vue
+++ b/client/src/App.vue
@@ -8,39 +8,44 @@
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
onLaunch(() => {
- console.log('[AI维度] App launched')
initTheme()
})
-onShow(() => {
- console.log('[AI维度] App shown')
-})
-
-onHide(() => {
- console.log('[AI维度] App hidden')
-})
+onShow(() => {})
+onHide(() => {})
+// 主题:'auto'(默认,跟随系统)| 'light' | 'dark'
function initTheme() {
- const theme = uni.getStorageSync('theme') || 'light'
+ const theme = uni.getStorageSync('theme') || 'auto'
applyTheme(theme)
+ // auto 模式下监听系统切换(H5)
+ if (theme === 'auto' && typeof window !== 'undefined' && window.matchMedia) {
+ const mq = window.matchMedia('(prefers-color-scheme: dark)')
+ const onChange = () => applyTheme('auto')
+ if (mq.addEventListener) mq.addEventListener('change', onChange)
+ else if (mq.addListener) mq.addListener(onChange)
+ }
+}
+
+function resolveTheme(theme) {
+ if (theme !== 'auto') return theme
+ if (typeof window !== 'undefined' && window.matchMedia) {
+ return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
+ }
+ return 'light'
}
function applyTheme(theme) {
+ const resolved = resolveTheme(theme)
try {
// H5 环境:操作 document class
const root = document.documentElement
- if (theme === 'dark') {
- root.classList.add('theme-dark')
- root.classList.remove('theme-light')
- } else {
- root.classList.remove('theme-dark')
- root.classList.add('theme-light')
- }
+ root.classList.remove('theme-dark', 'theme-light')
+ root.classList.add(resolved === 'dark' ? 'theme-dark' : 'theme-light')
} catch (e) {
- // 小程序环境:document 不存在
+ // 小程序环境:document 不存在,深色由 manifest darkmode + CSS 媒体查询接管
}
- // 小程序 tabBar 原生组件同步切换
- applyTabBarTheme(theme)
+ applyTabBarTheme(resolved)
}
function applyTabBarTheme(theme) {
@@ -48,202 +53,34 @@ function applyTabBarTheme(theme) {
if (theme === 'dark') {
uni.setTabBarStyle({
color: 'rgba(255,255,255,0.35)',
- selectedColor: '#a78bfa',
- backgroundColor: '#0d0d1a',
+ selectedColor: '#a2b2ff',
+ backgroundColor: '#181828',
borderStyle: 'black'
})
} else {
uni.setTabBarStyle({
color: 'rgba(0,0,0,0.3)',
- selectedColor: '#6366f1',
+ selectedColor: '#5b5ff8',
backgroundColor: '#ffffff',
borderStyle: 'white'
})
}
} catch (e) {
- // H5 环境 setTabBarStyle 可能不支持
+ // 非 tabBar 页面或不支持时忽略
}
}
-
\ No newline at end of file
+
+/* 区块标题(统一) */
+.section-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin: 24px 0 12px;
+
+ .section-title {
+ font-size: 16px;
+ font-weight: 700;
+ color: var(--text-primary);
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ }
+ .section-more {
+ font-size: 12px;
+ color: var(--text-tertiary);
+ }
+}
+
diff --git a/client/src/components/AppIcon.vue b/client/src/components/AppIcon.vue
new file mode 100644
index 0000000..711d016
--- /dev/null
+++ b/client/src/components/AppIcon.vue
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
diff --git a/client/src/components/ProgressRing.vue b/client/src/components/ProgressRing.vue
new file mode 100644
index 0000000..7bf0b75
--- /dev/null
+++ b/client/src/components/ProgressRing.vue
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+ {{ percent }}%
+
+
+
+
+
+
+
+
diff --git a/client/src/manifest.json b/client/src/manifest.json
index afc376d..d5a6c89 100644
--- a/client/src/manifest.json
+++ b/client/src/manifest.json
@@ -17,6 +17,9 @@
},
"usingComponents": true,
"permission": {},
- "requiredPrivateInfos": []
- }
+ "requiredPrivateInfos": [],
+ "darkmode": true,
+ "themeLocation": "theme.json"
+ },
+ "app-plus": {}
}
\ No newline at end of file
diff --git a/client/src/pages.json b/client/src/pages.json
index 60619f4..39ed0e1 100644
--- a/client/src/pages.json
+++ b/client/src/pages.json
@@ -124,25 +124,13 @@
"navigationBarTitleText": "协议",
"navigationStyle": "custom"
}
- },
- {
- "path": "pages/map/map",
- "style": {
- "navigationBarTitleText": "AI 知识地图"
- }
- },
- {
- "path": "pages/map/quiz",
- "style": {
- "navigationBarTitleText": "知识闯关"
- }
}
],
"globalStyle": {
- "navigationBarTextStyle": "black",
+ "navigationBarTextStyle": "@navTxt",
"navigationBarTitleText": "宇之然AI维度",
- "navigationBarBackgroundColor": "#f5f5f7",
- "backgroundColor": "#f5f5f7",
+ "navigationBarBackgroundColor": "@navBg",
+ "backgroundColor": "@bg",
"backgroundColorTop": "#f5f5f7",
"backgroundColorBottom": "#f5f5f7",
"app-plus": {
@@ -150,10 +138,10 @@
}
},
"tabBar": {
- "color": "rgba(0,0,0,0.3)",
- "selectedColor": "#6366f1",
- "backgroundColor": "#ffffff",
- "borderStyle": "white",
+ "color": "@tabTxt",
+ "selectedColor": "@tabSel",
+ "backgroundColor": "@tabBg",
+ "borderStyle": "@tabBorder",
"list": [
{
"pagePath": "pages/index/index",
diff --git a/client/src/pages/achievements/achievements.vue b/client/src/pages/achievements/achievements.vue
index 3d452df..edc270e 100644
--- a/client/src/pages/achievements/achievements.vue
+++ b/client/src/pages/achievements/achievements.vue
@@ -4,7 +4,7 @@
@@ -62,7 +62,7 @@
- 🏆
+ 暂无成就
还没有获得任何成就
继续学习,解锁属于你的成就吧
@@ -88,9 +88,9 @@ const loading = ref(true)
// 成就分类的默认配置
const CATEGORY_CONFIG = [
- { name: '知识探索', icon: '📖', color: 'var(--dim1-color)' },
- { name: '收藏成就', icon: '⭐', color: 'var(--dim2-color)' },
- { name: 'AI 问答', icon: '🤖', color: 'var(--dim3-color)' },
+ { name: '知识探索', icon: '星', color: 'var(--dim1-color)' },
+ { name: '收藏成就', icon: '藏', color: 'var(--dim2-color)' },
+ { name: 'AI 问答', icon: '问', color: 'var(--dim3-color)' },
{ name: '社交成就', icon: '👥', color: 'var(--dim4-color)' }
]
@@ -141,7 +141,7 @@ async function loadAchievements() {
function catIcon(name) {
const config = CATEGORY_CONFIG.find((c) => c.name === name)
- return config ? config.icon : '🏆'
+ return config ? config.icon : '成'
}
function achColor(icon) {
diff --git a/client/src/pages/chat/chat.vue b/client/src/pages/chat/chat.vue
index 084ea86..3cd98af 100644
--- a/client/src/pages/chat/chat.vue
+++ b/client/src/pages/chat/chat.vue
@@ -2,28 +2,29 @@
-
+