huaanglimeng/pages/settings/settings.js

56 lines
1.9 KiB
JavaScript
Raw Permalink Normal View History

Page({
clearCache() {
wx.showModal({
title: '确认清除',
content: '将清除所有本地数据,包括积分记录,是否继续?',
success(res) {
if (res.confirm) {
try {
wx.clearStorageSync()
wx.showToast({
title: '已清除',
icon: 'none'
})
// Consider re-initializing necessary keys if needed, or just let app.js handle it on next launch
} catch (e) {
wx.showToast({
title: '清除失败',
icon: 'none'
})
}
}
}
})
},
revokePrivacy() {
wx.showModal({
title: '撤销隐私授权',
content: '撤销后将重置隐私协议状态,下次启动需重新同意,是否继续?',
success(res) {
if (res.confirm) {
try {
wx.removeStorageSync('privacyAgreed')
wx.showToast({
title: '已撤销',
icon: 'none'
})
// 延迟跳转,确保提示显示
setTimeout(() => {
wx.reLaunch({
url: '/pages/privacy-agree/privacy-agree'
})
}, 1500)
} catch (e) {
wx.showToast({
title: '操作失败',
icon: 'none'
})
}
}
}
})
}
})