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

@@ -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' });
}
}
});
},