Files
youlegames/codes/minipro/calculation/miniprogram/pages/calculator/calculator.wxss

356 lines
6.2 KiB
Plaintext

/* pages/calculator/calculator.wxss */
/* ========== 全局 ========== */
page {
height: 100%;
background-color: #1c1c1e;
display: flex;
flex-direction: column;
}
.calculator-container {
display: flex;
flex-direction: column;
height: 100%;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
/* ========== 显示区域 ========== */
.display-area {
flex: 1;
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: flex-end;
padding: 30rpx 40rpx 20rpx;
background: linear-gradient(180deg, #1c1c1e 0%, #2c2c2e 100%);
position: relative;
overflow: hidden;
}
/* 顶部工具栏 */
.display-top-bar {
position: absolute;
top: 20rpx;
left: 30rpx;
right: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.top-actions {
display: flex;
gap: 16rpx;
}
.action-btn {
width: 64rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: rgba(255,255,255,0.08);
}
.action-icon {
font-size: 30rpx;
}
/* 模式切换 */
.mode-indicator text {
color: rgba(255,255,255,0.4);
font-size: 24rpx;
padding: 10rpx 24rpx;
border-radius: 30rpx;
background: rgba(255,255,255,0.06);
border: none;
}
.mode-indicator text.active {
color: #ff9f0a;
background: rgba(255, 159, 10, 0.15);
}
/* 表达式行 */
.history-text {
font-size: 32rpx;
color: rgba(255,255,255,0.35);
min-height: 44rpx;
margin-bottom: 12rpx;
font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
text-align: right;
width: 100%;
letter-spacing: 2rpx;
}
/* 当前值 */
.current-value {
font-size: 130rpx;
color: #ffffff;
line-height: 1.1;
font-weight: 200;
word-break: break-all;
text-align: right;
width: 100%;
font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
}
.current-value.shrink {
font-size: 90rpx;
}
.current-value.shrink-more {
font-size: 62rpx;
}
/* ========== 键盘区域 ========== */
.keypad-area {
background: #1c1c1e;
padding: 16rpx 24rpx 24rpx;
display: flex;
flex-direction: column;
gap: 20rpx;
}
.keypad-area.scientific-pad {
gap: 14rpx;
padding-bottom: 20rpx;
}
/* 行 */
.row {
display: flex;
justify-content: space-between;
gap: 20rpx;
}
.keypad-area.scientific-pad .row {
gap: 14rpx;
}
.small-row {
justify-content: space-around;
gap: 8rpx;
}
/* ========== 按钮通用 ========== */
.btn {
width: 152rpx;
height: 152rpx;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 56rpx;
font-weight: 400;
font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
position: relative;
overflow: hidden;
}
/* 数字键 */
.digit {
background-color: #3a3a3c;
color: #ffffff;
}
/* 功能键 */
.func {
background-color: #636366;
color: #ffffff;
font-size: 46rpx;
font-weight: 500;
}
/* 运算符 */
.operator {
background-color: #ff9f0a;
color: #ffffff;
font-size: 64rpx;
font-weight: 400;
}
/* 等号键:渐变突出 */
.equal {
background: linear-gradient(135deg, #ff9f0a 0%, #ff6723 100%);
box-shadow: 0 6rpx 20rpx rgba(255, 159, 10, 0.35);
}
/* 0键 */
.zero {
width: 324rpx;
border-radius: 76rpx;
justify-content: flex-start;
padding-left: 62rpx;
box-sizing: border-box;
}
/* 点击反馈 */
.btn-hover {
transform: scale(0.92);
opacity: 0.75;
}
/* 科学模式缩放 */
.keypad-area.scientific-pad .btn {
width: 130rpx;
height: 130rpx;
font-size: 48rpx;
}
.keypad-area.scientific-pad .zero {
width: 274rpx;
border-radius: 65rpx;
}
.keypad-area.scientific-pad .func {
font-size: 40rpx;
}
.keypad-area.scientific-pad .operator {
font-size: 54rpx;
}
/* 科学功能键 */
.sci-btn {
width: 120rpx !important;
height: 120rpx !important;
font-size: 32rpx !important;
background: rgba(255,255,255,0.08) !important;
color: #64d2ff !important;
border-radius: 50% !important;
font-weight: 500 !important;
letter-spacing: 1rpx;
}
/* ========== 历史记录面板 ========== */
.history-panel {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 100;
pointer-events: none;
opacity: 0;
}
.history-panel.show {
pointer-events: auto;
opacity: 1;
}
.history-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.55);
}
.history-content {
position: relative;
z-index: 101;
background: #2c2c2e;
border-radius: 0 0 36rpx 36rpx;
max-height: 70vh;
display: flex;
flex-direction: column;
box-shadow: 0 16rpx 48rpx rgba(0,0,0,0.5);
}
.history-panel.show .history-content {
animation: histSlideDown 0.3s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}
@keyframes histSlideDown {
from { transform: translateY(-100%); }
to { transform: translateY(0); }
}
.history-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 36rpx 40rpx;
border-bottom: 1rpx solid rgba(255,255,255,0.08);
}
.history-title {
color: #ffffff;
font-size: 34rpx;
font-weight: 600;
letter-spacing: 1rpx;
}
.history-clear {
color: #ff9f0a;
font-size: 28rpx;
padding: 8rpx 24rpx;
border-radius: 20rpx;
background: rgba(255, 159, 10, 0.1);
}
.history-list {
max-height: 58vh;
padding: 10rpx 0;
}
.history-item {
padding: 28rpx 40rpx;
border-bottom: 1rpx solid rgba(255,255,255,0.05);
display: flex;
flex-direction: column;
align-items: flex-end;
}
.history-item:active {
background: rgba(255,255,255,0.06);
}
.history-expr {
color: rgba(255,255,255,0.45);
font-size: 26rpx;
margin-bottom: 8rpx;
font-family: -apple-system, 'SF Pro Display', monospace;
}
.history-result {
color: #ffffff;
font-size: 42rpx;
font-weight: 500;
font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
}
.history-empty {
text-align: center;
padding: 100rpx 0;
color: rgba(255,255,255,0.25);
font-size: 28rpx;
}
.history-empty-icon {
font-size: 64rpx;
display: block;
margin-bottom: 16rpx;
}
/* ========== 小屏适配 ========== */
@media (max-width: 360px) {
.btn {
width: 140rpx;
height: 140rpx;
font-size: 50rpx;
}
.zero {
width: 300rpx;
}
.current-value {
font-size: 110rpx;
}
}