colly_wyx
2017-08-11 0b55ac0050b2779383499c122182f82d0ce97f0f
application/modules/Admin/views/index/index.phtml
@@ -1,2 +1,237 @@
<?=$word;?>
    <link rel="stylesheet" href="/themes/echats/css/echartsHome.css">
    <link rel="stylesheet" href="/themes/AdminLTE/plugins/daterangepicker/daterangepicker.css">
    <script type="text/javascript" src="/themes/AdminLTE/plugins/daterangepicker/moment.min.js"></script>
    <script type="text/javascript" src="/themes/AdminLTE/plugins/daterangepicker/daterangepicker.js"></script>
<style>
#time{text-align: center; font-size: 26px; padding: 20px 0;}
</style>
     <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div id="time" style="">辐射数据表</div>
            <!-- /.box-header -->
            <div class="box-body">
              <div id="main" class="main"></div>
            </div>
            <!-- /.box-body -->
          </div>
        </div>
      </div>
      <div class="row">
      <div class="col-md-6">
        <div class="box box-primary">
            <div class="box-header with-border">
              <h3 class="box-title">平台通知</h3>
              <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                </button>
                <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
              </div>
            </div>
          <!-- /.box-header -->
          <div class="box-body">
            <ul class="products-list product-list-in-box">
            <?php foreach ($system_news as $key => $system_new):?>
              <li class="item">
                <i class="fa fa-file-text-o">
                </i>
                <a href="/admin/index/look/id/<?php echo $system_new['_id']?>">
                &nbsp;&nbsp;<?php echo $system_new['name']?>
                 <span class=" pull-right">[<?php echo $system_new['create_time']?>]</span>
                </a>
              </li>
            <?php endforeach;?>
              <!-- /.item -->
            </ul>
          </div>
        </div>
        </div>
        <div class="col-md-6">
          <div class="box box-primary">
              <div class="box-header with-border">
                <h3 class="box-title">行业资讯</h3>
                <div class="box-tools pull-right">
                  <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                  </button>
                  <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                </div>
              </div>
            <!-- /.box-header -->
            <div class="box-body">
              <ul class="products-list product-list-in-box">
              <?php foreach ($industry_news as $key => $industry_new):?>
                <li class="item">
                  <i class="fa fa-file-text-o">
                  </i>
                  <a href="/admin/index/look/id/<?php echo $system_new['_id']?>">
                  &nbsp;&nbsp;<?php echo $industry_new['name']?>
                   <span class=" pull-right">[<?php echo $industry_new['create_time']?>]</span>
                  </a>
                </li>
              <?php endforeach;?>
                <!-- /.item -->
              </ul>
          </div>
          </div>
        </div>
      </div>
            <div class="row">
      <div class="col-md-6">
        <div class="box box-primary">
            <div class="box-header with-border">
              <h3 class="box-title">防辐射知识</h3>
              <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                </button>
                <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
              </div>
            </div>
          <!-- /.box-header -->
          <div class="box-body">
            <ul class="products-list product-list-in-box">
            <?php foreach ($ffs_news as $key => $ffs_new):?>
              <li class="item">
                <i class="fa fa-file-text-o">
                </i>
                <a href="/admin/index/look/id/<?php echo $system_new['_id']?>">
                &nbsp;&nbsp;<?php echo $ffs_new['name']?>
                 <span class=" pull-right">[<?php echo $ffs_new['create_time']?>]</span>
                 </a>
              </li>
            <?php endforeach;?>
              <!-- /.item -->
            </ul>
          </div>
        </div>
        </div>
        <div class="col-md-6">
          <div class="box box-primary">
              <div class="box-header with-border">
                <h3 class="box-title">母婴知识</h3>
                <div class="box-tools pull-right">
                  <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                  </button>
                  <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                </div>
              </div>
            <!-- /.box-header -->
            <div class="box-body">
              <ul class="products-list product-list-in-box">
              <?php foreach ($my_news as $key => $my_new):?>
                <li class="item">
                  <i class="fa fa-file-text-o">
                  </i>
                  <a href="/admin/index/look/id/<?php echo $system_new['_id']?>">
                  &nbsp;&nbsp;<?php echo $my_new['name']?>
                   <span class=" pull-right">[<?php echo $my_new['create_time']?>]</span>
                  </a>
                </li>
              <?php endforeach;?>
                <!-- /.item -->
              </ul>
          </div>
          </div>
        </div>
      </div>
          </div>
          <!-- /.box -->
        </section>
    <script type="text/javascript" src="/themes/echats/js/echarts-all.js"></script>
<script>
    myChart = echarts.init(document.getElementById('main'));
    window.onresize = myChart.resize;
    var option = {
          title : {
              text: '辐射数据监控报表',
             // subtext: ''
          },
          tooltip : {
              trigger: 'axis'
          },
          calculable : true,
          xAxis : [
              {
                  type : 'category',
                  boundaryGap : false,
                  data : [
                  <?php foreach ($days_arr as $day): ?>
                  <?php echo "'".$day."',"?>
                  <?php endforeach ?>
                  ]
              }
          ],
          yAxis : [
              {
                  type : 'value',
                  axisLabel : {
                      formatter: '{value}'
                  }
              }
          ],
          series : [
              {
                  name:'每日辐射平均值',
                  type:'line',
                  data:[
                    <?php $day_daily_arr[] =array();?>
                    <?php foreach ($user_dailys as $user_daily):?>
                    <?php $day_daily_arr[$user_daily['date']] = $user_daily['day_avg'];?>
                    <?php endforeach;?>
                    <?php foreach ($days_arr as $day): ?>
                    <?php if(isset($day_daily_arr[$day])):?>
                    <?php echo $day_daily_arr[$day].',';?>
                    <?php else:?>
                    0,
                    <?php endif;?>
                    <?php endforeach;?>
                  ],
                  markPoint : {
                      data : [
                          {type : 'max', name: '最大值'},
                          {type : 'min', name: '最小值'}
                      ]
                  },
              },
          ]
        };
      myChart.setOption(option);
      $(function(){
        function getDay(add_days){
          var date = new Date();
          date.setDate(date.getDate()+add_days);
          var year = date.getFullYear();
          var month = date.getMonth()+1;
          var day = date.getDate();
          return year+"-0"+month+"-0"+day;
        }
        var start_time = getDay(-7);
        var end_time = getDay(-1);
        var max_time = getDay(-1);
        $('#time').text('辐射数据表['+start_time+" 至 "+ end_time + ']');
      });
</script>