增加域名绑定功能

dependabot/npm_and_yarn/fir_admin/dns-packet-1.3.4
youngS 4 years ago
parent 710de8432d
commit 50d877f2f3
  1. 7
      fir_client/src/components/FirBase.vue
  2. 2
      fir_client/src/components/apps/FirAppInfossecurity.vue
  3. 244
      fir_client/src/components/base/BindDomain.vue
  4. 2
      fir_client/src/components/user/FirUserProfileInfo.vue
  5. 5
      fir_ser/api/utils/serializer.py

@ -6,7 +6,7 @@
:close-on-press-escape="false" :close-on-press-escape="false"
:visible.sync="bind_domain_sure" :visible.sync="bind_domain_sure"
width="666px"> width="666px">
<bind-domain transitionName="bind-user-domain" /> <bind-domain transitionName="bind-user-domain"/>
</el-dialog> </el-dialog>
<canvas ref="canvas" class="canvas" @mousemove="canvas_move" @mouseleave="canvas_leave"/> <canvas ref="canvas" class="canvas" @mousemove="canvas_move" @mouseleave="canvas_leave"/>
<el-container> <el-container>
@ -17,7 +17,8 @@
:closable="false" :closable="false"
effect="dark"> effect="dark">
<div slot="title"> <div slot="title">
<span :underline="false" class="domian-tip-bar">应用分发请绑定您自己的域名平台分发域名可能因不可违因素更换将导致您的应用无法访问</span> <span :underline="false"
class="domian-tip-bar">应用分发请绑定您自己的域名平台分发域名可能因不可违因素更换将导致您的应用无法访问</span>
<el-button size="medium" @click="bind_domain_sure=true">立即绑定</el-button> <el-button size="medium" @click="bind_domain_sure=true">立即绑定</el-button>
</div> </div>
</el-alert> </el-alert>
@ -84,7 +85,7 @@
'$store.state.domain_action': function () { '$store.state.domain_action': function () {
if (this.$store.state.domain_action) { if (this.$store.state.domain_action) {
this.$store.dispatch("dodomainaction", false); this.$store.dispatch("dodomainaction", false);
this.bind_domain_sure=true; this.bind_domain_sure = true;
} }
}, },
} }

@ -49,7 +49,7 @@
</el-form-item> </el-form-item>
<el-form-item label-width="200px" label="应用专属域名"> <el-form-item label-width="200px" label="应用专属域名">
<el-input v-model="currentapp.domain_name" clearable <el-input :value="currentapp.domain_name" clearable
style="width: 60%;margin-right: 10px" prefix-icon="el-icon-download" style="width: 60%;margin-right: 10px" prefix-icon="el-icon-download"
:placeholder="defualt_dtitle"/> :placeholder="defualt_dtitle"/>
<el-button @click="bind_domain_sure=true">保存</el-button> <el-button @click="bind_domain_sure=true">保存</el-button>

@ -1,136 +1,138 @@
<template> <template>
<transition :name="transitionName"> <transition :name="transitionName">
<div > <div>
<div style="margin: 5px 20px"> <div style="margin: 5px 20px">
<el-steps :active="active" finish-status="success"> <el-steps :active="active" finish-status="success">
<el-step title="步骤 1"> <el-step title="步骤 1">
</el-step> </el-step>
<el-step title="步骤 2"> <el-step title="步骤 2">
</el-step> </el-step>
<el-step title="步骤 3"/> <el-step title="步骤 3"/>
</el-steps> </el-steps>
<div style="margin-top: 20px"> <div style="margin-top: 20px">
<div v-if="active===1"> <div v-if="active===1">
<h2>你的二级域名</h2> <h2>你的二级域名</h2>
<el-input clearable autofocus v-model="domain_name"/> <el-input clearable autofocus v-model="domain_name"/>
</div>
<div v-else-if="active===2">
<div style="text-align: center;margin: 20px 0">
<h3>还差一步绑定成功</h3>
</div> </div>
<div v-else-if="active===2"> 请联系域名管理员前往 <strong>{{ domain_name }}</strong> 域名 DNS 管理后台添加如下 CNAME 记录
<el-table
:data="domain_tData"
border
stripe
style="width: 100%;margin-top: 20px">
<el-table-column
prop="type"
label="记录类型"
align="center"
width="100">
</el-table-column>
<el-table-column
prop="host"
align="center"
label="主机记录"
>
</el-table-column>
<el-table-column
prop="dns"
align="center"
label="记录值"
width="300">
</el-table-column>
</el-table>
<el-alert title="请在域名DNS配置成功后,点击“下一步”按钮"
style="margin-top: 30px"
type="warning"
:closable="false"
show-icon/>
</div>
<div v-else-if="active===3">
<div v-if="!bind_status">
<div style="text-align: center;margin: 20px 0"> <div style="text-align: center;margin: 20px 0">
<h3>还差一步绑定成功</h3> <el-link :underline="false" type="danger"
style="font-size: x-large">绑定失败
</el-link>
</div> </div>
请联系域名管理员前往 <strong>{{ domain_name }}</strong> 域名 DNS 管理后台添加如下 CNAME 记录
<el-table <p style="margin: 10px 0">您的账户正在绑定域名<strong>{{ domain_name }}</strong></p>
:data="domain_tData" <el-row>
border <el-col :span="16"><p>系统未检出到您的CNAME记录请检查您的配置</p></el-col>
stripe <el-col :span="6">
style="width: 100%;margin-top: 20px"> <el-button type="danger" size="small" plain style="margin-top: 8px"
<el-table-column @click="remove_domain">
prop="type" 解除绑定
label="记录类型" </el-button>
align="center" </el-col>
width="100"> </el-row>
</el-table-column>
<el-table-column
prop="host"
align="center"
label="主机记录"
>
</el-table-column>
<el-table-column
prop="dns"
align="center"
label="记录值"
width="300">
</el-table-column>
</el-table>
<el-alert title="请在域名DNS配置成功后,点击“下一步”按钮"
style="margin-top: 30px"
type="warning"
:closable="false"
show-icon/>
</div> </div>
<div v-else-if="active===3">
<div v-if="!bind_status">
<div style="text-align: center;margin: 20px 0">
<el-link :underline="false" type="danger"
style="font-size: x-large">绑定失败
</el-link>
</div>
<p style="margin: 10px 0">您的账户正在绑定域名<strong>{{ domain_name }}</strong></p> <div v-else>
<el-row> <div style="text-align: center;margin: 20px 0">
<el-col :span="16"><p>系统未检出到您的CNAME记录请检查您的配置</p></el-col> <el-link :underline="false" type="success"
<el-col :span="6"> style="font-size: x-large">绑定成功
<el-button type="danger" size="small" plain style="margin-top: 8px" </el-link>
@click="remove_domain">
解除绑定
</el-button>
</el-col>
</el-row>
</div> </div>
<div v-else> <el-row>
<div style="text-align: center;margin: 20px 0"> <el-col :span="16"><p>您的账户已绑定域名<strong>{{ domain_name }}</strong></p></el-col>
<el-link :underline="false" type="success" <el-col :span="6">
style="font-size: x-large">绑定成功 <el-button type="danger" size="small" plain style="margin-top: 8px"
</el-link> @click="remove_domain">
</div> 解除绑定
</el-button>
</el-col>
</el-row>
<el-row>
<el-col :span="16"><p>您的账户已绑定域名<strong>{{ domain_name }}</strong></p></el-col>
<el-col :span="6">
<el-button type="danger" size="small" plain style="margin-top: 8px"
@click="remove_domain">
解除绑定
</el-button>
</el-col>
</el-row>
</div>
<el-table
:data="domain_tData"
border
stripe
style="width: 100%;margin-top: 20px">
<el-table-column
prop="type"
label="记录类型"
align="center"
width="100">
</el-table-column>
<el-table-column
prop="host"
align="center"
label="主机记录"
>
</el-table-column>
<el-table-column
prop="dns"
align="center"
label="记录值"
width="300">
</el-table-column>
</el-table>
<div v-if="!bind_status" style="text-align: center;margin: 30px 0">
<el-button @click="check_cname" type="success" plain>已经修改配置再次检查绑定</el-button>
</div>
</div> </div>
<el-table
:data="domain_tData"
border
stripe
style="width: 100%;margin-top: 20px">
<el-table-column
prop="type"
label="记录类型"
align="center"
width="100">
</el-table-column>
<el-table-column
prop="host"
align="center"
label="主机记录"
>
</el-table-column>
<el-table-column
prop="dns"
align="center"
label="记录值"
width="300">
</el-table-column>
</el-table>
<div v-if="!bind_status" style="text-align: center;margin: 30px 0">
<el-button @click="check_cname" type="success" plain>已经修改配置再次检查绑定</el-button>
</div>
</div> </div>
</div>
<div v-if="active!==3" style="margin:40px 20px 0;text-align: right">
<el-button @click="last"
:disabled="bind_status|| active===1 ">上一步</el-button>
<el-button @click="next">下一步</el-button>
</div>
</div>
</div> </div>
<div v-if="active!==3" style="margin:40px 20px 0;text-align: right">
<el-button @click="last"
:disabled="bind_status|| active===1 ">上一步
</el-button>
<el-button @click="next">下一步</el-button>
</div>
</div>
</transition> </transition>
</template> </template>
<script> <script>
import {domainFun} from "@/restful"; import {domainFun} from "@/restful";
export default { export default {
name: 'BindDomain', name: 'BindDomain',
props: { props: {
@ -147,8 +149,8 @@
return { return {
active: 1, active: 1,
bind_status: false, bind_status: false,
bind_domain_sure:true, bind_domain_sure: true,
domain_name:'', domain_name: '',
domain_tData: [{'type': 'CNAME', 'host': 'xxx', 'dns': 'demo.xxx.cn'}], domain_tData: [{'type': 'CNAME', 'host': 'xxx', 'dns': 'demo.xxx.cn'}],
} }
}, },
@ -156,7 +158,7 @@
this.bind_click() this.bind_click()
}, },
beforeDestroy() { beforeDestroy() {
this.bind_domain_sure=false; this.bind_domain_sure = false;
}, },
methods: { methods: {
check_cname() { check_cname() {
@ -175,7 +177,7 @@
this.bind_status = false; this.bind_status = false;
this.$message.error("绑定失败 " + data.msg) this.$message.error("绑定失败 " + data.msg)
} }
}, {methods: 'PUT', data: {app_id:this.app_id}}) }, {methods: 'PUT', data: {app_id: this.app_id}})
}, },
remove_domain() { remove_domain() {
domainFun(data => { domainFun(data => {
@ -187,7 +189,7 @@
} else { } else {
this.$message.error("解除绑定失败 " + data.msg) this.$message.error("解除绑定失败 " + data.msg)
} }
}, {methods: 'DELETE', data: {app_id:this.app_id}}); }, {methods: 'DELETE', data: {app_id: this.app_id}});
}, },
bind_click() { bind_click() {
domainFun(data => { domainFun(data => {
@ -209,7 +211,7 @@
} else { } else {
this.$message.error("绑定失败 " + data.msg) this.$message.error("绑定失败 " + data.msg)
} }
}, {methods: 'GET', data: {app_id:this.app_id}}); }, {methods: 'GET', data: {app_id: this.app_id}});
}, },
format_domain_tData(cname_domain) { format_domain_tData(cname_domain) {
let domain_name_list = this.domain_name.split('.'); let domain_name_list = this.domain_name.split('.');
@ -233,7 +235,7 @@
} else { } else {
this.$message.error("绑定失败 " + data.msg) this.$message.error("绑定失败 " + data.msg)
} }
}, {methods: 'POST', data: {domain_name: this.domain_name,app_id:this.app_id}}) }, {methods: 'POST', data: {domain_name: this.domain_name, app_id: this.app_id}})
} else if (this.active === 2) { } else if (this.active === 2) {
this.check_cname() this.check_cname()
} }
@ -246,7 +248,7 @@
</script> </script>
<style scoped> <style scoped>
.dialog-footer{ .dialog-footer {
} }
</style> </style>

@ -160,7 +160,7 @@
<el-form-item label="下载域名"> <el-form-item label="下载域名">
<el-row :gutter="36"> <el-row :gutter="36">
<el-col :span="16"> <el-col :span="16">
<el-input v-model="userinfo.domain_name" :readonly="true" ref="domain_name" <el-input :value="userinfo.domain_name" :readonly="true" ref="domain_name"
prefix-icon="el-icon-download" prefix-icon="el-icon-download"
placeholder="下载页域名" clearable/> placeholder="下载页域名" clearable/>
</el-col> </el-col>

@ -137,6 +137,11 @@ class AppsSerializer(serializers.ModelSerializer):
def get_preview_url(self, obj): def get_preview_url(self, obj):
return get_redirect_server_domain(None, obj.user_id, get_app_domain_name(obj)) return get_redirect_server_domain(None, obj.user_id, get_app_domain_name(obj))
domain_name = serializers.SerializerMethodField()
def get_domain_name(self, obj):
return get_app_domain_name(obj)
sign_type_choice = serializers.SerializerMethodField() sign_type_choice = serializers.SerializerMethodField()
def get_sign_type_choice(self, obj): def get_sign_type_choice(self, obj):

Loading…
Cancel
Save