rt_login.tpl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>欢迎页面-X-admin2.0</title>
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  8. <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
  9. <link rel="stylesheet" href="./static/css/font.css">
  10. <link rel="stylesheet" href="./static/css/xadmin.css">
  11. <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
  12. <script src="http://code.highcharts.com/highcharts.js"></script>
  13. </head>
  14. <body onload="InitParams({{.Server_id}})">
  15. <div class="x-body layui-anim layui-anim-up">
  16. <blockquote class="layui-elem-quote">
  17. 指定服务器:<input id="server_id" type="text" name="服务器ID" />
  18. <br>
  19. <br>
  20. <input class="layui-btn" type="button" onclick="submitUpdate()" value=刷新>
  21. <input class="layui-btn" type="button" onclick="submitDownload()" value=下载>
  22. </blockquote>
  23. </div>
  24. <div id="container" style="width: 1600px; height: 800px; margin: 0 auto"></div>
  25. <script language="JavaScript">
  26. $(document).ready(function() {
  27. var chart = {
  28. type: 'spline'
  29. };
  30. var title = {
  31. text: '登陆时段人数分布'
  32. };
  33. var subtitle = {
  34. text: '来源:游戏服'
  35. };
  36. var xAxis = {
  37. title: {
  38. text: '时间段(1小时)'
  39. },
  40. tickPixelInterval: 1,
  41. categories: {{.Categories}}
  42. };
  43. var yAxis = {
  44. title: {
  45. text: '人数'
  46. },
  47. plotLines: [{
  48. value: 0,
  49. width: 1,
  50. color: '#808080'
  51. }]
  52. };
  53. var tooltip = {
  54. valueSuffix: '人'
  55. }
  56. var legend = {
  57. layout: 'vertical',
  58. align: 'right',
  59. verticalAlign: 'middle',
  60. borderWidth: 0
  61. };
  62. var series = [
  63. ];
  64. var list = {{.Series}}
  65. var onlineCount = {{.Online_count}};
  66. for ( var i= 0; i < list.length; i++){
  67. series.push({"name":list[i].Name, "data":eval(list[i].Data)})
  68. }
  69. var json = {};
  70. json.title = title;
  71. json.subtitle = subtitle;
  72. json.xAxis = xAxis;
  73. json.yAxis = yAxis;
  74. json.tooltip = tooltip;
  75. json.legend = legend;
  76. json.series = series;
  77. json.chart = chart;
  78. $('#container').highcharts(json);
  79. });
  80. function InitParams(ServerId) {
  81. if (ServerId.length > 0) {
  82. document.getElementById("server_id").value = ServerId;
  83. }
  84. }
  85. function submitUpdate () {
  86. var sid = document.getElementById("server_id").value;
  87. var text = "server_id=" + encodeURI(sid);
  88. $.ajax({
  89. type:"get",
  90. url:"/rtlogin?" + text,
  91. success:function (data) {
  92. // alert(data.status);
  93. if (data.status){
  94. window.location.href="/rtlogin?"+text;
  95. if (data.info){
  96. layer.msg(data.info,{icon:1,time:1000});
  97. }
  98. }else{
  99. if (data.info){
  100. alert(data.info);
  101. }else{
  102. window.location.href="/rtlogin?"+text;
  103. }
  104. }
  105. }
  106. });
  107. }
  108. function submitDownload () {
  109. var sid = document.getElementById("server_id").value;
  110. var text = "server_id=" + encodeURI(sid) + "&querydata=rtlogin";
  111. $.ajax({
  112. type:"get",
  113. url:"/rtlogin?" + text,
  114. success:function (data) {
  115. // alert(data.status);
  116. if (data.status){
  117. window.location.href="/rtlogin?"+text;
  118. if (data.info){
  119. layer.msg(data.info,{icon:1,time:1000});
  120. }
  121. }else{
  122. if (data.info){
  123. alert(data.info);
  124. }else{
  125. window.location.href="/rtlogin?"+text;
  126. }
  127. }
  128. }
  129. });
  130. }
  131. </script>
  132. </body>
  133. </html>