feat(前端): 重构数字人交互界面并添加全屏功能

重构前端界面布局,将控制面板改为浮动式设计,添加全屏显示功能。主要变更包括:
1. 重新设计界面布局,使用浮动面板替代固定面板
2. 实现数字人显示区域的全屏功能
3. 优化SDK容器缩放逻辑
4. 添加面板切换和状态管理功能
5. 更新样式以适应新的交互设计
This commit is contained in:
2026-04-30 09:54:24 +08:00
parent 1db57cd18c
commit ad676cf0b8
8 changed files with 846 additions and 507 deletions

View File

@@ -1,18 +1,15 @@
/* ===== CSS 变量定义 ===== */
:root {
/* 主色调 - 科技蓝 */
--primary-color: #2563eb;
--primary-dark: #1d4ed8;
--primary-light: #3b82f6;
--primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
/* 辅助色 */
--success-color: #10b981;
--warning-color: #f59e0b;
--danger-color: #ef4444;
--info-color: #06b6d4;
/* 中性色 */
--bg-primary: #0f172a;
--bg-secondary: #1e293b;
--bg-tertiary: #334155;
@@ -21,26 +18,22 @@
--text-muted: #64748b;
--border-color: #475569;
/* 阴影 */
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
--shadow-glow: 0 0 20px rgba(37, 99, 235, 0.3);
/* 间距 */
--spacing-xs: 0.25rem;
--spacing-sm: 0.5rem;
--spacing-md: 1rem;
--spacing-lg: 1.5rem;
--spacing-xl: 2rem;
/* 圆角 */
--radius-sm: 0.375rem;
--radius-md: 0.5rem;
--radius-lg: 0.75rem;
--radius-xl: 1rem;
/* 字体 */
--font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
@@ -56,128 +49,207 @@ body {
background: var(--bg-primary);
color: var(--text-primary);
min-height: 100vh;
line-height: 1.6;
overflow: hidden;
}
/* ===== 应用容器 ===== */
.app-container {
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* ===== 头部 ===== */
.header {
background: var(--bg-secondary);
border-bottom: 1px solid var(--border-color);
padding: var(--spacing-md) var(--spacing-xl);
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
/* ===== 数字人全视口容器 ===== */
.digital-human-box {
position: fixed;
top: 0;
z-index: 100;
box-shadow: var(--shadow-md);
}
.logo {
left: 0;
width: 100vw;
height: 100vh;
background: var(--bg-primary);
display: flex;
align-items: center;
gap: var(--spacing-md);
justify-content: center;
z-index: 1;
}
.logo-icon {
font-size: 2rem;
.digital-human-box.active {
box-shadow: inset 0 0 50px rgba(37, 99, 235, 0.1);
}
.digital-human-box::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
radial-gradient(circle at 20% 80%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
pointer-events: none;
z-index: 0;
}
.placeholder {
text-align: center;
color: var(--text-muted);
z-index: 1;
}
.placeholder-icon {
font-size: 5rem;
display: block;
margin-bottom: var(--spacing-md);
opacity: 0.5;
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-5px); }
50% { transform: translateY(-10px); }
}
.logo h1 {
font-size: 1.5rem;
font-weight: 600;
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
.placeholder p {
font-size: 1rem;
opacity: 0.7;
}
.status-bar {
display: flex;
align-items: center;
gap: var(--spacing-lg);
}
.status {
padding: var(--spacing-xs) var(--spacing-md);
border-radius: var(--radius-full);
.fullscreen-exit-hint {
position: absolute;
bottom: var(--spacing-lg);
left: 50%;
transform: translateX(-50%);
background: rgba(30, 41, 59, 0.8);
backdrop-filter: blur(10px);
padding: var(--spacing-sm) var(--spacing-md);
border-radius: var(--radius-md);
color: var(--text-secondary);
font-size: 0.875rem;
font-weight: 500;
opacity: 0;
transition: opacity 0.3s ease;
pointer-events: none;
z-index: 10;
}
.digital-human-box.fullscreen:hover .fullscreen-exit-hint {
opacity: 1;
}
/* ===== 浮动控制栏 ===== */
.floating-toolbar {
position: fixed;
bottom: var(--spacing-xl);
right: var(--spacing-xl);
display: flex;
align-items: center;
gap: var(--spacing-xs);
flex-direction: column;
gap: var(--spacing-sm);
z-index: 1000;
}
.status::before {
content: '';
width: 8px;
height: 8px;
border-radius: 50%;
background: currentColor;
}
.status.connected {
background: rgba(16, 185, 129, 0.2);
color: var(--success-color);
}
.status.disconnected {
background: rgba(239, 68, 68, 0.2);
color: var(--danger-color);
}
.version {
color: var(--text-muted);
font-size: 0.875rem;
}
/* ===== 主内容区 ===== */
.main-content {
flex: 1;
padding: var(--spacing-xl);
display: grid;
grid-template-columns: 320px 1fr 380px;
gap: var(--spacing-xl);
max-width: 1600px;
margin: 0 auto;
width: 100%;
}
/* ===== 面板通用样式 ===== */
section {
background: var(--bg-secondary);
.toolbar-btn {
width: 50px;
height: 50px;
border-radius: var(--radius-lg);
padding: var(--spacing-lg);
background: var(--bg-secondary);
border: 1px solid var(--border-color);
color: var(--text-primary);
font-size: 1.5rem;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
box-shadow: var(--shadow-md);
}
section h2 {
font-size: 1.125rem;
font-weight: 600;
margin-bottom: var(--spacing-lg);
color: var(--text-primary);
display: flex;
align-items: center;
gap: var(--spacing-sm);
.toolbar-btn:hover {
background: var(--primary-color);
border-color: var(--primary-color);
transform: scale(1.1);
box-shadow: var(--shadow-glow);
}
/* ===== 配置面板 ===== */
.toolbar-btn:active {
transform: scale(0.95);
}
.toolbar-btn.active {
background: var(--primary-color);
border-color: var(--primary-color);
}
/* ===== 浮动面板通用样式 ===== */
.floating-panel {
position: fixed;
background: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: var(--radius-xl);
box-shadow: var(--shadow-lg);
z-index: 999;
display: none;
flex-direction: column;
max-height: 80vh;
overflow: hidden;
animation: panelSlideIn 0.2s ease-out;
}
@keyframes panelSlideIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.floating-panel.visible {
display: flex;
}
.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: var(--spacing-md) var(--spacing-lg);
border-bottom: 1px solid var(--border-color);
background: var(--bg-tertiary);
}
.panel-header h2 {
font-size: 1rem;
font-weight: 600;
color: var(--text-primary);
margin: 0;
}
.panel-close {
width: 30px;
height: 30px;
border-radius: var(--radius-md);
background: transparent;
border: none;
color: var(--text-secondary);
font-size: 1.5rem;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.panel-close:hover {
background: var(--danger-color);
color: white;
}
.panel-content {
padding: var(--spacing-lg);
overflow-y: auto;
flex: 1;
}
/* ===== 连接配置面板 ===== */
.config-panel {
height: fit-content;
bottom: calc(var(--spacing-xl) + 60px);
right: var(--spacing-xl);
width: 360px;
max-height: 70vh;
}
.config-section {
@@ -238,16 +310,6 @@ section h2 {
cursor: default;
}
.input-with-status {
position: relative;
display: flex;
align-items: center;
}
.input-with-status input {
padding-right: 80px;
}
.input-with-button {
display: flex;
gap: var(--spacing-sm);
@@ -257,30 +319,6 @@ section h2 {
flex: 1;
}
.field-status {
position: absolute;
right: var(--spacing-sm);
font-size: 0.75rem;
padding: 2px 8px;
border-radius: var(--radius-sm);
font-weight: 500;
}
.field-status.success {
background: rgba(16, 185, 129, 0.2);
color: var(--success-color);
}
.field-status.error {
background: rgba(239, 68, 68, 0.2);
color: var(--danger-color);
}
.field-status.loading {
background: rgba(6, 182, 212, 0.2);
color: var(--info-color);
}
.field-hint {
display: block;
margin-top: var(--spacing-xs);
@@ -291,13 +329,194 @@ section h2 {
.form-actions {
display: flex;
gap: var(--spacing-sm);
margin-top: var(--spacing-md);
margin-top: var(--spacing-lg);
}
.form-actions.main-actions {
margin-top: var(--spacing-xl);
padding-top: var(--spacing-lg);
border-top: 2px solid var(--border-color);
/* ===== 对话控制面板 ===== */
.control-panel {
bottom: calc(var(--spacing-xl) + 60px);
right: var(--spacing-xl);
width: 360px;
}
.control-group {
margin-bottom: var(--spacing-lg);
}
.control-group:last-child {
margin-bottom: 0;
}
.control-group h3 {
font-size: 0.875rem;
font-weight: 600;
color: var(--text-secondary);
margin-bottom: var(--spacing-sm);
text-transform: uppercase;
letter-spacing: 0.05em;
}
.button-row {
display: flex;
gap: var(--spacing-sm);
flex-wrap: wrap;
}
.button-row .btn {
flex: 1;
min-width: 100px;
}
.text-input-row {
display: flex;
gap: var(--spacing-sm);
}
.text-input-row input {
flex: 1;
padding: var(--spacing-sm) var(--spacing-md);
background: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
color: var(--text-primary);
font-size: 0.875rem;
}
.text-input-row input:focus {
outline: none;
border-color: var(--primary-color);
}
.text-input-row input:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* ===== 日志面板 ===== */
.log-panel {
bottom: calc(var(--spacing-xl) + 60px);
right: var(--spacing-xl);
width: 450px;
max-height: 60vh;
}
.log-toolbar {
display: flex;
gap: var(--spacing-sm);
align-items: center;
}
.log-toolbar select {
padding: var(--spacing-xs) var(--spacing-sm);
background: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
color: var(--text-primary);
font-size: 0.875rem;
}
.log-container {
overflow-y: auto;
background: var(--bg-primary);
border-radius: var(--radius-md);
padding: var(--spacing-md);
font-family: 'Consolas', 'Monaco', monospace;
font-size: 0.8125rem;
line-height: 1.5;
max-height: 400px;
}
.log-entry {
padding: var(--spacing-xs) 0;
border-bottom: 1px solid var(--bg-tertiary);
display: flex;
gap: var(--spacing-sm);
animation: slideIn 0.2s ease-out;
}
.log-entry:last-child {
border-bottom: none;
}
.log-time {
color: var(--text-muted);
white-space: nowrap;
}
.log-level {
font-weight: 600;
min-width: 50px;
}
.log-level.debug {
color: var(--text-muted);
}
.log-level.info {
color: var(--info-color);
}
.log-level.warn {
color: var(--warning-color);
}
.log-level.error {
color: var(--danger-color);
}
.log-message {
color: var(--text-primary);
word-break: break-all;
}
/* ===== 状态栏 ===== */
.status-bar-floating {
position: fixed;
top: var(--spacing-lg);
left: var(--spacing-lg);
display: flex;
align-items: center;
gap: var(--spacing-md);
z-index: 10000;
background: var(--bg-secondary);
padding: var(--spacing-sm) var(--spacing-md);
border-radius: var(--radius-lg);
border: 1px solid var(--border-color);
box-shadow: var(--shadow-md);
backdrop-filter: blur(10px);
}
.status {
padding: var(--spacing-xs) var(--spacing-md);
border-radius: var(--radius-full);
font-size: 0.875rem;
font-weight: 500;
display: flex;
align-items: center;
gap: var(--spacing-xs);
}
.status::before {
content: '';
width: 8px;
height: 8px;
border-radius: 50%;
background: currentColor;
}
.status.connected {
background: rgba(16, 185, 129, 0.2);
color: var(--success-color);
}
.status.disconnected {
background: rgba(239, 68, 68, 0.2);
color: var(--danger-color);
}
.version {
color: var(--text-muted);
font-size: 0.875rem;
}
/* ===== 按钮样式 ===== */
@@ -374,233 +593,60 @@ section h2 {
font-size: 0.75rem;
}
/* ===== 数字人显示区 ===== */
.digital-human-container {
display: flex;
flex-direction: column;
/* ===== 全屏模式 ===== */
.digital-human-box.fullscreen {
z-index: 9999 !important;
}
.digital-human-box {
flex: 1;
min-height: 400px;
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
border-radius: var(--radius-lg);
border: 2px dashed var(--border-color);
display: flex;
align-items: center;
justify-content: center;
position: relative;
overflow: hidden;
margin-bottom: var(--spacing-lg);
.digital-human-box.fullscreen .fullscreen-exit-hint {
opacity: 1;
}
.digital-human-box.active {
border-style: solid;
border-color: var(--primary-color);
box-shadow: var(--shadow-glow);
}
.digital-human-box::before {
content: '';
/* ===== SDK 响应式缩放 ===== */
.digital-human-box .sdk-scaling-wrapper {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
radial-gradient(circle at 20% 80%, rgba(37, 99, 235, 0.1) 0%, transparent 50%),
radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
pointer-events: none;
}
.placeholder {
text-align: center;
color: var(--text-muted);
}
.placeholder-icon {
font-size: 4rem;
display: block;
margin-bottom: var(--spacing-md);
opacity: 0.5;
}
/* ===== 控制面板 ===== */
.control-panel {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
gap: var(--spacing-lg);
}
.control-group h3 {
font-size: 0.875rem;
font-weight: 600;
color: var(--text-secondary);
margin-bottom: var(--spacing-sm);
text-transform: uppercase;
letter-spacing: 0.05em;
}
.button-row {
display: flex;
gap: var(--spacing-sm);
flex-wrap: wrap;
}
.button-row .btn {
flex: 1;
min-width: 100px;
}
.text-input-row {
display: flex;
gap: var(--spacing-sm);
}
.text-input-row input {
flex: 1;
padding: var(--spacing-sm) var(--spacing-md);
background: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
color: var(--text-primary);
font-size: 0.875rem;
}
.text-input-row input:focus {
outline: none;
border-color: var(--primary-color);
}
.text-input-row input:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* ===== 日志面板 ===== */
.log-panel {
display: flex;
flex-direction: column;
max-height: calc(100vh - 200px);
}
.log-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: var(--spacing-md);
justify-content: center;
overflow: hidden;
z-index: 1;
}
.log-toolbar select {
padding: var(--spacing-xs) var(--spacing-sm);
background: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
color: var(--text-primary);
font-size: 0.875rem;
.digital-human-box .sdk-scaling-wrapper .sdk-inner {
transform-origin: center center;
width: 100%;
height: 100%;
}
.log-container {
flex: 1;
overflow-y: auto;
background: var(--bg-primary);
border-radius: var(--radius-md);
padding: var(--spacing-md);
font-family: 'Consolas', 'Monaco', monospace;
font-size: 0.8125rem;
line-height: 1.5;
.digital-human-box .sdk-scaling-wrapper .sdk-inner .digital-intelligent-interaction {
width: 100% !important;
height: 100% !important;
}
.log-entry {
padding: var(--spacing-xs) 0;
border-bottom: 1px solid var(--bg-tertiary);
display: flex;
gap: var(--spacing-sm);
/* ===== 覆盖 SDK 字体大小 ===== */
.digital-intelligent-interaction {
font-size: 14px !important;
}
.log-entry:last-child {
border-bottom: none;
.digital-intelligent-interaction .ai-chat-btn .ai-chat-btn-content {
font-size: 16px !important;
}
.log-time {
color: var(--text-muted);
white-space: nowrap;
.digital-intelligent-interaction .message-item .rich-text-card .content {
font-size: 16px !important;
line-height: 24px !important;
}
.log-level {
font-weight: 600;
min-width: 50px;
.digital-intelligent-interaction .stop-chat-btn.normal .stop-chat-btn-content {
font-size: 16px !important;
}
.log-level.debug {
color: var(--text-muted);
}
.log-level.info {
color: var(--info-color);
}
.log-level.warn {
color: var(--warning-color);
}
.log-level.error {
color: var(--danger-color);
}
.log-message {
color: var(--text-primary);
word-break: break-all;
}
/* ===== 底部 ===== */
.footer {
background: var(--bg-secondary);
border-top: 1px solid var(--border-color);
padding: var(--spacing-md) var(--spacing-xl);
text-align: center;
color: var(--text-muted);
font-size: 0.875rem;
}
/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
.main-content {
grid-template-columns: 1fr;
max-width: 800px;
}
.digital-human-box {
min-height: 300px;
}
.log-panel {
max-height: 400px;
}
}
@media (max-width: 640px) {
.header {
flex-direction: column;
gap: var(--spacing-md);
text-align: center;
}
.main-content {
padding: var(--spacing-md);
}
.form-actions {
flex-direction: column;
}
.button-row {
flex-direction: column;
}
.text-input-row {
flex-direction: column;
}
.digital-intelligent-interaction .toast-container .toast-content .toast-text {
font-size: 12px !important;
}
/* ===== 滚动条样式 ===== */
@@ -647,7 +693,3 @@ section h2 {
transform: translateY(0);
}
}
.log-entry {
animation: slideIn 0.2s ease-out;
}