index.ftl 12.2 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>
Y
yadong.zhang 已提交
71
<div class="row">
智布道's avatar
智布道 已提交
72
    <div class="col-md-12 col-sm-12 col-xs-12 top_tiles">
73
        <#-- 文章 -->
智布道's avatar
智布道 已提交
74 75 76 77 78 79 80
        <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 已提交
81
            </div>
智布道's avatar
智布道 已提交
82
        </a>
83
        <#-- 标签 -->
智布道's avatar
智布道 已提交
84 85 86 87 88 89
        <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 已提交
90
                </div>
智布道's avatar
智布道 已提交
91 92
            </div>
        </a>
93
        <#-- 分类 -->
智布道's avatar
智布道 已提交
94 95 96 97 98 99
        <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 已提交
100
                </div>
智布道's avatar
智布道 已提交
101 102
            </div>
        </a>
103
        <#-- 评论 -->
智布道's avatar
智布道 已提交
104 105 106 107 108 109
        <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 已提交
110 111
                </div>
            </div>
智布道's avatar
智布道 已提交
112 113 114 115
        </a>
    </div>
</div>
<div class="row">
116
    <#-- 分类文章数统计 -->
智布道's avatar
智布道 已提交
117 118 119 120 121 122 123 124 125 126 127 128 129 130
    <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>
131
    <#-- 文章访问TOP.10 -->
智布道's avatar
智布道 已提交
132 133 134 135 136 137 138 139 140 141 142 143
    <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">
144
                        <#if hotList?? && (hotList?size > 0)>
智布道's avatar
智布道 已提交
145 146 147 148 149 150 151 152 153 154
                            <#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>
155
    <#-- 爬虫访问统计TOP.10 -->
智布道's avatar
智布道 已提交
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
    <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>

171
    <#-- 近期文章 -->
智布道's avatar
智布道 已提交
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
    <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">
194
                        <#if recentArticles?? && (recentArticles?size > 0)>
智布道's avatar
智布道 已提交
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
                            <#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>
210
    <#-- 近期评论 -->
智布道's avatar
智布道 已提交
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
    <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>
232
                    <@zhydTag method="recentComments" pageSize="5">
233
                        <#if recentComments?? && (recentComments?size > 0)>
234 235
                            <#list recentComments as item>
                            <tr>
236 237 238
                                <th class="title word-prase"><div><a href="${item.url}" target="_blank" rel="external nofollow">${item.nickname!}</a></div></th>
                                <td class="content"><div class="word-prase">${item.briefContent!}</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!}</a></div></td>
239 240 241 242 243
                                <td>${item.createTime?string('yyyy-MM-dd')}</td>
                            </tr>
                            </#list>
                        </#if>
                    </@zhydTag>
智布道's avatar
智布道 已提交
244 245 246
                    </tbody>
                </table>
            </div>
Y
yadong.zhang 已提交
247 248 249 250
        </div>
    </div>
</div>
</div>
251 252
<#-- 网站首页的项目介绍内容 -->
<@aboutOneBlog></@aboutOneBlog>
智布道's avatar
智布道 已提交
253
<@footer>
254
<script src="https://cdn.jsdelivr.net/npm/echarts@4.1.0/dist/echarts.min.js"></script>
智布道's avatar
智布道 已提交
255
<script src="/assets/js/zhyd.echarts.js"></script>
256 257 258 259 260 261 262 263 264 265
<#-- 显示或者关闭首页的弹窗,当点击“不再显示后”,如果清缓存,这个弹窗仍然会再次显示 -->
<script type="text/javascript">
    var neverShowNoticeModal = localStorage.getItem("neverShowNoticeModal");
    if(!neverShowNoticeModal) {
        $("#noticeModal").modal('show');
    }
    $("#neverShowNoticeModal").click(function (){
        localStorage.setItem("neverShowNoticeModal", 1);
    })
</script>
智布道's avatar
智布道 已提交
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 302 303 304 305 306 307 308 309 310 311
<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;
    }
312
    init_echarts();
智布道's avatar
智布道 已提交
313
</script>
314
</@footer>