index.ftl 11.8 KB
Newer Older
Y
yadong.zhang 已提交
1
<#include "include/macros.ftl">
Y
yadong.zhang 已提交
2 3
<@header>
    <style>
智布道's avatar
智布道 已提交
4
        .notice-box ul {
Y
yadong.zhang 已提交
5 6
            -webkit-padding-start: 40px!important;
        }
智布道's avatar
智布道 已提交
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
        .statistics-panel {
            color: #73879C;
        }
        .statistics-box {
            z-index: 1;
            padding-bottom: 15px;
            margin-bottom: 0;
        }
        .statistics-box:hover {
            transform: translateY(-2px);
            -webkit-transform: translateY(-2px);
            -moz-transform: translateY(-2px);
            box-shadow: -10px 10px 30px -15px #9e9c9c;
            -webkit-box-shadow: -10px 10px 30px -15px #9e9c9c;
            -moz-box-shadow: -10px 10px 30px -15px #9e9c9c;
            transition: all .3s ease;
        }
        .statistics-box .icon i {
            margin: 0;
            font-size: 45px;
            line-height: 0;
            vertical-align: bottom;
            padding: 0;
        }

        .panel_toolbox {
            min-width: auto;
        }

        #statistics-article-list li.title {
            padding: 2px;
            width: 85%;
            float: left
        }

        .recentArticles th.title div{
            width: 200px;
        }

        .recentComments .content{
            width: 150px;
        }

        .recentComments .source div{
            width: 80px;
        }
        .word-prase {
            white-space: nowrap;
            word-wrap: normal;
            text-overflow: ellipsis;
            overflow: hidden;
        }

        #statistics-article-list li.count {
            padding: 2px;
            width: 15%;
            float: left;
            text-align: right;
        }
66 67 68
        .notice-box li{
            line-height: 25px;
        }
Y
yadong.zhang 已提交
69 70
    </style>
</@header>
71 72
<#-- 网站首页的项目介绍内容 -->
<@aboutOneBlog></@aboutOneBlog>
Y
yadong.zhang 已提交
73
<div class="row">
智布道's avatar
智布道 已提交
74
    <div class="col-md-12 col-sm-12 col-xs-12 top_tiles">
75
        <#-- 文章 -->
智布道's avatar
智布道 已提交
76 77 78 79 80 81 82
        <a href="/articles" class="statistics-panel">
            <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 statistics-article" data-key="articleCount">
                <div class="tile-stats statistics-box">
                    <div class="icon"><i class="fa fa-envira"></i></div>
                    <div class="count"></div>
                    <h4>文章</h4>
                </div>
Y
yadong.zhang 已提交
83
            </div>
智布道's avatar
智布道 已提交
84
        </a>
85
        <#-- 标签 -->
智布道's avatar
智布道 已提交
86 87 88 89 90 91
        <a href="/article/tags" class="statistics-panel">
            <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 statistics-tag" data-key="tagCount">
                <div class="tile-stats statistics-box">
                    <div class="icon"><i class="fa fa-tags"></i></div>
                    <div class="count"></div>
                    <h4>标签</h4>
Y
yadong.zhang 已提交
92
                </div>
智布道's avatar
智布道 已提交
93 94
            </div>
        </a>
95
        <#-- 分类 -->
智布道's avatar
智布道 已提交
96 97 98 99 100 101
        <a href="/article/types" class="statistics-panel">
            <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 statistics-type" data-key="typeCount">
                <div class="tile-stats statistics-box">
                    <div class="icon"><i class="fa fa-th"></i></div>
                    <div class="count"></div>
                    <h4>分类</h4>
Y
yadong.zhang 已提交
102
                </div>
智布道's avatar
智布道 已提交
103 104
            </div>
        </a>
105
        <#-- 评论 -->
智布道's avatar
智布道 已提交
106 107 108 109 110 111
        <a href="/comments" class="statistics-panel">
            <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 statistics-comment" data-key="commentCount">
                <div class="tile-stats statistics-box">
                    <div class="icon"><i class="fa fa-comments-o"></i></div>
                    <div class="count"></div>
                    <h4>留言数</h4>
Y
yadong.zhang 已提交
112 113
                </div>
            </div>
智布道's avatar
智布道 已提交
114 115 116 117
        </a>
    </div>
</div>
<div class="row">
118
    <#-- 分类文章数统计 -->
智布道's avatar
智布道 已提交
119 120 121 122 123 124 125 126 127 128 129 130 131 132
    <div class="col-md-4 col-sm-4 col-xs-12">
        <div class="x_panel fixed_height_320 statistics-box">
            <div class="x_title">
                <h2>分类文章数统计</h2>
                <ul class="nav navbar-right panel_toolbox">
                    <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
                </ul>
                <div class="clearfix"></div>
            </div>
            <div class="x_content">
                <div id="echart_type" style="height: 250px;"></div>
            </div>
        </div>
    </div>
133
    <#-- 文章访问TOP.10 -->
智布道's avatar
智布道 已提交
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
    <div class="col-md-4 col-sm-4 col-xs-12">
        <div class="x_panel fixed_height_320 statistics-box">
            <div class="x_title">
                <h2>文章访问TOP.10</h2>
                <ul class="nav navbar-right panel_toolbox">
                    <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
                </ul>
                <div class="clearfix"></div>
            </div>
            <div class="x_content" id="statistics-article-list">
                <ul class="list-unstyled">
                    <@articleTag method="hotList" pageSize="10">
                        <#if hotList?exists && (hotList?size > 0)>
                            <#list hotList as item>
                            <li class="title word-prase"><a href="${config.siteUrl}/article/${item.id?c}" title="${item.title}">${item.title}</a></li>
                            <li class="count"><span title="浏览人次:${item.lookCount?c}">${item.lookCount?c}</span></li>
                            </#list>
                        </#if>
                    </@articleTag>
                </ul>
            </div>
        </div>
    </div>
157
    <#-- 爬虫访问统计TOP.10 -->
智布道's avatar
智布道 已提交
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
    <div class="col-md-4 col-sm-4 col-xs-12">
        <div class="x_panel fixed_height_320 statistics-box">
            <div class="x_title">
                <h2>爬虫访问统计TOP.10</h2>
                <ul class="nav navbar-right panel_toolbox">
                    <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
                </ul>
                <div class="clearfix"></div>
            </div>
            <div class="x_content">
                <div id="echart_spider" style="height: 250px;"></div>
            </div>
        </div>
    </div>

173
    <#-- 近期文章 -->
智布道's avatar
智布道 已提交
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
    <div class="col-md-6 col-sm-6 col-xs-12">
        <div class="x_panel statistics-box">
            <div class="x_title">
                <h2>近期文章 <small> </small></h2>
                <ul class="nav navbar-right panel_toolbox">
                    <li><a href="/articles" target="_blank" title="查看更多"><i class="fa fa-ellipsis-h"></i></a></li>
                    <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
                </ul>
                <div class="clearfix"></div>
            </div>
            <div class="x_content">
                <table class="table table-bordered recentArticles">
                    <thead>
                    <tr>
                        <th class="title"><div class="word-prase">标题</div></th>
                        <th>分类</th>
                        <th>浏览数</th>
                        <th>发布时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    <@articleTag method="recentArticles" pageSize="5">
                        <#if recentArticles?exists && (recentArticles?size > 0)>
                            <#list recentArticles as item>
                            <tr>
                                <th class="title"><div class="word-prase"><a href="${config.siteUrl}/article/${item.id?c}" title="${item.title}">${item.title}</a></div></th>
                                <td><a href="${config.siteUrl}/type/${item.type.id?c}" target="_blank">${item.type.name}</a></td>
                                <td>${item.lookCount?c}</td>
                                <td>${item.createTime?string('yyyy-MM-dd')}</td>
                            </tr>
                            </#list>
                        </#if>
                    </@articleTag>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
212
    <#-- 近期评论 -->
智布道's avatar
智布道 已提交
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
    <div class="col-md-6 col-sm-6 col-xs-12">
        <div class="x_panel statistics-box">
            <div class="x_title">
                <h2>近期评论 <small> </small></h2>
                <ul class="nav navbar-right panel_toolbox">
                    <li><a href="/comments" target="_blank" title="查看更多"><i class="fa fa-ellipsis-h"></i></a></li>
                    <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
                </ul>
                <div class="clearfix"></div>
            </div>
            <div class="x_content">
                <table class="table table-bordered recentComments">
                    <thead>
                    <tr>
                        <th><div>发起人</div></th>
                        <th class="content"><div class="word-prase">评论内容</div></th>
                        <th class="source"><div class="word-prase">出处</div></th>
                        <th>评论时间</th>
                    </tr>
                    </thead>
                    <tbody>
234 235 236 237 238 239 240 241 242 243 244 245
                    <@zhydTag method="recentComments" pageSize="5">
                        <#if recentComments?exists && (recentComments?size > 0)>
                            <#list recentComments as item>
                            <tr>
                                <th class="title word-prase"><div><a href="${item.url}" target="_blank" rel="external nofollow">${item.nickname?if_exists}</a></div></th>
                                <td class="content"><div class="word-prase">${item.briefContent?if_exists}</div></td>
                                <td class="source"><div class="word-prase"><a href="${config.siteUrl}${item.sourceUrl}#comment-${item.id?c}" target="_blank" rel="external nofollow">${item.articleTitle?if_exists}</a></div></td>
                                <td>${item.createTime?string('yyyy-MM-dd')}</td>
                            </tr>
                            </#list>
                        </#if>
                    </@zhydTag>
智布道's avatar
智布道 已提交
246 247 248
                    </tbody>
                </table>
            </div>
Y
yadong.zhang 已提交
249 250 251 252
        </div>
    </div>
</div>
</div>
智布道's avatar
智布道 已提交
253
<@footer>
254
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/4.1.0/echarts.min.js"></script>
智布道's avatar
智布道 已提交
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
<script src="/assets/js/zhyd.echarts.js"></script>
<script>
    /* 顶部卡片统计 */
    $.post("/statistics/siteInfo", function (json) {
        $.alert.ajaxSuccess(json);
        if(json.status == 200){
            var jsonData = json.data;

            function setValue(dom, value) {
                var $dom = dom;
                $dom.find("div.tile-stats .count").text(value);
            }

            $(".statistics-tag, .statistics-type, .statistics-comment, .statistics-article").each(function () {
                var $this = $(this);
                var jsonKey = $this.data("key");
                setValue($this, jsonData[jsonKey]);
            });
        }
    });
    /* 分类文章数统计 */
    $.post("/statistics/listType", function (json) {
        $.alert.ajaxSuccess(json);
        if(json.status == 200){
            var jsonData = json.data;
            zhyd.createChart({id:'echart_type', legendData: getNames(jsonData, 'name'), series:{name:'分类文章数统计', type: 'pie', seriesData: jsonData}});
        }
    });

    /* 爬虫访问统计 */
    $.post("/statistics/listSpider", function (json) {
        $.alert.ajaxSuccess(json);
        if(json.status == 200){
            var jsonData = json.data || [{name: '暂无', value: 0}];
            zhyd.createChart({id:'echart_spider', legendData: getNames(jsonData, 'name'), series:{name:'爬虫访问统计', type: 'pie', seriesData: jsonData}});
        }
    });
    function getNames(arr, key) {
        if(!arr){
            return [];
        }
        var resultArr = [];
        $.each(arr, function (i, v) {
            resultArr.push(v[key]);
        });
        return resultArr;
    }
302 303
    init_echarts();
    $("#noticeModal").modal('show');
智布道's avatar
智布道 已提交
304 305
</script>
</@footer>