dyform可视化表单拖拽json生成器代码

代码语言:html

所属分类:表单美化

代码描述:dyform可视化表单拖拽json生成器代码,可通过可视化拖拽的形式生成json表单元素配置,适合dyform表单生成器插件。

代码标签: dyform 可视化 表单 拖拽 json 生成器 代码

下面为部分代码预览,完整代码请点击下载或在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>JSON 表单设计器</title>
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.6.4.0.css">
   
<style>
        :root {
            --primary: #4e73df;
            --primary-light: #6f8bee;
            --primary-dark: #3a5dd1;
            --success: #1cc88a;
            --info: #36b9cc;
            --warning: #f6c23e;
            --danger: #e74a3b;
            --secondary: #858796;
            --light: #f8f9fc;
            --dark: #5a5c69;
            --border-color: #e3e6f0;
            --bg-light: #f8f9fc;
            --shadow: 0 .15rem 1.75rem 0 rgba(58,59,69,.15);
            --radius: 0.35rem;
        }
       
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
       
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            color: #333;
            background-color: var(--bg-light);
            line-height: 1.5;
            padding: 20px;
        }
       
        .container {
            max-width: 1200px;
            margin: 0 auto;
            display: grid;
            grid-template-columns: 300px 1fr;
            gap: 20px;
        }
       
        .sidebar {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
       
        .panel {
            background-color: white;
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            overflow: hidden;
        }
       
        .panel-header {
            background-color: var(--primary);
            color: white;
            padding: 15px 20px;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
       
        .panel-header i {
            margin-right: 8px;
        }
       
        .panel-content {
            padding: 15px;
        }
       
        #types-list {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
        }
       
        .type-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background-color: var(--light);
            border: 1px solid var(--border-color);
            border-radius: var(--radius);
            padding: 12px 8px;
            cursor: move;
            font-size: 14px;
            transition: all 0.2s;
            text-align: center;
            min-height: 90px;
        }
       
        .type-item:hover {
            background-color: var(--primary-light);
            color: white;
            transform: translateY(-2px);
        }
       
        .type-item i {
            font-size: 24px;
            margin-bottom: 8px;
        }
       
        #form-container {
            height: calc(100vh - 40px);
            display: flex;
            flex-direction: column;
        }
       
        .form-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 20px;
            border-bottom: 1px solid var(--border-color);
        }
       
        .form-header h2 {
            margin: 0;
            font-size: 18px;
        }
       
        #form-list {
            flex: 1;
            overflow-y: auto;
            padding: 15px;
            min-height: 400px;
        }
       
        .form-item {
            display: flex;
            align-items: center;
            background-color: white;
            border: 1px solid var(--border-color);
            border-left: 4px solid var(--primary);
            border-radius: var(--radius);
            padding: 15px;
            margin-bottom: 15px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.05);
            transition: all 0.2s;
        }
       
        .form-item:hover {
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            transform: translateY(-2px);
        }
       
        .form-item-handle {
            cursor: move;
            color: var(--secondary);
            margin-right: 10px;
            font-size: 18px;
        }
       
        .form-item-content {
            flex: 1;
        }
       
        .form-item-name {
            font-weight: 600;
            font-size: 16px;
        }
       
        .form-item-type {
            font-size: 14px;
            color: var(--secondary);
        }
       
        .form-item-actions {
            display: flex;
            gap: 8px;
        }
       
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 8px 16px;
            border: none;
            border-radius: var(--radius);
            cursor: pointer;
            font-weight: 500;
            transition: all 0.2s;
            font-size: 14px;
        }
       
        .btn i {
            margin-right: 5px;
        }
       
        .btn-primary {
            background-color: var(--primary);
            color: white;
        }
       
        .btn-primary:hover {
            background-color: var(--primary-dark);
        }
       
        .btn-danger {
            background-color: var(--danger);
            color: white;
        }
       
        .btn-danger:hover {
            background-color: #d03b2d;
        }
       
        .btn-success {
            background-color: var(--success);
            color: white;
        }
       
        .btn-success:hover {
            background-color: #17a673;
        }
       
        .btn-info {
            background-color: var(--info);
            color: white;
        }
       
        .btn-info:hover {
            background-color: #2ca8c9;
        }
       
        .btn-sm {
            padding: 5px 10px;
            font-size: 12px;
        }
       
        .form-footer {
            border-top: 1px solid var(--border-color);
            padding: 15px;
            display: flex;
            justify-content: flex-end;
        }
       
        /* Modal styles */
        .modal-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0,0,0,0.5);
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
        }
       
        .modal {
            background-color: white;
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            width: 90%;
            max-width: 700px;
            max-height: 90vh;
            overflow-y: auto;
            animation: modal-appear 0.3s ease;
        }
       
        @keyframes modal-appear {
            from { opacity: 0; transform: scale(0.9); }
            to { opacity: 1; transform: scale(1); }
        }
       
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 20px;
            border-bottom: 1px solid var(--border-color);
            background-color: var(--primary);
            color: white;
        }
       
        .modal-title {
            font-size: 18px;
            font-weight: 600;
            margin: 0;
        }
       
        .modal-close {
            background: none;
            border: none;
            color: white;
            font-size: 20px;
            cursor: pointer;
            opacity: 0.8;
        }
       
        .modal-close:hover {
            opacity: 1;
        }
       
        .modal-body {
            padding: 20px;
        }
       
        .modal-footer {
            padding: 15px 20px;
            border-top: 1px solid var(--border-color);
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }
       
        /* Form styles */
        .form-group {
            margin-bottom: 15px;
        }
       
        .form-group label {
            display: block;
            margin-bottom: 5px;
            font-weight: 500;
        }
       
        .form-control {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid var(--border-color);
            border-radius: var(--radius);
            font-size: 14px;
        }
       
        .form-control:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
        }
       
        .form-check {
            display: flex;
            align-items: center;
        }
       
        .form-check-input {
            margin-right: 8px;
        }
       
        .options-list {
            margin-top: 20px;
            border-top: 1px solid var(--border-color);
            padding-top: 20px;
        }
       
        .options-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }
       
        .option-item {
            background-color: var(--light);
            border-radius: var(--radius);
            padding: 15px;
            margin-bottom: 10px;
            position: relative;
        }
       
        .option-remove {
            position: absolute;
            top: 5px;
            right: 5px;
            background: none;
            border: none;
            color: var(--danger);
            cursor: pointer;
            font-size: 16px;
        }
       
        .option-handle {
            cursor: move;
            color: var(--secondary);
            margin-right: 8px;
        }
       
        .form-tabs {
            display: flex;
            border-bottom: 1px solid var(--border-color);
            margin-bottom: 20px;
        }
       
        .form-tab {
            padding: 10px 15px;
            cursor: pointer;
            border-bottom: 2px solid transparent;
        }
       
        .form-tab.active {
            border-bottom-color: var(--primary);
            color: var(--primary);
        }
       
        .tab-content {
            display: none;
        }
       
        .tab-content.active {
            display: block;
        }
       
        .dropzone {
            border: 2px dashed var(--border-color);
            border-radius: var(--radius);
            padding: 20px;
            text-align: center;
            color: var(--secondary);
            transition: all 0.2s;
        }
       
        .dropzone.drag-over {
            background-color: rgba(78, 115, 223, 0.1);
            border-color: var(--primary);
        }
       
        /* Responsive */
        @media (max-width: 768px) {
            .container {
                grid-template-columns: 1fr;
            }
        }
       
        .card {
            min-height: 100px;
            width: 100%;
            background-color: white;
            box-shadow: var(--shadow);
            border-radius: var(--radius);
            margin-bottom: 20px;
        }
       
        .card-header {
            padding:.........完整代码请登录后点击上方下载按钮下载查看

网友评论0