首页布局更新
This commit is contained in:
@@ -4,50 +4,21 @@
|
||||
:active-menu="activeMenu"
|
||||
:active-history-id="activeHistoryId"
|
||||
:history-list="historyList"
|
||||
:tree-nodes="treeNodes"
|
||||
:tree-loading="treeLoading"
|
||||
@menu-change="handleMenuChange"
|
||||
@new-chat="handleCreateHistory"
|
||||
@select-history="handleSelectHistory"
|
||||
@delete-history="handleDeleteHistory"
|
||||
@preview-node="previewNode"
|
||||
@download-node="downloadNode"
|
||||
/>
|
||||
<div class="main-wrapper">
|
||||
<MainContent :active-menu="activeMenu" />
|
||||
<InputBar @send="handleSend" />
|
||||
</div>
|
||||
<!-- 右侧:工作空间(树形结构) -->
|
||||
<div class="workspace-panel">
|
||||
<div class="workspace-tree-wrap" v-loading="treeLoading">
|
||||
<el-empty v-if="!treeLoading && treeNodes.length === 0" description="暂无作品数据" />
|
||||
<el-tree
|
||||
v-else
|
||||
:data="treeNodes"
|
||||
node-key="id"
|
||||
:props="treeProps"
|
||||
default-expand-all
|
||||
:highlight-current="true"
|
||||
:expand-on-click-node="true"
|
||||
@node-click="handleTreeNodeClick"
|
||||
>
|
||||
<template #default="{ data }">
|
||||
<div
|
||||
class="tree-node"
|
||||
:class="[
|
||||
data.nodeType === 'date' ? 'level-date' :
|
||||
data.nodeType === 'contentType' ? 'level-flow' : 'level-file',
|
||||
data.fileType ? data.fileType.replace(/\\/g, ' ').split(' ')[0] : ''
|
||||
]"
|
||||
>
|
||||
<span class="ellipsis">{{ data.label }}</span>
|
||||
<div v-if="data.nodeType === 'title' && data.fileUrl" class="tree-node-actions">
|
||||
<el-button type="primary" link size="small" @click.stop="previewNode(data)"> 预览 </el-button>
|
||||
<el-button type="primary" link size="small" @click.stop="downloadNode(data)"> 下载 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-tree>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 预览弹窗 - 放在外层,避免被右侧容器限制宽度 -->
|
||||
<!-- 预览弹窗 -->
|
||||
<el-dialog v-model="previewDialogVisible" title="预览" width="95%" top="2vh" :close-on-click-modal="false" destroy-on-close>
|
||||
<div class="preview-container">
|
||||
<el-image v-if="previewUrl && previewMode === 'image'" :src="previewUrl" fit="contain" style="width: 100%; height: 100%" />
|
||||
@@ -107,7 +78,6 @@ const historyList = ref<HistoryItem[]>([
|
||||
{ id: 4, title: '快捷回复产品设计', time: '2 天前' },
|
||||
]);
|
||||
|
||||
const treeProps = { children: 'children', label: 'label' };
|
||||
const apiBaseUrl = (import.meta.env.VITE_API_URL || '').replace(/\/$/, '');
|
||||
|
||||
const joinUrl = (b: string, p: string) => `${b.replace(/\/$/, '')}${p.startsWith('/') ? p : `/${p}`}`;
|
||||
@@ -155,15 +125,15 @@ const mockTreeData: ExecutionTreeItem[] = [
|
||||
flowName: '代码审查任务',
|
||||
sessionId: 'session-1',
|
||||
items: [
|
||||
{ label: '审查结果.md', content: 'https://placekitten.com/800/600', type: 'text/markdown' },
|
||||
{ label: '流程图.png', content: 'https://placekitten.com/800/600', type: 'image/png' },
|
||||
{ label: '审查结果.md', content: 'https://placekitten.com/800/600', type: 'text/markdown', timestamp: '' },
|
||||
{ label: '流程图.png', content: 'https://placekitten.com/800/600', type: 'image/png', timestamp: '' },
|
||||
],
|
||||
},
|
||||
{
|
||||
Id: 2,
|
||||
flowName: '需求分析',
|
||||
sessionId: 'session-2',
|
||||
items: [{ label: '需求拆解.txt', content: '# 需求分析结果\n\n- 功能点一\n- 功能点二\n- 需要优化', type: 'text/plain' }],
|
||||
items: [{ label: '需求拆解.txt', content: '# 需求分析结果\n\n- 功能点一\n- 功能点二\n- 需要优化', type: 'text/plain', timestamp: '' }],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -174,7 +144,7 @@ const mockTreeData: ExecutionTreeItem[] = [
|
||||
Id: 3,
|
||||
flowName: '生成演示视频',
|
||||
sessionId: 'session-3',
|
||||
items: [{ label: '输出视频.mp4', content: 'https://www.w3schools.com/html/mov_bbb.mp4', type: 'video/mp4' }],
|
||||
items: [{ label: '输出视频.mp4', content: 'https://www.w3schools.com/html/mov_bbb.mp4', type: 'video/mp4', timestamp: '' }],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -230,10 +200,6 @@ const downloadNode = (data: TreeNode) => {
|
||||
document.body.removeChild(a);
|
||||
};
|
||||
|
||||
const handleTreeNodeClick = () => {
|
||||
// 点击节点不需要额外操作
|
||||
};
|
||||
|
||||
const handleMenuChange = (menu: string) => {
|
||||
activeMenu.value = menu;
|
||||
};
|
||||
@@ -311,151 +277,6 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 右侧工作空间面板 - 渐变玻璃风格 */
|
||||
.workspace-panel {
|
||||
width: 260px;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(255, 255, 255, 0.85) 0%,
|
||||
rgba(249, 251, 255, 0.7) 50%,
|
||||
rgba(235, 241, 252, 0.6) 100%
|
||||
);
|
||||
border-left: 1px solid rgba(59, 130, 246, 0.15);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
box-shadow: -6px 0 35px rgba(59, 130, 246, 0.08);
|
||||
backdrop-filter: blur(16px);
|
||||
}
|
||||
|
||||
.workspace-tree-wrap {
|
||||
flex: 1;
|
||||
padding: 8px 8px 12px;
|
||||
overflow-y: auto;
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.el-tree) {
|
||||
background: transparent;
|
||||
|
||||
.el-tree-node {
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
// 一级节点(日期)- 蓝色渐变
|
||||
:deep(.level-date) .el-tree-node__content {
|
||||
height: 42px;
|
||||
background: linear-gradient(135deg, rgba(59, 130, 246, 0.20) 0%, rgba(59, 130, 246, 0.05) 100%);
|
||||
border: 1px solid rgba(59, 130, 246, 0.28);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
// 二级节点(工作流)- 紫色渐变
|
||||
:deep(.level-flow) .el-tree-node__content {
|
||||
margin-left: 8px;
|
||||
background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.03) 100%);
|
||||
border: 1px solid rgba(139, 92, 246, 0.18);
|
||||
}
|
||||
|
||||
// 三级节点(文件)- 根据文件类型区分颜色
|
||||
:deep(.level-file.image) .el-tree-node__content,
|
||||
:deep(.level-file.jpg) .el-tree-node__content,
|
||||
:deep(.level-file.png) .el-tree-node__content,
|
||||
:deep(.level-file.gif) .el-tree-node__content {
|
||||
margin-left: 16px;
|
||||
background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0.04) 100%);
|
||||
border: 1px solid rgba(16, 185, 129, 0.15);
|
||||
}
|
||||
|
||||
:deep(.level-file.video) .el-tree-node__content,
|
||||
:deep(.level-file.mp4) .el-tree-node__content,
|
||||
:deep(.level-file.webm) .el-tree-node__content {
|
||||
margin-left: 16px;
|
||||
background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(245, 158, 11, 0.04) 100%);
|
||||
border: 1px solid rgba(245, 158, 11, 0.15);
|
||||
}
|
||||
|
||||
:deep(.level-file.audio) .el-tree-node__content,
|
||||
:deep(.level-file.mp3) .el-tree-node__content,
|
||||
:deep(.level-file.wav) .el-tree-node__content {
|
||||
margin-left: 16px;
|
||||
background: linear-gradient(135deg, rgba(236, 72, 153, 0.18) 0%, rgba(236, 72, 153, 0.04) 100%);
|
||||
border: 1px solid rgba(236, 72, 153, 0.15);
|
||||
}
|
||||
|
||||
:deep(.level-file.text) .el-tree-node__content,
|
||||
:deep(.level-file.md) .el-tree-node__content,
|
||||
:deep(.level-file.txt) .el-tree-node__content,
|
||||
:deep(.level-file.markdown) .el-tree-node__content {
|
||||
margin-left: 16px;
|
||||
background: linear-gradient(135deg, rgba(79, 70, 229, 0.18) 0%, rgba(79, 70, 229, 0.04) 100%);
|
||||
border: 1px solid rgba(79, 70, 229, 0.15);
|
||||
}
|
||||
|
||||
// 默认其他文件
|
||||
:deep(.level-file:not(.image):not(.video):not(.audio):not(.text)) .el-tree-node__content {
|
||||
margin-left: 16px;
|
||||
background: linear-gradient(135deg, rgba(100, 116, 139, 0.15) 0%, rgba(100, 116, 139, 0.04) 100%);
|
||||
border: 1px solid rgba(100, 116, 139, 0.15);
|
||||
}
|
||||
|
||||
.el-tree-node__content {
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
border-radius: 8px;
|
||||
margin: 2px 0;
|
||||
backdrop-filter: blur(8px);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
border-width: 2px;
|
||||
transform: translateX(2px);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
}
|
||||
|
||||
.el-tree-node.is-current > .el-tree-node__content {
|
||||
border-width: 2px;
|
||||
box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
|
||||
.el-tree-node__expand-icon {
|
||||
color: rgba(59, 130, 246, 0.7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tree-node {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
gap: 6px;
|
||||
|
||||
.ellipsis {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.tree-node-actions {
|
||||
flex-shrink: 0;
|
||||
.el-button {
|
||||
font-size: 11px;
|
||||
padding: 2px 4px;
|
||||
margin: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.preview-container {
|
||||
max-height: 85vh;
|
||||
overflow: auto;
|
||||
|
||||
Reference in New Issue
Block a user