|
@ -9,13 +9,14 @@ |
|
|
<el-form class="el-row demo-ruleForm" ref="formRef"> |
|
|
<el-form class="el-row demo-ruleForm" ref="formRef"> |
|
|
<div class="domain-from">域名来源</div> |
|
|
<div class="domain-from">域名来源</div> |
|
|
<div class="domain-radio"> |
|
|
<div class="domain-radio"> |
|
|
<GuipRadio v-model="domainFrom" :options="domainFromOptions"/> |
|
|
<GuipRadio v-model="domain_type" :options="domain_types"/> |
|
|
</div> |
|
|
</div> |
|
|
<div class="flex domain-info"> |
|
|
<div class="flex domain-info"> |
|
|
<span>当前服务域名:</span><span>{{info.domain}}</span> |
|
|
<span>当前服务域名:</span><span>{{info.domain}}</span> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<domainBind v-show="domainFrom === '1'" label="域名设置" @handleEvent="handleEvent"/> |
|
|
<domainBind ref="domainBind" v-if="domain_type === '2'" label="域名设置" |
|
|
|
|
|
:defaultPrefix="newDomain.prefix" :defaultDomain="newDomain.domain" @handleEvent="handleEvent"/> |
|
|
</el-form> |
|
|
</el-form> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -55,17 +56,20 @@ export default { |
|
|
borderRadius: '4px', |
|
|
borderRadius: '4px', |
|
|
background: '#006AFF', |
|
|
background: '#006AFF', |
|
|
}, |
|
|
}, |
|
|
domainFrom: '0', |
|
|
domain_type: '', |
|
|
domainFromOptions: { |
|
|
domain_types: {}, |
|
|
'0': '平台免费域名', |
|
|
newDomain: { |
|
|
'1': '我自己有域名' |
|
|
prefix: '', |
|
|
}, |
|
|
domain: '' |
|
|
newDomain: {} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
|
this.info = JSON.parse(JSON.stringify(this.serviceInfo)) |
|
|
this.info = JSON.parse(JSON.stringify(this.serviceInfo)) |
|
|
if(this.info.ser_domain) this.domainFrom = '1' |
|
|
this.domain_type = String(this.info.domain_type) |
|
|
|
|
|
this.domain_types = this.info.domain_types |
|
|
|
|
|
this.newDomain.prefix = this.info.domain_prefix |
|
|
|
|
|
this.newDomain.domain = this.info.domain_name |
|
|
}, |
|
|
}, |
|
|
methods:{ |
|
|
methods:{ |
|
|
handleEvent(data){ |
|
|
handleEvent(data){ |
|
@ -75,35 +79,37 @@ export default { |
|
|
let obj = {} |
|
|
let obj = {} |
|
|
obj.uid = this.info.uid |
|
|
obj.uid = this.info.uid |
|
|
obj.type = this.info.type |
|
|
obj.type = this.info.type |
|
|
if(this.domainFrom === '1'){ |
|
|
obj.domain = '' |
|
|
if(!this.newDomain.prefix || !this.newDomain.domain) return false |
|
|
if(this.domain_type === '2') obj.domain = this.newDomain.prefix + this.newDomain.domain |
|
|
obj.domain = this.newDomain.prefix + this.newDomain.domain |
|
|
|
|
|
}else{ |
|
|
|
|
|
obj.domain = '' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const that = this |
|
|
const that = this |
|
|
this.$http('POST', '/agentnew/ajax_update_service_domain', obj).then(response => { |
|
|
let domainValid = true; |
|
|
if(response.status){ |
|
|
if(that.domain_type === '2'){ |
|
|
that.$message.success('保存成功'); |
|
|
that.$refs.domainBind.$refs.bindFormRef.validate(valid => { |
|
|
|
|
|
domainValid = valid |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
if (domainValid) { |
|
|
|
|
|
that.$http('POST', '/agentnew/ajax_update_service_domain', obj).then(response => { |
|
|
|
|
|
if (response.status) { |
|
|
|
|
|
that.$message.success('保存成功'); |
|
|
|
|
|
|
|
|
//替换域名 |
|
|
//替换域名 |
|
|
const protocol = new URL(that.info.domain).protocol; |
|
|
const protocol = new URL(that.info.domain).protocol; |
|
|
if(this.domainFrom === '1'){ |
|
|
if (that.domain_type === '2') { |
|
|
that.info.domain = protocol + "//" +obj.domain; |
|
|
that.info.domain = protocol + "//" + obj.domain; |
|
|
that.info.ser_domain = protocol + "//" +obj.domain; |
|
|
} else { |
|
|
}else{ |
|
|
that.info.domain = that.info.site_domain; |
|
|
that.info.domain = that.info.site_domain; |
|
|
} |
|
|
that.info.ser_domain = ''; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
that.$emit('saveEvent', that.info) |
|
|
that.$emit('saveEvent', that.info) |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
that.$message.error(response.info); |
|
|
that.$message.error(response.info); |
|
|
}).catch(error => { |
|
|
}).catch(error => { |
|
|
console.error(error, 'error') |
|
|
console.error(error, 'error') |
|
|
}) |
|
|
}) |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|