2
0

fix:个人信息部分错误信息修复

This commit is contained in:
zhongzm
2025-02-26 15:35:50 +08:00
parent ee4338b2fb
commit 0a51eb0fab
4 changed files with 22 additions and 22 deletions

View File

@@ -77,7 +77,7 @@ async function getDeviceList() {
})); }));
} }
} catch (err) { } catch (err) {
console.error('Failed to fetch device list:', err); // console.error('Failed to fetch device list:', err);
} finally { } finally {
loading.value = false; loading.value = false;
} }

View File

@@ -102,18 +102,18 @@ const getBase64 = (file: File): Promise<string> => {
const getKYCStatus = async () => { const getKYCStatus = async () => {
try { try {
const response = await fetchKYCStatus(); const response = await fetchKYCStatus();
console.log('KYC Response:', response); // console.log('KYC Response:', response);
// 检查响应数据结构 // 检查响应数据结构
if (response?.data?.rows && Array.isArray(response.data.rows) && response.data.rows.length > 0) { if (response?.data?.rows && Array.isArray(response.data.rows) && response.data.rows.length > 0) {
// 获取第一条记录 // 获取第一条记录
const kycData = response.data.rows[0]; const kycData = response.data.rows[0];
console.log('KYC Data:', kycData); // console.log('KYC Data:', kycData);
if (kycData && kycData.status) { if (kycData && kycData.status) {
// 将状态转换为标准格式,不区分大小写 // 将状态转换为标准格式,不区分大小写
const normalizedStatus = kycData.status.toUpperCase() as Api.KYC.KYCStatus; const normalizedStatus = kycData.status.toUpperCase() as Api.KYC.KYCStatus;
console.log('Normalized status:', normalizedStatus); // console.log('Normalized status:', normalizedStatus);
// 确保状态值有效 // 确保状态值有效
if (['UNVERIFIED', 'PENDING', 'VERIFIED', 'REJECTED'].includes(normalizedStatus)) { if (['UNVERIFIED', 'PENDING', 'VERIFIED', 'REJECTED'].includes(normalizedStatus)) {
@@ -134,7 +134,7 @@ const getKYCStatus = async () => {
} }
// 如果没有有效的状态数据,设置为默认值 // 如果没有有效的状态数据,设置为默认值
console.warn('Invalid or missing KYC status data:', response); // console.warn('Invalid or missing KYC status data:', response);
kycStatus.value = 'UNVERIFIED'; kycStatus.value = 'UNVERIFIED';
kycInfo.value = { kycInfo.value = {
status: 'UNVERIFIED', status: 'UNVERIFIED',
@@ -145,8 +145,8 @@ const getKYCStatus = async () => {
}; };
} catch (error) { } catch (error) {
console.error('Failed to fetch KYC status:', error); // console.error('Failed to fetch KYC status:', error);
message.error(t('page.kyc.kycerror')); // message.error(t('page.kyc.kycerror'));
// 发生错误时设置默认值 // 发生错误时设置默认值
kycStatus.value = 'UNVERIFIED'; kycStatus.value = 'UNVERIFIED';
kycInfo.value = { kycInfo.value = {
@@ -184,8 +184,8 @@ const handleIdCardUpload: UploadProps['beforeUpload'] = async (file) => {
message.success(t('page.kyc.picturesuc')); message.success(t('page.kyc.picturesuc'));
} }
} catch (error) { } catch (error) {
console.error('Failed to upload ID card:', error); // console.error('Failed to upload ID card:', error);
message.error(t('page.kyc.picturefal')); // message.error(t('page.kyc.picturefal'));
} finally { } finally {
idCardLoading.value = false; idCardLoading.value = false;
} }
@@ -216,8 +216,8 @@ const handlePhotoUpload: UploadProps['beforeUpload'] = async (file) => {
message.success(t('page.kyc.picturesuc')); message.success(t('page.kyc.picturesuc'));
} }
} catch (error) { } catch (error) {
console.error('Failed to upload photo:', error); // console.error('Failed to upload photo:', error);
message.error(t('page.kyc.picturefal')); // message.error(t('page.kyc.picturefal'));
} finally { } finally {
photoLoading.value = false; photoLoading.value = false;
} }
@@ -250,8 +250,8 @@ const submitKYC = async () => {
message.success(t('page.kyc.kycsubmit')); message.success(t('page.kyc.kycsubmit'));
await getKYCStatus(); await getKYCStatus();
} catch (error) { } catch (error) {
console.error('Failed to submit KYC:', error); // console.error('Failed to submit KYC:', error);
message.error(t('page.kyc.submitfalse')); // message.error(t('page.kyc.submitfalse'));
} }
}; };

View File

@@ -136,7 +136,7 @@ onMounted(async () => {
const userInfo = authStore.userInfo?.user; const userInfo = authStore.userInfo?.user;
if (!userInfo) { if (!userInfo) {
message.error(t('page.profile.getUserInfoFailed')); // message.error(t('page.profile.getUserInfoFailed'));
return; return;
} }
@@ -150,8 +150,8 @@ onMounted(async () => {
sex: userInfo.sex ?? '0' sex: userInfo.sex ?? '0'
}; };
} catch (error) { } catch (error) {
console.error('Failed to get user info:', error); // console.error('Failed to get user info:', error);
message.error(t('page.profile.getUserInfoFailed')); // message.error(t('page.profile.getUserInfoFailed'));
} }
}); });
@@ -162,7 +162,7 @@ const handleSubmit = async () => {
const userId = authStore.userInfo?.user?.userId; const userId = authStore.userInfo?.user?.userId;
if (!userId) { if (!userId) {
message.error(t('page.profile.getUserInfoFailed')); // message.error(t('page.profile.getUserInfoFailed'));
return; return;
} }
@@ -207,11 +207,11 @@ const handleSubmit = async () => {
} }
message.success(t('page.profile.updateSuccess')); message.success(t('page.profile.updateSuccess'));
} else { } else {
message.error(t('page.profile.updateFailed')); // message.error(t('page.profile.updateFailed'));
} }
} catch (error) { } catch (error) {
console.error('表单验证失败:', error); // console.error('表单验证失败:', error);
message.error(t('page.profile.updateFailed')); // message.error(t('page.profile.updateFailed'));
} finally { } finally {
loading.value = false; loading.value = false;
} }

View File

@@ -154,8 +154,8 @@ async function handleSubmit() {
} catch (error) { } catch (error) {
console.error('Reset password failed:', error); // console.error('Reset password failed:', error);
message.error(t('page.login.resetPwd.resetFailed')); // message.error(t('page.login.resetPwd.resetFailed'));
} }
} }