login.tpl 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>欢迎页面-X-admin2.0</title>
  6. <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
  7. <script src="http://code.highcharts.com/highcharts.js"></script>
  8. </head>
  9. <body>
  10. 指定服务器:
  11. <input id="server_id" type="text" name="服务器ID" value={{.Server_id}}>
  12. <br>
  13. 过往天数:
  14. <input id="days" type="text" name="天数" value={{.Days}}>
  15. <br>
  16. <br>
  17. <input class="layui-btn" type="button" onclick="submitUpdate()" value=刷新>
  18. <input class="layui-btn" type="button" onclick="submitDownload()" value=下载>
  19. <br>
  20. <br>
  21. <div id="container" style="width: 1600px; height: 800px; margin: 0 auto"></div>
  22. <script language="JavaScript">
  23. $(document).ready(function() {
  24. var chart = {
  25. type: 'spline'
  26. };
  27. var title = {
  28. text: '统计登录'
  29. };
  30. var subtitle = {
  31. text: 'Source: '
  32. };
  33. var xAxis = {
  34. title: {
  35. text: '时间(每5分钟)'
  36. },
  37. tickPixelInterval: 1,
  38. categories: {{.Categories}}
  39. };
  40. var yAxis = {
  41. title: {
  42. text: '人数'
  43. },
  44. plotLines: [{
  45. value: 0,
  46. width: 1,
  47. color: '#808080'
  48. }]
  49. };
  50. var tooltip = {
  51. valueSuffix: '人'
  52. }
  53. var legend = {
  54. layout: 'vertical',
  55. align: 'right',
  56. verticalAlign: 'middle',
  57. borderWidth: 0
  58. };
  59. var series = [
  60. ];
  61. var list = {{.Series}}
  62. for ( var i= 0; i < list.length; i++){
  63. series.push({"name":list[i].Name, "data":eval(list[i].Data)})
  64. }
  65. var json = {};
  66. json.title = title;
  67. json.subtitle = subtitle;
  68. json.xAxis = xAxis;
  69. json.yAxis = yAxis;
  70. json.tooltip = tooltip;
  71. json.legend = legend;
  72. json.series = series;
  73. json.chart = chart;
  74. $('#container').highcharts(json);
  75. });
  76. function submitUpdate () {
  77. var sid = document.getElementById("server_id").value;
  78. var days = document.getElementById("days").value;
  79. var text = "server_id=" + encodeURI(sid) + "&days=" + encodeURI(days);
  80. $.ajax({
  81. type:"get",
  82. url:"/login?" + text,
  83. success:function (data) {
  84. // alert(data.status);
  85. if (data.status){
  86. window.location.href="/login?"+text;
  87. }else{
  88. if (data.info){
  89. alert(data.info);
  90. }else{
  91. window.location.href="/login?"+text;
  92. }
  93. }
  94. }
  95. });
  96. }
  97. function submitDownload () {
  98. var sid = document.getElementById("server_id").value;
  99. var days = document.getElementById("days").value;
  100. var text = "server_id=" + encodeURI(sid) + "&days=" + encodeURI(days) + "&querydata=login";
  101. $.ajax({
  102. type:"get",
  103. url:"/login?" + text,
  104. success:function (data) {
  105. // alert(data.status);
  106. if (data.status){
  107. window.location.href="/login?"+text;
  108. }else{
  109. if (data.info){
  110. alert(data.info);
  111. }else{
  112. window.location.href="/login?"+text;
  113. }
  114. }
  115. }
  116. });
  117. }
  118. </script>
  119. </body>
  120. </html>