vue3实现类似coze扣子的暗色可视化拖拽工作流设计及运行代码
代码语言:html
所属分类:其他
代码描述:vue3实现类似coze扣子的暗色可视化拖拽工作流设计及运行代码,会导出在nodejs运行的完整工作流代码与浏览器代码还有json文件。
代码标签: vue 类似 coze 扣子 暗色 可视化 拖拽 工作流 设计 运行 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>可视化工作流编排器 - 类Coze</title>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue.global.3.5.18.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
body {
background: #0f0f23;
color: #fff;
overflow: hidden;
}
.app-container {
display: flex;
height: 100vh;
flex-direction: column;
}
/* 顶部工具栏 */
.toolbar {
height: 56px;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
border-bottom: 1px solid #2a2a4a;
display: flex;
align-items: center;
padding: 0 20px;
gap: 12px;
flex-shrink: 0;
}
.toolbar-logo {
font-size: 20px;
font-weight: 600;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-right: 20px;
}
.toolbar-btn {
padding: 8px 16px;
border-radius: 8px;
border: none;
cursor: pointer;
font-size: 13px;
font-weight: 500;
transition: all 0.2s;
display: flex;
align-items: center;
gap: 6px;
}
.toolbar-btn.primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #fff;
}
.toolbar-btn.primary:hover {
transform: translateY(-1px);
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
.toolbar-btn.secondary {
background: #2a2a4a;
color: #a0a0c0;
}
.toolbar-btn.secondary:hover {
background: #3a3a5a;
color: #fff;
}
.toolbar-btn.success {
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
color: #fff;
}
.toolbar-btn.danger {
background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
color: #fff;
}
.toolbar-divider {
width: 1px;
height: 28px;
background: #3a3a5a;
margin: 0 8px;
}
/* 主体区域 */
.main-content {
display: flex;
flex: 1;
overflow: hidden;
}
/* 左侧节点面板 */
.node-panel {
width: 240px;
background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
border-right: 1px solid #2a2a4a;
padding: 16px;
overflow-y: auto;
flex-shrink: 0;
}
.panel-title {
font-size: 12px;
font-weight: 600;
color: #8888aa;
text-transform: uppercase;
letter-spacing: 1px;
margin-bottom: 12px;
}
.node-item {
padding: 12px 14px;
border-radius: 10px;
margin-bottom: 8px;
cursor: grab;
transition: all 0.2s;
display: flex;
align-items: center;
gap: 10px;
border: 1px solid transparent;
}
.node-item:hover {
transform: translateX(4px);
border-color: #3a3a5a;
}
.node-item:active {
cursor: grabbing;
}
.node-item.start { background: linear-gradient(135deg, rgba(17, 153, 142, 0.2) 0%, rgba(56, 239, 125, 0.1) 100%); }
.node-item.end { background: linear-gradient(135deg, rgba(235, 51, 73, 0.2) 0%, rgba(244, 92, 67, 0.1) 100%); }
.node-item.if { background: linear-gradient(135deg, rgba(246, 185, 59, 0.2) 0%, rgba(255, 165, 0, 0.1) 100%); }
.node-item.switch { background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.1) 100%); }
.node-item.function { background: linear-gradient(135deg, rgba(0, 176, 255, 0.2) 0%, rgba(0, 221, 255, 0.1) 100%); }
.node-icon {
width: 32px;
height: 32px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
}
.node-icon.start { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.node-icon.end { background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%); }
.node-icon.if { background: linear-gradient(135deg, #f6b93b 0%, #ffa500 100%); }
.node-icon.switch { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.node-icon.function { background: linear-gradient(135deg, #00b0ff 0%, #00ddff 100%); }
.node-info h4 {
font-size: 13px;
font-weight: 500;
color: #fff;
margin-bottom: 2px;
}
.node-info p {
font-size: 11px;
color: #8888aa;
}
/* 画布区域 */
.canvas-container {
flex: 1;
position: relative;
overflow: hidden;
background: #0a0a1a;
}
.canvas-grid {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image:
radial-gradient(circle, #2a2a4a 1px, transparent 1px);
background-size: 20px 20px;
}
.canvas {
position: absolute;
top: 0;
left: 0;
width: 5000px;
height: 5000px;
transform-origin: 0 0;
}
/* SVG连接线 */
.connections-svg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 1;
}
.connection-path {
fill: none;
stroke: #667eea;
stroke-width: 2;
pointer-events: stroke;
cursor: pointer;
transition: stroke 0.2s;
}
.connection-path:hover {
stroke: #ff6b6b;
stroke-width: 3;
}
.connection-path.temp {
stroke: #888;
stroke-dasharray: 5, 5;
}
/* 画布节点 */
.canvas-node {
position: absolute;
min-width: 180px;
background: #1e1e3f;
border-radius: 12px;
border: 2px solid #3a3a5a;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
cursor: move;
z-index: 10;
transition: border-color 0.2s, box-shadow 0.2s;
}
.canvas-node:hover {
border-color: #667eea;
}
.canvas-node.selected {
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3), 0 4px 20px rgba(0, 0, 0, 0.3);
}
.canvas-node.start { border-color: #38ef7d; }
.canvas-node.end { border-color: #f45c43; }
.canvas-node.if { border-color: #f6b93b; }
.canvas-node.switch { border-color: #764ba2; }
.canvas-node.function { border-color: #00ddff; }
.node-header {
padding: 10px 14px;
border-radius: 10px 10px 0 0;
display: flex;
align-items: center;
gap: 10px;
}
.canvas-node.start .node-header { background: linear-gradient(135deg, rgba(17, 153, 142, 0.3) 0%, rgba(56, 239, 125, 0.2) 100%); }
.canvas-node.end .node-header { background: linear-gradient(135deg, rgba(235, 51, 73, 0.3) 0%, rgba(244, 92, 67, 0.2) 100%); }
.canvas-node.if .node-header.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0