增加国家/地区封禁管理

This commit is contained in:
刘祥超
2020-11-06 11:02:26 +08:00
parent 7edd234d46
commit d8cb7e15d4
15 changed files with 301 additions and 24 deletions

View File

@@ -1,8 +0,0 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "waf_menu"}
<p class="ui message">此功能暂未开放,敬请期待。</p>
</div>

View File

@@ -0,0 +1,5 @@
<second-menu style="margin-top:-1em">
<menu-item :href="'/servers/components/waf/ipadmin?firewallPolicyId=' + firewallPolicyId" :active="subMenuItem == 'region'">国家/地区封禁</menu-item>
<menu-item :href="'/servers/components/waf/ipadmin/provinces?firewallPolicyId=' + firewallPolicyId" :active="subMenuItem == 'province'">省份封禁</menu-item>
<menu-item :href="'/servers/components/waf/ipadmin/lists?firewallPolicyId=' + firewallPolicyId" :active="subMenuItem == 'list'">IP名单</menu-item>
</second-menu>

View File

@@ -0,0 +1,16 @@
.region-letter-group .item {
padding-left: 1em !important;
padding-right: 1em !important;
}
.country-group {
padding-bottom: 1em;
}
.country-group .country-list .item {
float: left;
width: 12em;
margin-bottom: 0.5em;
}
.country-group .country-list .item .checkbox label {
font-size: 12px !important;
}
/*# sourceMappingURL=index.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA,oBACC;EACC,4BAAA;EACA,6BAAA;;AAIF;EAaC,mBAAA;;AAbD,cACC,cACC;EACC,WAAA;EACA,WAAA;EACA,oBAAA;;AALH,cACC,cACC,MAKC,UAAU;EACT,0BAAA","file":"index.css"}

View File

@@ -0,0 +1,51 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../waf_menu"}
{$template "menu"}
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="firewallPolicyId" :value="firewallPolicyId"/>
<table class="ui table selectable definition">
<tr>
<td class="title">已封禁</td>
<td>
<div class="ui label tiny" v-for="country in countries" v-if="country.isChecked" style="margin-bottom: 0.5em">
<input type="hidden" name="countryIds" :value="country.id"/>
({{country.letter}}){{country.name}} <a href="" @click.prevent="deselectCountry(country)" title="取消封禁"><i class="icon remove"></i></a>
</div>
</td>
</tr>
<tr>
<td>选择封禁区域</td>
<td>
<div class="ui menu tabular tiny region-letter-group">
<a href="" v-for="group in letterGroups" class="item" :class="{active: group == selectedGroup}" @click.prevent="selectGroup(group)">{{group}}</a>
<div class="item right">
<div class="ui checkbox" @click.prevent="checkAll">
<input type="checkbox" v-model="isCheckingAll"/>
<label>全选</label>
</div>
</div>
</div>
<div v-for="group in letterGroups">
<div v-for="letter in group" v-if="letterCountries[letter] != null && group == selectedGroup" class="country-group">
<h4>{{letter}}</h4>
<div class="country-list">
<div class="item" v-for="country in letterCountries[letter]">
<div class="ui checkbox" @click.prevent="selectCountry(country)">
<input type="checkbox" v-model="country.isChecked"/>
<label>{{country.name}}</label>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,40 @@
Tea.context(function () {
this.letterGroups = [
"ABC", "DEF", "GHI", "JKL", "MNO", "PQR", "STU", "VWX", "YZ"
];
this.selectedGroup = "ABC"
this.selectedCountries = []
this.letterCountries = {}
let that = this
this.countries.forEach(function (country) {
if (typeof (that.letterCountries[country.letter]) == "undefined") {
that.letterCountries[country.letter] = []
}
that.letterCountries[country.letter].push(country)
})
this.isCheckingAll = false
this.selectGroup = function (group) {
this.selectedGroup = group
}
this.selectCountry = function (country) {
country.isChecked = !country.isChecked
}
this.deselectCountry = function (country) {
country.isChecked = false
}
this.checkAll = function () {
this.isCheckingAll = !this.isCheckingAll
this.countries.forEach(function (country) {
country.isChecked = that.isCheckingAll
})
}
this.success = function () {
teaweb.successToast("保存成功")
}
})

View File

@@ -0,0 +1,22 @@
.region-letter-group {
.item {
padding-left: 1em !important;
padding-right: 1em !important;
}
}
.country-group {
.country-list {
.item {
float: left;
width: 12em;
margin-bottom: 0.5em;
.checkbox label {
font-size: 12px !important;
}
}
}
padding-bottom: 1em;
}

View File

@@ -0,0 +1,7 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../waf_menu"}
{$template "menu"}
</div>

View File

@@ -0,0 +1,7 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../waf_menu"}
{$template "menu"}
</div>