mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-19 15:30:25 +08:00
增加ip2region库管理
This commit is contained in:
39
web/views/@default/servers/components/ip-library/index.html
Normal file
39
web/views/@default/servers/components/ip-library/index.html
Normal file
@@ -0,0 +1,39 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<first-menu>
|
||||
<menu-item v-for="type in types" :href="'/servers/components/ip-library?type=' + type.code" :active="type.code == selectedType">{{type.name}}</menu-item>
|
||||
<span class="item">|</span>
|
||||
<a href="" class="item" @click.prevent="upload()">[上传]</a>
|
||||
</first-menu>
|
||||
|
||||
<p class="comment" v-if="libraries.length == 0">暂时还没有IP库。</p>
|
||||
<div v-if="libraries.length > 0">
|
||||
<div class="margin"></div>
|
||||
<table class="ui table selectable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文件名</th>
|
||||
<th>文件尺寸</th>
|
||||
<th>上传时间</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="library in libraries">
|
||||
<td>
|
||||
<span v-if="library.file != null">{{library.file.filename}}</span>
|
||||
<span v-else>-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="library.file != null">{{library.file.sizeMB}}MB</span>
|
||||
<span v-else>-</span>
|
||||
</td>
|
||||
<td>{{library.createdTime}}</td>
|
||||
<td>
|
||||
<a :href="'/servers/components/ip-library/download?libraryId=' + library.id" target="_blank">下载</a> <a href="" @click.prevent="deleteLibrary(library.id)">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
24
web/views/@default/servers/components/ip-library/index.js
Normal file
24
web/views/@default/servers/components/ip-library/index.js
Normal file
@@ -0,0 +1,24 @@
|
||||
Tea.context(function () {
|
||||
this.upload = function () {
|
||||
teaweb.popup("/servers/components/ip-library/uploadPopup", {
|
||||
callback: function () {
|
||||
teaweb.success("上传成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteLibrary = function (libraryId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除此IP库吗?", function () {
|
||||
that.$post(".delete")
|
||||
.params({
|
||||
"libraryId": libraryId
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,25 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>上传IP库</h3>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success" data-tea-timeout="120" data-tea-before="before" data-tea-done="done">
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>IP库类型 *</td>
|
||||
<td>
|
||||
<select name="type" class="ui dropdown auto-width" @change="changeType()" v-model="selectedTypeCode">
|
||||
<option v-for="type in types" :value="type.code">{{type.name}}</option>
|
||||
</select>
|
||||
<p class="comment">{{selectedTypeDescription}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">选择IP库文件 *</td>
|
||||
<td>
|
||||
<input type="file" name="file" :accept="selectedTypeExt"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn v-if="!isRequesting"></submit-btn>
|
||||
<button class="ui button disabled" type="button" v-if="isRequesting">上传中...</button>
|
||||
</form>
|
||||
@@ -0,0 +1,28 @@
|
||||
Tea.context(function () {
|
||||
this.isRequesting = false
|
||||
this.selectedTypeCode = this.types[0].code
|
||||
this.selectedTypeDescription = this.types[0].description
|
||||
this.selectedTypeExt = this.types[0].ext
|
||||
|
||||
this.success = NotifyPopup
|
||||
|
||||
this.before = function () {
|
||||
this.isRequesting = true
|
||||
}
|
||||
|
||||
this.done = function () {
|
||||
this.isRequesting = false
|
||||
}
|
||||
|
||||
this.changeType = function () {
|
||||
let that = this
|
||||
let selectedType = this.types.$find(function (k, v) {
|
||||
return v.code == that.selectedTypeCode
|
||||
})
|
||||
if (selectedType == null) {
|
||||
return
|
||||
}
|
||||
this.selectedTypeDescription = selectedType.description
|
||||
this.selectedTypeExt = selectedType.ext
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user