5.2 KiB
5.2 KiB
DR01 — 主题系统设计
版本:V1.1 | UI 框架:Element Plus 参考:pj006-zhilianyuan2 frontend-orgadmin 的主题覆盖模式
1. Element Plus 变量覆盖
// styles/element-variables.scss
$--color-primary: #1677ff; // 主色 — 博昇品牌蓝
$--color-success: #52c41a;
$--color-warning: #faad14;
$--color-danger: #ff4d4f;
$--color-info: #909399;
$--color-text-primary: #303133;
$--color-text-regular: #606266;
$--color-text-secondary: #909399;
$--color-text-placeholder: #c0c4cc;
$--border-color-base: #dcdfe6;
$--border-color-light: #e4e7ed;
$--border-color-lighter: #ebeef5;
$--border-color-extra-light: #f2f6fc;
$--background-color-base: #f5f7fa;
$--border-radius-base: 4px;
$--border-radius-small: 2px;
$--border-radius-round: 20px;
$--font-size-base: 14px;
$--font-size-medium: 16px;
$--font-size-small: 13px;
$--font-size-extra-small: 12px;
2. 全局 CSS 变量
/* styles/variables.css */
:root {
/* ===== 左边导航栏 ===== */
--nav-width: 220px;
--nav-bg: #ffffff;
--nav-border: 1px solid #e4e7ed;
--nav-brand-height: 60px;
--nav-item-active-color: #1677ff;
--nav-item-active-bg: #ecf5ff;
--nav-item-hover-bg: #f5f7fa;
/* ===== 主内容区 ===== */
--content-padding: 24px;
--content-max-width: 1200px;
--content-bg: #f5f7fa;
/* ===== AI 侧栏 ===== */
--ai-panel-width: 360px;
--ai-panel-bg: #ffffff;
--ai-panel-border: 1px solid #e4e7ed;
/* ===== 消息气泡 ===== */
--bubble-user-bg: #1677ff;
--bubble-user-color: #ffffff;
--bubble-ai-bg: #f5f7fa;
--bubble-ai-color: #303133;
/* ===== 表格 ===== */
--table-stripe-bg: #fafafa;
--table-hover-bg: #f5f7fa;
/* ===== 阴影 ===== */
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
--shadow-base: 0 2px 8px rgba(0, 0, 0, 0.08);
--shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
}
3. 统一页面容器样式
/* 所有页面通用的容器样式 */
.page-container {
max-width: var(--content-max-width);
margin: 0 auto;
padding: 0 var(--content-padding);
}
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.page-header h2 {
font-size: 20px;
font-weight: 600;
color: #303133;
}
/* 筛选栏 */
.filter-bar {
display: flex;
gap: 12px;
align-items: center;
margin-bottom: 16px;
padding: 16px;
background: #fff;
border-radius: 4px;
border: 1px solid #e4e7ed;
}
/* 内容卡片 */
.content-card {
background: #fff;
border-radius: 4px;
border: 1px solid #e4e7ed;
padding: 20px;
margin-bottom: 16px;
}
4. 按钮状态规范
| 状态 | 样式 | 色值 |
|---|---|---|
| 可用(主按钮) | 蓝色底白字 | #1677ff / #ffffff |
| 可用(普通按钮) | 白底灰边框 | #ffffff / #606266 / #dcdfe6 |
| 可用(文字按钮) | 无底蓝字 | 透明 / #1677ff |
| 不可用(禁用) | 灰底灰字 + cursor not-allowed | #cbd5e1 / #64748b |
| 危险(删除) | 红底白字 | #ff4d4f / #ffffff |
5. 主要组件样式
/* ===== 左边导航栏 ===== */
.side-nav {
width: var(--nav-width);
min-width: var(--nav-width);
background: var(--nav-bg);
border-right: var(--nav-border);
display: flex;
flex-direction: column;
overflow-y: auto;
}
.side-nav__brand {
height: var(--nav-brand-height);
display: flex;
align-items: center;
padding: 0 20px;
border-bottom: var(--nav-border);
font-size: 18px;
font-weight: 700;
color: #1677ff;
}
.side-nav__menu {
flex: 1;
border-right: none !important;
}
.side-nav__menu .el-menu-item.is-active {
background-color: var(--nav-item-active-bg);
color: var(--nav-item-active-color);
border-right: 3px solid var(--nav-item-active-color);
}
.side-nav__footer {
padding: 12px 16px;
}
/* ===== AI 侧栏 ===== */
.ai-panel {
width: var(--ai-panel-width);
min-width: var(--ai-panel-width);
background: var(--ai-panel-bg);
border-left: var(--ai-panel-border);
display: flex;
flex-direction: column;
height: 100%;
}
.ai-header {
padding: 14px 16px;
border-bottom: var(--ai-panel-border);
display: flex;
justify-content: space-between;
align-items: center;
font-weight: 600;
font-size: 15px;
}
.ai-messages {
flex: 1;
overflow-y: auto;
padding: 16px;
}
.ai-messages .message {
margin-bottom: 12px;
}
.ai-messages .message.user {
text-align: right;
}
.ai-messages .message.user .bubble {
display: inline-block;
background: var(--bubble-user-bg);
color: var(--bubble-user-color);
border-radius: 8px 8px 0 8px;
padding: 8px 14px;
max-width: 80%;
text-align: left;
}
.ai-messages .message.assistant .bubble {
display: inline-block;
background: var(--bubble-ai-bg);
color: var(--bubble-ai-color);
border-radius: 8px 8px 8px 0;
padding: 8px 14px;
max-width: 80%;
}
.ai-input {
padding: 12px 16px;
border-top: var(--ai-panel-border);
display: flex;
gap: 8px;
}
.ai-quick-actions {
padding: 8px 16px 12px;
display: flex;
gap: 6px;
flex-wrap: wrap;
}
/* ===== 展开 AI 浮动按钮 ===== */
.ai-trigger {
position: fixed;
right: 0;
bottom: 80px;
z-index: 100;
padding: 8px 12px;
background: #1677ff;
color: #fff;
border-radius: 4px 0 0 4px;
cursor: pointer;
font-size: 13px;
}