1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542 |
- <template>
- <div class="course-exam">
- <Header></Header>
- <section class="section">
- <div class="container">
- <div class="section__header">
- <!-- <el-breadcrumb separator="/">
- <el-breadcrumb-item
- v-for="(item, index) in $route.matched"
- :key="index"
- :to="{ path: item.path }"
- >{{ item.name }}</el-breadcrumb-item
- >
- </el-breadcrumb> -->
- </div>
- <div class="section__body">
- <div class="explain-record">
- <div class="explain-record__body">
- <div class="left-box">
- <Header-tab-box
- :num="questionOverNum(true)"
- @prevQuestion="prevQuestion"
- @nextQuestion="nextQuestion"
- ></Header-tab-box>
- <div class="left-box__body">
- <template v-for="(question, questionIndex) in questionList">
- <div
- class="question"
- v-if="question.type == 1 && current == questionIndex"
- :key="questionIndex"
- >
- <div class="question__title">
- {{ questionIndex + 1 }}、单选题
- </div>
- <div
- class="question__desc"
- v-html="question.content"
- ></div>
- <div class="question__content">
- <div class="question-list" v-if="!question.ques">
- <div
- class="radio"
- v-for="(item, index) in question.jsonStr"
- :key="index"
- @click="
- radioSelect(
- question,
- questionIndex,
- item.optionsId
- )
- "
- >
- <div>
- {{ ast[index] }}. {{ item.content }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="$tools.splitImgHost(item.imgUrl)"
- alt=""
- />
- </div>
- </div>
- </div>
- </div>
- <div class="question-list" v-if="question.ques">
- <div
- class="radio"
- :class="{
- right:
- item.optionsId == question.ques ||
- item.optionsId == question.ans,
- wrong:
- item.optionsId == question.ques &&
- question.ques != question.ans,
- }"
- v-for="(item, index) in question.jsonStr"
- :key="index"
- >
- <div>
- {{ ast[index] }}. {{ item.content }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="$tools.splitImgHost(item.imgUrl)"
- alt=""
- />
- </div>
- </div>
- </div>
- </div>
- <div class="answer-list" v-if="question.ques">
- <div class="answer-list__left">
- 正确答案:{{ ast[question.ans - 1] }}
- </div>
- <div class="answer-list__left">
- 我的答案:{{ ast[question.ques - 1] }}
- </div>
- </div>
- <div class="explain-list" v-if="question.ques">
- <div class="explain-list__header">答案解析:</div>
- <div
- class="explain-list__body"
- v-html="question.analysisContent"
- ></div>
- </div>
- </div>
- </div>
- <div
- class="question"
- v-if="question.type == 2 && current == questionIndex"
- :key="questionIndex"
- >
- <div class="question__title">
- {{ questionIndex + 1 }}、多选题
- </div>
- <div
- class="question__desc"
- v-html="question.content"
- ></div>
- <div class="question__content">
- <div class="question-list" v-if="!question.ques">
- <el-checkbox
- class="checkbox"
- v-for="(item, index) in question.jsonStr"
- :key="index"
- :label="item.optionsId"
- v-model="item.checked"
- >
- <div>
- {{ ast[index] }}. {{ item.content }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="$tools.splitImgHost(item.imgUrl)"
- alt=""
- />
- </div>
- </div>
- </el-checkbox>
- </div>
- <div class="question-list" v-if="question.ques">
- <el-checkbox
- disabled
- class="checkbox"
- :class="{
- right:
- question.ques.indexOf(item.optionsId) != -1 ||
- question.ans.indexOf(item.optionsId) != -1,
- wrong:
- question.ques.indexOf(item.optionsId) != -1 &&
- question.ans.indexOf(item.optionsId) == -1,
- }"
- v-for="(item, index) in question.jsonStr"
- :key="index"
- :label="item.optionsId"
- v-model="item.checked"
- >
- <div>
- {{ ast[index] }}. {{ item.content }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="$tools.splitImgHost(item.imgUrl)"
- alt=""
- />
- </div>
- </div>
- </el-checkbox>
- </div>
- <div class="answer-list" v-if="question.ques">
- <div class="answer-list__left">
- 正确答案:
- <template v-for="ansItem in question.ans">{{
- ast[ansItem - 1]
- }}</template>
- </div>
- <div class="answer-list__left">
- 我的答案:
- <template v-for="quesItem in question.ques">{{
- ast[quesItem - 1]
- }}</template>
- </div>
- </div>
- <div class="explain-list" v-if="question.ques">
- <div class="explain-list__header">答案解析:</div>
- <div
- class="explain-list__body"
- v-html="question.analysisContent"
- ></div>
- </div>
- </div>
- <div class="question__btns">
- <div
- v-if="!question.ques"
- class="submit"
- @click="checkboxSubmit(question, questionIndex)"
- >
- 确认答案
- </div>
- </div>
- </div>
- <div
- class="question"
- v-if="question.type == 3 && current == questionIndex"
- :key="questionIndex"
- >
- <div class="question__title">
- {{ questionIndex + 1 }}、判断题
- </div>
- <div
- class="question__desc"
- v-html="question.content"
- ></div>
- <div class="question__content">
- <div class="question-list" v-if="!question.ques">
- <div
- class="radio"
- v-for="(item, index) in judge"
- :key="index"
- @click="judgeSelect(question, questionIndex, index)"
- >
- <div>
- {{ ast[index] }}. {{ item }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="$tools.splitImgHost(item.imgUrl)"
- alt=""
- />
- </div>
- </div>
- </div>
- </div>
- <div class="question-list" v-if="question.ques">
- <!-- right:
- index == question.ques || index == question.ans,
- wrong:
- index == question.ques &&
- question.ques != question.ans, -->
- <div
- class="radio"
- :class="{
- right:
- index == (question.ques == 1 ? 0 : 1) ||
- index != question.ans,
- wrong:
- index == (question.ques == 1 ? 0 : 1) &&
- question.ques != question.ans,
- }"
- v-for="(item, index) in judge"
- :key="index"
- >
- <div>
- {{ ast[index] }}. {{ item }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="$tools.splitImgHost(item.imgUrl)"
- alt=""
- />
- </div>
- </div>
- </div>
- </div>
- <div class="answer-list" v-if="question.ques">
- <div class="answer-list__left">
- 正确答案:{{ ast[question.ans == 1 ? 0 : 1] }}
- </div>
- <div class="answer-list__left">
- 我的答案:{{ ast[question.ques == 1 ? 0 : 1] }}
- </div>
- </div>
- <div class="explain-list" v-if="question.ques">
- <div class="explain-list__header">答案解析:</div>
- <div
- class="explain-list__body"
- v-html="question.analysisContent"
- ></div>
- </div>
- </div>
- </div>
- <div
- class="question"
- v-if="question.type == 4 && current == questionIndex"
- :key="questionIndex"
- >
- <div class="question__title">
- {{ questionIndex + 1 }}、案例题
- </div>
- <div
- class="question__desc"
- v-html="question.content"
- ></div>
- <div class="question__content">
- <el-tabs v-model="question.tabIndex">
- <el-tab-pane
- v-for="(json, jsonIndex) in question.jsonStr"
- :label="'问题' + (jsonIndex + 1)"
- :name="jsonIndex + ''"
- :key="jsonIndex"
- >
- <div
- class="question"
- v-if="json.type == 1"
- :key="questionIndex"
- >
- <div class="question__title">
- {{ jsonIndex + 1 }}、单选题
- </div>
- <div
- class="question__desc"
- v-html="json.content"
- ></div>
- <div class="question__content">
- <div
- class="question-list"
- v-if="!question.ques[jsonIndex]"
- >
- <div
- class="radio"
- v-for="(item, index) in json.optionsList"
- :key="index"
- @click="
- radioSelectChild(
- questionIndex,
- jsonIndex,
- item.optionsId
- )
- "
- >
- <div>
- {{ ast[index] }}. {{ item.content }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="
- $tools.splitImgHost(item.imgUrl)
- "
- alt=""
- />
- </div>
- </div>
- </div>
- </div>
- <div
- class="question-list"
- v-if="question.ques[jsonIndex]"
- >
- <div
- class="radio"
- :class="{
- right:
- item.optionsId ==
- question.ques[jsonIndex] ||
- item.optionsId ==
- question.ans[jsonIndex],
- wrong:
- item.optionsId ==
- question.ques[jsonIndex] &&
- question.ques[jsonIndex] !=
- question.ans[jsonIndex],
- }"
- v-for="(item, index) in json.optionsList"
- :key="index"
- >
- <div>
- {{ ast[index] }}. {{ item.content }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="
- $tools.splitImgHost(item.imgUrl)
- "
- alt=""
- />
- </div>
- </div>
- </div>
- </div>
- <div
- class="answer-list"
- v-if="question.ques[jsonIndex]"
- >
- <div class="answer-list__left">
- 正确答案:{{
- ast[question.ans[jsonIndex] - 1]
- }}
- </div>
- <div class="answer-list__left">
- 我的答案:{{
- ast[question.ques[jsonIndex] - 1]
- }}
- </div>
- </div>
- <div
- class="explain-list"
- v-if="question.ques[jsonIndex]"
- >
- <div class="explain-list__header">
- 答案解析:
- </div>
- <div
- class="explain-list__body"
- v-html="json.analysisContent"
- ></div>
- </div>
- </div>
- <div class="question__btns"></div>
- </div>
- <div
- class="question"
- v-if="json.type == 2"
- :key="jsonIndex"
- >
- <div class="question__title">
- {{ jsonIndex + 1 }}、多选题
- </div>
- <div
- class="question__desc"
- v-html="json.content"
- ></div>
- <div class="question__content">
- <div
- class="question-list"
- v-if="!question.ques[jsonIndex]"
- >
- <el-checkbox
- class="checkbox"
- v-for="(item, index) in json.optionsList"
- :key="index"
- :label="item.optionsId"
- v-model="item.checked"
- >
- <div>
- {{ ast[index] }}. {{ item.content }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="
- $tools.splitImgHost(item.imgUrl)
- "
- alt=""
- />
- </div>
- </div>
- </el-checkbox>
- </div>
- <div
- class="question-list"
- v-if="question.ques[jsonIndex]"
- >
- <el-checkbox
- disabled
- class="checkbox"
- :class="{
- right:
- question.ques[jsonIndex].indexOf(
- item.optionsId
- ) != -1 ||
- question.ans[jsonIndex].indexOf(
- item.optionsId
- ) != -1,
- wrong:
- question.ques[jsonIndex].indexOf(
- item.optionsId
- ) != -1 &&
- question.ans[jsonIndex].indexOf(
- item.optionsId
- ) == -1,
- }"
- v-for="(item, index) in json.optionsList"
- :key="index"
- :label="item.optionsId"
- v-model="item.checked"
- >
- <div>
- {{ ast[index] }}. {{ item.content }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="
- $tools.splitImgHost(item.imgUrl)
- "
- alt=""
- />
- </div>
- </div>
- </el-checkbox>
- </div>
- <div
- class="answer-list"
- v-if="question.ques[jsonIndex]"
- >
- <div class="answer-list__left">
- 正确答案:
- <template
- v-for="ansItem in question.ans[jsonIndex]"
- >{{ ast[ansItem - 1] }}</template
- >
- </div>
- <div class="answer-list__left">
- 我的答案:
- <template
- v-for="quesItem in question.ques[
- jsonIndex
- ]"
- >{{ ast[quesItem - 1] }}</template
- >
- </div>
- </div>
- <div
- class="explain-list"
- v-if="question.ques[jsonIndex]"
- >
- <div class="explain-list__header">
- 答案解析:
- </div>
- <div
- class="explain-list__body"
- v-html="json.analysisContent"
- ></div>
- </div>
- </div>
- <div class="question__btns">
- <div
- v-if="!question.ques[jsonIndex]"
- class="submit"
- @click="
- checkboxSubmitChild(
- questionIndex,
- jsonIndex
- )
- "
- >
- 确认答案
- </div>
- </div>
- </div>
- <div
- class="question"
- v-if="json.type == 3"
- :key="jsonIndex"
- >
- <div class="question__title">
- {{ jsonIndex + 1 }}、判断题
- </div>
- <div
- class="question__desc"
- v-html="json.content"
- ></div>
- <div class="question__content">
- <div
- class="question-list"
- v-if="!question.ques[jsonIndex]"
- >
- <div
- class="radio"
- v-for="(item, index) in judge"
- :key="index"
- @click="
- judgeSelectChild(
- questionIndex,
- jsonIndex,
- index
- )
- "
- >
- <div>
- {{ ast[index] }}. {{ item }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="
- $tools.splitImgHost(item.imgUrl)
- "
- alt=""
- />
- </div>
- </div>
- </div>
- </div>
- <div
- class="question-list"
- v-if="question.ques[jsonIndex]"
- >
- <div
- class="radio"
- :class="{
- right:
- index ==
- (question.ques[jsonIndex] == 1
- ? 0
- : 1) ||
- index != question.ans[jsonIndex],
- wrong:
- index ==
- (question.ques[jsonIndex] == 1
- ? 0
- : 1) &&
- question.ques[jsonIndex] !=
- question.ans[jsonIndex],
- }"
- v-for="(item, index) in judge"
- :key="index"
- >
- <div>
- {{ ast[index] }}. {{ item }}
- <div v-if="item.imgUrl">
- <img
- style="max-width: 100%"
- :src="
- $tools.splitImgHost(item.imgUrl)
- "
- alt=""
- />
- </div>
- </div>
- </div>
- </div>
- <div
- class="answer-list"
- v-if="question.ques[jsonIndex]"
- >
- <div class="answer-list__left">
- 正确答案:{{
- ast[question.ans[jsonIndex] == 1 ? 0 : 1]
- }}
- </div>
- <div class="answer-list__left">
- 我的答案:{{
- ast[question.ques[jsonIndex] == 1 ? 0 : 1]
- }}
- </div>
- </div>
- <div
- class="explain-list"
- v-if="question.ques[jsonIndex]"
- >
- <div class="explain-list__header">
- 答案解析:
- </div>
- <div
- class="explain-list__body"
- v-html="json.analysisContent"
- ></div>
- </div>
- </div>
- <div class="question__btns"></div>
- </div>
- <div
- class="question"
- v-if="json.type == 5"
- :key="jsonIndex"
- >
- <div class="question__title">
- {{ jsonIndex + 1 }}、简答题
- </div>
- <div
- class="question__desc"
- v-html="json.content"
- ></div>
- <div class="question__content">
- <div
- class="question-list textarea"
- v-if="
- !(
- question.ques[jsonIndex] &&
- (question.ques[jsonIndex].imageList
- .length ||
- question.ques[jsonIndex].text)
- )
- "
- >
- <el-input
- type="textarea"
- rows="5"
- v-model="json.ansText.text"
- resize="none"
- ></el-input>
- <div class="upload clearfix">
- <div
- class="upload__imgs"
- v-for="(img, imgIndex) in json.ansText
- .imageList"
- :key="imgIndex"
- >
- <img
- :src="$tools.splitImgHost(img, true)"
- alt=""
- />
- </div>
- <div class="upload__btn">
- <i class="el-icon-plus icon"></i>
- <p>上传图片</p>
- <input
- @change="
- uploadImgChild(
- $event,
- questionIndex,
- jsonIndex
- )
- "
- type="file"
- />
- </div>
- </div>
- </div>
- <div
- class="explain-list"
- v-if="
- question.ques[jsonIndex] &&
- (question.ques[jsonIndex].imageList
- .length ||
- question.ques[jsonIndex].text)
- "
- >
- <div class="explain-list__header">
- 我的答案:
- </div>
- <div class="explain-list__body">
- <div>
- {{ question.ques[jsonIndex].text }}
- </div>
- <div class="upload clearfix">
- <div
- class="upload__imgs"
- v-for="(img, imgIndex) in question.ques[
- jsonIndex
- ].imageList"
- :key="imgIndex"
- >
- <img
- :src="$tools.splitImgHost(img, true)"
- alt=""
- />
- </div>
- </div>
- </div>
- <div class="explain-list__header">
- 答案解析:
- </div>
- <div
- class="explain-list__body"
- v-html="question.analysisContent"
- ></div>
- </div>
- </div>
- <div class="question__btns">
- <div
- v-if="
- !(
- question.ques[jsonIndex] &&
- (question.ques[jsonIndex].imageList
- .length ||
- question.ques[jsonIndex].text)
- )
- "
- class="submit"
- @click="
- ansSubmitChild(
- question,
- questionIndex,
- jsonIndex
- )
- "
- >
- 确认答案
- </div>
- </div>
- </div>
- </el-tab-pane>
- </el-tabs>
- </div>
- </div>
- <div
- class="question"
- v-if="question.type == 5 && current == questionIndex"
- :key="questionIndex"
- >
- <div class="question__title">
- {{ questionIndex + 1 }}、简答题
- </div>
- <div
- class="question__desc"
- v-html="question.content"
- ></div>
- <div class="question__content">
- <div
- class="question-list textarea"
- v-if="
- !question.ques.imageList.length &&
- !question.ques.text
- "
- >
- <el-input
- type="textarea"
- rows="5"
- v-model="question.ansText.text"
- resize="none"
- ></el-input>
- <div class="upload clearfix">
- <div
- class="upload__imgs"
- v-for="(img, imgIndex) in question.ansText
- .imageList"
- :key="imgIndex"
- >
- <img
- :src="$tools.splitImgHost(img, true)"
- alt=""
- />
- </div>
- <div class="upload__btn">
- <i class="el-icon-plus icon"></i>
- <p>上传图片</p>
- <input
- @change="
- uploadImg($event, question, questionIndex)
- "
- type="file"
- />
- </div>
- </div>
- </div>
- <div
- class="explain-list"
- v-if="
- question.ques.imageList.length || question.ques.text
- "
- >
- <div class="explain-list__header">我的答案:</div>
- <div class="explain-list__body">
- <div>{{ question.ques.text }}</div>
- <div class="upload clearfix">
- <div
- class="upload__imgs"
- v-for="(img, imgIndex) in question.ques
- .imageList"
- :key="imgIndex"
- >
- <img
- :src="$tools.splitImgHost(img, true)"
- alt=""
- />
- </div>
- </div>
- </div>
- <div class="explain-list__header">答案解析:</div>
- <div
- class="explain-list__body"
- v-html="question.analysisContent"
- ></div>
- </div>
- </div>
- <div class="question__btns">
- <div
- v-if="
- !question.ques.imageList.length &&
- !question.ques.text
- "
- class="submit"
- @click="ansSubmit(question, questionIndex)"
- >
- 确认答案
- </div>
- </div>
- </div>
- </template>
- </div>
- <Collection-box
- :param="param"
- @sumit="getCollectInfo(current)"
- :showT="!collectList[current]"
- ></Collection-box>
- </div>
- <div class="right-box">
- <div class="right-box__header">
- <el-button
- type="primary"
- round
- plain
- size="small"
- class="back-btn"
- @click="$router.back(-1)"
- >返回</el-button
- >
- </div>
- <div class="right-box__footer">
- <el-button
- type="primary"
- :loading="loading"
- class="submit"
- @click="submit"
- >交卷</el-button
- >
- </div>
- <div class="right-box__header">答题卡</div>
- <div class="right-box__body">
- <div class="card">
- <div class="card__note">
- <div class="item">
- <div class="box green"></div>
- 正确
- </div>
- <div class="item">
- <div class="box red"></div>
- 错误
- </div>
- <div class="item">
- <div class="box blue"></div>
- 已做未评改
- </div>
- <div class="item">
- <div class="box yellow"></div>
- 少选
- </div>
- <div class="item">
- <div class="box white"></div>
- 未做
- </div>
- </div>
- <div class="card__content">
- <ul class="list">
- <li
- class="item white"
- v-for="(item, index) in questionList"
- :key="index"
- :class="{
- green: isRight(item, index),
- red: isWrong(item, index),
- yellow: isPart(item, index),
- blue: isOver(item, index),
- }"
- @click="changeIndex(index)"
- >
- {{ index + 1 }}
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </section>
- <ToolBar></ToolBar>
- <Footer></Footer>
- </div>
- </template>
- <script>
- import Footer from "@/components/footer/index";
- import Header from "@/components/header/index";
- import ToolBar from "@/components/toolbar/index";
- import CollectionBox from "@/components/common/CollectionBox.vue";
- import HeaderTabBox from "../../components/exam/HeaderTabBox.vue";
- import { mapMutations } from "vuex";
- export default {
- name: "BankExplain",
- components: {
- Footer,
- Header,
- ToolBar,
- CollectionBox,
- HeaderTabBox
- },
- data() {
- return {
- recordId: 0,
- questionIndex: 0,
- checked: false,
- activeName: "1",
- questionList: [],
- bankList: [],
- judge: ["正确", "错误"],
- ast: [
- "A",
- "B",
- "C",
- "D",
- "E",
- "F",
- "G",
- "H",
- "I",
- "J",
- "K",
- "L",
- "M",
- "N",
- "O",
- "P",
- "Q",
- "R",
- "S",
- "T",
- "U",
- "V",
- "W",
- "X",
- "Y",
- "Z",
- ],
- lastTime: 0, //剩余考试时长
- allTimes: 0, //总考试时长
- lastCount: 0,
- examId: 0,
- goodsId: 0,
- moduleId: 0,
- chapterId: 0,
- loading: false,
- current: 0,
- examData: {},
- orderGoodsId: "",
- collectList: [],
- isSubmit: false,
- postTimer: null,
- };
- },
- beforeDestroy() {
- clearInterval(this.postTimer);
- },
- beforeRouteLeave(to, from, next) {
- if (this.isSubmit) {
- //交卷
- next();
- return;
- }
- let ansCount = this.questionOverNum(true); //已答题数
- this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
- //所有题目答完
- if (this.lastCount == 0) {
- // this.testOver = true;
- this.$confirm("您还未交卷,确定结束做题吗?", "温馨提示", {
- confirmButtonText: "结束做题",
- cancelButtonText: "下次继续",
- type: "warning",
- })
- .then(() => {
- this.examSubmit();
- })
- .catch(() => {
- this.examRecordEdit();
- next();
- });
- //未答完
- } else {
- this.$confirm(
- `您还有${this.lastCount}道题未作答, 现在继续作答,还是下次继续?`,
- "温馨提示",
- {
- confirmButtonText: "继续作答",
- cancelButtonText: "下次继续",
- type: "warning",
- }
- )
- .then(() => {
- // confirmButton回调
- })
- .catch(() => {
- this.examRecordEdit();
- next();
- });
- // this.isLastCount = true;
- }
- },
- async mounted() {
- this.goodsId = this.$route.params.goodsId;
- this.examId = this.$route.query.examId;
- this.moduleId = this.$route.query.moduleId;
- this.chapterId = this.$route.query.chapterId;
- this.recordId = this.$route.query.recordId;
- this.orderGoodsId = this.$route.query.orderGoodsId || "";
- this.goodsQuestionList();
- },
- methods: {
- ...mapMutations(["setExamResult"]),
- toFixed(num) {
- if (num) {
- let str = String(num).indexOf(".");
- if (str != -1) {
- return +num.toFixed(2);
- } else {
- return num;
- }
- } else {
- return 0;
- }
- },
- /**
- * 是否做完所有题目
- */
- isDoOver() {
- let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
- if (this.questionList.length == questionOverNum) {
- //全部做完弹窗
- this.$nextTick(() => {
- this.$confirm("您已完成所有题目,快去交卷吧!", "提示", {
- confirmButtonText: "立即交卷",
- cancelButtonText: "暂不交卷",
- type: "warning",
- })
- .then(() => {
- this.examSubmit();
- })
- .catch(() => {});
- });
- }
- },
- /**
- * 请求题目列表
- */
- goodsQuestionList() {
- console.log("继续做题");
- this.$request.examReport(this.recordId).then((res) => {
- let json = JSON.parse(res.data.historyExamJson);
- this.examData = res.data;
- this.questionList = json;
- this.getCollectInfo(this.current);
- //5秒保存一下做题记录
- clearInterval(this.postTimer);
- this.postTimer = setInterval(() => {
- this.examRecordEdit();
- }, 5000);
- });
- },
- /**
- * @param {Object}
- * 单选点击确认
- */
- radioSelect(question, questionIndex, optionsId) {
- if (this.questionList[questionIndex].ques) return;
- this.$set(this.questionList[questionIndex], "ques", optionsId);
- this.isDoOver();
- },
- /**
- * @param {Object}
- * 案例单选点击
- */
- radioSelectChild(questionIndex, jsonIndex, optionsId) {
- if (this.questionList[questionIndex].ques[jsonIndex]) return;
- this.$set(this.questionList[questionIndex].ques, jsonIndex, optionsId);
- this.isDoOver();
- },
- /**
- * 多选点击确认
- */
- checkboxSubmit(question, questionIndex) {
- if (this.questionList[questionIndex].ques) return;
- let arr = [];
- this.questionList[questionIndex].jsonStr.forEach((item) => {
- if (item.checked) {
- arr.push(item.optionsId);
- }
- });
- if (!arr.length) {
- this.$message({
- type: "warning",
- message: "请选择答案",
- });
- return;
- }
- this.$set(this.questionList[questionIndex], "ques", arr);
- this.isDoOver();
- },
- /**
- * @param {Object}
- * 案例多选确认
- */
- checkboxSubmitChild(questionIndex, ansIndex) {
- if (this.questionList[questionIndex].ques[ansIndex]) return;
- let arr = [];
- this.questionList[questionIndex].jsonStr[ansIndex].optionsList.forEach(
- (item) => {
- if (item.checked) {
- arr.push(item.optionsId);
- }
- }
- );
- if (!arr.length) {
- this.$message({
- type: "warning",
- message: "请选择答案",
- });
- return;
- }
- this.$set(this.questionList[questionIndex].ques, ansIndex, arr);
- this.isDoOver();
- },
- /**
- * 判断点击确认
- */
- judgeSelect(question, questionIndex, index) {
- if (question.ques) return;
- this.$set(
- this.questionList[questionIndex],
- "ques",
- index == 0 ? "1" : "0"
- );
- this.isDoOver();
- },
- judgeSelectChild(questionIndex, jsonIndex, index) {
- console.log(this.questionList[questionIndex].ques[jsonIndex]);
- if (this.questionList[questionIndex].ques[jsonIndex]) return;
- this.$set(
- this.questionList[questionIndex].ques,
- jsonIndex,
- index == 0 ? "1" : "0"
- );
- this.isDoOver();
- },
- /**
- * 上传图片
- */
- uploadImg(e, question, questionIndex) {
- var file = e.target.files[0];
- if (file.size > 2 * 1024 * 1024) {
- this.$message.warn("图片不得大于2000kb");
- return;
- }
- var type = e.target.value.toLowerCase().split(".").splice(-1);
- if (
- type[0] != "jpg" &&
- type[0] != "png" &&
- type[0] != "jpeg" &&
- type[0] != "gif"
- ) {
- this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
- e.target.value = "";
- return;
- }
- this.$upload.upload(file, 0).then((res) => {
- question.ansText.imageList.push(res);
- });
- },
- /**
- * 案例上传图片
- */
- uploadImgChild(e, questionIndex, jsonIndex) {
- var file = e.target.files[0];
- if (file.size > 2 * 1024 * 1024) {
- this.$message.warn("图片不得大于2000kb");
- return;
- }
- var type = e.target.value.toLowerCase().split(".").splice(-1);
- if (
- type[0] != "jpg" &&
- type[0] != "png" &&
- type[0] != "jpeg" &&
- type[0] != "gif"
- ) {
- this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
- e.target.value = "";
- return;
- }
- this.$upload.upload(file, 0).then((res) => {
- this.questionList[questionIndex].jsonStr[
- jsonIndex
- ].ansText.imageList.push(res);
- });
- },
- /**
- * @param {Object} current
- * 获取收藏信息
- */
- getCollectInfo(current) {
- this.$request
- .getCollectInfo({
- examId: this.examId,
- questionId: this.questionList[current].questionId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- doMode: 1
- })
- .then((res) => {
- this.$set(this.collectList, current, res.data);
- })
- .catch((err) => {
- this.$set(this.collectList, current, false);
- });
- },
- isOver(item, index) {
- if (this.questionList[index].ques) {
- if (item.type == 4) {
- //案例题
- let isOver = item.jsonStr.every((jsonItem, indexs) => {
- if (
- jsonItem.type == 1 ||
- jsonItem.type == 2 ||
- jsonItem.type == 3
- ) {
- if (item.ques[indexs]) {
- return true;
- } else {
- return false;
- }
- } else if (jsonItem.type == 5) {
- if (
- item.ques[indexs] &&
- (item.ques[indexs].text || item.ques[indexs].imageList.length)
- ) {
- console.log("chil");
- return true;
- } else {
- return false;
- }
- }
- });
- if (isOver) {
- return true;
- } else {
- return false;
- }
- } else if (item.type == 5) {
- //简答题
- //每一项都相等
- if (item.ques && (item.ques.imageList.length || item.ques.text)) {
- return true;
- }
- //判断
- } else {
- return false;
- }
- } else {
- return false;
- }
- },
- ansSubmit(question, questionIndex) {
- if (!question.ansText.text && !question.ansText.imageList.length) {
- this.$message({
- type: "warning",
- message: "请输入内容或上传图片",
- });
- return;
- }
- question.ques.imageList = question.ansText.imageList;
- question.ques.text = question.ansText.text;
- this.isDoOver();
- console.log(question.ques);
- },
- ansSubmitChild(question, questionIndex, jsonIndex) {
- if (
- !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text &&
- !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.imageList
- .length
- ) {
- this.$message({
- type: "warning",
- message: "请输入内容或上传图片",
- });
- return;
- }
- this.$set(this.questionList[questionIndex].ques, jsonIndex, {
- imageList:
- this.questionList[questionIndex].jsonStr[jsonIndex].ansText
- .imageList || [],
- text:
- this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text ||
- "",
- });
- this.isDoOver();
- },
- changeIndex(index) {
- this.current = index;
- this.getCollectInfo(this.current);
- },
- nextQuestion() {
- if (this.current >= this.questionList.length - 1) {
- this.$message({
- type: "warning",
- message: "已经是最后一题了!",
- });
- return;
- }
- this.current++;
- this.getCollectInfo(this.current);
- },
- prevQuestion() {
- if (this.current == 0) {
- this.$message({
- type: "warning",
- message: "已经是第一题了!",
- });
- return;
- } else {
- this.current--;
- this.getCollectInfo(this.current);
- }
- },
- isRight(item, index) {
- //单选
- if (this.questionList[index].ques) {
- if (item.type == 1) {
- console.log(
- this.questionList[index].ques == this.questionList[index].ans
- );
- return this.questionList[index].ques == this.questionList[index].ans;
- //多选
- } else if (item.type == 2) {
- //每一项都相等
- return this.questionList[index].ans.every((item, i) => {
- return item == this.questionList[index].ques[i];
- });
- //判断
- } else if (item.type == 3) {
- return this.questionList[index].ques == this.questionList[index].ans;
- } else {
- return false;
- }
- } else {
- return false;
- }
- },
- isWrong(item, index) {
- if (this.questionList[index].ques) {
- //单选
- if (item.type == 1) {
- return this.questionList[index].ques != this.questionList[index].ans;
- //多选
- } else if (item.type == 2) {
- //每一项都相等
- return this.questionList[index].ques.some((item, i) => {
- return this.questionList[index].ans.indexOf(item) == -1;
- });
- //判断
- } else if (item.type == 3) {
- return this.questionList[index].ques != this.questionList[index].ans;
- } else {
- return false;
- }
- } else {
- return false;
- }
- },
- isPart(item, index) {
- if (this.questionList[index].ques) {
- if (item.type == 2) {
- let isWrong = this.questionList[index].ques.some((item, i) => {
- return this.questionList[index].ans.indexOf(item) == -1;
- });
- let isRight = this.questionList[index].ans.every((item, i) => {
- return item == this.questionList[index].ques[i];
- });
- if (!isRight && !isWrong) {
- return true;
- }
- }
- } else {
- return false;
- }
- },
- right(bankIndex, ansIndex, option) {
- if (
- this.questionList[bankIndex].ques[ansIndex] &&
- this.questionList[bankIndex].ans[ansIndex]
- ) {
- if (
- this.questionList[bankIndex].ques[ansIndex].indexOf(
- option.optionsId
- ) != -1 ||
- this.questionList[bankIndex].ans[ansIndex].indexOf(
- option.optionsId
- ) != -1
- ) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- },
- wrong(bankIndex, ansIndex, option) {
- if (
- this.questionList[bankIndex].ques[ansIndex] &&
- this.questionList[bankIndex].ans[ansIndex]
- ) {
- if (
- this.questionList[bankIndex].ques[ansIndex].indexOf(
- option.optionsId
- ) != -1 &&
- this.questionList[bankIndex].ans[ansIndex].indexOf(
- option.optionsId
- ) == -1
- ) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- },
- /**
- * 获取已经回答的题目数
- * hasSpecail (是否包含简答和案例)
- */
- questionOverNum(hasSpecail) {
- let count = 0;
- this.questionList.forEach((item) => {
- if (item.type == 1 || item.type == 2 || item.type == 3) {
- if (item.ques) {
- count++;
- }
- } else if (item.type == 4) {
- //案例题
- if (hasSpecail) {
- let isOver = item.jsonStr.every((jsonItem, index) => {
- if (
- jsonItem.type == 1 ||
- jsonItem.type == 2 ||
- jsonItem.type == 3
- ) {
- if (item.ques[index]) {
- return true;
- } else {
- return false;
- }
- } else if (jsonItem.type == 5) {
- if (
- item.ques[index] &&
- (item.ques[index].text || item.ques[index].imageList.length)
- ) {
- return true;
- } else {
- return false;
- }
- }
- });
- if (isOver) {
- count++;
- console.log(item, 444);
- }
- }
- } else if (item.type == 5) {
- //简答题
- if (hasSpecail) {
- if (item.ques && (item.ques.text || item.ques.imageList.length)) {
- console.log(5, item);
- count++;
- }
- }
- }
- });
- return count;
- },
- collect(state, index) {
- if (!state) {
- this.$request
- .collectQuestion({
- examId: this.examId,
- questionId: this.questionList[index].questionId,
- goodsId: this.goodsId || "",
- orderGoodsId: this.orderGoodsId,
- doMode:1
- })
- .then((res) => {
- this.$set(this.collectList, index, true);
- this.$message.success("收藏成功");
- this.getCollectInfo(index);
- });
- } else {
- this.$request
- .deleteCollectQuestion(this.collectList[index].collectQuestionId)
- .then((res) => {
- this.$set(this.collectList, index, false);
- this.$message.success("取消收藏成功");
- });
- }
- return;
- },
- submit() {
- let ansCount = this.questionOverNum(true); //已答题数
- this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
- //没有答完
- if (this.lastCount !== 0) {
- this.$confirm(
- `您还有${this.lastCount}道题未作答, 现在继续作答,还是下次继续?`,
- "提示",
- {
- confirmButtonText: "立即交卷",
- cancelButtonText: "继续做题",
- closeOnClickModal: false,
- closeOnPressEscape: false,
- distinguishCancelAndClose: false,
- showClose: false,
- }
- )
- .then((_) => {
- this.examSubmit();
- })
- .catch((_) => {});
- return;
- }
- this.examSubmit();
- },
- examSubmit() {
- clearInterval(this.postTimer);
- this.loading = true;
- let score = 0; //计算总分
- let reportStatus = 0;
- let number = 0; //做对的题目数量
- let doQuestionNum = 0; //做过的题目数量
- let allScore = 0; //总分
- let passScore = 0;
- let doWrongQuestionIds = []; //错题和未做题id(客观题)
- let doQuestionIds = []; //做过的题目id
- let rightQuestionIds = []; //做对的题目id
- let lessQuestionNum = 0;
- this.questionList.forEach((item, index) => {
- passScore = item.passScore;
- if (item.type == 1) {
- //正确
- if (item.ques == item.ans) {
- item.scoreResult = item.score;
- score += item.score;
- number++;
- rightQuestionIds.push(item.questionId);
- } else {
- //错误
- item.scoreResult = 0;
- if (item.ques) {
- doWrongQuestionIds.push(item.questionId);
- }
- }
- allScore += item.score;
- if (item.ques) {
- console.log(doQuestionNum, "单选");
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item.type == 2) {
- let isRight =
- item.ans &&
- item.ans.every((quesItem, quesIndex) => {
- if (item.ques) {
- return item.ques[quesIndex] == item.ans[quesIndex];
- } else {
- return false;
- }
- });
- if (isRight) {
- score += item.score;
- number++;
- item.scoreResult = item.score;
- rightQuestionIds.push(item.questionId);
- } else {
- let hasPart = false;
- let checkboxScore = 1; //获取单题总分数
- item.ques &&
- item.ques.forEach((ques, quesIndex) => {
- //选错一个全扣
- if (item.ques) {
- if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
- checkboxScore = 0;
- }
- } else {
- checkboxScore = 0;
- }
- });
- console.log(checkboxScore);
- //没选错
- if (checkboxScore) {
- checkboxScore = 0;
- item.ans.forEach((ans, quesIndex) => {
- //漏选扣一部分,对n题给n X partScore 分
- if (item.ques) {
- if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
- checkboxScore += item.partScore;
- hasPart = true;
- }
- } else {
- checkboxScore = 0;
- }
- });
- }
- if (!hasPart) {
- //0分
- item.scoreResult = 0;
- if (item.ques) {
- doWrongQuestionIds.push(item.questionId);
- }
- } else {
- //部分分
- // number++;
- lessQuestionNum++;
- // doWrongQuestionIds.push(item.questionId);
- item.scoreResult = checkboxScore;
- score += checkboxScore;
- // rightQuestionIds.push(item.questionId)
- }
- }
- allScore += item.score;
- if (item.ques && item.ques.length) {
- console.log(doQuestionNum, "多选");
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item.type == 3) {
- if (item.ques == item.ans) {
- item.scoreResult = item.score;
- score += item.score;
- number++;
- rightQuestionIds.push(item.questionId);
- } else {
- item.scoreResult = 0;
- if (item.ques) {
- doWrongQuestionIds.push(item.questionId);
- }
- }
- allScore += item.score;
- if (item.ques) {
- console.log(doQuestionNum, "判断");
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item.type == 4) {
- allScore += item.score;
- if (item.ques && item.ques.length) {
- console.log(doQuestionNum, "案例");
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item.type == 5) {
- allScore += item.score;
- if (
- item.ques &&
- (item.ques.imageList.length || item.ques.text.length)
- ) {
- console.log(doQuestionNum, "简答");
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- }
- });
- //大于分及格
- if (score >= passScore) {
- reportStatus = 1;
- } else {
- reportStatus = 0;
- }
- //交卷
- this.$request
- .examRecordEdit({
- orderGoodsId: this.orderGoodsId,
- examId: this.examId,
- goodsId: this.goodsId,
- reportStatus: reportStatus,
- totalScore: allScore,
- recordId: this.recordId,
- lessQuestionNum: lessQuestionNum,
- rightQuestionNum: number,
- status: 1,
- moduleExamId: this.moduleId || 0,
- chapterExamId: this.chapterId || 0,
- doQuestionIds: doQuestionIds.join(","),
- rightQuestionIds: rightQuestionIds.join(","),
- doQuestionNum: doQuestionNum,
- performance: score,
- historyExamJson: JSON.stringify(this.questionList),
- })
- .then((res) => {
- this.isSubmit = true;
- this.loading = false;
- this.$message({
- type: "success",
- message: "交卷成功",
- });
- setTimeout(() => {
- let result = {
- orderGoodsId: this.orderGoodsId,
- chapterId: this.chapterId,
- moduleId: this.moduleId,
- examId: this.examId,
- recordId: this.recordId,
- };
- console.log(result);
- this.setExamResult(result);
- this.$router.replace({
- path: "/bank-report/" + this.goodsId,
- query: {
- orderGoodsId: this.orderGoodsId,
- chapterId: this.chapterId,
- moduleId: this.moduleId,
- examId: this.examId,
- recordId: this.recordId,
- },
- });
- }, 1000);
- })
- .catch((err) => {
- this.loading = false;
- console.log(err, "err");
- });
- //错题集id提交(客观题)
- this.$request
- .examWrongRecord({
- orderGoodsId: this.orderGoodsId,
- examId: this.examId,
- goodsId: this.goodsId,
- questionIds: doWrongQuestionIds,
- recordId: this.recordId,
- type: 1,
- doMode: this.doMode
- })
- .then((res) => {})
- .catch((err) => {});
- },
- /**
- * 离开页面统计回答正确题数
- */
- examRecordEdit() {
- let number = 0;
- let score = 0;
- let doQuestionNum = 0;
- let doQuestionIds = []; //做过的题目id
- let lessQuestionNum = 0;
- this.questionList.forEach((item, index) => {
- if (item.type == 1) {
- if (item.ques == item.ans) {
- score += item.score;
- number++;
- }
- if (item.ques) {
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item.type == 2) {
- let isRight =
- item.ans &&
- item.ans.every((quesItem, quesIndex) => {
- if (item.ques) {
- return item.ques[quesIndex] == item.ans[quesIndex];
- } else {
- return false;
- }
- });
- if (isRight) {
- score += item.score;
- number++;
- } else {
- let hasPart = false;
- let checkboxScore = 1; //获取单题总分数
- item.ques &&
- item.ques.forEach((ques, quesIndex) => {
- //选错一个全扣
- if (item.ques) {
- if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
- checkboxScore = 0;
- }
- } else {
- checkboxScore = 0;
- }
- });
- console.log(checkboxScore);
- //没选错
- if (checkboxScore) {
- checkboxScore = 0;
- item.ans.forEach((ans, quesIndex) => {
- //漏选扣一部分,对n题给n X partScore 分
- if (item.ques) {
- if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
- checkboxScore += item.partScore;
- hasPart = true;
- }
- } else {
- checkboxScore = 0;
- }
- });
- }
- if (!hasPart) {
- //0分
- } else {
- //部分分
- // number++;
- lessQuestionNum++;
- score += checkboxScore;
- }
- }
- if (item.ques && item.ques.length) {
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item.type == 3) {
- if (item.ques == item.ans) {
- score += item.score;
- number++;
- }
- if (item.ques) {
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item == 4) {
- if (item.ques.length) {
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item.type == 5) {
- if (item.ques && (item.ques.imageList.length || item.ques.text)) {
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- }
- });
- this.$request
- .examRecordEdit({
- examId: this.examId,
- goodsId: this.goodsId,
- recordId: this.recordId,
- orderGoodsId: this.orderGoodsId,
- doQuestionIds: doQuestionIds.join(","),
- rightQuestionNum: number,
- lessQuestionNum: lessQuestionNum,
- moduleExamId: this.moduleId || 0,
- chapterExamId: this.chapterId || 0,
- status: 0,
- doQuestionNum: doQuestionNum,
- historyExamJson: JSON.stringify(this.questionList),
- })
- .then((res) => {});
- },
- },
- computed: {
- param() {
- return {
- examId: this.examId,
- questionId: this.questionList[this.current]
- ? this.questionList[this.current].questionId
- : undefined,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- collectQuestionId: this.collectList[this.current]
- ? this.collectList[this.current].collectQuestionId
- : undefined,
- };
- },
- },
- };
- </script>
- <!-- Add "scoped" attribute to limit CSS to this component only -->
- <style scoped lang="scss">
- .course-exam {
- .section {
- overflow: hidden;
- &__header {
- height: 20px;
- margin-top: 20px;
- }
- &__body {
- .explain-record {
- &__header {
- }
- &__body {
- margin-bottom: 20px;
- border: 1px solid #eee;
- .left-box {
- position: relative;
- float: left;
- width: 970px;
- min-height: 630px;
- border: 1px solid #eee;
- &__body {
- .question {
- padding: 12px 0 0 12px;
- display: flex;
- flex-direction: column;
- height: 100%;
- &__title {
- padding-left: 12px;
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- color: #333333;
- line-height: 24px;
- }
- &__desc {
- padding-left: 12px;
- margin-top: 20px;
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #666666;
- line-height: 24px;
- /deep/ img {
- max-width: 100% !important;
- }
- }
- &__content {
- /deep/ .el-tabs__item {
- height: 40px;
- line-height: 40px;
- }
- .question__content {
- height: auto;
- overflow: auto;
- }
- .question-list {
- padding: 24px 0 24px 24px;
- border-bottom: 1px solid #eee;
- .checkbox,
- .radio {
- cursor: pointer;
- margin-right: 24px;
- padding: 0 24px;
- display: flex;
- align-items: center;
- margin-top: 2px;
- min-height: 40px;
- padding-top: 10px;
- padding-bottom: 10px;
- background: #f5f9ff;
- border-radius: 8px;
- box-sizing: border-box;
- &.right {
- background: #37c65b;
- }
- &.wrong {
- background: #ff3a30;
- }
- }
- &.textarea {
- margin-right: 12px;
- .upload {
- margin-top: 10px;
- &__imgs {
- margin-right: 10px;
- width: 80px;
- height: 80px;
- background: #ffffff;
- border: 1px solid #eeeeee;
- border-radius: 4px;
- position: relative;
- display: flex;
- float: left;
- align-items: center;
- justify-content: center;
- img {
- max-width: 100%;
- max-height: 100%;
- }
- }
- &__btn {
- margin-right: 10px;
- width: 80px;
- height: 80px;
- background: #ffffff;
- border: 1px solid #eeeeee;
- border-radius: 4px;
- position: relative;
- display: flex;
- float: left;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- .icon {
- font-size: 20px;
- color: #3f8dfd;
- }
- p {
- font-size: 12px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #999999;
- line-height: 24px;
- }
- input {
- position: absolute;
- left: 0;
- top: 0;
- display: block;
- width: 100%;
- height: 100%;
- opacity: 0;
- }
- }
- }
- }
- /deep/
- .el-checkbox__input.is-checked
- + .el-checkbox__label {
- color: #000 !important;
- }
- /deep/
- .el-checkbox__input.is-disabled
- + span.el-checkbox__label {
- color: #000;
- }
- /deep/ .el-checkbox {
- white-space: normal;
- }
- }
- .answer-list {
- height: 40px;
- // border-top: 1px solid #eee;
- border-bottom: 1px solid #eee;
- // margin-top: 24px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 24px;
- &__left {
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #333333;
- line-height: 24px;
- }
- &__right {
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #333333;
- line-height: 24px;
- }
- }
- .explain-list {
- padding: 12px 24px;
- &__header {
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- color: #666666;
- line-height: 24px;
- }
- &__body {
- margin-top: 12px;
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #666666;
- line-height: 24px;
- }
- .upload {
- margin-top: 10px;
- &__imgs {
- margin-right: 10px;
- width: 80px;
- height: 80px;
- background: #ffffff;
- border: 1px solid #eeeeee;
- border-radius: 4px;
- position: relative;
- display: flex;
- float: left;
- align-items: center;
- justify-content: center;
- img {
- max-width: 100%;
- max-height: 100%;
- }
- }
- }
- }
- .question {
- padding-bottom: 58px;
- }
- }
- &__btns {
- position: relative;
- height: 32px;
- .submit {
- cursor: pointer;
- margin: 0 auto;
- width: 140px;
- height: 32px;
- color: #fff;
- background: #3f8dfd;
- box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
- border-radius: 16px;
- text-align: center;
- line-height: 32px;
- font-size: 16px;
- }
- .collect {
- width: 100px;
- cursor: pointer;
- position: absolute;
- right: 0;
- top: 5px;
- font-size: 12px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #3f8dfd;
- line-height: 24px;
- i {
- font-size: 20px;
- }
- }
- }
- }
- }
- &__footer {
- height: 40px;
- display: flex;
- justify-content: space-around;
- align-items: center;
- .btn {
- cursor: pointer;
- width: 140px;
- height: 32px;
- background: #ffffff;
- border: 1px solid #3f8dfd;
- border-radius: 16px;
- line-height: 32px;
- text-align: center;
- color: #3f8dfd;
- }
- }
- }
- .right-box {
- float: right;
- width: 299px;
- border-right: 1px solid #eee;
- &__header {
- height: 40px;
- line-height: 40px;
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- color: #333333;
- text-align: center;
- border-bottom: 1px solid #eeeeee;
- .back-btn {
- display: block;
- margin: 0 auto;
- width: 160px;
- }
- }
- &__body {
- height: 510px;
- border-bottom: 1px solid #eee;
- .card {
- &__note {
- display: flex;
- height: 64px;
- align-items: center;
- border-bottom: 1px solid #eee;
- flex-wrap: wrap;
- .item {
- display: flex;
- align-items: center;
- margin-left: 10px;
- width: 84px;
- font-size: 12px;
- .box {
- margin-right: 5px;
- width: 16px;
- height: 16px;
- border-radius: 4px;
- &.white {
- background: #ffffff;
- border: 1px solid #eeeeee;
- }
- &.green {
- background: #37c65b;
- }
- &.red {
- background: #ff3a30;
- }
- &.yellow {
- background: #ffc53d;
- }
- &.blue {
- background: #3f8dfd;
- }
- }
- }
- }
- &__content {
- height: 440px;
- overflow-y: scroll;
- &::-webkit-scrollbar {
- width: 6px;
- }
- &::-webkit-scrollbar-track {
- background-color: #fff;
- -webkit-border-radius: 2em;
- -moz-border-radius: 2em;
- border-radius: 2em;
- }
- &::-webkit-scrollbar-thumb {
- background-color: #eeeeee;
- -webkit-border-radius: 2em;
- -moz-border-radius: 2em;
- border-radius: 2em;
- }
- .list {
- display: flex;
- flex-wrap: wrap;
- .item {
- width: 40px;
- height: 40px;
- border-radius: 10px;
- text-align: center;
- line-height: 40px;
- margin-left: 16px;
- margin-top: 16px;
- cursor: pointer;
- &.white {
- line-height: 38px;
- color: #333333;
- background: #ffffff;
- border: 1px solid #eeeeee;
- }
- &.green {
- color: #fff;
- background: #37c65b;
- }
- &.red {
- color: #fff;
- background: #ff3a30;
- }
- &.blue {
- border: 1rpx solid #eeeeee;
- color: #fff;
- background: #3f8dfd;
- }
- &.yellow {
- background: #ffc53d;
- }
- &.disabled {
- cursor: not-allowed;
- line-height: 38px;
- color: #eeeeee;
- background: #ffffff;
- border: 1px solid #eeeeee;
- }
- }
- }
- }
- }
- }
- &__footer {
- border-bottom: 1px solid #eee;
- height: 40px;
- display: flex;
- align-items: center;
- justify-content: center;
- .submit {
- cursor: pointer;
- width: 140px;
- height: 32px;
- padding: 0;
- box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
- border-radius: 16px;
- line-height: 32px;
- text-align: center;
- font-size: 16px;
- }
- }
- }
- }
- }
- }
- }
- .take-photo {
- /deep/ .el-dialog__header {
- display: none;
- }
- /deep/ .el-dialog__body {
- padding: 0;
- overflow: unset;
- }
- &__close {
- cursor: pointer;
- position: absolute;
- right: 0;
- top: -28px;
- width: 24px;
- height: 24px;
- line-height: 24px;
- text-align: center;
- color: #eee;
- border: 1px solid #eee;
- border-radius: 50%;
- }
- &__header {
- height: 40px;
- border-bottom: 1px solid #eee;
- line-height: 40px;
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- color: #333333;
- padding-left: 24px;
- }
- &__body {
- height: 400px;
- padding: 40px 24px;
- .left-box {
- width: 336px;
- float: left;
- .title {
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- color: #ff3b30;
- line-height: 24px;
- }
- .content {
- font-size: 14px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #333333;
- line-height: 28px;
- margin-top: 32px;
- }
- }
- .right-box {
- float: right;
- width: 400px;
- height: 300px;
- video {
- width: 100%;
- height: 100%;
- }
- }
- }
- &__footer {
- height: 90px;
- border-top: 1px solid #eee;
- text-align: center;
- .take {
- display: inline-block;
- width: 200px;
- height: 40px;
- padding: 0;
- border-radius: 20px;
- text-align: center;
- line-height: 40px;
- margin: 24px auto;
- }
- }
- }
- }
- </style>
|