新建域名所有者测试成功

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

View File

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