Files
doodle-mini/miniprogram/demoPages/shapePrint/index.less
T

810 lines
18 KiB
Plaintext

.container {
padding: 20rpx;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
}
.header {
text-align: center;
margin-bottom: 30rpx;
padding: 30rpx;
background: rgba(255, 255, 255, 0.95);
border-radius: 25rpx;
box-shadow: 0 8rpx 25rpx rgba(0, 0, 0, 0.15);
.title {
font-size: 40rpx;
font-weight: bold;
color: #333;
display: block;
margin-bottom: 10rpx;
}
.subtitle {
font-size: 26rpx;
color: #666;
display: block;
}
}
.section {
background: rgba(255, 255, 255, 0.95);
border-radius: 25rpx;
padding: 30rpx;
margin-bottom: 25rpx;
box-shadow: 0 8rpx 25rpx rgba(0, 0, 0, 0.15);
backdrop-filter: blur(10rpx);
}
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 25rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 2rpx solid #f0f0f0;
padding-bottom: 15rpx;
}
/* 选择形状按钮 */
.select-shapes-btn {
width: 100%;
height: 90rpx;
font-size: 32rpx;
border-radius: 20rpx;
background: linear-gradient(45deg, #667eea, #764ba2);
border: none;
color: white;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 25rpx rgba(102, 126, 234, 0.4);
.btn-text {
margin-left: 10rpx;
font-weight: 500;
}
}
/* 形状卡片容器 */
.shape-cards-container {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20rpx;
}
/* 形状卡片 */
.shape-card {
position: relative;
padding: 20rpx;
background: linear-gradient(145deg, #ffffff, #f0f0f0);
border-radius: 20rpx;
border: 2rpx solid #e0e0e0;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
align-items: center;
&:active {
transform: scale(0.98);
background: linear-gradient(145deg, #f8f9fa, #e9ecef);
}
.delete-btn {
position: absolute;
top: 10rpx;
right: 10rpx;
width: 40rpx;
height: 40rpx;
background: rgba(255, 255, 255, 0.9);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
z-index: 10;
}
.shape-preview-container {
position: relative;
width: 80rpx;
height: 80rpx;
margin-bottom: 15rpx;
display: flex;
align-items: center;
justify-content: center;
}
.shape-preview-canvas {
position: absolute;
width: 80rpx;
height: 80rpx;
opacity: 0;
/* 隐藏,只用于未来可能的Canvas预览 */
}
.shape-name {
font-size: 26rpx;
color: #333;
font-weight: 500;
margin-bottom: 10rpx;
text-align: center;
}
.color-info {
display: flex;
align-items: center;
gap: 8rpx;
.color-dot {
width: 20rpx;
height: 20rpx;
border-radius: 50%;
border: 2rpx solid #ddd;
}
.color-text {
font-size: 22rpx;
color: #666;
}
}
}
/* 形状选择弹窗样式 */
.shape-selector-popup {
.van-popup {
max-height: 80vh;
}
}
.shape-selector-container {
padding: 30rpx;
max-height: 80vh;
overflow-y: auto;
.popup-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
padding-bottom: 20rpx;
border-bottom: 2rpx solid #f0f0f0;
.popup-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.selected-count {
font-size: 24rpx;
color: #667eea;
background: rgba(102, 126, 234, 0.1);
padding: 8rpx 15rpx;
border-radius: 15rpx;
}
}
.shape-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20rpx;
margin-bottom: 30rpx;
}
.popup-actions {
padding-top: 20rpx;
border-top: 2rpx solid #f0f0f0;
.confirm-btn {
width: 100%;
height: 80rpx;
font-size: 30rpx;
border-radius: 20rpx;
background: linear-gradient(45deg, #667eea, #764ba2);
}
}
}
/* 弹窗中的形状选项 */
.shape-option {
position: relative;
height: 140rpx;
border: 3rpx solid #e0e0e0;
border-radius: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: linear-gradient(145deg, #ffffff, #f0f0f0);
transition: all 0.3s ease;
cursor: pointer;
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.1);
&.selected {
border-color: #667eea;
background: linear-gradient(145deg, #e3f2fd, #bbdefb);
transform: translateY(-5rpx);
box-shadow: 0 8rpx 25rpx rgba(102, 126, 234, 0.3);
.shape-name {
color: #667eea;
font-weight: bold;
}
}
&.disabled {
opacity: 0.5;
background: #f5f5f5;
border-color: #ddd;
.shape-name {
color: #999;
}
}
.selected-mark {
position: absolute;
top: 8rpx;
right: 8rpx;
width: 24rpx;
height: 24rpx;
background: #667eea;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
}
}
.shape-preview-box {
width: 60rpx;
height: 60rpx;
margin-bottom: 10rpx;
display: flex;
align-items: center;
justify-content: center;
}
.shape-icon {
width: 50rpx;
height: 50rpx;
border: 2rpx solid #666;
&.shape-icon-circle {
border-radius: 50%;
background: var(--fill-color, transparent);
border-color: var(--border-color, #666);
}
&.shape-icon-square {
border-radius: 5rpx;
background: var(--fill-color, transparent);
border-color: var(--border-color, #666);
}
&.shape-icon-rectangle {
width: 60rpx;
height: 40rpx;
border-radius: 5rpx;
background: var(--fill-color, transparent);
border-color: var(--border-color, #666);
}
&.shape-icon-triangle {
width: 0;
height: 0;
border: none;
border-left: 25rpx solid transparent;
border-right: 25rpx solid transparent;
border-bottom: 45rpx solid var(--fill-color, red);
background: transparent;
}
&.shape-icon-oval {
border-radius: 50%;
width: 60rpx;
height: 40rpx;
background: var(--fill-color, transparent);
border-color: var(--border-color, #666);
}
&.shape-icon-diamond {
width: 0;
height: 0;
border: none;
border-left: 25rpx solid transparent;
border-right: 25rpx solid transparent;
border-top: 25rpx solid transparent;
border-bottom: 25rpx solid var(--fill-color, #666);
background: transparent;
transform: rotate(45deg);
}
/* 修正星形 */
&.shape-icon-star {
position: relative;
width: 80rpx;
height: 80rpx;
border: none;
background: transparent;
display: flex;
align-items: center;
justify-content: center;
--star-fill-color: var(--fill-color, red);
--star-border-color: var(--border-color, #333);
--star-border-width: 2rpx;
/* 边框层 */
&::before {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 66rpx;
height: 66rpx;
transform: translate(-50%, -50%);
background: transparent;
border: var(--star-border-width, 2rpx) solid var(--star-border-color, #333);
clip-path: polygon(50% 0%,
61% 35%,
98% 35%,
68% 57%,
79% 91%,
50% 70%,
21% 91%,
32% 57%,
2% 35%,
39% 35%);
z-index: 1;
box-sizing: border-box;
}
&::after {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 60rpx;
height: 60rpx;
transform: translate(-50%, -50%);
background: var(--star-fill-color, red);
clip-path: polygon(50% 0%,
61% 35%,
98% 35%,
68% 57%,
79% 91%,
50% 70%,
21% 91%,
32% 57%,
2% 35%,
39% 35%);
z-index: 2;
pointer-events: none;
}
}
/* 爱心形状 */
&.shape-icon-heart {
position: relative;
width: 44rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
background: transparent;
/* 主体部分(三角形) */
&::after {
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%) rotate(-45deg);
width: 32rpx;
height: 32rpx;
background: var(--fill-color, #f00);
border-left: 2rpx solid var(--border-color, #333);
border-bottom: 2rpx solid var(--border-color, #333);
border-bottom-left-radius: 20rpx;
border-bottom-right-radius: 20rpx;
z-index: 1;
clip-path: polygon(0 0, 100% 0, 50% 100%);
}
/* 左半圆 */
&::before {
content: '';
position: absolute;
left: 4rpx;
top: 0;
width: 24rpx;
height: 24rpx;
background: var(--fill-color, #f00);
border: 2rpx solid var(--border-color, #333);
border-bottom: none;
border-right: none;
border-radius: 50% 50% 0 0;
z-index: 2;
}
/* 右半圆 */
.heart-right {
position: absolute;
right: 4rpx;
top: 0;
width: 24rpx;
height: 24rpx;
background: var(--fill-color, #f00);
border: 2rpx solid var(--border-color, #333);
border-bottom: none;
border-left: none;
border-radius: 50% 50% 0 0;
z-index: 2;
content: '';
display: block;
}
}
&.shape-icon-hexagon {
width: 40rpx;
height: 22rpx;
background: var(--fill-color, #666);
border: 2rpx solid var(--border-color, #333);
position: relative;
&::before,
&::after {
content: '';
position: absolute;
width: 0;
height: 0;
border-left: 20rpx solid transparent;
border-right: 20rpx solid transparent;
}
&::before {
bottom: 100%;
border-bottom: 11rpx solid var(--fill-color, #666);
}
&::after {
top: 100%;
border-top: 11rpx solid var(--fill-color, #666);
}
}
/* 修正五边形 */
&.shape-icon-pentagon {
position: relative;
width: 40rpx;
height: 38rpx;
background: transparent;
border: none;
display: flex;
align-items: center;
justify-content: center;
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 40rpx;
height: 38rpx;
background: var(--fill-color, #666);
border: 2rpx solid var(--border-color, #333);
clip-path: polygon(50% 0%,
100% 38%,
81% 100%,
19% 100%,
0% 38%);
box-sizing: border-box;
}
}
/* 修正半圆 */
&.shape-icon-semicircle {
width: 50rpx;
height: 25rpx;
border: none;
background: transparent;
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 50rpx;
height: 50rpx;
background: var(--fill-color, #666);
border: 2rpx solid var(--border-color, #333);
border-radius: 50%;
box-sizing: border-box;
}
}
/* 修正梯形 */
&.shape-icon-trapezoid {
width: 50rpx;
height: 30rpx;
border: none;
background: transparent;
position: relative;
overflow: visible;
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 50rpx;
height: 30rpx;
background: var(--fill-color, #666);
border: 2rpx solid var(--border-color, #333);
clip-path: polygon(15% 100%,
85% 100%,
100% 0%,
0% 0%);
box-sizing: border-box;
}
}
}
.shape-name {
font-size: 24rpx;
color: #666;
text-align: center;
}
/* 颜色选择器 */
.color-selector {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120rpx, 1fr));
gap: 20rpx;
}
.color-option {
height: 100rpx;
border-radius: 20rpx;
border: 3rpx solid #e0e0e0;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
justify-content: center;
position: relative;
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.1);
&.active {
border-color: #667eea;
transform: scale(1.05);
box-shadow: 0 0 0 6rpx rgba(102, 126, 234, 0.3);
}
.color-name {
color: white;
font-size: 22rpx;
font-weight: bold;
text-shadow: 1rpx 1rpx 2rpx rgba(0, 0, 0, 0.5);
}
}
/* 添加按钮 */
.add-btn {
width: 100%;
height: 90rpx;
font-size: 32rpx;
border-radius: 20rpx;
background: linear-gradient(45deg, #667eea, #764ba2);
border: none;
color: white;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 25rpx rgba(102, 126, 234, 0.4);
.add-icon {
font-size: 40rpx;
margin-right: 10rpx;
font-weight: bold;
}
}
/* 已选择的形状 */
.selected-shapes {
display: flex;
flex-direction: column;
gap: 15rpx;
}
.selected-shape {
display: flex;
align-items: center;
padding: 20rpx;
background: linear-gradient(145deg, #f8f9fa, #e9ecef);
border-radius: 20rpx;
border: 2rpx solid #e0e0e0;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.1);
&:active {
background: linear-gradient(145deg, #ffebee, #ffcdd2);
border-color: #ff5722;
transform: scale(0.98);
}
}
.shape-preview {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
margin-right: 20rpx;
border: 2rpx solid #333;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
}
.shape-details {
flex: 1;
display: flex;
flex-direction: column;
gap: 5rpx;
}
.shape-info {
font-size: 28rpx;
color: #333;
font-weight: 500;
}
.color-info {
font-size: 22rpx;
color: #666;
font-family: monospace;
}
.remove-hint {
font-size: 20rpx;
color: #999;
font-style: italic;
}
/* 设置项 */
.setting-item {
margin-bottom: 30rpx;
&:last-child {
margin-bottom: 0;
}
}
.setting-label {
font-size: 28rpx;
color: #333;
margin-bottom: 15rpx;
display: block;
font-weight: 500;
}
.bg-radio-group {
display: flex;
flex-wrap: wrap;
gap: 25rpx;
margin-top: 15rpx;
}
.bg-option {
display: flex;
align-items: center;
gap: 10rpx;
padding: 10rpx 15rpx;
border-radius: 15rpx;
background: rgba(0, 0, 0, 0.05);
text {
font-size: 26rpx;
color: #666;
}
}
.feature-intro {
margin-top: 30rpx;
padding: 25rpx;
background: linear-gradient(145deg, #f0f8ff, #e6f3ff);
border-radius: 15rpx;
border-left: 5rpx solid #667eea;
}
.intro-title {
font-size: 26rpx;
color: #333;
font-weight: bold;
display: block;
margin-bottom: 15rpx;
}
.intro-text {
font-size: 24rpx;
color: #666;
display: block;
margin-bottom: 8rpx;
padding-left: 15rpx;
&:last-child {
margin-bottom: 0;
}
}
/* 操作按钮 */
.generate-btn {
width: 100%;
height: 90rpx;
font-size: 32rpx;
border-radius: 20rpx;
margin-bottom: 20rpx;
background: linear-gradient(45deg, #4CAF50, #45a049);
border: none;
color: white;
box-shadow: 0 8rpx 25rpx rgba(76, 175, 80, 0.4);
&:disabled {
background: #ccc;
box-shadow: none;
}
}
.save-btn {
width: 100%;
height: 90rpx;
font-size: 32rpx;
border-radius: 20rpx;
background: linear-gradient(45deg, #ff9800, #f57c00);
border: none;
color: white;
box-shadow: 0 8rpx 25rpx rgba(255, 152, 0, 0.4);
}
/* 隐藏的画布 */
.hidden-canvas {
position: fixed;
top: -9999rpx;
left: -9999rpx;
width: 595px;
height: 842px;
}
/* 预览图片 */
.preview-image {
width: 100%;
max-height: 600rpx;
border-radius: 20rpx;
border: 3rpx solid #e0e0e0;
background-color: white;
cursor: pointer;
box-shadow: 0 8rpx 25rpx rgba(0, 0, 0, 0.15);
transition: transform 0.3s ease;
&:active {
transform: scale(0.98);
}
}
.preview-hint {
display: block;
text-align: center;
font-size: 24rpx;
color: #666;
margin-top: 20rpx;
padding: 15rpx;
background: rgba(0, 0, 0, 0.05);
border-radius: 15rpx;
}