Files
wecom_it_smart_desk/frontend-h5/src/styles/global.css
T

352 lines
9.1 KiB
CSS
Raw Normal View History

/* =============================================================================
* 企微IT智能服务台 — H5用户端全局样式
* =============================================================================
* 说明:全局基础样式,包括:
* 1. CSS 变量(浅色/深色双主题)
* 2. 全局重置样式
* 3. 企微 WebView 适配
* 4. 摇人按钮动画
* 5. 通用工具类
* ============================================================================= */
/* --------------------------------------------------------------------------
* CSS 变量 — 统一管理主题色和间距(同步原型 v5.3)
* 色值体系来源:Tailwind / shadcn-ui 色板,原型 v5.3 定义
* -------------------------------------------------------------------------- */
:root {
/* ---- 浅色主题背景色 — 企微风格(更柔和的灰) ---- */
--bg-primary: #f7f7f7;
--bg-secondary: #ffffff;
--bg-tertiary: #ededed;
--bg-hover: #e8ecf1;
--bg-active: #dce3ec;
--bg-accent-soft: rgba(7, 193, 96, 0.1);
/* ---- 浅色主题文字色 — 企微风格 ---- */
--text-primary: #191919;
--text-secondary: #666666;
--text-tertiary: #999999;
--text-muted: #999999; /* 同 text-tertiary,原型命名 */
--text-placeholder: #c0c4cc;
/* ---- 浅色主题边框色 — 企微风格(更淡) ---- */
--border: #e5e5e5; /* 原型命名 */
--border-color: #e5e5e5; /* 兼容旧引用 */
--border-light: #f0f0f0;
/* ---- 主色调 — 企微绿 ---- */
--accent: #07C160;
--accent-hover: #06ae56;
--accent-soft: rgba(7, 193, 96, 0.1);
/* ---- 语义色 — 企微风格 ---- */
--color-primary: #07C160;
--color-success: #22c55e;
--color-warning: #f59e0b;
--color-danger: #ef4444;
--color-info: #60a5fa;
/* 语义色 soft 版 */
--success-soft: #dcfce7;
--warning-soft: #fef3c7;
--danger-soft: #fee2e2;
--accent-soft: rgba(7, 193, 96, 0.1);
--color-success-soft: #dcfce7;
--color-warning-soft: #fef3c7;
--color-danger-soft: #fee2e2;
/* 扩展色 */
--purple: #8b5cf6;
--purple-soft: #ede9fe;
--orange: #f97316;
--orange-soft: #fff7ed;
/* 员工消息背景(企微绿底白字) */
--color-employee-bg: #07C160;
/* 坐席消息背景(白底黑字) */
--color-agent-bg: #ffffff;
/* 坐席消息边框 */
--color-agent-border: #e2e8f0;
/* AI 消息背景 */
--color-ai-bg: #dcfce7;
/* AI 消息文字 */
--color-ai-text: #166534;
/* AI 标签背景 */
--color-ai-tag-bg: #dcfce7;
/* AI 标签文字 */
--color-ai-tag-text: #22c55e;
/* 系统消息文字 */
--color-system-text: #94a3b8;
/* 系统消息背景 */
--color-system-bg: #f0f2f5;
/* 摇人按钮绿色渐变 — 企微风格 */
--color-shake-start: #07C160;
--color-shake-end: #06ae56;
/* 呼叫引导条文字 */
--color-guide-active: #f97316;
/* ---- 圆角 — 企微风格偏圆润 ---- */
--border-radius-sm: 4px;
--border-radius-md: 8px;
--border-radius-lg: 12px;
--border-radius-round: 50%;
--radius: 8px;
--radius-lg: 12px;
/* ---- 间距 ---- */
--spacing-xs: 4px;
--spacing-sm: 8px;
--spacing-md: 12px;
--spacing-lg: 16px;
--spacing-xl: 24px;
/* ---- 字体大小 ---- */
--font-size-sm: 12px;
--font-size-md: 14px;
--font-size-lg: 16px;
/* ---- 阴影 ---- */
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
--shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
--shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
/* ---- 过渡 ---- */
--transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
/* --------------------------------------------------------------------------
* 深色主题覆盖(同步原型 v5.3)
* -------------------------------------------------------------------------- */
[data-theme="dark"] {
--bg-primary: #0f1923;
--bg-secondary: #151f2b;
--bg-tertiary: #1a2736;
--bg-hover: #1e3044;
--bg-active: #243b52;
--bg-accent-soft: #2b5f8a;
--text-primary: #e8edf2;
--text-secondary: #8ba1b7;
--text-tertiary: #5c7185;
--text-muted: #5c7185;
--text-placeholder: #3d5568;
--border: #1e3044;
--border-color: #1e3044;
--border-light: #2a3f56;
--accent: #4da6ff;
--accent-hover: #73b9ff;
--accent-soft: #2b5f8a;
--color-primary: #4da6ff;
--color-success: #34d399;
--color-warning: #fbbf24;
--color-danger: #f87171;
--color-info: #60a5fa;
--success-soft: #1a3a2a;
--warning-soft: #3a2f10;
--danger-soft: #3a1a1a;
--accent-soft: #2b5f8a;
--color-success-soft: #1a3a2a;
--color-warning-soft: #3a2f10;
--color-danger-soft: #3a1a1a;
--purple: #a78bfa;
--purple-soft: #2d2060;
--orange: #fb923c;
--orange-soft: #3d1f08;
--color-employee-bg: #4da6ff;
--color-agent-bg: #1a2736;
--color-agent-border: #1e3044;
--color-ai-bg: #1a3a2a;
--color-ai-text: #34d399;
--color-ai-tag-bg: rgba(52, 211, 153, 0.15);
--color-ai-tag-text: #34d399;
--color-system-text: #5c7185;
--color-system-bg: #1a2736;
--color-shake-start: #FF6B35;
--color-shake-end: #FF8F5E;
--color-guide-active: #fb923c;
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
--shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25);
--shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.35);
}
/* --------------------------------------------------------------------------
* 全局重置
* -------------------------------------------------------------------------- */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
font-size: 14px;
line-height: 1.5;
color: var(--text-primary);
background-color: var(--bg-primary);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* 防止企微 WebView 中的文字大小被系统设置影响 */
-webkit-text-size-adjust: 100%;
transition: background-color 0.3s, color 0.3s;
}
#app {
width: 100%;
height: 100%;
}
/* --------------------------------------------------------------------------
* 企微 WebView 适配
* -------------------------------------------------------------------------- */
/* 禁止长按弹出菜单(企微 WebView 中常见问题) */
* {
-webkit-touch-callout: none;
-webkit-user-select: none;
user-select: none;
}
/* 输入框允许选择文字 */
input,
textarea {
-webkit-user-select: auto;
user-select: auto;
}
/* 禁止点击高亮 */
* {
-webkit-tap-highlight-color: transparent;
}
/* --------------------------------------------------------------------------
* 摇人按钮摇晃动画
* -------------------------------------------------------------------------- */
@keyframes shake {
0% { transform: rotate(0deg); }
10% { transform: rotate(-15deg); }
20% { transform: rotate(15deg); }
30% { transform: rotate(-10deg); }
40% { transform: rotate(10deg); }
50% { transform: rotate(-5deg); }
60% { transform: rotate(5deg); }
70% { transform: rotate(-2deg); }
80% { transform: rotate(2deg); }
90% { transform: rotate(0deg); }
100% { transform: rotate(0deg); }
}
/* 摇人按钮动画类 */
.shake-animation {
animation: shake 0.6s ease-in-out;
}
/* --------------------------------------------------------------------------
* 通用工具类
* -------------------------------------------------------------------------- */
/* 文本省略 */
.text-ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 双栏布局容器 */
.dual-column-layout {
display: flex;
width: 100%;
height: 100%;
}
/* 左栏:对话区(60% */
.dual-column-left {
flex: 0 0 60%;
max-width: 60%;
overflow: hidden;
}
/* 右栏:AI助手面板(40%) */
.dual-column-right {
flex: 0 0 40%;
max-width: 40%;
overflow-y: auto;
border-left: 1px solid var(--border-color);
}
/* --------------------------------------------------------------------------
* 主题切换滑轨样式(匹配原型v5.3)
* -------------------------------------------------------------------------- */
.theme-switch {
display: flex;
align-items: center;
gap: 6px;
cursor: pointer;
user-select: none;
}
.theme-switch .switch-icon {
font-size: 14px;
}
.theme-switch .switch-track {
width: 36px;
height: 20px;
background: var(--border-light);
border-radius: 10px;
position: relative;
transition: background 0.3s;
}
[data-theme="dark"] .theme-switch .switch-track {
background: var(--accent);
}
.theme-switch .switch-thumb {
width: 16px;
height: 16px;
background: var(--bg-secondary);
border-radius: 50%;
position: absolute;
top: 2px;
left: 2px;
transition: transform 0.3s;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .theme-switch .switch-thumb {
transform: translateX(16px);
}
/* --------------------------------------------------------------------------
* 滚动条美化
* -------------------------------------------------------------------------- */
::-webkit-scrollbar {
width: 4px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: var(--text-placeholder);
border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--text-tertiary);
}