{"remainingRequest":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\examine-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\examine-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\examine-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\examine-fvue\\src\\views\\mnksMenu\\components\\simulationTestPaper.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\examine-fvue\\src\\views\\mnksMenu\\components\\simulationTestPaper.vue","mtime":1705466684677},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.function.name\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport { mapState } from 'vuex';\nimport { TableMixin } from '@/mixins/tableMixin';\nimport dictUtils from '@/components/dict/DictSelectUtils.js';\nimport mnsjMenu from '@/api/examination/mnsjMenu.js';\nexport default {\n  mixins: [TableMixin],\n  name: 'formalTestPaper',\n  components: {},\n  data: function data() {\n    return {\n      circleUrl: \"https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png\",\n      //头像\n      hr: 1,\n      min: 60,\n      sec: 0,\n      radio: '',\n      checkList: [],\n      radio3: '',\n      input: '',\n      textarea: '',\n      end: null,\n      paperData: {},\n      //试卷数据\n      topicList: [],\n      //题目类型\n      formalType: false,\n      //正式考试\n      param: {\n        status: 0,\n        recordId: null,\n        questionOptionList: []\n      },\n      userKey: null,\n      paperName: null,\n      newParams: {}\n    };\n  },\n  created: function created() {\n    this.topicList = dictUtils.getDictItemsFromCache('sttx');\n  },\n  methods: {\n    loadData: function loadData() {\n      var _this = this;\n\n      if (this.$route.params.id !== {} && typeof this.$route.params.id === 'string') {\n        this.userKey = this.$route.params.id;\n        this.paperName = this.$route.params.name;\n        sessionStorage.setItem('userkey', this.userKey); //初次收到userKey，存起来\n\n        sessionStorage.setItem('paperName', this.paperName); //初次收到userKey，存起来\n      } else {\n        if (sessionStorage.getItem('userkey')) {\n          this.userKey = sessionStorage.getItem('userkey'); //不是第一次了，取出来\n\n          this.paperName = sessionStorage.getItem('paperName'); //不是第一次了，取出来\n        } else {\n          //如果实在是没有了，就直接去store里面取\n          this.userKey = store.state.user.userInfo.userKey;\n          this.paperName = store.state.user.userInfo.paperName;\n        }\n      }\n\n      var params = {\n        recordId: \"\",\n        userId: '',\n        paperId: this.userKey\n      };\n      mnsjMenu.startExam(params, function (res) {\n        if (res) {\n          var minutes = res.timeLength / 1000 / 60;\n          _this.end = Date.parse(new Date()) + 1 * minutes * 60 * 1000;\n\n          _this.countdown();\n\n          console.log(res); // return\n\n          res.questionsInfoVos.forEach(function (e) {\n            if (e.result) {\n              console.log(e.result);\n\n              if (e.type == 2) {\n                var arr = JSON.parse(JSON.stringify(e.result.split(\",\")));\n                e.result = [];\n                arr.forEach(function (re) {\n                  e.result.push(re);\n                });\n                console.log(e.result);\n              }\n            } else {\n              if (e.type == 2) {\n                e.result = [];\n              } else {\n                e.result = '';\n              }\n            }\n\n            _this.topicList.forEach(function (t) {\n              if (e.type == t.value) {\n                e.typeName = t.name;\n              }\n            });\n          });\n          _this.paperData = res;\n          console.log(_this.paperData);\n          _this.param.recordId = res.recordId;\n        }\n      });\n    },\n    countdown: function countdown() {\n      var now = Date.parse(new Date());\n      var msec = this.end - now;\n      if (msec < 0) return;\n      var day = parseInt(msec / 1000 / 60 / 60 / 24);\n      var hr = parseInt(msec / 1000 / 60 / 60 % 24);\n      var min = parseInt(msec / 1000 / 60 % 60);\n      var sec = parseInt(msec / 1000 % 60);\n      this.day = day;\n      this.hr = hr > 9 ? hr : '0' + hr;\n      this.min = min > 9 ? min : '0' + min;\n      this.sec = sec > 9 ? sec : '0' + sec;\n      var that = this;\n\n      if (hr >= 0 && min >= 0 && sec >= 0) {\n        //倒计时结束关闭订单\n        if (hr == 0 && min == 0 && sec == 0) {\n          this.$message({\n            type: 'warning',\n            message: '考试时间结束'\n          });\n          return;\n        }\n\n        setTimeout(function () {\n          that.countdown();\n        }, 1000);\n      }\n    },\n    changeResult: function changeResult(val) {\n      var _this2 = this;\n\n      console.log(val);\n\n      if (val.length > 0 || val != '') {\n        this.param.status = 0;\n        this.newParams = {};\n        this.param.questionOptionList = [];\n        this.newParams = JSON.parse(JSON.stringify(this.paperData));\n        this.newParams.questionsInfoVos.forEach(function (e) {\n          if (e.type == 2) {\n            var ts = \"\";\n\n            if (e.result.length > 0) {\n              e.result.forEach(function (r, ri) {\n                if (ri == 0) {\n                  ts = r;\n                } else {\n                  ts += ',' + r;\n                }\n              });\n            }\n\n            e.result = ts;\n          }\n\n          _this2.param.questionOptionList.push({\n            questionId: e.questionId,\n            result: e.result\n          });\n        });\n        mnsjMenu.submitAnswer(this.param, function (res) {\n          if (res.state) {}\n        });\n      }\n    },\n    //提交试卷\n    submitPaper: function submitPaper() {\n      var _this3 = this;\n\n      this.param.questionOptionList = [];\n      this.paperData.questionsInfoVos.forEach(function (e) {\n        if (e.type == 2) {\n          var ts = \"\";\n          e.result.forEach(function (r, ri) {\n            if (ri == 0) {\n              ts = r;\n            } else {\n              ts += ',' + r;\n            }\n          });\n          e.result = ts;\n        }\n\n        _this3.param.questionOptionList.push({\n          questionId: e.questionId,\n          result: e.result\n        });\n      });\n      this.$confirm('此操作将提交试卷, 是否继续?', '提示', {\n        confirmButtonText: '确定',\n        cancelButtonText: '取消',\n        type: 'warning'\n      }).then(function () {\n        _this3.param.status = 1;\n        mnsjMenu.submitAnswer(_this3.param, function (res) {\n          if (res.state) {\n            _this3.$message({\n              type: 'success',\n              message: '提交成功'\n            });\n\n            _this3.$router.push({\n              name: 'mnsjMenu'\n            });\n          }\n        });\n      }).catch(function () {\n        _this3.$message({\n          type: 'info',\n          message: '取消提交'\n        });\n      }); // this.$router.push({\n      // \tname: 'mnsjMenu'\n      // })\n      // this.$router.go(-1)\n    }\n  },\n  //自动保存\n  autosave: function autosave() {\n    console.log(1);\n  }\n};",null]}