|
|
@ -23,16 +23,19 @@ |
|
|
|
<div class="flex-right"> |
|
|
|
<GuipFormItem column="column" class="mb24"> |
|
|
|
<div slot="formLeft">域名来源</div> |
|
|
|
<GuipRadio slot="formDom" v-model="formData.domain_type" :options="formData.domain_types" prop="domain" :rules="formRules.domain" |
|
|
|
@change="radioDomainChange" /> |
|
|
|
<GuipRadio slot="formDom" v-model="formData.domain_type" :options="formData.domain_types" prop="domain"/> |
|
|
|
</GuipFormItem> |
|
|
|
<GuipFormItem column="column"> |
|
|
|
<GuipFormItem column="column" v-if="formData.domain_type==='1'"> |
|
|
|
<div slot="formLeft">域名设置</div> |
|
|
|
<GuipInput v-show="formData.domain_type==='1'" slot="formDom" v-model="formData.domain_prefix" class="w540"> |
|
|
|
<i slot="suffix" class="el-icon-close" @click="handleClear"></i> |
|
|
|
<span slot="appendshow">{{formData.domain_name}}</span> |
|
|
|
<GuipInput slot="formDom" ref="GuipInput" prop="domain_prefix" placeholder="仅支持数字、字母" |
|
|
|
v-model="formData.domain_prefix" :rules="formRules.domain_prefix" class="w540"> |
|
|
|
<i slot="suffix" v-if="formData.domain_prefix" class="el-icon-close" @click="handleClear"></i> |
|
|
|
<span slot="appendshow">{{formData.plat_domain}}</span> |
|
|
|
</GuipInput> |
|
|
|
<domainBind v-show="formData.domain_type==='2'" slot="formDom" :defaultPrefix="formData.domain_prefix" :defaultDomain="formData.domain_name" @handleEvent="handleChangeDomain" /> |
|
|
|
</GuipFormItem> |
|
|
|
<GuipFormItem column="column" v-if="formData.domain_type==='2'"> |
|
|
|
<div slot="formLeft">域名设置</div> |
|
|
|
<domainBind ref="domainBind" slot="formDom" :defaultPrefix="formData.domain_prefix" :defaultDomain="formData.domain_name" @handleEvent="handleChangeDomain" /> |
|
|
|
</GuipFormItem> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -142,9 +145,15 @@ export default { |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
submitData() { |
|
|
|
let domain = ""; |
|
|
|
if (this.formData.domain_type === '1') { |
|
|
|
domain = this.formData.domain_prefix + this.formData.plat_domain |
|
|
|
} else if (this.formData.domain_type === '2') { |
|
|
|
domain = this.formData.domain_prefix + this.formData.domain_name |
|
|
|
} |
|
|
|
return { |
|
|
|
short_name: this.formData.short_name, |
|
|
|
domain: this.formData.domain_prefix + this.formData.domain_name, |
|
|
|
domain: domain, |
|
|
|
sale_channel: this.formData.sale_channel, |
|
|
|
site_type: this.formData.site_type, |
|
|
|
site_tpl: this.formData.site_tpl, |
|
|
@ -163,6 +172,7 @@ export default { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
console.log(this.siteInfo) |
|
|
|
this.getAddInfo() |
|
|
|
}, |
|
|
|
methods:{ |
|
|
@ -172,19 +182,12 @@ export default { |
|
|
|
this.formData.site_tpl = siteTplInfo.site_tpl |
|
|
|
this.formData.site_tpl_name = siteTplInfo.site_tpl_name |
|
|
|
this.formData.picture = siteTplInfo.picture |
|
|
|
localStorage.removeItem('site_tpl_info') |
|
|
|
} |
|
|
|
|
|
|
|
const ico = await db.get('ico') |
|
|
|
if(ico){ |
|
|
|
this.formData.site_tpl_ico = ico |
|
|
|
await db.remove('ico') |
|
|
|
} |
|
|
|
if(ico) this.formData.site_tpl_ico = ico |
|
|
|
const logo = await db.get('logo') |
|
|
|
if(logo){ |
|
|
|
this.formData.site_tpl_logo = logo |
|
|
|
await db.remove('logo') |
|
|
|
} |
|
|
|
if(logo) this.formData.site_tpl_logo = logo |
|
|
|
}, |
|
|
|
getAddInfo() { |
|
|
|
const that = this |
|
|
@ -197,7 +200,6 @@ export default { |
|
|
|
that.formData.domain_type = String(addInfo.domain_type) |
|
|
|
that.formData.domain_types = addInfo.domain_types |
|
|
|
that.formData.plat_domain = addInfo.plat_domain |
|
|
|
that.formData.domain_name = addInfo.plat_domain |
|
|
|
|
|
|
|
that.formData.site_type = String(addInfo.site_type) |
|
|
|
that.formData.site_types = addInfo.site_types |
|
|
@ -218,12 +220,9 @@ export default { |
|
|
|
that.formData.picture = that.siteInfo.picture |
|
|
|
that.formData.not_finished_uid = that.siteInfo.uid |
|
|
|
|
|
|
|
//域名存在且不是平台主域名 |
|
|
|
if(that.siteInfo.domain){ |
|
|
|
that.formData.domain_type = String(that.siteInfo.domain_type) |
|
|
|
that.formData.domain_prefix = that.siteInfo.domain_prefix; |
|
|
|
that.formData.domain_name = that.siteInfo.domain_name; |
|
|
|
} |
|
|
|
that.formData.domain_type = String(that.siteInfo.domain_type) |
|
|
|
that.formData.domain_prefix = that.siteInfo.domain_prefix; |
|
|
|
that.formData.domain_name = that.siteInfo.domain_name; |
|
|
|
}) |
|
|
|
} |
|
|
|
return true |
|
|
@ -238,9 +237,6 @@ export default { |
|
|
|
const value = this.formData.sale_channel; |
|
|
|
this.formData.sale_channel_label = labels && labels[value] ? labels[value] : ''; |
|
|
|
}, |
|
|
|
radioDomainChange(){ |
|
|
|
this.formData.domain_name = this.formData.domain_type === '1' ? this.formData.plat_domain : '' |
|
|
|
}, |
|
|
|
radioTypeChange(){ |
|
|
|
if(this.formData.site_type){ |
|
|
|
this.formData.site_tpl = this.formData.site_type_tpl[this.formData.site_type].site_tpl |
|
|
@ -264,32 +260,55 @@ export default { |
|
|
|
return false; |
|
|
|
} |
|
|
|
localStorage.setItem('formData', JSON.stringify(this.formData)) |
|
|
|
this.$router.push(`/agent/siteTemplate?site_type=${this.formData.site_type}`) |
|
|
|
if(this.formData.not_finished_uid){ |
|
|
|
this.$router.push(`/agent/siteTemplate?uid=${this.formData.not_finished_uid}`) |
|
|
|
}else{ |
|
|
|
this.$router.push(`/agent/siteTemplate?site_type=${this.formData.site_type}`) |
|
|
|
} |
|
|
|
}, |
|
|
|
saveConfirm() { |
|
|
|
const that = this |
|
|
|
let formValid = false; |
|
|
|
that.$refs.formRef.validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
const that = this |
|
|
|
that.$http('POST', '/agentnew/ajax_add_new_site', that.submitData).then(response => { |
|
|
|
if(response.status && response.data.uid){ |
|
|
|
that.formData.uid = response.data.uid |
|
|
|
that.$emit('handelSiteInfo', that.formData) |
|
|
|
formValid = valid |
|
|
|
}); |
|
|
|
|
|
|
|
if(that.formData.sale_channel === '2'){ |
|
|
|
//自用站点无需设置收款方式 |
|
|
|
that.$emit('handelStep', 3) |
|
|
|
}else{ |
|
|
|
that.$emit('handelStep', 2) |
|
|
|
} |
|
|
|
return true; |
|
|
|
let domainValid = false; |
|
|
|
if(that.formData.domain_type === '2'){ |
|
|
|
that.$refs.domainBind.$refs.bindFormRef.validate(valid => { |
|
|
|
domainValid = valid |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
domainValid = true |
|
|
|
} |
|
|
|
|
|
|
|
if (formValid && domainValid) { |
|
|
|
that.$http('POST', '/agentnew/ajax_add_new_site', that.submitData).then(async response => { |
|
|
|
if(response.status && response.data.uid){ |
|
|
|
await that.deleteSiteTplData() |
|
|
|
|
|
|
|
that.formData.uid = response.data.uid |
|
|
|
that.$emit('handelSiteInfo', that.formData) |
|
|
|
|
|
|
|
if(that.formData.sale_channel === '2'){ |
|
|
|
//自用站点无需设置收款方式 |
|
|
|
that.$emit('handelStep', 3) |
|
|
|
}else{ |
|
|
|
that.$emit('handelStep', 2) |
|
|
|
} |
|
|
|
that.$message.error(response.info); |
|
|
|
}).catch(error => { |
|
|
|
console.error(error, 'error') |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
return true; |
|
|
|
} |
|
|
|
that.$message.error(response.info); |
|
|
|
}).catch(error => { |
|
|
|
console.error(error, 'error') |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
async deleteSiteTplData(){ |
|
|
|
localStorage.removeItem('activeStep') |
|
|
|
localStorage.removeItem('site_tpl_info') |
|
|
|
await db.remove('ico') |
|
|
|
await db.remove('logo') |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
@ -357,7 +376,7 @@ export default { |
|
|
|
} |
|
|
|
.channel-radio .el-radio{ |
|
|
|
min-width: 120px; |
|
|
|
margin-bottom: 12px; |
|
|
|
line-height: 16px; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |