/* Global styles */
body,
html {
margin: 0;
padding: 0;
height: 100%;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #e5e7eb;
color: #333;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
#app {
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
}
#main {
display: flex;
flex: 1;
height: calc(100vh - 60px);
}
#header {
flex-shrink: 0;
width: 100%;
height: 60px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
}
#header > h1 {
font-size: 20px;
}
.panel-title {
width: 90%;
margin: 0 5%;
padding: 10px 0;
border-bottom: 2px solid #667eea;
}
.panel-title span:nth-child(2) {
display: none;
}
.template-title {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.template-title > span {
width: 100px;
}
/* 组件面板 */
#components-panel {
position: relative;
width: 150px; /* 固定宽度 */
flex: none; /* 禁用flex伸缩 */
background-color: #fff;
border-right: 1px solid #e0e0e0;
display: flex;
flex-direction: column;
}
.components-list {
flex: 1;
padding: 10px;
overflow-y: auto;
display: flex;
flex-direction: column; /* 垂直堆叠组件 */
gap: 10px;
}
.component-item {
width: 100%; /* 组件宽度占满父容器,实现一行一个 */
height: 120px;
border-radius: 8px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
}
.component-item .grid-stack-item-content,
.grid-stack-item .grid-stack-item-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
#canvas-panel .grid-stack-item-content {
height: auto;
}
#components-panel .grid-stack-item {
background-color: #fff;
border: 1px solid #e0e0e0;
}
.component-item i,
.grid-stack-item i {
font-size: 18px;
margin-bottom: 5px;
color: #007bff;
}
.component-item span,
.grid-stack-item span {
font-size: 14px;
width: 100%;
text-align: center;
}
.image-container {
width: 100%;
height: 100%;
object-fit: cover;
}
.action-btn {
position: relative;
width: 100%;
height: auto; /* 高度自适应内容 */
display: flex;
flex-direction: column; /* 子元素垂直堆叠 */
align-items: center;
justify-content: center;
padding: 10px; /* 添加垂直内边距 */
}
.action-btn .trash-container,
.action-btn .save-container {
width: 100%; /* 宽度占满父容器 */
height: 40px;
margin: 5px 0; /* 添加垂直外边距,移除水平外边距 */
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
background: rgb(0, 123, 255, 0.6);
color: #fff;
font-size: 14px;
cursor: pointer;
}
.save-container {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}
.action-btn .trash-container > span,
.action-btn .save-container > span {
margin-left: 5px;
}
/* Canvas panel */
#canvas-panel {
flex: 4;
height: 100%;
background-color: #fff;
position: relative;
overflow-y: auto;
padding: 10px;
display: flex;
align-items: center;
justify-content: center;
}
#canvas-tabs,
#go-back {
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
z-index: 10;
background-color: rgba(255, 255, 255, 0.8);
border-radius: 8px;
padding: 5px;
display: flex;
gap: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
#go-back {
left: 60px;
background-color: unset;
box-shadow: unset;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
#go-back .tab-button.active {
background: #fff !important;
color: #000 !important;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
font-weight: bold;
font-size: 18px;
}
#go-back > img {
display: block;
width: 28px;
height: 28px;
padding: 4px;
cursor: pointer;
}
.tab-button {
padding: 8px 15px;
border: none;
background-color: transparent;
cursor: pointer;
border-radius: 6px;
font-size: 14px;
color: #333;
transition:
background-color 0.3s,
color 0.3s;
}
.tab-button:hover {
background-color: #f0f0f0;
}
.tab-button.active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #fff;
}
#main-screen {
display: none;
}
.grid-stack {
background-color: #e2e2e2;
border-radius: 8px;
width: 960px;
cursor: pointer !important; /* 强制光标为指针,覆盖 gridstack 的默认设置 */
}
.grid-stack-item-content {
cursor: grab; /* 将光标明确设置为抓手 */
background: #fff;
}
#canvas-panel .grid-stack-item-content {
border-radius: 8px;
border: 0px solid rgba(0, 0, 0, 0);
}
.global-save-button-container {
position: absolute;
top: 20px;
right: 20px;
z-index: 99;
}
.global-save-button {
padding: 10px 20px;
background-color: #28a745;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s;
}
.global-save-button:hover {
background-color: #218838;
}
/* Props panel */
#props-panel {
flex: 1;
background-color: #fff;
overflow-y: auto;
border-left: 1px solid #e0e0e0;
display: flex;
flex-direction: column;
}
form {
padding: 10px;
display: flex;
flex-direction: column;
flex: 1;
overflow-y: auto;
}
.form-item {
margin-bottom: 20px;
}
.form-item label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: #555;
}
.form-item input,
.form-item textarea {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
transition: border-color 0.3s;
}
.form-item input:focus,
.form-item textarea:focus {
outline: none;
border-color: #007bff;
}
.form-item select {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
}
.form-actions {
display: flex;
justify-content: space-between;
margin-top: 30px;
}
.form-actions button {
padding: 10px 15px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s;
flex: 1;
margin: 0 5px;
}
.save-button {
background-color: #007bff;
color: #fff;
}
.save-button:hover {
background-color: #0056b3;
}
.delete-button {
background-color: #dc3545;
color: #fff;
}
.delete-button:hover {
background-color: #c82333;
}
/* Scrollbar styles */
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #ccc;
border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
background: #aaa;
}
/* Responsive layout */
@media (max-width: 1200px) {
#components-panel {
grid-template-columns: 1fr;
}
}
.wait-box {
display: flex;
flex: 1;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
.show {
display: block;
}
.hidden {
display: none;
}
.layui-anim {
box-sizing: unset;
}
.layui-input:focus,
.layui-textarea:focus {
border-color: rgb(102, 126, 234) !important;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.08);
}
#copy-component {
margin: 5px 0 10px;
}