修复实名资料上传成功后不返回提示的问题
This commit is contained in:
parent
991b34232b
commit
3a998b2d08
@ -207,7 +207,7 @@ export default {
|
||||
const validFiles = newFiles.filter(file => {
|
||||
// 检查文件大小 (5MB限制)
|
||||
if (file.size > 5 * 1024 * 1024) {
|
||||
toast.error(`文件 ${file.name} 超过 5MB 限制`);
|
||||
alert(`文件 ${file.name} 超过 5MB 限制`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -249,14 +249,14 @@ export default {
|
||||
// 验证域名是否有效
|
||||
if (!domain || domain === '36h8on65rd') {
|
||||
console.error('域名信息无效:', domain);
|
||||
toast.error('域名信息无效,请重试');
|
||||
alert('域名信息无效,请重试');
|
||||
return;
|
||||
}
|
||||
|
||||
// 确保域名格式正确
|
||||
if (!domain.includes('.')) {
|
||||
console.error('域名格式无效:', domain);
|
||||
toast.error('域名格式无效,请重试');
|
||||
alert('域名格式无效,请重试');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -278,33 +278,36 @@ export default {
|
||||
|
||||
if (xhr.status === 200) {
|
||||
try {
|
||||
console.log('原始响应文本:', xhr.responseText);
|
||||
const response = JSON.parse(xhr.responseText);
|
||||
console.log('服务器响应:', response);
|
||||
console.log('解析后的响应:', response);
|
||||
|
||||
if (response && response.status === "success") {
|
||||
// 使用 setTimeout 延迟执行,避免在 XMLHttpRequest 回调中直接调用 toast
|
||||
setTimeout(() => {
|
||||
toast.success(response.message || '实名资料上传成功,请等待审核');
|
||||
}, 100);
|
||||
console.log('响应状态检查:', {
|
||||
response: response,
|
||||
responseKeys: Object.keys(response || {}),
|
||||
message: response?.message,
|
||||
status: response?.status,
|
||||
statusType: typeof response?.status
|
||||
});
|
||||
|
||||
// Jingrow 响应格式:{message: {...}}
|
||||
if (response && response.message && response.message.status === "success") {
|
||||
console.log('实名资料上传成功:', response.message.message || '请等待审核');
|
||||
// 直接关闭弹窗,不显示 toast
|
||||
this.$emit('success');
|
||||
this.$emit('close');
|
||||
} else {
|
||||
const errorMessage = response?.message || '上传失败,请重试';
|
||||
setTimeout(() => {
|
||||
toast.error(errorMessage);
|
||||
}, 100);
|
||||
const errorMessage = response?.message?.message || response?.message || '上传失败,请重试';
|
||||
console.error('上传失败:', errorMessage);
|
||||
alert(errorMessage);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('解析响应失败:', error);
|
||||
setTimeout(() => {
|
||||
toast.error('上传失败,请重试');
|
||||
}, 100);
|
||||
alert('上传失败,请重试');
|
||||
}
|
||||
} else {
|
||||
console.error('上传失败:', xhr.status, xhr.statusText);
|
||||
setTimeout(() => {
|
||||
toast.error('上传失败,请重试');
|
||||
}, 100);
|
||||
alert('上传失败,请重试');
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -321,19 +324,19 @@ export default {
|
||||
|
||||
} catch (error) {
|
||||
console.error('上传实名资料失败:', error);
|
||||
toast.error('上传失败,请重试');
|
||||
alert('上传失败,请重试');
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
validateForm() {
|
||||
if (!this.formData.idNumber.trim()) {
|
||||
toast.error('请填写证件号码');
|
||||
alert('请填写证件号码');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.uploadedFiles.length === 0) {
|
||||
toast.error('请上传证件材料');
|
||||
alert('请上传证件材料');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -3010,7 +3010,11 @@ def upload_domain_real_name_files(**data):
|
||||
|
||||
upload_response = client.upload_real_name_files(token, file_org, file_lxr)
|
||||
|
||||
# 打印西部数码API响应
|
||||
jingrow.log_error("西部数码API响应", str(upload_response))
|
||||
|
||||
if upload_response.get("status") == "error":
|
||||
jingrow.log_error("西部数码API错误", str(upload_response))
|
||||
return upload_response
|
||||
|
||||
# 解析响应
|
||||
@ -3018,8 +3022,10 @@ def upload_domain_real_name_files(**data):
|
||||
result = d.get("Result")
|
||||
msg = d.get("Msg", "")
|
||||
|
||||
jingrow.log_error("解析结果", f"result: {result}, msg: {msg}")
|
||||
|
||||
if result == 200:
|
||||
return {
|
||||
response_data = {
|
||||
"status": "success",
|
||||
"message": "实名资料上传成功,请等待审核",
|
||||
"data": {
|
||||
@ -3027,11 +3033,15 @@ def upload_domain_real_name_files(**data):
|
||||
"msg": msg
|
||||
}
|
||||
}
|
||||
jingrow.log_error("返回成功响应", str(response_data))
|
||||
return response_data
|
||||
else:
|
||||
return {
|
||||
response_data = {
|
||||
"status": "error",
|
||||
"message": f"实名资料上传失败: {msg}"
|
||||
}
|
||||
jingrow.log_error("返回错误响应", str(response_data))
|
||||
return response_data
|
||||
|
||||
except Exception as e:
|
||||
jingrow.log_error("上传实名资料失败", str(e))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user