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

@@ -1,4 +1,5 @@
{
"usingComponents": {
"privacy-popup": "/components/privacy-popup/privacy-popup"
}
}

View File

@@ -96,6 +96,19 @@ Component({
}
},
// 页面跳转方法
goToHistory() {
wx.navigateTo({ url: '/pages/history/history' });
},
goToPrivacy() {
wx.navigateTo({ url: '/pages/privacy/privacy' });
},
goToAbout() {
wx.navigateTo({ url: '/pages/about/about' });
},
// 弹出设置菜单
onSettingsTap() {
wx.showActionSheet({
@@ -449,13 +462,38 @@ Component({
// 复制验证码
copyVerificationCode() {
console.log('点击复制验证码');
const { verificationCode } = this.data;
if (!verificationCode) return;
console.log('当前验证码:', verificationCode);
if (!verificationCode) {
console.log('无验证码,无法复制');
return;
}
const dataStr = String(verificationCode);
wx.setClipboardData({
data: String(verificationCode),
data: dataStr,
success: () => {
wx.showToast({ title: '复制成功', icon: 'success' });
console.log('复制成功回调');
// 延迟一下显示 Toast防止被系统 Toast 覆盖(如果有)
setTimeout(() => {
wx.showToast({ title: '复制成功', icon: 'success' });
}, 100);
},
fail: (err) => {
console.error('复制失败:', err);
// 隐私协议未声明或用户拒绝会导致复制失败 (errno 112)
if (err.errno === 112 || (err.errMsg && err.errMsg.indexOf('privacy') > -1)) {
wx.showModal({
title: '提示',
content: '无法自动复制,请长按数字进行手动复制',
showCancel: false,
confirmText: '知道了'
});
} else {
wx.showToast({ title: '复制失败', icon: 'none' });
}
}
});
},

View File

@@ -70,7 +70,7 @@
<button class="login-btn" bindtap="getVerificationCode">生成随机数</button>
<view wx:if="{{verificationCode}}" class="code-display">
<text class="code-text">{{verificationCode}}</text>
<text class="code-text" user-select="{{true}}">{{verificationCode}}</text>
<view class="copy-btn" bindtap="copyVerificationCode">复制</view>
</view>
</view>
@@ -80,6 +80,27 @@
</block>
</block>
</view>
<!-- 更多设置菜单 (新增) -->
<view class="menu-list" style="margin-top: 30rpx; width: 100%; border-radius: 12rpx; overflow: hidden; background: #fff;">
<view class="menu-item" bindtap="goToHistory" style="padding: 30rpx; display: flex; justify-content: space-between; border-bottom: 1rpx solid #eee;">
<text>计算历史</text>
<text style="color: #999;">></text>
</view>
<view class="menu-item" bindtap="goToPrivacy" style="padding: 30rpx; display: flex; justify-content: space-between; border-bottom: 1rpx solid #eee;">
<text>隐私政策</text>
<text style="color: #999;">></text>
</view>
<view class="menu-item" bindtap="goToAbout" style="padding: 30rpx; display: flex; justify-content: space-between; border-bottom: 1rpx solid #eee;">
<text>关于我们</text>
<text style="color: #999;">></text>
</view>
<button open-type="feedback" class="menu-item" style="width: 100%; text-align: left; padding: 30rpx; display: flex; justify-content: space-between; background: #fff; font-weight: normal; margin: 0; line-height: 1.4;">
<text>意见反馈</text>
<text style="color: #999;">></text>
</button>
</view>
<!-- 隐私协议弹窗 -->
<privacy-popup></privacy-popup>
</view>
</scroll-view>