简化IP名单中创建IP操作/支持IP以CIDR方式显示

This commit is contained in:
GoEdgeLab
2024-04-13 16:45:32 +08:00
parent 34bd39100b
commit e33eeb9018
30 changed files with 229 additions and 537 deletions

View File

@@ -22,38 +22,11 @@
</td>
</tr>
<!-- IPv4 -->
<tbody v-if="type == 'ipv4'">
<tbody v-if="type != 'all'">
<tr>
<td>开始IP *</td>
<td>IP或IP段 *</td>
<td>
<input type="text" name="ipFrom" maxlength="64" placeholder="x.x.x.x" ref="focus" v-model="item.ipFrom"/>
</td>
</tr>
<tr>
<td>结束IP</td>
<td>
<input type="text" name="ipTo" maxlength="64" placeholder="x.x.x.x" v-model="item.ipTo"/>
<p class="comment">只有表示IP段的时候才需要填写此项。</p>
</td>
</tr>
</tbody>
<!-- IPv6 -->
<tbody v-if="type == 'ipv6'">
<tr>
<td>开始IP *</td>
<td>
<input type="text" name="ipFrom" maxlength="64" placeholder="x:x:x:x:x:x:x:x" ref="focus" v-model="item.ipFrom"/>
<p class="comment">IPv6地址比如 1406:3c00:0:2409:13:58:103:15</p>
</td>
</tr>
<tr>
<td>结束IP</td>
<td>
<input type="text" name="ipTo" maxlength="64" placeholder="x:x:x:x:x:x:x:x" ref="focus" v-model="item.ipTo"/>
<p class="comment">只有表示IP段的时候才需要填写此项。</p>
<input type="text" name="value" maxlength="64" placeholder="x.x.x.x" ref="focus" v-model="item.value" style="width: 20em"/>
</td>
</tr>
</tbody>

View File

@@ -21,37 +21,11 @@
</td>
</tr>
<!-- IPv4 -->
<tbody v-if="type == 'ipv4'">
<tbody v-if="type != 'all'">
<tr>
<td>开始IP *</td>
<td>IP或IP段 *</td>
<td>
<input type="text" name="ipFrom" maxlength="64" placeholder="x.x.x.x" ref="focus" v-model="item.ipFrom"/>
</td>
</tr>
<tr>
<td>结束IP</td>
<td>
<input type="text" name="ipTo" maxlength="64" placeholder="x.x.x.x" v-model="item.ipTo"/>
<p class="comment">只有表示IP段的时候才需要填写此项。</p>
</td>
</tr>
</tbody>
<!-- IPv6 -->
<tbody v-if="type == 'ipv6'">
<tr>
<td>开始IP *</td>
<td>
<input type="text" name="ipFrom" maxlength="64" placeholder="x:x:x:x:x:x:x:x" ref="focus" v-model="item.ipFrom"/>
<p class="comment">IPv6地址比如 1406:3c00:0:2409:13:58:103:15</p>
</td>
</tr>
<tr>
<td>结束IP</td>
<td>
<input type="text" name="ipTo" maxlength="64" placeholder="x:x:x:x:x:x:x:x" ref="focus" v-model="item.ipTo"/>
<p class="comment">只有表示IP段的时候才需要填写此项。</p>
<input type="text" name="value" maxlength="64" placeholder="x.x.x.x" ref="focus" v-model="item.value" style="width: 20em"/>
</td>
</tr>
</tbody>

View File

@@ -11,12 +11,10 @@
<td class="title">类型 *</td>
<td>
<select class="ui dropdown auto-width" name="type" v-model="type">
<option value="ipv4">IPv4</option>
<option value="ipv6">IPv6</option>
<option value="ip">单IP或IP段</option>
<option value="all">所有IP</option>
</select>
<p class="comment" v-if="type == 'ipv4'">单个IPv4或一个IPv4范围。</p>
<p class="comment" v-if="type == 'ipv6'">单个IPv6或一个IPv6范围。</p>
<p class="comment" v-if="type == 'ip'">单个IP或一个IP范围。</p>
<p class="comment" v-if="type == 'all'">允许或禁用所有的IP。</p>
</td>
</tr>
@@ -30,60 +28,23 @@
</tr>
<!-- 单个添加 -->
<!-- IPv4 -->
<tbody v-if="method == 'single' && type == 'ipv4'">
<tbody v-if="method == 'single' && type == 'ip'">
<tr>
<td>开始IP *</td>
<td>IP或IP段 *</td>
<td>
<input type="text" name="ipFrom" maxlength="64" placeholder="x.x.x.x" ref="focus" style="width: 10em"/>
</td>
</tr>
<tr>
<td>结束IP</td>
<td>
<input type="text" name="ipTo" maxlength="64" placeholder="x.x.x.x" style="width: 10em"/>
<p class="comment">只有表示IP段的时候才需要填写此项。</p>
</td>
</tr>
</tbody>
<!-- IPv6 -->
<tbody v-if="method == 'single' && type == 'ipv6'">
<tr>
<td>开始IP *</td>
<td>
<input type="text" name="ipFrom" maxlength="64" placeholder="x:x:x:x:x:x:x:x" ref="focus" style="width: 20em"/>
<p class="comment">IPv6地址比如 1406:3c00:0:2409:13:58:103:15</p>
</td>
</tr>
<tr>
<td>结束IP</td>
<td>
<input type="text" name="ipTo" maxlength="64" placeholder="x:x:x:x:x:x:x:x" ref="focus" style="width: 20em"/>
<p class="comment">只有表示IP段的时候才需要填写此项。</p>
<input type="text" name="value" maxlength="64" placeholder="x.x.x.x" ref="focus" style="width: 20em"/>
<p class="comment">支持IPv4和IPv6支持三种格式单个IP比如192.168.1.100、IP范围比如192.168.1.1-192.168.1.255、CIDR比如192.168.1.1/24</p>
</td>
</tr>
</tbody>
<!-- 批量添加 -->
<!-- IPv4 -->
<tbody v-if="method == 'batch' && type == 'ipv4'">
<tbody v-if="method == 'batch' && type == 'ip'">
<tr>
<td>IP列表</td>
<td>
<textarea name="ipData" style="width: 20em" :placeholder="'x.x.x.x' + '\n'+ 'x.x.x.x/24' + '\n' + 'x.x.x.x-y.y.y.y'" rows="3"></textarea>
<p class="comment">每行一个IP支持三种格式<code-label :class="'grey'">192.168.1.1</code-label><code-label :class="'grey'">192.168.1.1/24</code-label><code-label :class="'grey'">192.168.1.1-192.168.1.255</code-label></p>
</td>
</tr>
</tbody>
<!-- IPv6 -->
<tbody v-if="method == 'batch' && type == 'ipv6'">
<tr>
<td>IP列表</td>
<td>
<textarea name="ipData" style="width: 20em" :placeholder="'x:x:x:x:x:x:x:x'" rows="3"></textarea>
<p class="comment">每行一个IP。</p>
<textarea name="ipData" style="width: 20em" :placeholder="'x.x.x.x' + '\n' + 'x.x.x.x/24' + '\n' + 'x.x.x.x-y.y.y.y'" rows="3"></textarea>
<p class="comment">每行一个IP支持三种格式<code-label :class="'grey'">192.168.1.100</code-label><code-label :class="'grey'">192.168.1.1-192.168.1.255</code-label><code-label :class="'grey'">192.168.1.1/24</code-label></p>
</td>
</tr>
</tbody>

View File

@@ -1,5 +1,5 @@
Tea.context(function () {
this.type = "ipv4"
this.type = "ip"
this.eventLevel = (this.listType == "white") ? "debug" : "critical"
this.method = "single"
})

View File

@@ -7,7 +7,7 @@
<table class="ui table definition selectable">
<tr>
<td class="title">说明</td>
<td>导出所有的IP</td>
<td>导出所有的IP并以文件格式下载。注意v1.3.5版本及以后导出的数据不能在之前的版本中导入。</td>
</tr>
<tr>
<td>格式</td>

View File

@@ -21,7 +21,7 @@
<div v-if="result.isFound">
<div v-if="result.item != null">
<div v-if="result.isAllowed">
<span class="green">在白名单中 <ip-item-text :v-item="result.item"></ip-item-text>&nbsp;<a href="" @click.prevent="updateItem(result.list.id, result.item.id)" title="查看和修改"><i class="icon pencil small"></i></a></span>
<span class="green">在白名单中 <ip-item-text :v-item="result.item"></ip-item-text>&nbsp;<a href="" @click.prevent="updateItem(result.item.id)" title="查看和修改"><i class="icon pencil small"></i></a></span>
</div>
<div v-else>
<span class="red">在黑名单中 <ip-item-text :v-item="result.item"></ip-item-text>&nbsp;<a href="" @click.prevent="updateItem(result.item.id)" title="查看和修改"><i class="icon pencil small"></i></a></span>

View File

@@ -21,37 +21,11 @@
</td>
</tr>
<!-- IPv4 -->
<tbody v-if="type == 'ipv4'">
<tbody v-if="type != 'all'">
<tr>
<td>开始IP *</td>
<td>IP或IP段 *</td>
<td>
<input type="text" name="ipFrom" maxlength="64" placeholder="x.x.x.x" ref="focus" v-model="item.ipFrom"/>
</td>
</tr>
<tr>
<td>结束IP</td>
<td>
<input type="text" name="ipTo" maxlength="64" placeholder="x.x.x.x" v-model="item.ipTo"/>
<p class="comment">只有表示IP段的时候才需要填写此项。</p>
</td>
</tr>
</tbody>
<!-- IPv6 -->
<tbody v-if="type == 'ipv6'">
<tr>
<td>开始IP *</td>
<td>
<input type="text" name="ipFrom" maxlength="64" placeholder="x:x:x:x:x:x:x:x" ref="focus" v-model="item.ipFrom"/>
<p class="comment">IPv6地址比如 1406:3c00:0:2409:13:58:103:15</p>
</td>
</tr>
<tr>
<td>结束IP</td>
<td>
<input type="text" name="ipTo" maxlength="64" placeholder="x:x:x:x:x:x:x:x" ref="focus" v-model="item.ipTo"/>
<p class="comment">只有表示IP段的时候才需要填写此项。</p>
<input type="text" name="value" maxlength="64" placeholder="x.x.x.x" ref="focus" v-model="item.value" style="width: 20em"/>
</td>
</tr>
</tbody>

View File

@@ -22,36 +22,11 @@
</tr>
<!-- IPv4 -->
<tbody v-if="type == 'ipv4'">
<tbody v-if="type != 'all'">
<tr>
<td>开始IP *</td>
<td>IP或IP段 *</td>
<td>
<input type="text" name="ipFrom" maxlength="64" placeholder="x.x.x.x" ref="focus" v-model="item.ipFrom"/>
</td>
</tr>
<tr>
<td>结束IP</td>
<td>
<input type="text" name="ipTo" maxlength="64" placeholder="x.x.x.x" v-model="item.ipTo"/>
<p class="comment">只有表示IP段的时候才需要填写此项。</p>
</td>
</tr>
</tbody>
<!-- IPv6 -->
<tbody v-if="type == 'ipv6'">
<tr>
<td>开始IP *</td>
<td>
<input type="text" name="ipFrom" maxlength="64" placeholder="x:x:x:x:x:x:x:x" ref="focus" v-model="item.ipFrom"/>
<p class="comment">IPv6地址比如 1406:3c00:0:2409:13:58:103:15</p>
</td>
</tr>
<tr>
<td>结束IP</td>
<td>
<input type="text" name="ipTo" maxlength="64" placeholder="x:x:x:x:x:x:x:x" ref="focus" v-model="item.ipTo"/>
<p class="comment">只有表示IP段的时候才需要填写此项。</p>
<input type="text" name="value" maxlength="64" placeholder="x.x.x.x" ref="focus" v-model="item.value" style="width: 20em"/>
</td>
</tr>
</tbody>