reportTable.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. <script src="/analysis/js/layui/layui.js"></script>
  14. <style>
  15. /*body{ font-size: 24px}*/
  16. </style>
  17. </head>
  18. <body>
  19. <div style="margin: 0 auto; height: 100%; width: 100%; text-align: center">
  20. <div style="display: flex; width: 100%; height: 112px; align-items: center; justify-content: center;background-color: #0044CB; color:#ffffff">
  21. <div style="width: 60%; display: flex; height: 100%; align-items: center">
  22. <a href="/analysis/index.html">
  23. <div style="width:50%; float: left; text-align: left"><img src="/analysis/img/LOGO.png"></div>
  24. </a>
  25. <div style="width:50%;float: right; text-align: right">
  26. <!-- <a href="/index.html" style="text-decoration: none; color: #ffffff; font-size: 24px"><span>主页</span></a>-->
  27. <!-- <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>-->
  28. <!-- <a href="/analysis.html" style="text-decoration: none; color: #ffffff; font-size: 24px"> <span>认知测试</span></a>-->
  29. </div>
  30. </div>
  31. </div>
  32. <div style="width: 100%; height: 680px; display: flex; justify-content: center; flex-direction: column">
  33. <div style="width: 100%;display: flex; justify-content: center; align-items: center">
  34. <div id="dateRange">
  35. <input type="text" id="sdate" style="width: 200px; height: 20px; color: #666666">
  36. &nbsp;&nbsp;
  37. <input type="text" id="edate" style="width: 200px; height: 20px; color: #666666">
  38. &nbsp;&nbsp;
  39. </div>
  40. <!-- <button style="color:white;width:70px;height:30px;background-color: #3155C5; border: 0"-->
  41. <!-- onclick="javascript:search()">查询-->
  42. <!-- </button>-->
  43. <a href="javascript:search(null)" style="color:white;width:70px;height:30px;line-height: 30px;
  44. background-image: url('/analysis/img/btnBg.png'); background-repeat: no-repeat;background-size: cover;background-position: center;background-size: 100% 100%;
  45. ">查询</a>
  46. </div>
  47. <div>&nbsp;</div>
  48. <div style="width: 100%;display: flex; justify-content: center; align-items: center">
  49. <div style="display:flex;flex-direction: column; justify-content: center; align-items: center; width: 50%;
  50. background-image: url('/analysis/img/tableBg.png'); background-repeat: no-repeat;background-size: cover;background-position: center;background-size: 100% 100%;
  51. ">
  52. <div>&nbsp;</div>
  53. <div>&nbsp;</div>
  54. <table id="dg" style="width: 80%; " border="0" cellpadding="20"
  55. cellspacing="0">
  56. <thead style="background-color: #3155C5; height: 50px; color: white; font-weight: bold;">
  57. <td width="300px">测试日期</td>
  58. <td width="300px" align="center">百分比正确率</td>
  59. <td width="300px">正确数量</td>
  60. <td width="300px">错误数量</td>
  61. <td width="300px">超时数量</td>
  62. <td width="300px">结果</td>
  63. </thead>
  64. <tbody>
  65. <!-- <td>aaa</td>-->
  66. <!-- <td>aaa</td>-->
  67. <!-- <td style="width: 100px; height: 100px; background-image: url('/img/greenCircle.png');background-repeat: no-repeat;background-size: cover;background-position: center;background-size: 100% 100%;"><span>ddd</span></td>-->
  68. <!-- <td>aaa</td>-->
  69. </tbody>
  70. </table>
  71. </div>
  72. </div>
  73. <div></div>
  74. </div>
  75. <div style="width:100%; height:50px; ">
  76. <div id="test1"></div>
  77. </div>
  78. <div style="font-size:14px; height: 98px; color: #999999; display: flex;
  79. align-items: center; justify-content: center; background: url(/analysis/img/d97f28a59f20114dad3adbeb0dab456f.png) 100% no-repeat;">
  80. 地址:&nbsp;北京市朝阳区东四环中路41号嘉泰国际A座16层1619室&nbsp;&nbsp;&nbsp;&nbsp;联系电话:400-086-1638<br/>
  81. 湘ICP备2024059687号-3
  82. </div>
  83. </div>
  84. <script>
  85. function search() {
  86. currPage = 1
  87. // getReport(null)
  88. // alert("aa")
  89. checkLogin()
  90. }
  91. function setPage(count) {
  92. // alert(count+" ")
  93. layui.use('laypage', function () {
  94. var laypage = layui.laypage;
  95. //执行一个laypage实例
  96. laypage.render({
  97. elem: 'test1', //注意,这里的 test1 是 ID,不用加 # 号
  98. count: count, //数据总数,从服务端得到
  99. curr: currPage,
  100. limit: pageLimit,
  101. jump: function (obj, first) {
  102. //obj包含了当前分页的所有参数,比如:
  103. // console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
  104. // console.log(obj.limit); //得到每页显示的条数
  105. //首次不执行
  106. if (!first) {
  107. // alert(obj.curr+" "+obj.limit)
  108. currPage = obj.curr
  109. getReport(null)
  110. }
  111. }
  112. });
  113. });
  114. }
  115. function checkLogin() {
  116. // alert("aa")
  117. $.ajax({
  118. url: '/analysis/login/checkLogin',
  119. type: 'POST',
  120. dataType: 'json',
  121. success: function (res) {
  122. // console.log('成功:', res.code);
  123. if (res.code == 0) {
  124. // showReport(res.data)
  125. // phone = res.data.phone
  126. getReport(res.data.phone)
  127. } else {
  128. isLogin = false
  129. LAYER_ID = layer.open({
  130. // icon: 2,
  131. type: 2,
  132. title: ["请先登录", "font-size:18px"],
  133. // title: false,
  134. content: '/analysis/login.html',
  135. scrollbar: false,
  136. area: ['800px', '500px'],
  137. // offset:'100px',
  138. anim: 0,
  139. closeBtn: 0
  140. });
  141. }
  142. },
  143. error: function (xhr, status, error) {
  144. console.error('错误:', error);
  145. layer.alert("服务器繁忙,请稍后重试!", {icon: 2});
  146. }
  147. });
  148. }
  149. function afterLogin(data) {
  150. getReport(data.phone)
  151. }
  152. var currPage = 1
  153. var pageLimit = 5
  154. function getReport(phone) {
  155. // alert(pageLimit)
  156. const param = {
  157. "phone": phone,
  158. "sdate": $("#sdate").val(),
  159. "edate": $("#edate").val(),
  160. "currPage": currPage,
  161. "pageLimit": pageLimit
  162. }
  163. $.ajax({
  164. url: '/analysis/detect/report',
  165. type: 'POST',
  166. dataType: 'json',
  167. contentType: "application/json",
  168. data: JSON.stringify(param),
  169. success: function (res) {
  170. if (res.code == 0) {
  171. // alert(res.count)
  172. var htmlStr = ""
  173. for (let i = 0; i < res.data.length; i++) {
  174. // alert(res.data[i].create_time)
  175. const tt = new Date(res.data[i].create_time)
  176. htmlStr += "<tr style='height: 100px'>"
  177. htmlStr += "<td>" + tt.format("MM月dd日 hh时mm分") + "</td>"
  178. if (res.data[i].score > 70) {
  179. htmlStr += "<td style=\"width: 70px; height: 70px; background-image: url('/analysis/img/circleGreen100.png');background-repeat: no-repeat;background-position: center;background-size: 30%;\">"
  180. + res.data[i].score + "</td>"
  181. } else if (res.data[i].score < 30) {
  182. htmlStr += "<td style=\"width: 70px; height: 70px; background-image: url('/analysis/img/circleRed100.png');background-repeat: no-repeat;background-position: center;background-size: 30%;\">"
  183. + res.data[i].score + "</td>"
  184. } else {
  185. htmlStr += "<td style=\"width: 70px; height: 70px; background-image: url('/analysis/img/circleYellow100.png');background-repeat: no-repeat;background-position: center;background-size: 30%;\">"
  186. + res.data[i].score + "</td>"
  187. }
  188. htmlStr += "<td>" + res.data[i].total_right + "</td>"
  189. htmlStr += "<td>" + res.data[i].total_wrong + "</td>"
  190. htmlStr += "<td>" + res.data[i].total_timeout + "</td>"
  191. if (res.data[i].score <= 30) {
  192. htmlStr += "<td><img src='/analysis/img/iconWrong.png' style='width: 30px'></td>"
  193. } else {
  194. htmlStr += "<td><img src='/analysis/img/iconRight.png' style='width: 30px'></td>"
  195. }
  196. htmlStr += "<td></td>"
  197. htmlStr += "</tr>"
  198. }
  199. $("#dg tbody").html(htmlStr)
  200. setPage(res.count)
  201. } else {
  202. layer.alert(res.message, {icon: 2})
  203. }
  204. },
  205. error: function (xhr, status, error) {
  206. console.error('错误:', error);
  207. layer.alert("服务器繁忙,请稍后重试!", {icon: 2});
  208. }
  209. });
  210. }
  211. $(function () {
  212. laydate.render({
  213. elem: '#dateRange',
  214. type: 'date',
  215. range: ['#sdate', '#edate']
  216. })
  217. const sdate = new Date()
  218. sdate.setDate(sdate.getDate() - 30)
  219. // alert(sdate.format("yyyy-MM-dd"))
  220. $("#sdate").val(sdate.format("yyyy-MM-dd"))
  221. $("#edate").val(new Date().format("yyyy-MM-dd"))
  222. checkLogin()
  223. })
  224. </script>
  225. </body>
  226. </html>