This commit is contained in:
2025-10-01 11:13:26 +08:00
parent 9cb2ef0b6f
commit 6d416618f7
9 changed files with 116 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ import httpService, { ApiResponse } from './httpService';
import uploadFiles from './uploadFiles';
import Taro from '@tarojs/taro';
import getCurrentConfig from '@/config/env';
import { clear_login_state } from "@/services/loginService";
// 用户详情接口
@@ -552,6 +553,25 @@ export class UserService {
}
}
// 注销账户
static async logout(): Promise<void> {
try {
const response = await httpService.post<any>(API_CONFIG.USER.LOGOUT);
const { code, message } = response;
if (code === 0) {
// 清除用户数据
clear_login_state();
Taro.reLaunch({
url: "/login_pages/index/index",
});
} else {
throw new Error(message || '注销账户失败');
}
} catch (error) {
console.error('注销账户失败:', error);
}
}
}
// 从 loginService 移过来的用户相关方法
@@ -639,7 +659,7 @@ export const handleCustomerService = async (): Promise<void> => {
// 客服备用方案
const showCustomerServiceFallback = (customerInfo?: any) => {
const options = ['拨打客服电话', '复制邮箱地址'];
// 如果没有客服信息,只显示通用提示
if (!customerInfo?.phoneNumber && !customerInfo?.email) {
Taro.showModal({