vue实现ai智能画布效果代码
代码语言:html
所属分类:其他
代码描述:vue实现ai智能画布效果代码,可添加节点,支持文本链接、图片、视频,可调用ai工具连线生成新的节点,节点可移动、画布可缩放。
下面为部分代码预览,完整代码请点击下载或在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>AI 智能画布 - Pro</title> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue@2.6.1-dev.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/leader-line.1.1.9.js"></script> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.6.4.0.css"> <style> :root { --primary-color: #4A90E2; --secondary-color: #F5A623; --background-color: #F7F8FA; --node-background-color: #FFFFFF; --node-shadow-color: rgba(0, 0, 0, 0.1); --text-color: #333333; --border-color: #DDDDDD; --connector-color: #4A90E2; } body, html { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background-color: var(--background-color); color: var(--text-color); overflow: hidden; height: 100vh; width: 100vw; } #app { display: flex; flex-direction: column; height: 100%; } .header { display: flex; align-items: center; padding: 10px 20px; background-color: var(--node-background-color); border-bottom: 1px solid var(--border-color); box-shadow: 0 2px 4px var(--node-shadow-color); z-index: 100; flex-shrink: 0; } .header h1 { font-size: 1.5em; margin: 0; color: var(--primary-color); } .header h1 .fa-brain { margin-right: 10px; } .canvas-tabs { margin-left: 30px; display: flex; align-items: center; } .canvas-tabs button { padding: 8px 16px; margin-right: 5px; border-radius: 5px; border: 1px solid var(--border-color); background-color: transparent; cursor: pointer; transition: all 0.2s ease-in-out; } .canvas-tabs button.active { background-color: var(--primary-color); color: white; border-color: var(--primary-color); } .canvas-tabs button:hover:not(.active) { background-color: #E8F0FE; } .toolbar { position: absolute; top: 80px; left: 20px; display: flex; flex-direction: column; background-color: var(--node-background-color); padding: 10px; border-radius: 8px; box-shadow: 0 4px 12px var(--node-shadow-color); z-index: 50; } .toolbar button { background: none; border: none; font-size: 1.5em; padding: 10px; margin: 5px 0; cursor: pointer; border-radius: 5px; color: #555; transition: all 0.2s ease-in-out; } .toolbar button:hover { background-color: #E8F0FE; color: var(--primary-color); } .canvas-container { flex-grow: 1; position: relative; overflow: hidden; /* Changed from auto to hidden for zoom control */ background-image: radial-gradient(#ccc 1px, transparent 1px); background-size: 20px 20px; cursor: grab; } .canvas-container:active { cursor: grabbing; } #canvas { position: relative; width: 100%; height: 100%; transform-origin: 0 0; transition: transform 0.2s ease-out; } .node { position: absolute; background-color: var(--node-background-color); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 4px 8px var(--node-shadow-color); min-width: 220px; min-height: 50px; display: flex; flex-direction: column; transition: box-shadow 0.2s, transform 0.2s, opacity 0.3s; z-index: 10; } .node.selected { box-shadow: 0 0 0 3px var(--primary-color), 0 6px 12px rgba(0,0,0,0.2); border-color: var(--primary-color); } .node:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.15); } .node-header { padding: 8px 12px; font-weight: bold; border-bottom: 1px solid var(--border-color); cursor: move; display: flex; justify-content: space-between; align-items: center; background-color: #F9F9F9; border-top-left-radius: 8px; border-top-right-radius: 8px; color: #555; } .node-header .fa { margin-right: 8px; } .node-header .delete-btn { cursor: pointer; color: #999; font-size: 0.9em; } .node-header .delete-btn:hover { color: #e74c3c; } .node-content { padding: 12px; flex-grow: 1; } .node-content textarea { width: 100%; border: none; outline: none; resize: vertical; min-height: 60px; background: transparent; } .node-content img, .node-content video, .node-content audio { max-width: 100%; border-radius: 4px; } .node-content audio { width: 100%; } .node-content a { color: var(--primary-color); text-decoration: none; word-break: break-all; } .node-content a:hover { text-decoration: underline; } .node-content input[type="text"] { width: calc(100% - 10px); border: 1px solid #eee; padding: 4px; margin-top: 5px; } .connector-dot { width: 12px; height: 12px; background-color: white; border: 2px solid var(--connector-color); border-radius: 50%; position: absolute; cursor: crosshair; z-index: 15; transition: transform 0.2s; } .connector-dot:hover { transform: scale(1.3); background-color: var(--connector-color); } .connector-dot.top { top: -7px; left: 50%; transform: translateX(-50%); } .connector-dot.bottom { bottom: -7px; left.........完整代码请登录后点击上方下载按钮下载查看
网友评论0