| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // var myChart = echarts.init(document.getElementById("echarts-map-world"));
- var ajax_page=function(memo){
- var overtime='<tr><td colspan="7" style="text-align:center;">请求超时,<a href="javascript:;" class="ajax-page" data-memo="'+memo+'">点击重试</a></td></tr>';
- $.ajax({
- url:url,
- type:'post',
- data:'memo='+memo,
- dataType: "json",
- timeout: '10000',
- beforeSend:function(){
- $(".btn-group .btn-primary").addClass("btn-default");
- $(".btn-group .btn-primary").removeClass("btn-primary");
- $("#"+memo).addClass("btn-primary");
- $("#"+memo).removeClass("btn-default");
- $('.visit-world-tbody').html('<tr><td colspan="7" style="text-align: center;"><span><i class="fa fa-spin fa-spinner" aria-hidden="true"></i> 数据获取中...<span></td></tr>');
- },
- success:function(res){
- if(res.status){
- var map=res.map;
- // var option = {
- // tooltip : {
- // trigger: 'item',
- // },
- // nameMap:nameMap,
- // visualMap: {
- // min:'0',
- // max:map[0]['value'],
- // left: 'left',
- // top: 'bottom',
- // orient: 'horizontal',
- // inverse:true,
- // align:'left',
- // inRange: {
- // color: ['rgba(230,230,230,0.6)', '#3385e3'],
- // symbolSize: [30, 100]
- // },
- // outRange: {
- // color: ['#e6e6e6', '#3385e3'],
- // symbolSize: [30, 100]
- // },
- // borderColor:'#ffffff',
- // text:['高','低'],
- // },
- // series : [
- // {
- // name: '浏览量(PV)',
- // type: 'map',
- // map: 'world',
- // roam: true,
- // label: {
- // normal: {
- // show: false
- // },
- // emphasis: {
- // show: true
- // }
- // },
- // itemStyle:{
- // normal:{
- // borderColor:'#ffffff',
- // areaColor:'#e6e6e6'
- // }
- // },
- // data:map
- // },
- // ]
- // };
- // myChart.setOption(option);
- $('.pv_count').html(res['sum'][0]);
- $('.visitor_count').html(res['sum'][1]);
- $('.ip_count').html(res['sum'][2]);
- $('.bounce_ratio').html(res['sum'][3]+'%');
- $('.avg_visit_time').html(res['sum'][4]);
- $('.visit-world-tbody').html(res.html);
- }else{
- $('.visit-world-tbody').html('<tr><td colspan="7" style="text-align:center;">'+res.msg+'</td></tr>');
- }
- },
- error:function(XMLHttpRequest, textStatus, errorThrown){
- $('.visit-world-tbody').html(overtime);
- },
- complete: function (XMLHttpRequest, textStatus) {
- if(textStatus == 'timeout'){
- $('.visit-world-tbody').html(overtime);
- }
- },
- });
- };
- $(document).on("change","#changeSiteId",function(){
- var url=$(this).data("url");
- var siteid=$(this).val();
- $.ajax({
- url:url,
- data:'siteid='+siteid,
- dataType: "json",
- type:'post',
- success:function(res){
- if(res.code){
- location.reload();
- }else{
- layer.alert(res.msg);
- }
- }
- });
- })
- if(bdtj_show==1){
- ajax_page('tody');
- }else{
- layer.alert("尚未配置,请前往插件管理-百度网站统计-配置");
- }
- $(document).on("click",".ajax-page",function(){
- var memo=$(this).attr("data-memo");
- ajax_page(memo);
- })
- }
- };
- return Controller;
- });
|