sync.html 2.0 KB

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