123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8" />
- <title>欢迎页面-X-admin2.0</title>
-
- <link rel="stylesheet" href="./static/css/font.css">
- <link rel="stylesheet" href="./static/css/xadmin.css">
- <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
- <script src="./static/lib/layui/layui.js" charset="utf-8"></script>
- <script type="text/javascript" src="./static/js/xadmin.js"></script>
- </head>
- <body>
- <input type="text" id="token" value={{.token}} hidden=true>
- <input id="ip" name="ip" placeholder="IP" type="text" lay-verify="required" class="layui-input">
- <br>
- <input class="layui-btn" type="button" onclick="addBanIP()" value=新增>
- <br>
- <br>
- <table class="radio-table" border="1">
- <thead>
- <th style="width:128px;">IP</th>
- <th style="width:128px;">操作</th>
- </thead>
- <tbody>
- {{range .ipList}}
- <tr>
- <td style = "text-align:center;">{{.IP}}</td>
- <td style = "text-align:center;">
- <input class="layui-btn" type="button" onclick="submitDelete({{.IP}})" value=删除>
- </td>
- </tr>
- {{end}}
- </tbody>
- </table>
- <script language="JavaScript">
- function addBanIP () {
- var token = document.getElementById("token").value;
- var ip = document.getElementById("ip").value;
- var text = "token=" + encodeURI(token);
- text += "&ip=" + encodeURI(ip);
-
- $.ajax({
- type:"post",
- url:"/banip?" + text,
- success:function (data) {
- // alert(data.status);
- if (data.status){
- window.location.href="/banip";
- }else{
- if (data.info){
- alert(data.info);
- }else{
- window.location.href="/accountlogin";
- }
- }
- }
- });
- }
-
- function submitDelete(ip) {
- var token = document.getElementById("token").value;
-
- var text = "token=" + encodeURI(token);
- text += "&ip=" + encodeURI(ip);
-
- $.ajax({
- type:"delete",
- url:"/banip?" + text,
- success:function (data) {
- // alert(data.status);
- if (data.status){
- window.location.href="/banip";
- }else{
- if (data.info){
- alert(data.info);
- }else{
- window.location.href="/accountlogin";
- }
- }
- }
- });
- }
- </script>
- </body>
- </html>
|