index.html 4.0 KB
<include file="public@header"/>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="javascript:;">数据统计</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('AdminData/index')}">
        请选择:
        <select class="form-control" name="time" style="width: 140px;">
            <option value='0'>全部</option>
            <option value="7" <eq name="7" value="$time">selected</eq> >最近7天</option>
            <option value="30" <eq name="30" value="$time">selected</eq> >最近30天</option>
        </select> &nbsp;&nbsp;
        时间:
        <input type="text" class="form-control js-bootstrap-datetime" name="start_time"
               value="{$start_time|default=''}"
               style="width: 140px;" autocomplete="off">-
        <input type="text" class="form-control js-bootstrap-datetime" name="end_time"
               value="{$end_time|default=''}"
               style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="{:url('AdminData/index')}">清空</a>
    </form>
    <form class="well form-inline margin-top-20" method="post" action="{:url('AdminData/index')}">
        <span style="margin-left: 35%">总浏览量:{$total_num}</span>
        <span style="margin-left: 10%">今日浏览量:{$today_num}</span>
    </form>
    <div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div>
    <div id="container2" style="width: 550px; height: 400px; margin: 0 auto"></div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script language="JavaScript">
    $(document).ready(function() {
        var title = {
            text: '流量变化'
        };
        var subtitle = {
            text: ''
        };
        var xAxis = {
            categories: {$list1}
        };
        var yAxis = {
            title: {
                text: '访问量',
            },
            allowDecimals:false
        };
        var plotOptions = {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: true,
            }
        };
        var series= [{
            name: '流量走势',
            data: {$list2}
        }];

        var json = {};
        json.title = title;
        json.subtitle = subtitle;
        json.xAxis = xAxis;
        json.yAxis = yAxis;
        json.series = series;
        json.plotOptions = plotOptions;
        $('#container').highcharts(json);

    });
</script>
<script language="JavaScript">
    $(document).ready(function() {
        var datalist = {$list3};
        console.log(datalist);
        var chart = {
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false
        };
        var title = {
            text: '地区排行'
        };
        var tooltip = {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        };
        var plotOptions = {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: true,
                    format: '<b>{point.name}%</b>: {point.percentage:.1f} %',
                    style: {
                        color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                    }
                }
            }
        };
        var series= [{
            type: 'pie',
            name: '所占比例',
            data: {$list3}
        }];

        var json = {};
        json.chart = chart;
        json.title = title;
        json.tooltip = tooltip;
        json.series = series;
        json.plotOptions = plotOptions;
        $('#container2').highcharts(json);
    });
</script>
</body>
</html>