马宇豪
2024-08-21 6c77a2bafa0a5a77ed21299b8c0f0db127e831cb
1
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-tabBar-firstPage-exam"],{"0fa2":function(e,t,n){"use strict";n.r(t);var a=n("2401"),r=n.n(a);for(var s in a)["default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(s);t["default"]=r.a},2401:function(e,t,n){"use strict";n("6a54");var a=n("f5bd").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,n("fd3c");var r=a(n("2634")),s=a(n("2fdc")),i=n("1da1"),o=a(n("9b8e")),u={components:{},data:function(){return{statusBarHeight:0,bank:{},idList:[],questionList:[],currentIndex:0,currentQ:{},currentA:"",currentB:[],viewType:null}},onReady:function(){},onLoad:function(e){this.statusBarHeight=uni.getSystemInfoSync()["statusBarHeight"],this.bank=e.bank&&JSON.parse(decodeURIComponent(e.bank)),this.viewType=e.type&&JSON.parse(decodeURIComponent(e.type)),this.getQuestionIds(this.bank.paperId)},onShow:function(){},mounted:function(){},computed:{},beforeUnmount:function(){},beforeDestroy:function(){},methods:{getQuestionIds:function(e){var t=this;return(0,s.default)((0,r.default)().mark((function n(){var a,s;return(0,r.default)().wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,(0,i.getExamIdIdList)({paperId:e,viewType:t.viewType});case 2:a=n.sent,200==a.code?(s=a.data||[],s.length>0?(t.idList=s,(0,i.getExamListByIds)({paperId:e,questionIds:s.map((function(e){return e.id}))}).then((function(e){200==e.code?(t.questionList=e.data.map((function(e){return e.content=JSON.parse(e.content),o.default.set(e,"passed",null),e.studentAnswer&&(e.exExerciseAnswer.answer=e.studentAnswer.answer,e.exExerciseAnswer.passed=e.studentAnswer.passed),2==e.questionType&&e.exExerciseAnswer.answer&&(e.exExerciseAnswer.answer=e.exExerciseAnswer.answer.split(",")),e})),t.currentQ=t.questionList[t.currentIndex],console.log(t.currentQ,"当前问题")):uni.$u.toast(a.message)}))):(t.idList=[],uni.showToast({title:"本题库暂无题目",duration:1e3}))):uni.$u.toast(a.message);case 4:case"end":return n.stop()}}),n)})))()},checkboxChange:function(e){console.log("change",e)},groupChange:function(e){console.log("groupChange",e)},radioChange:function(e){console.log("radioChange",e)},confirmAnswer:function(){var e=this,t={answer:2==this.currentQ.questionType?this.currentQ.exExerciseAnswer.answer.join(","):this.currentQ.exExerciseAnswer.answer,paperId:this.bank.paperId,questionId:this.currentQ.id,studentId:uni.getStorageSync("uid")};(0,i.postExamAnswer)(t).then((function(t){200==t.code?(e.currentQ.passed=t.data,uni.$u.toast("答案已提交")):uni.$u.toast(t.message)}))},prevQ:function(){this.currentIndex-1>=0?(this.currentIndex--,this.currentQ=this.questionList[this.currentIndex]):uni.showToast({title:"已经是第一题了",duration:1e3})},nextQ:function(){null!=this.currentQ.passed||null!=this.currentQ.exExerciseAnswer.passed?(this.currentIndex+1<this.questionList.length?(this.currentIndex++,this.currentQ=this.questionList[this.currentIndex]):uni.showToast({title:"已经是最后一题了",duration:1e3}),console.log(this.currentQ,"current")):uni.$u.toast("请先完成当前题目")},endExam:function(){if(null!=this.currentQ.passed||null!=this.currentQ.exExerciseAnswer.passed){var e={id:this.bank.id};(0,i.postEndExam)(e).then((function(e){200==e.code?(uni.showToast({title:"本次考试结束",duration:1500}),setTimeout((function(){var e=uni.getStorageSync("prevPage");e?"/pages/tabBar/firstPage/firstPage"==e?uni.reLaunch({url:"/pages/tabBar/firstPage/firstPage"}):uni.navigateTo({url:e}):uni.reLaunch({url:"/pages/tabBar/firstPage/firstPage"})}),1500)):uni.$u.toast(e.message)}))}else uni.$u.toast("请先完成当前题目")},showA:function(){uni.showModal({title:"正确答案",content:this.currentQ.answer,showCancel:!1,success:function(e){e.confirm&&console.log("用户点击确定")}})},goBack:function(){var e=uni.getStorageSync("prevPage");e?uni.reLaunch({url:e}):uni.reLaunch({url:"/pages/tabBar/firstPage/firstPage"})}}};t.default=u},"2fad":function(e,t,n){var a=n("c86c");t=a(!1),t.push([e.i,'@charset "UTF-8";\n/* 水平间距 */\n/* 水平间距 */.navBarBox .navBar[data-v-008af9de]{background-color:#fff;height:50px;display:flex;flex-direction:row;justify-content:space-around;align-items:center;box-shadow:0 3px 12px rgba(0,0,0,.05)}.barText[data-v-008af9de]{margin-left:-20px;flex:1;\n  /* margin-left: 20px; */text-align:center;width:85%;font-size:16px;\n  /* text-align: center; */font-weight:600}.navBarBox .navBar .logo[data-v-008af9de]{width:%?82?%;height:%?82?%;margin-right:%?10?%}.m-p-15[data-v-008af9de]{width:100%;padding:0 15px;box-sizing:border-box}.m-p-15 .top[data-v-008af9de]{text-align:center;margin:%?20?% 0;font-weight:bolder}.m-p-15 .questions[data-v-008af9de]{width:100%;margin-top:40px}.m-p-15 .questions .title[data-v-008af9de]{font-size:16px;margin-bottom:20px}.m-p-15 .questions .content[data-v-008af9de]{padding-left:%?10?%}.m-p-15 .questions .content .answers[data-v-008af9de]{background:#ecf5ff;padding:10px}.m-p-15 .questions .content .answers > uni-view[data-v-008af9de]{margin-bottom:5px}.m-p-15 .questions .content .answers span[data-v-008af9de]{font-weight:bolder}.m-p-15 .questions .content .answers .right[data-v-008af9de]{color:#3c9cff}.m-p-15 .questions .content .answers .wrong[data-v-008af9de]{color:#e45656}.btns[data-v-008af9de]{width:100%;position:fixed;display:flex;align-items:center;justify-content:space-around;z-index:99;bottom:60px;left:0}[data-v-008af9de] .u-checkbox{background:#fff;padding:10px;box-sizing:border-box;border-radius:8px}[data-v-008af9de] .u-radio, .u-checkbox[data-v-008af9de]{padding:12px 10px;box-sizing:border-box;border-radius:8px;background:#f5f7fa;border:1px solid #fff;box-shadow:7px 7px 15px rgba(55,84,170,.15),-7px -7px 20px #fff,inset 0 0 4px hsla(0,0%,100%,.2),inset 7px 7px 15px rgba(55,84,170,0),inset -7px -7px 20px hsla(0,0%,100%,0),0 0 4px hsla(0,0%,100%,0)!important;transition:box-shadow .25s ease!important}[data-v-008af9de] .u-checkbox:active{box-shadow:7px 7px 15px rgba(55,84,170,.15),-7px -7px 20px #fff,inset 0 0 4px hsla(0,0%,100%,0),inset 7px 7px 15px rgba(55,84,170,.15),inset -7px -7px 20px #fff,0 0 4px hsla(0,0%,100%,.2)!important}[data-v-008af9de] .u-radio:active{box-shadow:7px 7px 15px rgba(55,84,170,.15),-7px -7px 20px #fff,inset 0 0 4px hsla(0,0%,100%,0),inset 7px 7px 15px rgba(55,84,170,.15),inset -7px -7px 20px #fff,0 0 4px hsla(0,0%,100%,.2)!important}',""]),e.exports=t},7463:function(e,t,n){var a=n("2fad");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var r=n("967d").default;r("20ed02c7",a,!0,{sourceMap:!1,shadowMode:!1})},cf50:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return s})),n.d(t,"a",(function(){return a}));var a={uIcon:n("fd60").default,uDivider:n("3dc7").default,uCheckboxGroup:n("630b").default,uCheckbox:n("a6a6").default,uRadioGroup:n("40fc").default,uRadio:n("6d53").default,uButton:n("a914").default},r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-uni-view",{staticStyle:{display:"flex","flex-direction":"column",height:"100%"}},[n("v-uni-view",{staticClass:"navBarBox"},[n("v-uni-view",{staticClass:"statusBar",style:{paddingTop:e.statusBarHeight+"px"}}),n("v-uni-view",{staticStyle:{display:"flex","flex-direction":"column"}},[n("v-uni-view",{staticClass:"navBar"},[n("u-icon",{staticStyle:{"margin-left":"8px"},attrs:{name:"arrow-left",color:"black",size:"17"},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.goBack.apply(void 0,arguments)}}}),n("v-uni-view",{staticClass:"barText"},[e._v("题目内容")])],1)],1)],1),n("v-uni-view",{staticClass:"m-p-15"},[n("u-divider",{staticStyle:{margin:"40px 0"},attrs:{text:"第"+(e.currentIndex+1)+"题",textColor:"#2979ff",lineColor:"#2979ff",textSize:"16"}}),n("v-uni-view",{staticClass:"questions"},[n("v-uni-view",{staticClass:"title"},[n("span",[e._v("【"+e._s(1==e.currentQ.questionType?"单选题":2==e.currentQ.questionType?"多选题":"判断题")+"】")]),e._v(e._s(e.currentQ.title))]),n("v-uni-view",{staticClass:"content"},[2==e.currentQ.questionType?n("u-checkbox-group",{attrs:{placement:"column",disabled:1!=e.viewType},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.checkboxChange.apply(void 0,arguments)}},model:{value:e.currentQ.exExerciseAnswer.answer,callback:function(t){e.$set(e.currentQ.exExerciseAnswer,"answer",t)},expression:"currentQ.exExerciseAnswer.answer"}},e._l(e.currentQ.content.items,(function(e,t){return n("u-checkbox",{key:t,attrs:{customStyle:{marginBottom:"15px"},label:e.prefix+":"+e.content,name:e.prefix}})})),1):e._e(),1==e.currentQ.questionType||3==e.currentQ.questionType?n("u-radio-group",{attrs:{placement:"column",disabled:1!=e.viewType},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.groupChange.apply(void 0,arguments)}},model:{value:e.currentQ.exExerciseAnswer.answer,callback:function(t){e.$set(e.currentQ.exExerciseAnswer,"answer",t)},expression:"currentQ.exExerciseAnswer.answer"}},e._l(e.currentQ.content.items,(function(t,a){return n("u-radio",{key:a,attrs:{customStyle:{marginBottom:"15px"},shape:"square",label:t.prefix+":"+t.content,name:t.prefix},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.radioChange.apply(void 0,arguments)}}})})),1):e._e(),1==e.viewType&&e.currentQ.exExerciseAnswer&&e.currentQ.exExerciseAnswer.answer&&(typeof e.currentQ.exExerciseAnswer.answer==String?""!==e.currentQ.exExerciseAnswer.answer:e.currentQ.exExerciseAnswer.answer.length>0)?n("u-button",{staticStyle:{width:"80%",margin:"30px auto"},attrs:{type:"primary",shape:"circle",text:"确认答案"},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.confirmAnswer.apply(void 0,arguments)}}}):e._e(),2==e.viewType&&e.currentQ.studentAnswer&&e.currentQ.studentAnswer.answer?n("v-uni-view",{staticClass:"answers"},[n("v-uni-view",[e._v("你的答案:"),(e.currentQ.questionType,n("span",{class:e.currentQ.answer==e.currentQ.studentAnswer.answer?"right":"wrong"},[e._v(e._s(e.currentQ.studentAnswer.answer))]))]),n("v-uni-view",[e._v("正确答案:"),n("span",{staticClass:"right"},[e._v(e._s(e.currentQ.answer))])])],1):e._e()],1)],1)],1),n("v-uni-view",{staticClass:"btns"},[n("u-button",{staticStyle:{width:"30%"},attrs:{type:"error",shape:"circle",size:"small",text:"上一题"},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.prevQ.apply(void 0,arguments)}}}),e.currentIndex<e.questionList.length-1?n("u-button",{staticStyle:{width:"30%"},attrs:{type:"error",shape:"circle",size:"small",text:"下一题"},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.nextQ.apply(void 0,arguments)}}}):e._e(),e.currentIndex==e.questionList.length-1&&1==e.viewType?n("u-button",{staticStyle:{width:"30%"},attrs:{type:"primary",shape:"circle",size:"small",text:"保存退出"},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.endExam.apply(void 0,arguments)}}}):e._e(),e.currentIndex==e.questionList.length-1&&2==e.viewType?n("u-button",{staticStyle:{width:"30%"},attrs:{type:"primary",shape:"circle",size:"small",text:"退出"},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.goBack.apply(void 0,arguments)}}}):e._e()],1)],1)},s=[]},eeb9:function(e,t,n){"use strict";var a=n("7463"),r=n.n(a);r.a},f617:function(e,t,n){"use strict";n.r(t);var a=n("cf50"),r=n("0fa2");for(var s in r)["default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(s);n("eeb9");var i=n("828b"),o=Object(i["a"])(r["default"],a["b"],a["c"],!1,null,"008af9de",null,!1,a["a"],void 0);t["default"]=o.exports}}]);