296 lines
7.9 KiB
Vue
296 lines
7.9 KiB
Vue
<template>
|
|
<view class="app-root">
|
|
<slot />
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
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')
|
|
})
|
|
|
|
function initTheme() {
|
|
const theme = uni.getStorageSync('theme') || 'light'
|
|
applyTheme(theme)
|
|
}
|
|
|
|
function applyTheme(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')
|
|
}
|
|
} catch (e) {
|
|
// 小程序环境:document 不存在
|
|
}
|
|
// 小程序 tabBar 原生组件同步切换
|
|
applyTabBarTheme(theme)
|
|
}
|
|
|
|
function applyTabBarTheme(theme) {
|
|
try {
|
|
if (theme === 'dark') {
|
|
uni.setTabBarStyle({
|
|
color: 'rgba(255,255,255,0.35)',
|
|
selectedColor: '#a78bfa',
|
|
backgroundColor: '#0d0d1a',
|
|
borderStyle: 'black'
|
|
})
|
|
} else {
|
|
uni.setTabBarStyle({
|
|
color: 'rgba(99,102,241,0.4)',
|
|
selectedColor: '#6366f1',
|
|
backgroundColor: '#f0f2f8',
|
|
borderStyle: 'white'
|
|
})
|
|
}
|
|
} catch (e) {
|
|
// H5 环境 setTabBarStyle 可能不支持
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
/* ============================================
|
|
宇之然AI维度 — 全局主题
|
|
默认:亮色模式(蓝紫主题) | .theme-dark:暗色模式
|
|
============================================ */
|
|
|
|
/* ---- 亮色模式(默认:蓝紫科技主题) ---- */
|
|
page, .theme-light {
|
|
/* 基础色 — 蓝紫科技灰 */
|
|
--bg-primary: #f0f2f8;
|
|
--bg-secondary: #f5f6fb;
|
|
--bg-tertiary: #e8eaf3;
|
|
|
|
/* 玻璃拟态 — 蓝紫玻璃 */
|
|
--glass-bg: rgba(99, 102, 241, 0.05);
|
|
--glass-border: rgba(99, 102, 241, 0.1);
|
|
--glass-hover: rgba(99, 102, 241, 0.08);
|
|
--glass-hover-border: rgba(99, 102, 241, 0.15);
|
|
--glass-strong: rgba(99, 102, 241, 0.08);
|
|
--glass-dim-bg: rgba(99, 102, 241, 0.03);
|
|
|
|
/* 文字 — 深色高对比 */
|
|
--text-primary: #1a1a2e;
|
|
--text-secondary: rgba(26, 26, 46, 0.65);
|
|
--text-tertiary: rgba(26, 26, 46, 0.45);
|
|
--text-muted: rgba(26, 26, 46, 0.28);
|
|
--text-disabled: rgba(26, 26, 46, 0.18);
|
|
|
|
/* 品牌色 — 蓝紫 */
|
|
--color-brand: #6366f1;
|
|
--color-brand-light: #818cf8;
|
|
--color-brand-dark: #4f46e5;
|
|
--color-brand-bg: rgba(99, 102, 241, 0.08);
|
|
--color-brand-glow: rgba(99, 102, 241, 0.1);
|
|
|
|
/* 维度色 — 保持可识别性,亮色模式加饱和度 */
|
|
--dim1-color: #6366f1;
|
|
--dim1-bg: rgba(99, 102, 241, 0.08);
|
|
--dim1-icon-bg: rgba(99, 102, 241, 0.14);
|
|
--dim1-border: rgba(99, 102, 241, 0.16);
|
|
--dim1-glow: rgba(99, 102, 241, 0.05);
|
|
|
|
--dim2-color: #0891b2;
|
|
--dim2-bg: rgba(8, 145, 178, 0.08);
|
|
--dim2-icon-bg: rgba(8, 145, 178, 0.14);
|
|
--dim2-border: rgba(8, 145, 178, 0.16);
|
|
--dim2-glow: rgba(8, 145, 178, 0.05);
|
|
|
|
--dim3-color: #059669;
|
|
--dim3-bg: rgba(5, 150, 105, 0.08);
|
|
--dim3-icon-bg: rgba(5, 150, 105, 0.14);
|
|
--dim3-border: rgba(5, 150, 105, 0.16);
|
|
--dim3-glow: rgba(5, 150, 105, 0.05);
|
|
|
|
--dim4-color: #d97706;
|
|
--dim4-bg: rgba(217, 119, 6, 0.08);
|
|
--dim4-icon-bg: rgba(217, 119, 6, 0.14);
|
|
--dim4-border: rgba(217, 119, 6, 0.16);
|
|
--dim4-glow: rgba(217, 119, 6, 0.05);
|
|
|
|
--dim5-color: #dc2626;
|
|
--dim5-bg: rgba(220, 38, 38, 0.08);
|
|
--dim5-icon-bg: rgba(220, 38, 38, 0.14);
|
|
--dim5-border: rgba(220, 38, 38, 0.16);
|
|
--dim5-glow: rgba(220, 38, 38, 0.05);
|
|
|
|
/* 功能色 */
|
|
--color-free: #059669;
|
|
--color-free-bg: rgba(5, 150, 105, 0.1);
|
|
--color-pro: #d97706;
|
|
--color-pro-bg: rgba(217, 119, 6, 0.1);
|
|
--color-vip: #dc2626;
|
|
--color-vip-bg: rgba(220, 38, 38, 0.1);
|
|
--color-hot: #dc2626;
|
|
--color-hot-bg: rgba(220, 38, 38, 0.12);
|
|
--color-new: #0891b2;
|
|
--color-new-bg: rgba(8, 145, 178, 0.12);
|
|
--color-pick: #6366f1;
|
|
--color-pick-bg: rgba(99, 102, 241, 0.12);
|
|
|
|
/* 圆角/间距/过渡 */
|
|
--radius-sm: 8px;
|
|
--radius-md: 12px;
|
|
--radius-lg: 16px;
|
|
--radius-xl: 20px;
|
|
--radius-full: 9999px;
|
|
--spacing-xs: 4px;
|
|
--spacing-sm: 8px;
|
|
--spacing-md: 12px;
|
|
--spacing-lg: 16px;
|
|
--spacing-xl: 20px;
|
|
--spacing-2xl: 24px;
|
|
--blur-bg: 20px;
|
|
--transition-fast: 0.2s ease;
|
|
--transition-normal: 0.3s ease;
|
|
--glow-brand: 0 0 20px rgba(99, 102, 241, 0.08);
|
|
--glow-brand-strong: 0 0 30px rgba(99, 102, 241, 0.12);
|
|
}
|
|
|
|
/* ---- 暗色模式 ---- */
|
|
.theme-dark {
|
|
/* 基础色 */
|
|
--bg-primary: #14141e;
|
|
--bg-secondary: #181828;
|
|
--bg-tertiary: #1c1a34;
|
|
|
|
--glass-bg: rgba(255, 255, 255, 0.06);
|
|
--glass-border: rgba(255, 255, 255, 0.08);
|
|
--glass-hover: rgba(255, 255, 255, 0.1);
|
|
--glass-hover-border: rgba(255, 255, 255, 0.15);
|
|
--glass-strong: rgba(255, 255, 255, 0.12);
|
|
--glass-dim-bg: rgba(99, 102, 241, 0.06);
|
|
|
|
--text-primary: rgba(255, 255, 255, 0.95);
|
|
--text-secondary: rgba(255, 255, 255, 0.7);
|
|
--text-tertiary: rgba(255, 255, 255, 0.5);
|
|
--text-muted: rgba(255, 255, 255, 0.3);
|
|
--text-disabled: rgba(255, 255, 255, 0.15);
|
|
|
|
--color-brand: #818cf8;
|
|
--color-brand-light: #a5b4fc;
|
|
--color-brand-dark: #6366f1;
|
|
--color-brand-bg: rgba(99, 102, 241, 0.12);
|
|
--color-brand-glow: rgba(99, 102, 241, 0.15);
|
|
|
|
--dim1-color: #a78bfa;
|
|
--dim1-bg: rgba(99, 102, 241, 0.12);
|
|
--dim1-icon-bg: rgba(99, 102, 241, 0.2);
|
|
--dim1-border: rgba(99, 102, 241, 0.18);
|
|
--dim1-glow: rgba(99, 102, 241, 0.08);
|
|
|
|
--dim2-color: #60a5fa;
|
|
--dim2-bg: rgba(96, 165, 250, 0.12);
|
|
--dim2-icon-bg: rgba(96, 165, 250, 0.2);
|
|
--dim2-border: rgba(96, 165, 250, 0.18);
|
|
--dim2-glow: rgba(96, 165, 250, 0.08);
|
|
|
|
--dim3-color: #34d399;
|
|
--dim3-bg: rgba(52, 211, 153, 0.12);
|
|
--dim3-icon-bg: rgba(52, 211, 153, 0.2);
|
|
--dim3-border: rgba(52, 211, 153, 0.18);
|
|
--dim3-glow: rgba(52, 211, 153, 0.08);
|
|
|
|
--dim4-color: #fbbf24;
|
|
--dim4-bg: rgba(251, 191, 36, 0.12);
|
|
--dim4-icon-bg: rgba(251, 191, 36, 0.2);
|
|
--dim4-border: rgba(251, 191, 36, 0.18);
|
|
--dim4-glow: rgba(251, 191, 36, 0.08);
|
|
|
|
--dim5-color: #fb7185;
|
|
--dim5-bg: rgba(251, 113, 133, 0.12);
|
|
--dim5-icon-bg: rgba(251, 113, 133, 0.2);
|
|
--dim5-border: rgba(251, 113, 133, 0.18);
|
|
--dim5-glow: rgba(251, 113, 133, 0.08);
|
|
|
|
--color-free: #34d399;
|
|
--color-free-bg: rgba(52, 211, 153, 0.12);
|
|
--color-pro: #fbbf24;
|
|
--color-pro-bg: rgba(251, 191, 36, 0.12);
|
|
--color-vip: #fb7185;
|
|
--color-vip-bg: rgba(251, 113, 133, 0.12);
|
|
--color-hot: #fb7185;
|
|
--color-hot-bg: rgba(251, 113, 133, 0.15);
|
|
--color-new: #60a5fa;
|
|
--color-new-bg: rgba(96, 165, 250, 0.15);
|
|
--color-pick: #a78bfa;
|
|
--color-pick-bg: rgba(99, 102, 241, 0.15);
|
|
|
|
--glow-brand: 0 0 20px rgba(99, 102, 241, 0.1);
|
|
--glow-brand-strong: 0 0 30px rgba(99, 102, 241, 0.15);
|
|
}
|
|
|
|
/* 全局排版 */
|
|
page {
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
|
|
background-color: var(--bg-primary);
|
|
color: var(--text-secondary);
|
|
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
|
|
}
|
|
|
|
view {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
::-webkit-scrollbar {
|
|
display: none;
|
|
width: 0;
|
|
height: 0;
|
|
}
|
|
|
|
/* 页面布局统一 */
|
|
.page-layout {
|
|
min-height: 100vh;
|
|
padding: 0 20px 30px;
|
|
background: var(--bg-primary);
|
|
}
|
|
|
|
/* 页面副标题(统一) */
|
|
.page-subtitle {
|
|
display: block;
|
|
font-size: 13px;
|
|
color: var(--text-tertiary);
|
|
margin-top: 4px;
|
|
}
|
|
|
|
/* 卡片通用 */
|
|
.card {
|
|
background: var(--glass-bg);
|
|
border: 1px solid var(--glass-border);
|
|
border-radius: var(--radius-lg);
|
|
backdrop-filter: blur(var(--blur-bg));
|
|
-webkit-backdrop-filter: blur(var(--blur-bg));
|
|
transition: all var(--transition-normal);
|
|
}
|
|
|
|
.gradient-brand {
|
|
background: linear-gradient(135deg, var(--color-brand), var(--color-brand-light));
|
|
}
|
|
|
|
.gradient-text {
|
|
background: linear-gradient(135deg, var(--color-brand-light), var(--color-brand));
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
background-clip: text;
|
|
}
|
|
</style> |