Refactor: UI & Feature updates (Calculator, UnitConverter, Privacy, Cleanup)
This commit is contained in:
@@ -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' });
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user