fix:最新版本
This commit is contained in:
@@ -15,6 +15,8 @@ function maskPhone(phone?: string): string {
|
||||
|
||||
export function usePrivacy() {
|
||||
const phone = ref('')
|
||||
const cancelAccountDialogVisible = ref(false)
|
||||
const cancelingAccount = ref(false)
|
||||
|
||||
const sections = computed<PrivacySection[]>(() => [
|
||||
{
|
||||
@@ -66,25 +68,23 @@ export function usePrivacy() {
|
||||
return
|
||||
}
|
||||
if (itemId === 'delete-account') {
|
||||
uni.showModal({
|
||||
title: '注销账号',
|
||||
content: '注销后账号及所有数据将被永久删除,且无法恢复。确定继续吗?',
|
||||
confirmColor: '#f04438',
|
||||
success: (res) => {
|
||||
if (!res.confirm) return
|
||||
void (async () => {
|
||||
try {
|
||||
await cancelAccount()
|
||||
teardownMessageInbox()
|
||||
clearStoredToken()
|
||||
uni.showToast({ title: '账号已注销', icon: 'success' })
|
||||
uni.reLaunch({ url: '/pages/login/index' })
|
||||
} catch (err) {
|
||||
uni.showToast({ title: getErrorMessage(err, '注销失败'), icon: 'none' })
|
||||
}
|
||||
})()
|
||||
},
|
||||
})
|
||||
cancelAccountDialogVisible.value = true
|
||||
}
|
||||
}
|
||||
|
||||
async function onConfirmCancelAccount() {
|
||||
if (cancelingAccount.value) return
|
||||
cancelingAccount.value = true
|
||||
try {
|
||||
await cancelAccount()
|
||||
teardownMessageInbox()
|
||||
clearStoredToken()
|
||||
uni.showToast({ title: '账号已注销', icon: 'success' })
|
||||
uni.reLaunch({ url: '/pages/login/index' })
|
||||
} catch (err) {
|
||||
uni.showToast({ title: getErrorMessage(err, '注销失败'), icon: 'none' })
|
||||
} finally {
|
||||
cancelingAccount.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,9 @@ export function usePrivacy() {
|
||||
|
||||
return {
|
||||
sections,
|
||||
cancelAccountDialogVisible,
|
||||
onItemTap,
|
||||
onLogout,
|
||||
onConfirmCancelAccount,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user