新建域名所有者测试成功

This commit is contained in:
jingrow 2025-08-02 14:20:49 +08:00
parent d497034501
commit 7840ad48c1
2 changed files with 24 additions and 23 deletions

View File

@ -40,6 +40,7 @@
type="radio"
v-model="formData.c_regtype"
value="I"
@change="onRegTypeChange"
class="mr-2"
>
<span class="text-sm">个人</span>
@ -49,6 +50,7 @@
type="radio"
v-model="formData.c_regtype"
value="E"
@change="onRegTypeChange"
class="mr-2"
>
<span class="text-sm">企业/组织</span>
@ -313,7 +315,7 @@ export default {
c_ph_type: '0', // 0-
c_ph: '', //
c_em: '', //
c_idtype_gswl: '', //
c_idtype_gswl: 'SFZ', //
c_idnum_gswl: '' //
},
selectedCountry: 'CN',
@ -339,32 +341,18 @@ export default {
}
try {
//
const submitData = { ...this.formData };
//
submitData.c_co = this.selectedCountry;
submitData.cocode = this.selectedCountry === 'CN' ? '+86' : '';
console.log('准备提交的数据:', submitData);
// API
console.log('开始调用API...');
const response = await this.$resources.createDomainOwner.submit(submitData);
console.log('API调用结果:', response);
if (response.success) {
console.log('域名所有者创建成功:', response);
const response = await this.$resources.createDomainOwner.submit(submitData);
if (response.status === 'Success') {
alert('域名所有者创建成功!');
this.$emit('submit', response.data);
this.closeDialog();
} else {
console.error('创建失败:', response);
alert(`创建失败: ${response.message}`);
}
} catch (error) {
console.error('创建域名所有者失败:', error);
alert('创建失败,请检查网络连接或联系管理员');
}
},
@ -434,7 +422,7 @@ export default {
c_ph_type: '0',
c_ph: '',
c_em: '',
c_idtype_gswl: '',
c_idtype_gswl: 'SFZ', //
c_idnum_gswl: ''
};
this.selectedCountry = 'CN';
@ -472,6 +460,17 @@ export default {
this.formData.c_idnum_gswl = '';
this.idNumberError = '';
},
onRegTypeChange() {
//
if (this.formData.c_regtype === 'I') {
this.formData.c_idtype_gswl = 'SFZ'; //
} else {
this.formData.c_idtype_gswl = 'YYZZ'; //
}
//
this.formData.c_idnum_gswl = '';
this.idNumberError = '';
},
getCurrentCities() {
if (!this.selectedProvince) return [];
return getCitiesByProvince(this.selectedProvince);
@ -513,7 +512,7 @@ export default {
if (this.formData.c_idtype_gswl === 'SFZ') {
const idNum = this.formData.c_idnum_gswl;
if (idNum.length !== 18) {
this.idNumberError = '身份证号码必须是18位';
this.idNumberError = `身份证号码必须是18位当前为${idNum.length}`;
return;
}

View File

@ -1190,13 +1190,15 @@ def create_domain_template(**data):
'fullname': data.get('c_ln_m', '') + data.get('c_fn_m', '') # 完整姓名
}
# 添加企业相关字段
if data['c_regtype'] == 'E':
if not data.get('c_org_m'):
return {"status": "error", "message": "企业类型必须填写单位名称"}
# 个人类型时不传入c_org_m参数
if data['c_regtype'] == 'E' and data.get('c_org_m'):
template_data['c_org_m'] = data['c_org_m']
template_data['c_org'] = data.get('c_org', '') # 英文单位名称
# 验证企业类型必须填写单位名称
if data['c_regtype'] == 'E' and not data.get('c_org_m'):
return {"status": "error", "message": "企业类型必须填写单位名称"}
# 添加区县信息
if data.get('c_dt_m'):
template_data['c_dt_m'] = data['c_dt_m']