sync.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>云阅卷本地代理工具</title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
  7. <link rel="stylesheet" href="css/style.css">
  8. </head>
  9. <body>
  10. <div class="wp">
  11. <div class="hd">
  12. <div class="logo"><a href="index.html"><img src="img/logo.png" /></a></div>
  13. <span class="y"> 欢迎您,<span id="user-name"></span><span class="pipe">|</span><a href="login.html">退出</a></span>
  14. </div>
  15. <div class="cont">
  16. <div class="title cl">
  17. <span class="y"><a href="index.html">返回考试主页</a></span>
  18. <h2>数据同步</h2>
  19. </div>
  20. <div class="data">
  21. <p>本地已下载考生数量:<b id="student-count"></b></p>
  22. <p>上次下载完成时间:<b id="last-time"></b></p>
  23. <div class="btn"><a href="sync-run.html"><span>开始同步数据</span></a></div>
  24. </div>
  25. </div>
  26. <div class="ft">Copyright © 2011-2020 www.qmth.com.cn, All Rights Reserved</div>
  27. </div>
  28. <script>
  29. const $ = require('jquery')
  30. const env = require('../lib/env.js')
  31. const config = require('../lib/config.js')
  32. const db = require('../lib/db.js')
  33. $(document).ready(() => {
  34. env.merge(JSON.parse(window.localStorage.getItem('env')))
  35. $('#user-name').html(env.user.userName)
  36. $('#last-time').html(config['syncTime'][env.server.host + '_' + env.exam.id])
  37. db.init()
  38. db.query('select count(*) as count from eb_exam_student where exam_id=?', [env.exam.id]).then((results) => {
  39. $('#student-count').html(results[0].count)
  40. }).catch(err => {
  41. alert('数据库查询失败\n' + (err || ''))
  42. })
  43. })
  44. </script>
  45. </body>
  46. </html>