From fa1a8e083e639bae08d26931d30fe0a4c612a945 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Sun, 8 Feb 2026 15:43:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E8=89=B2=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../minipro/calculation/miniprogram/app.json | 5 +- .../pages/calculator/calculator.json | 4 +- .../pages/calculator/calculator.ts | 27 +++ .../pages/calculator/calculator.wxml | 45 ++++- .../pages/calculator/calculator.wxss | 108 +++++++++-- .../pages/date-calc/date-calc.json | 2 +- .../miniprogram/pages/date-calc/date-calc.ts | 22 ++- .../pages/date-calc/date-calc.wxml | 38 ++++ .../pages/date-calc/date-calc.wxss | 169 ++++++++++++++++-- .../miniprogram/pages/index/index.wxml | 23 --- .../miniprogram/pages/index/index.wxss | 57 +++--- .../miniprogram/pages/profile/profile.wxml | 2 +- .../miniprogram/pages/profile/profile.wxss | 56 +++--- codes/minipro/calculation/project.config.json | 2 +- 14 files changed, 441 insertions(+), 119 deletions(-) diff --git a/codes/minipro/calculation/miniprogram/app.json b/codes/minipro/calculation/miniprogram/app.json index 59d4701..e3bb97c 100644 --- a/codes/minipro/calculation/miniprogram/app.json +++ b/codes/minipro/calculation/miniprogram/app.json @@ -13,8 +13,9 @@ "window": { "navigationBarTextStyle": "black", "navigationBarTitleText": "道棋百宝箱", - "navigationBarBackgroundColor": "#ffffff" + "navigationBarBackgroundColor": "#EBF4F8" }, "style": "v2", - "componentFramework": "glass-easel" + "componentFramework": "glass-easel", + "lazyCodeLoading": "requiredComponents" } \ No newline at end of file diff --git a/codes/minipro/calculation/miniprogram/pages/calculator/calculator.json b/codes/minipro/calculation/miniprogram/pages/calculator/calculator.json index 64bafa2..e2536f8 100644 --- a/codes/minipro/calculation/miniprogram/pages/calculator/calculator.json +++ b/codes/minipro/calculation/miniprogram/pages/calculator/calculator.json @@ -1,5 +1,5 @@ { "navigationBarTitleText": "科学计算器", - "navigationBarBackgroundColor": "#1c1c1e", - "navigationBarTextStyle": "white" + "navigationBarBackgroundColor": "#EBF4F8", + "navigationBarTextStyle": "black" } diff --git a/codes/minipro/calculation/miniprogram/pages/calculator/calculator.ts b/codes/minipro/calculation/miniprogram/pages/calculator/calculator.ts index f7eca78..ff7bc35 100644 --- a/codes/minipro/calculation/miniprogram/pages/calculator/calculator.ts +++ b/codes/minipro/calculation/miniprogram/pages/calculator/calculator.ts @@ -8,9 +8,27 @@ Page({ waitingForSecondOperand: false, isScientific: false, showHistory: false, + showHelp: false, historyList: [] as Array<{expression: string, result: string}> }, + onShareAppMessage() { + return { + title: '便捷好用的科学计算器', + path: '/pages/calculator/calculator' + } + }, + + onShareTimeline() { + return { + title: '便捷好用的科学计算器' + } + }, + + toggleHelp() { + this.setData({ showHelp: !this.data.showHelp }); + }, + onLoad() { // 从本地存储恢复历史记录 const saved = wx.getStorageSync('CALC_HISTORY'); @@ -34,6 +52,15 @@ Page({ }); }, + switchMode(e: any) { + const mode = e.currentTarget.dataset.mode; + const isSci = (mode === 'scientific'); + if (this.data.isScientific !== isSci) { + this.vibrate(); + this.setData({ isScientific: isSci }); + } + }, + onDigit(e: any) { this.vibrate(); const digit = e.currentTarget.dataset.digit; diff --git a/codes/minipro/calculation/miniprogram/pages/calculator/calculator.wxml b/codes/minipro/calculation/miniprogram/pages/calculator/calculator.wxml index a2c9a19..cccca49 100644 --- a/codes/minipro/calculation/miniprogram/pages/calculator/calculator.wxml +++ b/codes/minipro/calculation/miniprogram/pages/calculator/calculator.wxml @@ -1,5 +1,42 @@ + + + + + + 使用说明 + 关闭 + + + + + ⚗️ + + 科学模式 + 点击左上角“科学”按钮切换模式,支持三角函数(sin, cos, tan)、对数(log, ln)、指数(x²)、开方(√)等高级运算。 + + + + 🕐 + + 历史记录 + 点击时钟图标查看过往计算记录,点击某条记录可将其结果填入当前计算。 + + + + 📋 + + 复制结果 + 点击剪贴板图标可将当前显示结果复制到系统剪贴板。 + + + + + + + + @@ -28,8 +65,9 @@ - - ⚗️ 科学 + + 常用 + 科学 @@ -38,6 +76,9 @@ 📋 + + + {{history}} diff --git a/codes/minipro/calculation/miniprogram/pages/calculator/calculator.wxss b/codes/minipro/calculation/miniprogram/pages/calculator/calculator.wxss index cb32546..ac59144 100644 --- a/codes/minipro/calculation/miniprogram/pages/calculator/calculator.wxss +++ b/codes/minipro/calculation/miniprogram/pages/calculator/calculator.wxss @@ -38,42 +38,55 @@ page { display: flex; justify-content: space-between; align-items: center; + z-index: 10; } .top-actions { display: flex; - gap: 16rpx; + gap: 20rpx; } .action-btn { - width: 64rpx; - height: 64rpx; + width: 72rpx; + height: 72rpx; display: flex; align-items: center; justify-content: center; border-radius: 50%; - background: rgba(17, 97, 107, 0.1); /* Color 01 with opacity */ + background: #ffffff; + box-shadow: 0 4rpx 12rpx rgba(17, 97, 107, 0.15); /* Teal shadow */ } .action-icon { - font-size: 30rpx; + font-size: 36rpx; color: #11616B; /* Color 01 */ } /* 模式切换 */ +.mode-indicator { + display: flex; + background: #ffffff; + padding: 6rpx; + border-radius: 16rpx; /* Reduced radius */ + box-shadow: 0 4rpx 12rpx rgba(17, 97, 107, 0.1); +} + .mode-indicator text { - color: #7BBDB6; /* Color 02 text */ - font-size: 24rpx; - padding: 10rpx 24rpx; - border-radius: 30rpx; - background: rgba(123, 189, 182, 0.2); /* Color 02 bg */ + color: #7BBDB6; /* Color 02 */ + font-size: 26rpx; + padding: 10rpx 30rpx; + border-radius: 12rpx; /* Reduced radius */ + background: transparent; border: none; + font-weight: 500; + transition: all 0.2s ease; } .mode-indicator text.active { - color: #11616B; /* Color 01 text */ - background: rgba(17, 97, 107, 0.15); /* Color 01 bg */ + color: #ffffff; + background: #11616B; /* Color 01 */ font-weight: 600; + box-shadow: 0 2rpx 8rpx rgba(17, 97, 107, 0.2); } /* 表达式行 */ @@ -260,7 +273,7 @@ page { position: relative; z-index: 101; background: #EBF4F8; /* Color 03 */ - border-radius: 0 0 36rpx 36rpx; + border-radius: 0 0 16rpx 16rpx; /* Reduced radius */ max-height: 70vh; display: flex; flex-direction: column; @@ -306,25 +319,25 @@ page { .history-item { padding: 28rpx 40rpx; - border-bottom: 1rpx solid rgba(255,255,255,0.05); + border-bottom: 1rpx solid rgba(17, 97, 107, 0.08); /* Darker border for light bg */ display: flex; flex-direction: column; align-items: flex-end; } .history-item:active { - background: rgba(255,255,255,0.06); + background: rgba(17, 97, 107, 0.05); /* Dark interaction state */ } .history-expr { - color: rgba(255,255,255,0.45); + color: rgba(17, 97, 107, 0.6); /* Color 01 faded - Visible on light bg */ font-size: 26rpx; margin-bottom: 8rpx; font-family: -apple-system, 'SF Pro Display', monospace; } .history-result { - color: #ffffff; + color: #11616B; /* Color 01 - Visible High Contrast */ font-size: 42rpx; font-weight: 500; font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif; @@ -344,6 +357,67 @@ page { opacity: 0.5; } +/* Help Panel Styles */ +.help-list { + padding: 0; /* padding moved to inner section to avoid scroll-view width issues */ +} + +.help-section { + display: flex; + flex-direction: column; + gap: 40rpx; + padding: 30rpx 40rpx 60rpx; /* Apply padding here */ + box-sizing: border-box; +} + +.help-item { + display: flex; + gap: 24rpx; + align-items: flex-start; +} + +.help-icon { + font-size: 44rpx; + width: 60rpx; + text-align: center; + padding-top: 4rpx; +} + +.help-text { + flex: 1; + display: flex; + flex-direction: column; +} + +.help-h1 { + font-size: 30rpx; + font-weight: bold; + color: #11616B; /* Color 01 */ + margin-bottom: 12rpx; +} + +.help-p { + font-size: 26rpx; + color: #2d3436; + line-height: 1.6; + opacity: 0.8; +} + +.share-btn-large { + background-color: #11616B !important; /* Color 01 */ + color: white !important; + border-radius: 16rpx !important; /* Unified radius */ + font-size: 30rpx !important; + font-weight: 500 !important; + margin-top: 20rpx; + width: 100% !important; + box-shadow: 0 8rpx 20rpx rgba(17, 97, 107, 0.25); + display: flex; + align-items: center; + justify-content: center; + padding: 24rpx 0; +} + /* ========== 小屏适配 ========== */ @media (max-width: 360px) { .btn { diff --git a/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.json b/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.json index fab2d2a..93db4f7 100644 --- a/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.json +++ b/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.json @@ -1,6 +1,6 @@ { "usingComponents": {}, "navigationBarTitleText": "日期计算与农历转换", - "navigationBarBackgroundColor": "#f5f6fa", + "navigationBarBackgroundColor": "#EBF4F8", "navigationBarTextStyle": "black" } diff --git a/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.ts b/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.ts index 5be7e10..08c8454 100644 --- a/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.ts +++ b/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.ts @@ -34,7 +34,27 @@ Page({ todayLunar: '', todayGanZhi: '', todayAnimal: '', - todayTerm: '' + todayTerm: '', + showHelp: false + }, + + onShareAppMessage() { + return { + title: '实用的日期推算与农历转换工具', + path: '/pages/date-calc/date-calc' + } + }, + + onShareTimeline() { + return { + title: '实用的日期推算与农历转换工具' + } + }, + + toggleHelp() { + this.setData({ + showHelp: !this.data.showHelp + }); }, onLoad() { diff --git a/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.wxml b/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.wxml index 4c9216e..94e3727 100644 --- a/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.wxml +++ b/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.wxml @@ -1,11 +1,49 @@ + + + + + + + 功能说明 + 关闭 + + + + + 📅 + + 日期推算 + 设定一个开始日期,输入往后(+)或往前(-)推算的天数,即可计算出目标日期。底部提供常用快捷按钮。 + + + + + + 间隔计算 + 选择两个日期,计算它们之间相差多少天,并自动换算为周数和月数。 + + + + 🌙 + + 农历转换 + 支持公历(阳历)与农历(阴历)互转,并显示干支纪年、生肖、节气等传统信息。 + + + + + + + 日期推算 间隔计算 农历转换 + diff --git a/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.wxss b/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.wxss index 7df97da..0c8cc93 100644 --- a/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.wxss +++ b/codes/minipro/calculation/miniprogram/pages/date-calc/date-calc.wxss @@ -25,22 +25,23 @@ page { /* ========== Tab 切换 ========== */ .tab-header { - display: grid; - grid-template-columns: 1fr 1fr 1fr; - background: #dfe9ed; /* Slightly darker than page bg */ - padding: 8rpx; - border-radius: 60rpx; + display: flex; + background: #ffffff; /* Changed to white */ + padding: 6rpx; + border-radius: 16rpx; /* Reduced radius */ margin-bottom: 40rpx; align-items: center; - gap: 8rpx; + gap: 4rpx; /* Reduced gap */ + box-shadow: 0 4rpx 12rpx rgba(17, 97, 107, 0.1); } .tab-pill { + flex: 1; text-align: center; - padding: 24rpx 0; - border-radius: 50rpx; - font-size: 28rpx; - color: #7f8c8d; + padding: 16rpx 8rpx; /* Added horizontal padding */ + border-radius: 12rpx; /* Reduced radius */ + font-size: 24rpx; /* Reduced font size to create more space */ + color: #7BBDB6; /* Color 02 */ font-weight: 500; white-space: nowrap; transition: all 0.2s ease; @@ -48,11 +49,155 @@ page { z-index: 1; } +.help-btn { + width: 64rpx; /* Reduced width */ + height: 64rpx; /* Reduced height */ + display: flex; + align-items: center; + justify-content: center; + font-size: 36rpx; + color: #11616B; +} + +/* Modal Styles Copied & Adapted */ +.history-panel { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: -1; + opacity: 0; + transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1); + pointer-events: none; + visibility: hidden; +} + +.history-panel.show { + z-index: 1000; + opacity: 1; + pointer-events: auto; + visibility: visible; +} + +.history-mask { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.4); + backdrop-filter: blur(4px); +} + +.history-content { + position: absolute; + bottom: 0; + left: 0; + right: 0; + background: #EBF4F8; /* Color 03 */ + border-radius: 36rpx 36rpx 0 0; + max-height: 80vh; + display: flex; + flex-direction: column; + box-shadow: 0 -8rpx 30rpx rgba(17, 97, 107, 0.15); + transform: translateY(100%); + transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1); +} + +.history-panel.show .history-content { + transform: translateY(0); +} + +.history-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 36rpx 40rpx; + border-bottom: 2rpx solid rgba(17, 97, 107, 0.1); +} + +.history-title { + color: #11616B; /* Color 01 */ + font-size: 34rpx; + font-weight: 600; + letter-spacing: 1rpx; +} + +.history-clear { + color: #DC8B70; /* Color 05 */ + font-size: 28rpx; + padding: 8rpx 24rpx; + border-radius: 20rpx; + background: rgba(220, 139, 112, 0.15); /* Color 05 faint */ +} + +/* Help specific */ +.help-list { + padding: 0; +} + +.help-section { + display: flex; + flex-direction: column; + gap: 40rpx; + padding: 30rpx 40rpx 60rpx; + box-sizing: border-box; +} + +.help-item { + display: flex; + gap: 24rpx; + align-items: flex-start; +} + +.help-icon { + font-size: 44rpx; + width: 60rpx; + text-align: center; + padding-top: 4rpx; +} + +.help-text { + flex: 1; + display: flex; + flex-direction: column; +} + +.help-h1 { + font-size: 30rpx; + font-weight: bold; + color: #11616B; /* Color 01 */ + margin-bottom: 12rpx; +} + +.help-p { + font-size: 26rpx; + color: #2d3436; + line-height: 1.6; + opacity: 0.8; +} + +.share-btn-large { + background-color: #11616B !important; /* Color 01 */ + color: white !important; + border-radius: 16rpx !important; + font-size: 30rpx !important; + font-weight: 500 !important; + margin-top: 40rpx; + width: 100% !important; + box-shadow: 0 8rpx 20rpx rgba(17, 97, 107, 0.25); + display: flex; + align-items: center; + justify-content: center; + padding: 24rpx 0; +} + .tab-pill.active { background: #11616B; /* Color 01 */ color: #ffffff; font-weight: 600; - box-shadow: 0 4rpx 12rpx rgba(17, 97, 107, 0.3); + box-shadow: 0 2rpx 8rpx rgba(17, 97, 107, 0.2); transform: none; } @@ -378,7 +523,7 @@ page { align-items: center; gap: 8rpx; padding: 12rpx 24rpx; - border-radius: 30rpx; + border-radius: 12rpx; /* Reduced radius */ background: var(--primary-bg); transition: all 0.2s; border: 1rpx solid transparent; /* 防止抖动 */ diff --git a/codes/minipro/calculation/miniprogram/pages/index/index.wxml b/codes/minipro/calculation/miniprogram/pages/index/index.wxml index 55003ec..d7a120e 100644 --- a/codes/minipro/calculation/miniprogram/pages/index/index.wxml +++ b/codes/minipro/calculation/miniprogram/pages/index/index.wxml @@ -46,29 +46,6 @@ - - - 功能亮点 - - - - 计算器支持基础四则运算和科学模式 - - - - 计算历史记录,随时回看 - - - - 日期推算与天数间隔计算 - - - - 公历农历互转,节日速查 - - - -