reportLine.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>耀荣康健</title>
  6. <link rel="stylesheet" type="text/css" href="/analysis/css/styles.css">
  7. <link rel="stylesheet" type="text/css" href="/analysis/js/layui/css/layui.css">
  8. <script src="/analysis/js/jquery-3.2.1.min.js"></script>
  9. <script src="/analysis/js/layer.js"></script>
  10. <script src="/analysis/js/timeUtils.js"></script>
  11. <script src="/analysis/js/chart.js"></script>
  12. <script src="/analysis/js/laydate.js"></script>
  13. </head>
  14. <body>
  15. <div style="margin: 0 auto; height: 100%; width: 100%; text-align: center">
  16. <div style="display: flex; width: 100%; height: 112px; align-items: center; justify-content: center;background-color: #0044CB; color:#ffffff">
  17. <div style="width: 60%; display: flex; height: 100%; align-items: center">
  18. <a href="/analysis/index.html">
  19. <div style="width:50%; float: left; text-align: left"><img src="/analysis/img/LOGO.png"></div>
  20. </a>
  21. <div style="width:50%;float: right; text-align: right">
  22. <!-- <a href="/index.html" style="text-decoration: none; color: #ffffff; font-size: 24px"><span>主页</span></a>-->
  23. <!-- <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>-->
  24. <!-- <a href="/analysis.html" style="text-decoration: none; color: #ffffff; font-size: 24px"> <span>认知测试</span></a>-->
  25. </div>
  26. </div>
  27. </div>
  28. <div style="width: 100%; height: 730px; display: flex; justify-content: center; flex-direction: column">
  29. <div style="width: 100%;display: flex; justify-content: center; align-items: center">
  30. <div id="dateRange">
  31. <input type="text" id="sdate" style="width: 200px; height: 20px; color: #666666">
  32. &nbsp;&nbsp;
  33. <input type="text" id="edate" style="width: 200px; height: 20px; color: #666666">
  34. &nbsp;&nbsp;
  35. </div>
  36. <a href="javascript:search(null)" style="color:white;width:70px;height:30px;line-height: 30px;
  37. background-image: url('/analysis/img/btnBg.png'); background-repeat: no-repeat;background-size: cover;background-position: center;background-size: 100% 100%;
  38. ">查询</a>
  39. </div>
  40. <div>&nbsp;</div>
  41. <div style="width: 100%;display: flex; justify-content: center; align-items: center">
  42. <div style="width: 50%">
  43. <canvas id="myChart"></canvas>
  44. </div>
  45. </div>
  46. </div>
  47. <!-- <div style="width:100%; height:50px; display: flex; align-items: center; justify-content: center">-->
  48. <!-- <div id="dateRange" style=" display: flex; justify-content: center; align-items: center">-->
  49. <!-- <input type="text" id="sdate" style="width: 200px; height: 20px; color: #666666">-->
  50. <!-- &nbsp;&nbsp;-->
  51. <!-- <input type="text" id="edate" style="width: 200px; height: 20px; color: #666666">-->
  52. <!-- &nbsp;&nbsp;-->
  53. <!-- </div>-->
  54. <!--&lt;!&ndash; <button style="color:white;width:100px;height:30px;background-color: #3155C5; border: 0"&ndash;&gt;-->
  55. <!--&lt;!&ndash; onclick="javascript:getReport(null)">查询</button>&ndash;&gt;-->
  56. <!-- <a href="javascript:getReport(null)" style="color:white;width:70px;height:30px;line-height: 30px;-->
  57. <!--background-image: url('/img/btnBg.png'); background-repeat: no-repeat;background-size: cover;background-position: center;background-size: 100% 100%;-->
  58. <!--">查询</a>-->
  59. <!-- </div>-->
  60. <!-- <div style="width:100%; height:660px; display: flex; align-items: center; justify-content: center">-->
  61. <!-- <div style="width: 50%">-->
  62. <!-- <canvas id="myChart"></canvas>-->
  63. <!-- </div>-->
  64. <!-- </div>-->
  65. <div style="font-size:14px; height: 98px; color: #999999; display: flex;
  66. align-items: center; justify-content: center; background: url(/analysis/img/d97f28a59f20114dad3adbeb0dab456f.png) 100% no-repeat;">
  67. 地址:&nbsp;北京市朝阳区东四环中路41号嘉泰国际A座16层1619室&nbsp;&nbsp;&nbsp;&nbsp;联系电话:400-086-1638<br/>
  68. 湘ICP备2024059687号-3
  69. </div>
  70. </div>
  71. <script>
  72. function search() {
  73. currPage = 1
  74. checkLogin()
  75. }
  76. function checkLogin() {
  77. $.ajax({
  78. url: '/analysis/login/checkLogin',
  79. type: 'POST',
  80. dataType: 'json',
  81. success: function (res) {
  82. // console.log('成功:', res.code);
  83. if (res.code == 0) {
  84. // showReport(res.data)
  85. // phone = res.data.phone
  86. getReport(res.data.phone)
  87. } else {
  88. isLogin = false
  89. LAYER_ID = layer.open({
  90. // icon: 2,
  91. type: 2,
  92. title: ["请先登录", "font-size:18px"],
  93. // title: false,
  94. content: '/analysis/login.html',
  95. scrollbar: false,
  96. area: ['800px', '500px'],
  97. // offset:'100px',
  98. anim: 0,
  99. closeBtn: 0
  100. });
  101. }
  102. },
  103. error: function (xhr, status, error) {
  104. console.error('错误:', error);
  105. layer.alert("服务器繁忙,请稍后重试!", {icon: 2});
  106. }
  107. });
  108. }
  109. function afterLogin(data) {
  110. getReport(data.phone)
  111. }
  112. function getReport(phone) {
  113. const param = {"phone": phone, "sdate": $("#sdate").val(), "edate": $("#edate").val()}
  114. $.ajax({
  115. url: '/analysis/detect/report',
  116. type: 'POST',
  117. dataType: 'json',
  118. contentType: "application/json",
  119. data: JSON.stringify(param),
  120. success: function (res) {
  121. if (res.code == 0) {
  122. const labels = []
  123. const data1 = []
  124. const data2 = []
  125. for (let i = 0; i < res.data.length; i++) {
  126. // alert(res.data[i].create_time)
  127. const tt = new Date(res.data[i].create_time)
  128. labels.push(tt.format("MM月dd日hh时mm分"))
  129. data1.push(res.data[i].score)
  130. data2.push(res.data[i].ave_time)
  131. }
  132. if ((null != myChat)) {
  133. myChat.destroy()
  134. }
  135. showReport(labels, data1, data2)
  136. // myChat.update()
  137. } else {
  138. layer.alert(res.message, {icon: 2})
  139. }
  140. },
  141. error: function (xhr, status, error) {
  142. console.error('错误:', error);
  143. layer.alert("服务器繁忙,请稍后重试!", {icon: 2});
  144. }
  145. });
  146. }
  147. var myChat
  148. function showReport(labels, data1, data2) {
  149. const ctx = document.getElementById('myChart');
  150. myChat = new Chart(ctx, {
  151. type: 'line',
  152. data: {
  153. labels: labels,
  154. datasets: [
  155. {
  156. label: '百分比正确率',
  157. data: data1,
  158. labels: "百分比正确率",
  159. borderWidth: 1,
  160. yAxisID: "y",
  161. },
  162. {
  163. label: '平均反应速度',
  164. data: data2,
  165. labels: "平均反应速度",
  166. borderWidth: 1,
  167. yAxisID: "y1",
  168. }
  169. ],
  170. },
  171. options: {
  172. responsive: true,
  173. interaction: {
  174. mode: 'index',
  175. intersect: false,
  176. },
  177. stacked: false,
  178. plugins: {
  179. title: {
  180. display: true,
  181. text: '早筛结果趋势图'
  182. }
  183. },
  184. scales: {
  185. y: {
  186. type: 'linear',
  187. display: true,
  188. position: 'left',
  189. },
  190. y1: {
  191. type: 'linear',
  192. display: true,
  193. position: 'right',
  194. // grid line settings
  195. grid: {
  196. drawOnChartArea: false, // only want the grid lines for one axis to show up
  197. },
  198. },
  199. }
  200. },
  201. });
  202. // new Chart(ctx, {
  203. // type: 'line',
  204. // data: {
  205. // // labels: ['2025年12月12日12点12分', '2025年12月12日12点13分', '2025年12月12日12点14分', '2025年12月12日12点15分', '2025年12月12日12点12分', '2025年12月12日12点12分', '2025年12月12日12点12分', '2025年12月12日12点12分', '2025年12月12日12点12分'],
  206. // labels: ['12点12分', '12点13分', '12点14分', '12点15分', '12点12分', '12点12分', '12点12分', '12点12分', '12点12分'],
  207. // datasets: [
  208. // {
  209. // label: '1',
  210. // data: [12, 19, 3, 5, 2, 3],
  211. // labels: ['12分', '9分', '2分', '8分', '3分', '12分'],
  212. // borderWidth: 1
  213. // },
  214. // {
  215. // label: '2',
  216. // data: [1, 2, 3, 5, 2, 3],
  217. // labels: ['12分', '9分', '2分', '8分', '3分', '12分'],
  218. // borderWidth: 1
  219. // }
  220. // ],
  221. // // datasets: [
  222. // // }]
  223. // },
  224. // options: {
  225. // scales: {
  226. // y: {
  227. // beginAtZero: true
  228. // }
  229. // }
  230. // }
  231. // });
  232. }
  233. $(function () {
  234. showReport([], [], [])
  235. // laydate.render({
  236. // elem: '#timeRange', //指定元素
  237. // type: "datetime",
  238. // range: ['#test1','#test2']
  239. // });
  240. laydate.render({
  241. elem: '#dateRange',
  242. type: 'date',
  243. range: ['#sdate', '#edate']
  244. })
  245. const sdate = new Date()
  246. sdate.setDate(sdate.getDate() - 30)
  247. // alert(sdate.format("yyyy-MM-dd"))
  248. $("#sdate").val(sdate.format("yyyy-MM-dd"))
  249. $("#edate").val(new Date().format("yyyy-MM-dd"))
  250. checkLogin()
  251. })
  252. </script>
  253. </body>
  254. </html>