Refactor: UI & Feature updates (Calculator, UnitConverter, Privacy, Cleanup)

This commit is contained in:
2026-02-09 01:15:19 +08:00
parent fa1a8e083e
commit 2c5d5b7505
52 changed files with 1351 additions and 2702 deletions

View File

@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "计算历史",
"usingComponents": {}
}

View File

@@ -0,0 +1,28 @@
Page({
data: {
historyList: []
},
onShow() {
const list = wx.getStorageSync('CALC_HISTORY') || [];
this.setData({
historyList: list
});
},
clearHistory() {
wx.showModal({
title: '提示',
content: '确定要清空所有记录吗?',
success: (res) => {
if (res.confirm) {
wx.removeStorageSync('CALC_HISTORY');
this.setData({
historyList: []
});
}
}
});
}
});

View File

@@ -0,0 +1,22 @@
<view class="container">
<block wx:if="{{historyList.length > 0}}">
<view class="history-list">
<view class="history-item" wx:for="{{historyList}}" wx:key="index">
<view class="expression">{{item.expression}}</view>
<view class="result">= {{item.result}}</view>
</view>
</view>
<view class="footer-btn">
<button class="clear-btn" bindtap="clearHistory" hover-class="btn-hover">清空历史记录</button>
</view>
</block>
<block wx:else>
<view class="empty-state">
<text class="empty-icon">📭</text>
<text class="empty-text">暂无历史记录</text>
<text class="empty-sub">快去使用计算器吧</text>
</view>
</block>
</view>

View File

@@ -0,0 +1,84 @@
page {
background-color: #EBF4F8; /* Color 03 */
}
.container {
padding: 30rpx;
padding-bottom: 120rpx;
}
.history-list {
width: 100%;
display: flex;
flex-direction: column;
gap: 20rpx;
}
.history-item {
background-color: #fff;
padding: 30rpx;
border-radius: 20rpx;
box-shadow: 0 4rpx 12rpx rgba(17, 97, 107, 0.08);
}
.expression {
font-size: 28rpx;
color: #7BBDB6; /* Color 02 */
margin-bottom: 10rpx;
text-align: right;
}
.result {
font-size: 40rpx;
color: #11616B; /* Color 01 */
font-weight: bold;
text-align: right;
}
.footer-btn {
position: fixed;
bottom: 40rpx;
left: 0;
width: 100%;
padding: 0 40rpx;
box-sizing: border-box;
}
.clear-btn {
background-color: #DC8B70; /* Color 05 - Accent */
color: #fff;
border-radius: 40rpx;
font-size: 30rpx;
box-shadow: 0 8rpx 20rpx rgba(220, 139, 112, 0.4);
}
.btn-hover {
opacity: 0.9;
transform: scale(0.98);
}
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 200rpx;
}
.empty-icon {
font-size: 100rpx;
margin-bottom: 30rpx;
color: #7BBDB6; /* Color 02 */
}
.empty-text {
font-size: 34rpx;
color: #11616B; /* Color 01 */
margin-bottom: 10rpx;
font-weight: bold;
}
.empty-sub {
font-size: 26rpx;
color: #7BBDB6; /* Color 02 */
}