前端页面
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!-- 左侧菜单由 Go Backend 自动生成注入,此处加首行子菜单使其符合标准平台样式 -->
|
||||
<first-menu>
|
||||
<menu-item href="/httpdns/sandbox" code="index">API 在线沙盒</menu-item>
|
||||
<menu-item href="/httpdns/sandbox" code="index">解析测试</menu-item>
|
||||
</first-menu>
|
||||
@@ -1,24 +1,6 @@
|
||||
{$layout}
|
||||
{$template "menu"}
|
||||
<style>
|
||||
.httpdns-sdns-row {
|
||||
display: flex;
|
||||
gap: .5em;
|
||||
align-items: center;
|
||||
margin-bottom: .45em;
|
||||
}
|
||||
.httpdns-sdns-row .field {
|
||||
margin: 0 !important;
|
||||
flex: 1;
|
||||
}
|
||||
.httpdns-sdns-actions {
|
||||
margin-top: .2em;
|
||||
}
|
||||
.httpdns-sdns-actions .count {
|
||||
color: #8f9aa6;
|
||||
margin-left: .4em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="ui margin"></div>
|
||||
|
||||
<div>
|
||||
<div class="ui grid stackable">
|
||||
@@ -52,24 +34,6 @@
|
||||
@click.prevent="request.qtype='AAAA'" type="button">AAAA</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>SDNS 参数</label>
|
||||
<div class="httpdns-sdns-row" v-for="(param, index) in sdnsParams">
|
||||
<div class="field">
|
||||
<input type="text" maxlength="64" placeholder="参数名称" v-model="param.name" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="text" maxlength="64" placeholder="参数值" v-model="param.value" />
|
||||
</div>
|
||||
<a href="" @click.prevent="removeSDNSParam(index)" title="删除"><i class="icon trash alternate outline"></i></a>
|
||||
</div>
|
||||
<div class="httpdns-sdns-actions">
|
||||
<a href="" @click.prevent="addSDNSParam" :class="{disabled: sdnsParams.length >= 10}">
|
||||
<i class="icon plus circle"></i>添加参数
|
||||
</a>
|
||||
<span class="count">{{sdnsParams.length}}/10</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui divider"></div>
|
||||
|
||||
@@ -123,7 +87,8 @@
|
||||
<div class="column">
|
||||
<div class="ui segment">
|
||||
<div class="grey">客户端 IP</div>
|
||||
<div style="margin-top:.4em;"><code>{{response.data.client_ip || request.clientIp || '-'}}</code></div>
|
||||
<div style="margin-top:.4em;">
|
||||
<code>{{response.data.client_ip || request.clientIp || '-'}}</code></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
@@ -155,7 +120,8 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(row, idx) in response.resultRows">
|
||||
<td v-if="idx === 0" :rowspan="response.resultRows.length">{{row.domain || request.domain}}</td>
|
||||
<td v-if="idx === 0" :rowspan="response.resultRows.length">{{row.domain ||
|
||||
request.domain}}</td>
|
||||
<td>{{row.type || request.qtype}}</td>
|
||||
<td><code>{{row.ip}}</code></td>
|
||||
<td>{{row.ttl}}s</td>
|
||||
@@ -168,4 +134,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -9,7 +9,6 @@ Tea.context(function () {
|
||||
}
|
||||
|
||||
this.request = this.newRequest()
|
||||
this.sdnsParams = [{name: "", value: ""}]
|
||||
|
||||
this.response = {
|
||||
hasResult: false,
|
||||
@@ -26,39 +25,6 @@ Tea.context(function () {
|
||||
this.apps = []
|
||||
}
|
||||
|
||||
this.addSDNSParam = function () {
|
||||
if (this.sdnsParams.length >= 10) {
|
||||
return
|
||||
}
|
||||
this.sdnsParams.push({name: "", value: ""})
|
||||
}
|
||||
|
||||
this.removeSDNSParam = function (index) {
|
||||
if (index < 0 || index >= this.sdnsParams.length) {
|
||||
return
|
||||
}
|
||||
this.sdnsParams.splice(index, 1)
|
||||
if (this.sdnsParams.length == 0) {
|
||||
this.sdnsParams.push({name: "", value: ""})
|
||||
}
|
||||
}
|
||||
|
||||
this.cleanSDNSParams = function () {
|
||||
let list = []
|
||||
this.sdnsParams.forEach(function (item) {
|
||||
let name = (item.name || "").trim()
|
||||
let value = (item.value || "").trim()
|
||||
if (name.length == 0 && value.length == 0) {
|
||||
return
|
||||
}
|
||||
list.push({
|
||||
name: name,
|
||||
value: value
|
||||
})
|
||||
})
|
||||
return list
|
||||
}
|
||||
|
||||
this.normalizeResultRows = function (data) {
|
||||
if (typeof data == "undefined" || data == null) {
|
||||
return []
|
||||
@@ -106,7 +72,6 @@ Tea.context(function () {
|
||||
this.response.hasResult = false
|
||||
|
||||
let payload = Object.assign({}, this.request)
|
||||
payload.sdnsParamsJSON = JSON.stringify(this.cleanSDNSParams())
|
||||
|
||||
this.$post("/httpdns/sandbox/test")
|
||||
.params(payload)
|
||||
@@ -122,7 +87,6 @@ Tea.context(function () {
|
||||
|
||||
this.resetForm = function () {
|
||||
this.request = this.newRequest()
|
||||
this.sdnsParams = [{name: "", value: ""}]
|
||||
this.response = {
|
||||
hasResult: false,
|
||||
code: -1,
|
||||
|
||||
Reference in New Issue
Block a user