testPaperEdit-legacy-eee3df76.js 9.4 KB

1
  1. System.register(["./LJFlexBox.vue_vue_type_style_index_0_scoped_62c7247f_lang-legacy-9d357713.js","./index-legacy-240e7575.js","./vendor-legacy-8856a2a6.js","./LJTitle-legacy-e5b62f89.js","./TestQuestionOptions-legacy-2efb73e9.js","./LJDivider-legacy-eab2ea25.js","./StartTheExamDialog-legacy-e46ccac6.js","./LJDivider.vue_vue_type_style_index_0_scoped_b367bc80_lang-legacy-45b10d3a.js","./LJFlexBox-legacy-f7dcb900.js","./LJLabelInput-legacy-c846227e.js","./formatDate-legacy-af81a0a4.js","./LJWWDMSelect-legacy-e4e781f9.js","./LJWWData-legacy-70848b40.js","./LJWWData.vue_vue_type_style_index_0_scoped_1870765c_lang-legacy-38258497.js","./LJWWDMSelect.vue_vue_type_style_index_0_lang-legacy-2f5e0dc8.js"],(function(t,e){"use strict";var s,a,n,i,o,r,l,p,u,c,d,m,f,v,_,g=document.createElement("style");return g.textContent=".header[data-v-30700e83]{display:flex;justify-content:space-between}.title-border[data-v-30700e83]{border-bottom:1px solid #E6E6E6;margin-bottom:20px}.test-paper-details-edit-views[data-v-30700e83]{height:calc(100vh - var(--main-nav-height) - var(--main-tabs-height) - var(--main-footer-height) - 62px);overflow:hidden;background-color:#fff;padding:10px;border-radius:8px}.test-paper-details-edit-views .header-tools[data-v-30700e83]{height:32px}.test-paper-details-edit-views .test-paper-info[data-v-30700e83]{margin-top:10px;height:calc(100vh - var(--main-nav-height) - var(--main-tabs-height) - var(--main-footer-height) - 2px - 125px);overflow:hidden;overflow-y:auto}.test-paper-details-edit-views .test-paper-info .basis[data-v-30700e83],.test-paper-details-edit-views .test-paper-info .test-questions-main[data-v-30700e83]{padding:10px 0;border:1px #E6E6E6 solid;border-radius:5px}.test-paper-details-edit-views .test-paper-info .basis .lj-title[data-v-30700e83],.test-paper-details-edit-views .test-paper-info .test-questions-main .lj-title[data-v-30700e83]{padding:0 15px}.test-paper-details-edit-views .test-paper-info .test-questions-main[data-v-30700e83]{margin-top:15px}.test-paper-details-edit-views .test-paper-info .test-questions-main .test-questions-content[data-v-30700e83]{padding:5px 0 50px}.test-paper-details-edit-views .test-paper-info .test-questions-main .test-questions-content .test-questions-content-item .test-question-title[data-v-30700e83],.test-paper-details-edit-views .test-paper-info .test-questions-main .test-questions-content .test-questions-content-item .lj-test-question-options[data-v-30700e83],.test-paper-details-edit-views .test-paper-info .test-questions-main .test-questions-content .test-questions-content-item .test-question-analysis[data-v-30700e83]{padding:0 15px!important}\n",document.head.appendChild(g),{setters:[function(){},function(t){s=t.n,a=t.$},function(t){n=t.g,i=t.u,o=t.r,r=t.i,l=t.o,p=t.e},function(t){u=t.L},function(t){c=t.T,d=t.a,m=t.b},function(t){f=t.T,v=t.L},function(t){_=t.S},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){var e={__name:"testPaperEdit",setup:function(t){var e=n(),s=i(),g=o(),x=o(),h=o(!1),y=o("试卷生成"),b=r({id:e.query.id,name:"",total_score:0,total_num:0,test_paper_Questions:[]}),q=r({name:[{required:!0,message:"请输入试卷名称",trigger:"blur"}]}),T=function(t,e){return t===b.total_num-1?b.total_score-e:Math.floor(b.total_score/b.total_num)},w=function(){for(var t=0,e=0;e<b.test_paper_Questions.length;e++){var s=T(e,t);b.test_paper_Questions[e].score=s,t+=s}};function Q(){"edite"==e.query.type?y.value="编辑试卷":"start"==e.query.type&&(y.value="启动考试"),b.id&&HTTP.getReadById("test_paper",b.id).then((function(t){var e=t.data;b.name=e.name,b.total_score=e.total_score,b.total_num=e.total_num,b.test_paper_Questions=e.test_paper_Questions.map((function(t){return t.option?t.option=JSON.parse(t.option):t.option=[],t})),w()})).catch((function(t){console.log("error:",t)}))}var S=function(t){for(var e=!0,s=0;s<b.test_paper_Questions.length;s++){var a=b.test_paper_Questions[s];if(!a.content){e=!1,p.exports.Message.error("请输入第".concat(s+1,"题题目"));break}for(var n=0;n<a.option.length;n++){var i=a.option[n];if(!i.optionContent){e=!1,p.exports.Message.error("请输入第".concat(s+1,"题 ").concat(i.optionName,"选项内容"));break}}if(!a.answer){e=!1,p.exports.Message.error("请设置第".concat(s+1,"题正确答案"));break}if(!a.analysis){e=!1,p.exports.Message.error("请输入第".concat(s+1,"题解析"));break}}t(e)},C=function(){var t=JSON.parse(JSON.stringify(b.test_paper_Questions));return{test_id:b.id,name:b.name,start_test:0,questions_data_list:t.map((function(t){return t.option=JSON.stringify(t.option),t}))}},F=function(){if(!h.value){h.value=!0;var t=C();if(!t.questions_data_list.length)return p.exports.Message.error("没有试题信息");HTTP.post("modify_test_and_questions",t).then((function(t){if(0!==t.code)return p.exports.Message.error(t.msg||"保存失败");p.exports.Message.success("保存成功"),s.push({path:"/personnelRoot/aiExam/testPaperList"})})).catch((function(t){p.exports.Message.error(t.msg||"保存失败")})).finally((function(){setTimeout((function(){return h.value=!1}),600)}))}},L=function(){var t=C();if(!t.questions_data_list.length)return p.exports.Message.error("没有试题信息");x.value.handleOpen(t)};return l((function(){Q()})),{__sfc:!0,route:e,router:s,ruleFormRef:g,startTheExamDialogRef:x,saveLoading:h,title:y,ruleForm:b,rules:q,getScore:T,updateScore:w,getTestPaper:Q,updateQuestionOptionsContent:function(t,e,s){b.test_paper_Questions[t].option[e].optionContent=s},handleDeleteQuestion:function(t){b.test_paper_Questions.splice(t,1)},handelAddTestQuestions:function(){var t={analysis:"",answer:"",company:a.getters.company,content:"",del_flag:0,grades:0,option:[{optionContent:"",optionName:"A"},{optionContent:"",optionName:"B"},{optionContent:"",optionName:"C"},{optionContent:"",optionName:"D"}],status:!0,test_paper:b.id,type:1};b.total_num++,b.test_paper_Questions.push(t),w()},validateFormQuestions:S,handleCancel:function(){g.value.clearValidate(),s.back()},handleSubmit:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];g.value.validate((function(e){e&&S((function(e){if(e)return t?t?L():void 0:F()}))}))},getSubmitFormData:C,doSaveSubmitHttp:F,doStartTheExamDialog:L,LJTitle:u,TestQuestions:c,TestQuestionAnalysis:f,LJDivider:v,TestQuestionTitle:d,TestQuestionOptions:m,StartTheExamDialog:_}}};t("default",s(e,(function(){var t=this,e=t._self._c,s=t._self._setupProxy;return e("div",{staticClass:"test-paper-details-edit-views"},[e("div",{staticClass:"header"},[e("span",{staticStyle:{"line-height":"36px","padding-left":"20px"}},[t._v(" "+t._s(s.title)+" ")]),e("div",[e("el-button",{on:{click:s.handleCancel}},[t._v("取消")]),e("el-button",{directives:[{name:"permission",rawName:"v-permission",value:51105,expression:"51105"}],attrs:{loading:s.saveLoading,type:"primary"},on:{click:function(t){return s.handleSubmit(!1)}}},[t._v(" 保存 ")]),e("el-button",{directives:[{name:"permission",rawName:"v-permission",value:51105,expression:"51105"}],attrs:{type:"primary"},on:{click:function(t){return s.handleSubmit(!0)}}},[t._v(" 保存并启动考试 ")])],1)]),e("div",{staticClass:"test-paper-info"},[e("div",{staticClass:"basis"},[e("div",{staticClass:"title-border"},[e(s.LJTitle,{attrs:{title:"基础信息",margin:"10px 10px 20px 10px",blockWidth:"4px"}})],1),e("el-form",{ref:"ruleFormRef",attrs:{model:s.ruleForm,rules:s.rules,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"试卷名称",prop:"name"}},[e("el-input",{staticStyle:{width:"20%"},model:{value:s.ruleForm.name,callback:function(e){t.$set(s.ruleForm,"name",e)},expression:"ruleForm.name"}})],1),e("el-form-item",{attrs:{label:"总分"}},[e("el-input",{staticStyle:{width:"20%"},attrs:{disabled:""},model:{value:s.ruleForm.total_score,callback:function(e){t.$set(s.ruleForm,"total_score",e)},expression:"ruleForm.total_score"}},[e("template",{slot:"append"},[t._v("分")])],2)],1),e("el-form-item",{attrs:{label:"题数"}},[e("div",{staticStyle:{display:"flex"}},[e("el-input",{staticStyle:{width:"20%"},attrs:{disabled:""},model:{value:s.ruleForm.total_num,callback:function(e){t.$set(s.ruleForm,"total_num",e)},expression:"ruleForm.total_num"}},[e("template",{slot:"append"},[t._v("个")])],2),e("div",{staticStyle:{"font-size":"12px",color:"#b1b1b1","margin-left":"20px"}},[t._v(" 单题分数=总分÷数量 ")])],1)])],1)],1),e("div",{staticClass:"test-questions-main"},[e("div",{staticClass:"title-border"},[e(s.LJTitle,{attrs:{title:"试题信息",margin:"10px 10px 20px 10px",blockWidth:"4px"}})],1),e("div",{staticClass:"test-questions-content"},[t._l(s.ruleForm.test_paper_Questions,(function(a,n){return e(s.TestQuestions,{key:n,staticClass:"test-questions-content-item"},[e(s.TestQuestionTitle,{attrs:{score:a.score,index:n,"score-bg":"#F1F5FF"},on:{del:s.handleDeleteQuestion},model:{value:a.content,callback:function(e){t.$set(a,"content",e)},expression:"question.content"}}),e(s.TestQuestionOptions,{attrs:{i:n,options:a.option},on:{upContent:s.updateQuestionOptionsContent},model:{value:a.answer,callback:function(e){t.$set(a,"answer",e)},expression:"question.answer"}}),e(s.TestQuestionAnalysis,{model:{value:a.analysis,callback:function(e){t.$set(a,"analysis",e)},expression:"question.analysis"}}),e(s.LJDivider,{attrs:{padding:"30px 0","border-style":"solid"}})],1)})),e("el-button",{staticStyle:{"margin-left":"15px"},attrs:{type:"primary",icon:"el-icon-plus"},on:{click:s.handelAddTestQuestions}},[t._v("新增试题 ")])],2)])]),e(s.StartTheExamDialog,{ref:"startTheExamDialogRef"})],1)}),[],!1,null,"30700e83",null,null).exports)}}}));