rules_to_clear.html 3.0 KB
Newer Older
H
hjdhnx 已提交
1 2 3 4
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
H
hjdhnx 已提交
5
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
H
hjdhnx 已提交
6 7 8 9
    <meta http-equiv="Cache-Control" content="no-siteapp;no-transform">
    <meta name="applicable-device" content="pc,mobile">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
H
hjdhnx 已提交
10
    <title>删除已缓存规则列表-{{rules.count}}</title>
H
hjdhnx 已提交
11
    <script src="/static/js/jquery.min.js"></script>
H
hjdhnx 已提交
12
    <script src="/static/js/grey.js"></script>
H
hjdhnx 已提交
13 14 15 16 17 18 19 20 21 22
</head>
<style>
    .red {
        color:red;
        font-weight: bold
    }
    .yellow {
        color:yellow;
        font-weight: bold
    }
H
hjdhnx 已提交
23 24 25 26
    .yellow a{
        width: 100px;
        color: #ea7d7d;
    }
H
hjdhnx 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
    .refresh{

    }
</style>
<body>
<script>
    $(document).ready(function(){
        $(".refresh").click(function(){
            // location.reload();
            let rule = this.innerText.trim();
            let code = $.ajax({url:"/clear?rule="+rule,async:false}).responseText;
            code = typeof(code) === "object"?code:JSON.parse(code);
            if(code.code === 200){
                alert(code.msg);
                location.reload()
            }

        });
45 46 47 48

        $(".cls").click(function(){
            let cls = this.innerText.trim();
            if(confirm('确认清除规则'+cls+'缓存的分类?')){
H
hjdhnx 已提交
49
                let code = $.ajax({url:"/cls/clear/"+cls,async:false}).responseText;
50 51 52 53 54 55 56 57 58
            code = typeof(code) === "object"?code:JSON.parse(code);
                if(code.code === 200){
                    alert('操作成功!\n'+code.msg);
                    location.reload()
                }else{
                    alert('操作失败!\n'+code.msg);
                }
            }
        });
H
hjdhnx 已提交
59 60 61
});

</script>
H
hjdhnx 已提交
62
<h1>缓存规则列表-{{rules.count}}</h1>
H
hjdhnx 已提交
63 64 65 66 67 68 69 70 71 72
{% if rules.count < 1 %}
<h3>暂无已缓存的规则</h3>
{% endif %}

{% for rule in rules.list %}

    	{% if rule|length > 2 %}
        <!-- | 为过滤条件 -->
        	<li class="red">
<!--                <a class="refresh" href="/clear?rule={{rule}}" target="_blank">{{ rule }}</a>-->
H
hjdhnx 已提交
73
                <a class="refresh" href="javascript:void(0);">{{ rule.name }}</a>
H
hjdhnx 已提交
74 75 76 77 78
            </li>

        {% else %}
         <!-- 如果是if条件,最后必须要有else,否则就会报错 -->
            <li class="yellow">
H
hjdhnx 已提交
79
                <a class="refresh" href="javascript:void(0);" target="_blank">{{ rule.name }}</a>
H
hjdhnx 已提交
80 81 82 83 84
            </li>

        {% endif %}
      	<!-- if条件必须有endif,否则会报错 -->

85 86
 {% endfor %}

H
hjdhnx 已提交
87
<h1>缓存分类列表-{{classes|length}}</h1>
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
{% if classes|length < 1 %}
<h3>暂无已缓存的分类</h3>
{% endif %}
{% for cls in classes %}
    {% if cls|length > 2 %}
        <li class="red">
            <a class="cls" href="javascript:void(0);">{{ cls }}</a>
        </li>

    {% else %}
        <li class="yellow">
            <a class="cls" href="javascript:void(0);">{{ cls }}</a>
        </li>

    {% endif %}
 {% endfor %}
H
hjdhnx 已提交
104 105 106
</body>

</html>