goods.tpl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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}}, {{.Days}})">
  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. 过往天数:<input id="days" type="text" name="天数" />
  19. <br>
  20. <br>
  21. <input class="layui-btn" type="button" onclick="submitUpdate()" value=刷新>
  22. <input class="layui-btn" type="button" onclick="submitDownload()" value=下载>
  23. </blockquote>
  24. </div>
  25. <div id="container" style="width: 1600px; height: 800px; margin: 0 auto"></div>
  26. <script language="JavaScript">
  27. $(document).ready(function() {
  28. var chart = {
  29. type: 'column'
  30. };
  31. var title = {
  32. text: '商品统计'
  33. };
  34. var subtitle = {
  35. text: '来源:游戏服'
  36. };
  37. var xAxis = {
  38. title: {
  39. text: '商品id'
  40. },
  41. tickPixelInterval: 1,
  42. categories: {{.Categories}}
  43. };
  44. var yAxis = {
  45. title: {
  46. text: '数量(件)'
  47. },
  48. plotLines: [{
  49. value: 0,
  50. width: 1,
  51. color: '#808080'
  52. }]
  53. };
  54. var tooltip = {
  55. valueSuffix: '件'
  56. }
  57. var legend = {
  58. layout: 'vertical',
  59. align: 'right',
  60. verticalAlign: 'middle',
  61. borderWidth: 0
  62. };
  63. var series = [
  64. ];
  65. var list = {{.Series}}
  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, Days) {
  81. if (ServerId.length > 0) {
  82. document.getElementById("server_id").value = ServerId;
  83. }
  84. if (Days != null && Days > 0) {
  85. document.getElementById("days").value = Days;
  86. }
  87. }
  88. function submitUpdate () {
  89. var sid = document.getElementById("server_id").value;
  90. var days = document.getElementById("days").value;
  91. var text = "server_id=" + encodeURI(sid) + "&days=" + encodeURI(days) ;
  92. $.ajax({
  93. type:"get",
  94. url:"/goods?" + text,
  95. success:function (data) {
  96. // alert(data.status);
  97. if (data.status){
  98. window.location.href="/goods?"+text;
  99. if (data.info){
  100. layer.msg(data.info,{icon:1,time:1000});
  101. }
  102. }else{
  103. if (data.info){
  104. alert(data.info);
  105. }else{
  106. window.location.href="/goods?"+text;
  107. }
  108. }
  109. }
  110. });
  111. }
  112. function submitDownload () {
  113. var sid = document.getElementById("server_id").value;
  114. var days = document.getElementById("days").value;
  115. var text = "server_id=" + encodeURI(sid) + "&days=" + encodeURI(days) + "&querydata=goods";
  116. $.ajax({
  117. type:"get",
  118. url:"/goods?" + text,
  119. success:function (data) {
  120. // alert(data.status);
  121. if (data.status){
  122. window.location.href="/goods?"+text;
  123. if (data.info){
  124. layer.msg(data.info,{icon:1,time:1000});
  125. }
  126. }else{
  127. if (data.info){
  128. alert(data.info);
  129. }else{
  130. window.location.href="/goods?"+text;
  131. }
  132. }
  133. }
  134. });
  135. }
  136. </script>
  137. </body>
  138. </html>