import r from"./index.bec79140.js";import{h as o,i as n}from"./my-course.d26f38fb.js";import{n as a}from"./vueComponentNormalizer.9ef17bb1.js";import"./onlineTest.1d86eb4e.js";import"./index.f5168bf8.js";import"./humanEval.e7206f1d.js";import"./AQCard.8a0f8a13.js";/* empty css                */import"./QuestionsList.4ae2bac5.js";import"./QuestionItem.1944680c.js";import"./questionInfoMapJsonTrans.58e126b5.js";var c=function(){var e=this,s=e.$createElement,t=e._self._c||s;return t("div",{directives:[{name:"loading",rawName:"v-loading",value:e.isLoading,expression:"isLoading"}],staticClass:"course-exercise"},[t("QuestionsList",{ref:"questionList",staticStyle:{height:"100%"},attrs:{questions:e.exercises,mode:e.mode,paperStyle:0},on:{flag:e.flagListChanged,answers:e.userAnswerChanged,evalChanged:e.evalListChanged}}),e.viewModel?t("div",{staticClass:"course-exercise-floor"},[t("el-button",{attrs:{type:"primary"},on:{click:e.exerciseAgin}},[e._v("\u518D\u6B21\u7EC3\u4E60")]),t("el-button",{on:{click:function(l){return e.$router.replace({path:"/online-course/my-course"})}}},[e._v("\u8FD4\u56DE\u8BFE\u7A0B")])],1):e._e()],1)},u=[];const d={components:{QuestionsList:r},data(){return{recordId:0,courseInfo:{},exercises:void 0,model:0,viewModel:!1,isLoading:!1,createTime:null}},async activated(){this.createTime=new Date,this.recordId=this.$route.query.recordId,this.viewModel=this.$route.query.viewer,this.viewModel&&(this.$refs.questionList.mode=1),+this.recordId?await this.getExerciseInfo():this.isShowEveal=!0},mounted(){this.$nextTick(()=>{this.$refs.questionList.$refs.AQCard&&(this.$refs.questionList.$refs.AQCard.style.display="none")})},methods:{async getExerciseInfo(){this.isLoading=!0;const{data:e}=await o(this.recordId);this.courseInfo=e,this.exercises=this.courseInfo.exercise,this.$set(this,"exercises",e.exercise),this.$nextTick(()=>{this.$refs.questionList.questions=this.exercises.map(s=>{var t;return s.info.typeId=s.info.type,s.info.type=s.info.typeInfo.name,s.info.classify=s.info.classifyId,s.info.element=s.info.typeInfo.element,s.info.score=s.score,this.$refs.questionList.mode===1&&(s.info.userAnswer=((t=s.answer)==null?void 0:t.userAnswer)||["\u672A\u56DE\u7B54"]),s.info}),this.$refs.questionList.cancelThisExamBtnHandler=this.cancelThisExamBtnHandler,this.$refs.questionList.submitExam=this.submitExam,this.isLoading=!1}),this.$refs.questionList.mode===1?this.viewModel=!0:this.viewModel=!1},async submitExam(){this.isLoading=!0;const e=this.$refs.questionList.answers;await n({coureseId:this.courseInfo.courseId,recordId:this.recordId,answer:e,createTime:this.createTime}),this.$refs.questionList.questions=[],this.$refs.questionList.mode=1,this.getExerciseInfo(),this.isLoading=!1},cancelThisExamBtnHandler(){return this.mode===3?this.$router.go(-1):this.$confirm("\u672A\u5B8C\u6210\u8BD5\u5377\uFF0C\u8BF7\u8865\u5145\u5B8C\u6574\u6216\u9000\u51FA\u7EC3\u4E60\uFF01","\u8B66\u544A",{type:"error"}).then(e=>{this.$router.replace({path:"/online-course/my-course"})}).catch(e=>{})},exerciseAgin(){this.createTime=new Date,this.$refs.questionList.mode=0,this.getExerciseInfo()}}},i={};var h=a(d,c,u,!1,f,"cadf3d4a",null,null);function f(e){for(let s in i)this[s]=i[s]}const E=function(){return h.exports}();export{E as default};
