地质所 沉降监测网建设项目
chenhuan
2024-05-16 0fdd42e318f51f9e3c6581473416af1cca69877f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="zh">
<head>
    <th:block th:include="include :: header('文章模板列表')" />
</head>
<body class="gray-bg">
    <div id="main" class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div id="c1" class="col-sm-4">
               
 
            </div>
            <div  id="c2" class="col-sm-4">
 
            </div>
            <div  id="c3" class="col-sm-4">
 
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
 
    <script type="text/javascript">
        var prefix = ctx + "cms/articleTemplate";
        var pageNum=1;
        var url = prefix + "/list";
        var totalPages;
        function selectMinColumn(){
            var h1=$("#c1").height();
            var h2=$("#c2").height();
            var h3=$("#c3").height();
            var arr=[];
            arr.push(h1);
            arr.push(h2);
            arr.push(h3);
            var minData= arr[0];
            var index=0;
            for (var i = 0; i < arr.length; i++) {
                if (arr[i]<minData) {
                    minData = arr[i];  // 最小值
                    index=i;
                }
            }
            return "c"+(index+1);//返回高度最小的元素id
 
        }
        function initList(){
            $.ajax({
                url: url+"?pageNum="+pageNum,
                type: "post",
                dataType: "json",
                data: null,
                success: function(json) {
                    if(json.code!=0&&json.code!='0'){
                        $.modal.alertWarning(json.msg);
                    }else{
                        totalPages=(json.total+9)/10;
                        var data=json.rows;
                        $.each(data,function(i,v){
                            var html="";
                            html+=" <div class=\"ibox\">" +
                                "                    <div class=\"ibox-title\">" ;
                                    if(v.hotFalg==1){
                                        html+= "                        <span class=\"label label-danger pull-right\">HOT</span>" ;
                                    }else if(v.newFlag==1){
                                        html+= "                        <span class=\"label label-primary pull-right\">NEW</span>" ;
                                    }else{
                                        html+= "                        <span class=\"label label-primary pull-right\"></span>" ;
                                    }
 
                            html+= "                        <h5>"+v["name"]+"</h5>" +
                                "                    </div>" +
                                "                    <div style='padding: 8px 20px 20px 20px;' class=\"ibox-content\">" +
                                "                        <h4>效果预览:</h4>" +
                                "                        <p>" +v["content"]+"</p>" +
                                "                        <div style='    border-top: 1px solid #ddd;    padding-top: 20px;' class=\"row  m-t-sm\">" +
                                "                            <div class=\"col-sm-6\">" +
                                "                                作者:<div style=\"display: inline-block\" class=\"font-bold\">markbro</div>" +
                                "                            </div>" +
                                "                            <div class=\"col-sm-6 text-right\">" +
                                "                                日期:<div style=\"display: inline-block\"  class=\"font-bold\">2019年12月31日</div>" +
                                "                            </div>" +
                                "                        </div>" +
                                "                    </div>" +
                                "                </div>";
 
                            var id=selectMinColumn();
                            $("#"+id).append(html);
                        });
                    }
                }
            });
        }
        $(function(){
            initList();
            //alert(selectMinColumn());
            $(window).scroll(
 
                function() {
                    var scrollTop = $(this).scrollTop();
                    var scrollHeight = $(document).height();
                    var windowHeight = $(this).height();
                    if (scrollTop + windowHeight == scrollHeight) {
                        pageNum++;
                        if(pageNum>totalPages){
                            layer.msg("已经加载了全部数据!");
                        }else{
                            initList();
                        }
 
                    }
                });
        })
    </script>
</body>
</html>