增加DNS服务商账号管理

This commit is contained in:
刘祥超
2020-11-11 21:32:19 +08:00
parent 1037b83742
commit a697ec65ac
15 changed files with 464 additions and 3 deletions

View File

@@ -0,0 +1,46 @@
{$layout "layout_popup"}
<h3>添加DNS服务商账号</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr>
<td class="title">账号说明 *</td>
<td>
<input type="text" name="name" maxlength="50" ref="focus"/>
<p class="comment">用来方便区分不同的账号。</p>
</td>
</tr>
<tr>
<td>服务商厂家 *</td>
<td>
<select class="ui dropdown auto-width" name="type" v-model="type">
<option value="">[请选择]</option>
<option v-for="type in types" :value="type.code">{{type.name}}</option>
</select>
<p class="comment">创建后无法修改此选项。</p>
</td>
</tr>
<tr>
<td colspan="2">API参数</td>
</tr>
<!-- DNSPod -->
<tbody v-if="type == 'dnspod'">
<tr>
<td>密钥ID *</td>
<td>
<input type="text" name="paramId" maxlength="100"/>
</td>
</tr>
<tr>
<td>密钥Token *</td>
<td>
<input type="text" name="paramToken" maxlength="100"/>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,4 @@
Tea.context(function () {
this.success = NotifyPopup
this.type = ""
})

View File

@@ -1,3 +1,33 @@
{$layout}
<p class="ui message">此功能暂未开放,敬请期待。</p>
<first-menu>
<a href="" class="item" @click.prevent="createProvider()">[添加DNS账号信息]</a>
</first-menu>
<p class="comment" v-if="providers.length == 0">暂时还没有第三方DNS服务商。</p>
<table class="ui table selectable" v-if="providers.length > 0">
<thead>
<tr>
<th>账号说明</th>
<th>服务商</th>
<th>可用线路</th>
<th>最近更新时间</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="provider in providers">
<td>{{provider.name}}</td>
<td>{{provider.typeName}}</td>
<td></td>
<td>
<span v-if="provider.dataUpdatedTime.length > 0">{{provider.dataUpdatedTime}}</span>
<span v-else class="disabled">-</span>
</td>
<td>
<a href="" @click.prevent="updateProvider(provider.id)">修改</a> &nbsp; <a href="" @click.prevent="deleteProvider(provider.id)">删除</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,34 @@
Tea.context(function () {
this.createProvider = function () {
teaweb.popup(Tea.url(".createPopup"), {
height: "26em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.updateProvider = function (providerId) {
teaweb.popup(Tea.url(".updatePopup?providerId=" + providerId), {
height: "26em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.deleteProvider = function (providerId) {
let that = this
teaweb.confirm("确定要删除这个DNS服务商账号吗", function () {
that.$post(".delete")
.params({
providerId: providerId
})
.refresh()
})
}
})

View File

@@ -0,0 +1,45 @@
{$layout "layout_popup"}
<h3>修改DNS服务商账号</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="providerId" :value="provider.id"/>
<input type="hidden" name="type" :value="provider.type"/>
<table class="ui table definition selectable">
<tr>
<td class="title">账号说明 *</td>
<td>
<input type="text" name="name" maxlength="50" ref="focus" v-model="provider.name"/>
<p class="comment">用来方便区分不同的账号。</p>
</td>
</tr>
<tr>
<td>服务商厂家 *</td>
<td>
{{provider.typeName}}
<p class="comment">创建后无法修改此选项。</p>
</td>
</tr>
<tr>
<td colspan="2">API参数</td>
</tr>
<!-- DNSPod -->
<tbody v-if="provider.type == 'dnspod'">
<tr>
<td>密钥ID *</td>
<td>
<input type="text" name="paramId" maxlength="100" :value="provider.params.id"/>
</td>
</tr>
<tr>
<td>密钥Token *</td>
<td>
<input type="text" name="paramToken" maxlength="100" :value="provider.params.token"/>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyPopup
})