IPBox增加地域、ISP、添加到黑名单等功能

This commit is contained in:
刘祥超
2021-08-15 15:42:05 +08:00
parent 82646c3576
commit 7f04f1ed62
11 changed files with 192 additions and 11 deletions

View File

@@ -0,0 +1,9 @@
.cell-title {
background: rgba(0, 0, 0, 0.03);
font-weight: bold;
width: 7em;
}
.cell-content {
width: 22%;
}
/*# sourceMappingURL=index.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACC,+BAAA;EACA,iBAAA;EACA,UAAA;;AAGD;EACC,UAAA","file":"index.css"}

View File

@@ -1,6 +1,44 @@
{$layout "layout_popup"}
<h3>最近访问日志<span class="grey">{{ip}}</span></h3>
<h3>IP最近访问日志<span class="grey"><span>{{ip}}</span></span></h3>
<table class="ui table definition celled selectable">
<tr>
<td class="cell-title">IP</td>
<td class="cell-content">
<span id="ip-text">{{ip}}</span>
<copy-to-clipboard :v-target="'ip-text'"></copy-to-clipboard>
</td>
<td class="cell-title">区域</td>
<td class="cell-content">
<span v-if="regions.length > 0">{{regions}}</span>
<span v-else class="disabled">-</span>
</td>
<td class="cell-title">ISP</td>
<td>
<span v-if="isp.length > 0">{{isp}}</span>
<span v-else class="disabled">-</span>
</td>
</tr>
<tr v-if="publicBlackIPLists.length > 0">
<td>所在IP名单</td>
<td colspan="5">
<div class="ui label basic small" v-for="ipList in ipLists">
{{ipList.name}}
</div>
&nbsp; &nbsp;
<a href="" @click.prevent="showBlackLists"><i class="icon angle" :class="{up: blackListsVisible, down: !blackListsVisible}"></i>添加黑名单</a>
</td>
</tr>
<tr v-if="publicBlackIPLists.length > 0 && blackListsVisible">
<td>加入黑名单</td>
<td colspan="5">
<a class="ui label basic small" v-for="ipList in publicBlackIPLists" @click.prevent="addBlackIP(ipList)">
{{ipList.name}}
</a>
</td>
</tr>
</table>
<p class="comment" v-if="accessLogs.length == 0">暂时还没有访问日志。</p>
<table class="ui table selectable" v-if="accessLogs.length > 0">

View File

@@ -0,0 +1,30 @@
Tea.context(function () {
this.blackListsVisible = false
this.allPublicBlackIPLists = this.publicBlackIPLists.$copy()
this.showBlackLists = function () {
let that = this
this.publicBlackIPLists = this.allPublicBlackIPLists.filter(function (allList) {
let found = true
that.ipLists.forEach(function (list) {
if (allList.id == list.id) {
found = false
}
})
return found
})
this.blackListsVisible = !this.blackListsVisible
}
this.addBlackIP = function (list) {
this.$post(".addIP")
.params({
listId: list.id,
ip: this.ip
})
.success(function () {
this.ipLists.push(list)
this.blackListsVisible = false
})
}
})

View File

@@ -0,0 +1,9 @@
.cell-title {
background: rgba(0, 0, 0, 0.03);
font-weight: bold;
width: 7em;
}
.cell-content {
width: 22%;
}