index.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import {getMultResult} from '../../../utils/util.js'
  2. let app = getApp()
  3. Page({
  4. data: {
  5. spinShow: false,
  6. paperId: null,
  7. answers:[],
  8. info: {},
  9. paper: {},
  10. answer: {},
  11. preList:["A","B","C", "D","E","F"],
  12. timer: null,
  13. doTime: 0,
  14. remainTime: 0,
  15. remainTimeStr: '',
  16. modalShow: false,
  17. result: 0,
  18. getMultResult,
  19. timeOutShow: false
  20. },
  21. onLoad: function(options) {
  22. let paperId = +options.id||5
  23. let _this = this
  24. app.formPost('Exam.PaperInfo',{paperId}).then(res => {
  25. if (res.code === 200) {
  26. _this.setData({
  27. info: res.data.info,
  28. answers: res.data.answers,
  29. paperId: paperId,
  30. });
  31. }
  32. })
  33. },
  34. onUnload() {
  35. clearInterval(this.data.timer)
  36. wx.reLaunch({
  37. url: "/pages/exam/index/index"
  38. })
  39. },
  40. returnRecord() {
  41. wx.reLaunch({
  42. url: '/pages/record/index',
  43. });
  44. },
  45. timeOut() {
  46. clearInterval(this.data.timer)
  47. this.setData({
  48. timeOutShow: true
  49. });
  50. }
  51. })