12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068 |
- <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 clearfix">
- <div class="left-box">
- <Header-tab-box :num="questionOverNum(true)" :allNum="lastCount" @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:
- bankType == 1 &&
- (item.optionsId == question.ques ||
- item.optionsId == question.ans),
- wrong:
- bankType == 1 &&
- item.optionsId == question.ques &&
- question.ques != question.ans,
- user_choose:
- bankType == 2 &&
- item.optionsId == question.ques,
- }" 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 :src="$tools.splitImgHost(item.imgUrl)" alt="" />
- </div>
- </div>
- </div>
- </div>
- <div class="answer-list" v-if="bankType == 1 && 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="bankType == 1 && 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 :src="$tools.splitImgHost(item.imgUrl)" alt="" />
- </div>
- </div>
- </el-checkbox>
- </div>
- <div class="question-list" v-if="question.ques">
- <el-checkbox :disabled="bankType == 2 ? false : true" class="checkbox" :class="{
- right:
- bankType == 1 &&
- (question.ques.indexOf(item.optionsId) != -1 ||
- question.ans.indexOf(item.optionsId) != -1),
- wrong:
- bankType == 1 &&
- question.ques.indexOf(item.optionsId) != -1 &&
- question.ans.indexOf(item.optionsId) == -1,
- user_choose:
- bankType == 2 &&
- question.ques.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 :src="$tools.splitImgHost(item.imgUrl)" alt="" />
- </div>
- </div>
- </el-checkbox>
- </div>
- <div class="answer-list" v-if="bankType == 1 && 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="bankType == 1 && 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="
- bankType == 2 || (bankType == 1 && !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:
- bankType == 1 && (index == question.ques || index == question.ans),
- wrong:
- bankType == 1 && (index == question.ques &&
- question.ques != question.ans),
- user_choose: bankType == 2 && (index == question.ques), -->
- <div class="radio" :class="{
- right:
- bankType == 1 &&
- (index == (question.ques == 1 ? 0 : 1) ||
- index != question.ans),
- wrong:
- bankType == 1 &&
- index == (question.ques == 1 ? 0 : 1) &&
- question.ques != question.ans,
- user_choose:
- bankType == 2 &&
- index == (question.ques == 1 ? 0 : 1),
- }" 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="answer-list" v-if="bankType == 1 && 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="bankType == 1 && 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:
- bankType == 1 &&
- (item.optionsId ==
- question.ques[jsonIndex] ||
- item.optionsId ==
- question.ans[jsonIndex]),
- wrong:
- bankType == 1 &&
- item.optionsId ==
- question.ques[jsonIndex] &&
- question.ques[jsonIndex] !=
- question.ans[jsonIndex],
- user_choose:
- bankType == 2 &&
- item.optionsId ==
- question.ques[jsonIndex],
- }" 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="answer-list" v-if="
- bankType == 1 && 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="
- bankType == 1 && 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="bankType == 2 ? false : true" class="checkbox" :class="{
- right:
- bankType == 1 &&
- (question.ques[jsonIndex].indexOf(
- item.optionsId
- ) != -1 ||
- question.ans[jsonIndex].indexOf(
- item.optionsId
- ) != -1),
- wrong:
- bankType == 1 &&
- question.ques[jsonIndex].indexOf(
- item.optionsId
- ) != -1 &&
- question.ans[jsonIndex].indexOf(
- item.optionsId
- ) == -1,
- user_choose:
- bankType == 2 &&
- question.ques[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="
- bankType == 1 && 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="
- bankType == 1 && 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="
- bankType == 2 ||
- (bankType == 1 && !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]">
- <!-- right:
- bankType == 1 && (index == question.ques[jsonIndex] ||
- index == question.ans[jsonIndex]),
- wrong:
- bankType == 1 &&
- index == question.ques[jsonIndex] &&
- question.ques[jsonIndex] !=
- question.ans[jsonIndex]),
- user_choose: bankType == 2 && (index == question.ques[jsonIndex]), -->
- <div class="radio" :class="{
- right:
- bankType == 1 &&
- (index ==
- (question.ques[jsonIndex] == 1
- ? 0
- : 1) ||
- index != question.ans[jsonIndex]),
- wrong:
- bankType == 1 &&
- index ==
- (question.ques[jsonIndex] == 1
- ? 0
- : 1) &&
- question.ques[jsonIndex] !=
- question.ans[jsonIndex],
- user_choose:
- bankType == 2 &&
- index ==
- (question.ques[jsonIndex] == 1
- ? 0
- : 1),
- }" 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="answer-list" v-if="
- bankType == 1 && question.ques[jsonIndex]
- ">
- <div class="answer-list__left">
- 正确答案:{{ ast[question.ans[jsonIndex]] }}
- </div>
- <div class="answer-list__left">
- 我的答案:{{
- ast[question.ques[jsonIndex]]
- }}
- </div>
- </div>
- <div class="explain-list" v-if="
- bankType == 1 && 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="
- bankType == 2 ||
- (bankType == 1 &&
- !(
- 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="
- bankType == 1 &&
- 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="
- bankType == 2 ||
- (bankType == 1 &&
- !(
- 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="
- bankType == 2 ||
- (bankType == 1 &&
- !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="
- bankType == 1 &&
- (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="
- bankType == 2 ||
- (bankType == 1 &&
- !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 class="title">答题卡</div>
- <div class="time" v-if="allTimes">
- {{ countdown(lastTime) }}
- </div>
- </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: bankType == 1 && isRight(item, index),
- red: bankType == 1 && isWrong(item, index),
- yellow: bankType == 1 && isPart(item, index),
- blue: bankType == 1 && isOver(item, index),
- check_ans: bankType == 2 && isCheck(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,
- tabIndex: "1",
- textarea: "",
- questionIndex: 0,
- checked: false,
- activeName: "1",
- questionList: [],
- goodsExamConfig: [],
- goodsDetail: {},
- 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",
- ],
- loading: false,
- needPhoto: false,
- lastTime: 0, //剩余考试时长
- allTimes: 0, //总考试时长
- lastCount: 0,
- examId: 0,
- goodsId: 0,
- moduleId: 0,
- chapterId: 0,
- current: 0,
- bankType: 0,
- timer: null,
- orderGoodsId: "",
- collectList: [],
- isSubmit: false,
- postTimer: null,
- number: '',
- };
- },
- async mounted() {
- this.orderGoodsId = this.$route.query.orderGoodsId || "";
- this.current = +this.$route.query.current || 0;
- this.goodsId = this.$route.params.goodsId;
- this.number = this.$route.query.number
- this.examId = this.$route.query.examId;
- this.moduleId = this.$route.query.moduleId;
- this.chapterId = this.$route.query.chapterId;
- if (!this.number) {
- await this.bankExam();
- this.goodsQuestionList();
- } else {
- // 随机练习
- this.goodsExamRandomList();
- }
- },
- beforeDestroy() {
- clearInterval(this.postTimer);
- clearInterval(this.timer);
- try {
- this.$msgbox.close();
- } catch (err) { }
- },
- beforeRouteLeave(to, from, next) {
- if (this.isSubmit) {
- //交卷
- next();
- } else {
- //离开
- if (this.bankType == 1) {
- console.log(1);
- let ansCount = this.questionOverNum(true); //已答题数
- this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
- //所有题目答完
- if (this.lastCount == 0) {
- // this.testOver = true;
- this.$nextTick(() => {
- this.$confirm("您还未交卷,确定结束做题吗?", "温馨提示", {
- confirmButtonText: "结束做题",
- cancelButtonText: "下次继续",
- type: "warning",
- })
- .then(() => {
- this.examSubmit();
- })
- .catch(() => {
- this.examRecordEdit();
- next();
- });
- });
- //未答完
- } else {
- this.$nextTick(() => {
- this.$confirm(
- `您还有${this.lastCount}道题未作答, 现在继续作答,还是下次继续?`,
- "温馨提示",
- {
- confirmButtonText: "继续作答",
- cancelButtonText: "下次继续",
- type: "warning",
- }
- )
- .then(() => {
- // confirmButton回调
- })
- .catch(() => {
- this.examRecordEdit();
- next();
- });
- });
- // this.isLastCount = true;
- }
- } else if (this.bankType == 2) {
- console.log(2);
- let ansCount = this.questionOverNum(true); //已答题数
- this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
- //所有题目答完
- if (this.lastCount == 0) {
- this.$nextTick(() => {
- this.$confirm(`您已完成所有题目,快去交卷吧!`, "温馨提示", {
- confirmButtonText: "立即交卷",
- cancelButtonText: "暂不交卷",
- type: "warning",
- })
- .then(() => {
- // confirmButton回调
- this.examSubmit();
- next();
- })
- .catch(() => { });
- });
- //未答完
- } else {
- this.$nextTick(() => {
- this.$confirm(
- `您当前正在测试,还剩${this.lastCount}道题未完成,离开视为交卷`,
- "温馨提示",
- {
- confirmButtonText: "继续离开",
- cancelButtonText: "暂不离开",
- type: "warning",
- }
- )
- .then(() => {
- // confirmButton回调
- console.log(12);
- this.leaveNow();
- next();
- })
- .catch(() => { });
- });
- }
- }
- }
- },
- 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;
- }
- },
- /**
- * @param {Object} current
- * 获取收藏信息
- */
- getCollectInfo(current) {
- this.$request
- .getCollectInfo({
- examId: this.examId,
- questionId: this.questionList[current].questionId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- doMode: this.doMode
- })
- .then((res) => {
- this.$set(this.collectList, current, res.data);
- })
- .catch((err) => {
- this.$set(this.collectList, current, false);
- });
- },
- /**
- * 是否做完所有题目
- */
- isDoOver() {
- let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
- if (this.questionList.length == questionOverNum) {
- //全部做完弹窗
- this.$nextTick(() => {
- this.$confirm(`您已完成所有题目,快去交卷吧!`, "温馨提示", {
- confirmButtonText: "立即交卷",
- cancelButtonText: "暂不交卷",
- type: "warning",
- })
- .then(() => {
- // confirmButton回调
- this.examSubmit();
- })
- .catch(() => { });
- });
- }
- },
- /**
- * 请求题目列表
- */
- goodsQuestionList() {
- this.$request
- .goodsQuestionList({
- examId: this.examId,
- })
- .then(async (res) => {
- if (!res.data.length) {
- this.$message({
- type: "warning",
- message: "该试卷暂无题目",
- });
- return;
- }
- this.allTimes = res.data[0].answerTime * 60;
- this.lastTime = res.data[0].answerTime && res.data[0].answerTime * 60;
- //考试时间到了自动交卷
- if (this.lastTime) {
- this.timer = setInterval(() => {
- if (this.lastTime <= 0) {
- clearInterval(this.timer);
- this.$confirm(`考试时间已到,系统将自动交卷`, "提示", {
- confirmButtonText: "立即交卷",
- closeOnClickModal: false,
- showCancelButton: false,
- closeOnPressEscape: false,
- distinguishCancelAndClose: false,
- showClose: false,
- });
- setTimeout(() => {
- try {
- this.$msgbox.close();
- } catch (err) { }
- this.examSubmit();
- }, 3000);
- return;
- }
- this.lastTime--;
- }, 1000);
- } else {
- }
- res.data.forEach((item, index) => {
- item.jsonStr = JSON.parse(item.jsonStr);
- if (item.type == 2) {
- //多选
- item.jsonStr.forEach((str) => {
- str.optionsId = "" + str.optionsId;
- });
- let arr = item.answerQuestion.split(",");
- arr.forEach((a, i) => {
- arr[i] = "" + a;
- });
- item.ans = arr;
- item.quesSelect = [];
- item.analysisContent &&
- (item.analysisContent = item.analysisContent.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- item.content &&
- (item.content = item.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- return;
- } else if (item.type == 5) {
- //简答题
- item.ansText = {
- text: "",
- imageList: [],
- };
- item.ques = {
- text: "",
- imageList: [],
- };
- item.analysisContent &&
- (item.analysisContent = item.analysisContent.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- item.content &&
- (item.content = item.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- return;
- } else if (item.type == 4) {
- //案例题
- console.log(item.jsonStr);
- item.ques = [];
- item.tabIndex = "0";
- let ansArr = [];
- item.jsonStr.forEach((json, index) => {
- if (json.type == 1) {
- ansArr[index] = json.answerQuestion;
- json.content &&
- (json.content = json.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- } else if (json.type == 2) {
- json.optionsList.forEach((str) => {
- str.optionsId = "" + str.optionsId;
- });
- let arr = json.answerQuestion.split(",");
- arr.forEach((a, i) => {
- arr[i] = "" + a;
- });
- ansArr[index] = arr;
- json.content &&
- (json.content = json.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- } else if (json.type == 3) {
- ansArr[index] = json.answerQuestion;
- json.content &&
- (json.content = json.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- } else if (json.type == 5) {
- ansArr[index] = {
- text: "",
- imageList: [],
- };
- json.ansText = {
- text: "",
- imageList: [],
- };
- json.ques = {
- text: "",
- imageList: [],
- };
- json.content &&
- (json.content = json.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- }
- });
- item.ans = ansArr;
- return;
- }
- item.analysisContent &&
- (item.analysisContent = item.analysisContent.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- item.content &&
- (item.content = item.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- item.ques = "";
- item.ans = item.answerQuestion;
- });
- this.questionList = res.data;
- this.lastCount = this.questionList.length;
- this.getCollectInfo(this.current);
- await this.examRecord();
- });
- },
- // 随机练习题目
- goodsExamRandomList() {
- this.$request
- .goodsExamRandomList({
- goodsId: this.goodsId,
- number: this.number,
- orderGoodsId: this.orderGoodsId
- }).then(async (res) => {
- if (!res.data.questionList.length) {
- this.$message({
- type: "warning",
- message: "该试卷暂无题目",
- });
- return;
- }
- this.examId = res.data.examId
- this.bankExam()
- res.data.questionList.forEach((item, index) => {
- item.jsonStr = JSON.parse(item.jsonStr);
- console.log(item.type, "item");
- if (item.type == 2) {
- //多选
- item.jsonStr.forEach((str) => {
- str.optionsId = "" + str.optionsId;
- });
- let arr = item.answerQuestion.split(",");
- arr.forEach((a, i) => {
- arr[i] = "" + a;
- });
- item.ans = arr;
- item.quesSelect = [];
- item.analysisContent &&
- (item.analysisContent = item.analysisContent.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- item.content &&
- (item.content = item.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- return;
- } else if (item.type == 5) {
- //简答题
- item.ansText = {
- text: "",
- imageList: [],
- };
- item.ques = {
- text: "",
- imageList: [],
- };
- item.analysisContent &&
- (item.analysisContent = item.analysisContent.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- item.content &&
- (item.content = item.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- return;
- } else if (item.type == 4) {
- //案例题
- console.log(item.jsonStr);
- item.ques = [];
- item.tabIndex = "0";
- let ansArr = [];
- item.jsonStr.forEach((json, index) => {
- if (json.type == 1) {
- ansArr[index] = json.answerQuestion;
- json.content &&
- (json.content = json.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- } else if (json.type == 2) {
- json.optionsList.forEach((str) => {
- str.optionsId = "" + str.optionsId;
- });
- let arr = json.answerQuestion.split(",");
- arr.forEach((a, i) => {
- arr[i] = "" + a;
- });
- ansArr[index] = arr;
- json.content &&
- (json.content = json.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- } else if (json.type == 3) {
- ansArr[index] = json.answerQuestion;
- json.content &&
- (json.content = json.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- } else if (json.type == 5) {
- ansArr[index] = {
- text: "",
- imageList: [],
- };
- json.ansText = {
- text: "",
- imageList: [],
- };
- json.ques = {
- text: "",
- imageList: [],
- };
- json.content &&
- (json.content = json.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- }
- });
- item.ans = ansArr;
- return;
- }
- item.analysisContent &&
- (item.analysisContent = item.analysisContent.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- item.content &&
- (item.content = item.content.replace(
- /<img/gi,
- '<img style="max-width:100%;"'
- ));
- item.ques = "";
- item.ans = item.answerQuestion;
- });
- this.questionList = res.data.questionList;
- this.lastCount = this.questionList.length;
- this.getCollectInfo(this.current);
- await this.examRecord();
- })
- },
- /**
- * 记录总题数,获取recordId
- * hasSpecial (是否包含简答和案例) true 包含 false 不包含
- */
- examRecord(hasSpecial) {
- return new Promise((resolve) => {
- let self = this;
- let questionList = 0;
- // if(!hasSpecial) {
- this.questionList.forEach((item, index) => {
- if (item.type == 1 || item.type == 2 || item.type == 3) {
- questionList++;
- }
- });
- // } else {
- // questionList = this.questionList.length;
- // }
- this.$request
- .examRecord({
- chapterExamId: this.chapterId || 0,
- moduleExamId: this.moduleId || 0,
- examId: this.examId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- totalQuestionNum: questionList,
- allQuestionNum: this.questionList.length,
- doMode: this.doMode
- })
- .then((res) => {
- this.recordId = res.data;
- if (this.bankType == 1) {
- this.examRecordEdit();
- clearInterval(this.postTimer);
- this.postTimer = setInterval(() => {
- this.examRecordEdit();
- }, 5000);
- }
- });
- });
- },
- /**
- * 离开页面统计回答正确题数
- */
- examRecordEdit() {
- clearInterval(this.postTimer);
- clearInterval(this.timer);
- 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,
- moduleExamId: this.moduleId || 0,
- chapterExamId: this.chapterId || 0,
- lessQuestionNum: lessQuestionNum,
- status: 0,
- doQuestionNum: doQuestionNum,
- historyExamJson: JSON.stringify(this.questionList),
- })
- .then((res) => {
- this.punchClock()
- });
- },
- /**
- * 获取试卷类型2考试,1练习
- */
- bankExam() {
- return new Promise((resolve) => {
- this.$request.bankExam(this.examId).then((res) => {
- this.bankType = res.data.doType;
- if (this.bankType == 2) {
- this.needBack = true;
- }
- resolve();
- });
- });
- },
- /**
- * @param {Object}
- * 单选点击确认
- */
- radioSelect(question, questionIndex, optionsId) {
- // if (this.questionList[questionIndex].ques) return;
- if (this.questionList[questionIndex].ques && this.bankType == 1) {
- return;
- }
- this.$set(this.questionList[questionIndex], "ques", optionsId);
- this.isDoOver();
- // if (
- // this.questionList[questionIndex].ques !=
- // this.questionList[questionIndex].ans
- // ) {
- // this.$request
- // .examWrongRecord({
- // orderGoodsId: this.orderGoodsId,
- // examId: this.examId,
- // goodsId: this.goodsId,
- // moduleExamId: this.moduleId || 0,
- // chapterExamId: this.chapterId || 0,
- // questionIds: [this.questionList[questionIndex].questionId],
- // recordId: this.recordId,
- // type 1,
- // })
- // .then((res) => {});
- // }
- },
- /**
- * @param {Object}
- * 案例单选点击
- */
- radioSelectChild(questionIndex, jsonIndex, optionsId) {
- // if (this.questionList[questionIndex].ques[jsonIndex]) return;
- if (
- this.questionList[questionIndex].ques[jsonIndex] &&
- this.bankType == 1
- ) {
- return;
- }
- this.$set(this.questionList[questionIndex].ques, jsonIndex, optionsId);
- this.isDoOver();
- },
- /**
- * 多选点击确认
- */
- checkboxSubmit(question, questionIndex) {
- // if (this.questionList[questionIndex].ques) return;
- if (this.questionList[questionIndex].ques && this.bankType == 1) {
- return;
- }
- let arr = [];
- this.questionList[questionIndex].jsonStr.forEach((item) => {
- if (item.checked) {
- arr.push(item.optionsId);
- }
- });
- if (!arr.length) {
- delete this.questionList[questionIndex].ques;
- this.$message({
- type: "warning",
- message: "请选择答案",
- });
- return;
- }
- this.$set(this.questionList[questionIndex], "ques", arr);
- this.isDoOver();
- // let isWrong = this.questionList[questionIndex].ques.some((item, i) => {
- // return this.questionList[questionIndex].ans.indexOf(item) == -1;
- // })
- // // 回答错误
- // if (isWrong) {
- // this.$request
- // .examWrongRecord({
- // orderGoodsId: this.orderGoodsId,
- // examId: this.examId,
- // goodsId: this.goodsId,
- // moduleExamId: this.moduleId || 0,
- // chapterExamId: this.chapterId || 0,
- // questionIds: [this.questionList[questionIndex].questionId],
- // recordId: this.recordId,
- // type 1,
- // })
- // .then((res) => {});
- // }
- },
- /**
- * @param {Object}
- * 案例多选确认
- */
- checkboxSubmitChild(questionIndex, ansIndex) {
- // if (this.questionList[questionIndex].ques[ansIndex]) return;
- if (
- this.questionList[questionIndex].ques[ansIndex] &&
- this.bankType == 1
- ) {
- return;
- }
- let arr = [];
- this.questionList[questionIndex].jsonStr[ansIndex].optionsList.forEach(
- (item) => {
- if (item.checked) {
- arr.push(item.optionsId);
- }
- }
- );
- if (!arr.length) {
- delete this.questionList[questionIndex].ques[ansIndex];
- this.$message({
- type: "warning",
- message: "请选择答案",
- });
- return;
- }
- this.$set(this.questionList[questionIndex].ques, ansIndex, arr);
- this.isDoOver();
- },
- /**
- * 判断点击确认
- */
- judgeSelect(question, questionIndex, index) {
- console.log(this.bankType)
- // if (question.ques) return;
- if (question.ques && this.bankType == 1) {
- return;
- }
- this.$set(
- this.questionList[questionIndex],
- "ques",
- index == 0 ? "1" : "0"
- );
- this.isDoOver();
- // if (
- // this.questionList[questionIndex].ques !=
- // this.questionList[questionIndex].ans
- // ) {
- // this.$request
- // .examWrongRecord({
- // orderGoodsId: this.orderGoodsId,
- // examId: this.examId,
- // goodsId: this.goodsId,
- // moduleExamId: this.moduleId || 0,
- // chapterExamId: this.chapterId || 0,
- // questionIds: [this.questionList[questionIndex].questionId],
- // recordId: this.recordId,
- // type 1,
- // })
- // .then((res) => {});
- // }
- },
- judgeSelectChild(questionIndex, jsonIndex, index) {
- console.log(this.questionList[questionIndex].ques[jsonIndex]);
- // if (this.questionList[questionIndex].ques[jsonIndex]) return;
- if (
- this.questionList[questionIndex].ques[jsonIndex] &&
- this.bankType == 1
- ) {
- 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);
- });
- },
- 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);
- }
- },
- isCheck(item, index) {
- if (this.questionList[index].ques) {
- return true;
- }
- },
- 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, 4441);
- }
- }
- } else if (item.type == 5) {
- //简答题
- if (hasSpecail) {
- if (item.ques && (item.ques.text || item.ques.imageList.length)) {
- console.log(5, item);
- count++;
- }
- }
- }
- });
- return count;
- },
- 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;
- }
- if (this.bankType == 2) {
- if (this.lastTime > 0) {
- let lastTime = this.countdown(this.lastTime);
- this.$confirm(`时间还剩余${lastTime},确定交卷吗?`, "提示", {
- confirmButtonText: "交卷",
- cancelButtonText: "继续答题",
- closeOnClickModal: false,
- closeOnPressEscape: false,
- distinguishCancelAndClose: false,
- showClose: false,
- })
- .then((_) => {
- this.examSubmit();
- })
- .catch((_) => { });
- return;
- }
- }
- this.examSubmit();
- },
- /**
- * @param {Object} second倒计时过滤器
- */
- countdown(second) {
- if (second) {
- let h = parseInt((second / 60 / 60) % 24); // 计算小时
- let m = parseInt((second / 60) % 60); // 计算分数
- let s = parseInt(second % 60); // 计算当前秒数
- if (h < 10) h = "0" + h;
- if (m < 10) m = "0" + m;
- if (s < 10) s = "0" + s;
- return h + ":" + m + ":" + s;
- } else {
- return "";
- }
- },
- /**
- * 交卷,跳转报告页
- */
- examSubmit() {
- this.loading = true;
- clearInterval(this.timer);
- clearInterval(this.postTimer);
- 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) {
- 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, "checkboxScore1");
- //没选错
- 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;
- }
- });
- }
- console.log(checkboxScore, "checkboxScore2");
- 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) {
- 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) {
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item.type == 4) {
- allScore += item.score;
- if (item.ques && item.ques.length) {
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item.type == 5) {
- allScore += item.score;
- if (item.ques && (item.ques.imageList.length || item.ques.text)) {
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- }
- });
- //大于及格
- if (score >= passScore) {
- reportStatus = 1;
- } else {
- reportStatus = 0;
- }
- // setTimeout(() => {
- // let result = {
- // chapterId: this.chapterId,
- // moduleId: this.moduleId,
- // examId: this.examId,
- // recordId: this.recordId,
- // };
- // this.setExamResult(result);
- // this.$router.push({
- // path: "/bank-report/" + this.goodsId,
- // });
- // }, 1000);
- // return;
- //交卷 /exam/record/edit
- this.$request
- .examRecordEdit({
- examId: this.examId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- reportStatus: reportStatus,
- 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,
- totalScore: allScore,
- examTime: parseInt(this.allTimes),
- doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
- historyExamJson: JSON.stringify(this.questionList),
- })
- .then((res) => {
- this.isSubmit = true;
- this.loading = false;
- this.$message({
- type: "success",
- message: "交卷成功",
- });
- this.punchClock()
- setTimeout(() => {
- this.$router.replace({
- path: "/bank-report/" + this.goodsId,
- query: {
- orderGoodsId: this.orderGoodsId,
- chapterId: this.chapterId,
- moduleId: this.moduleId,
- examId: this.examId,
- recordId: this.recordId,
- examType: this.examType
- },
- });
- }, 1000);
- })
- .catch((err) => {
- this.loading = false;
- });
- //错题集id提交(客观题)/exam/wwrong/record
- 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) => { });
- },
- // 打卡
- punchClock() {
- if (this.examType != 1) {
- return
- }
- this.$request.punchClock({
- chapterExamId: this.chapterId,
- examId: this.examId,
- goodsId: this.goodsId,
- moduleExamId: this.moduleId,
- recordTime: new Date(new Date().setHours(0, 0, 0, 0)) / 1000,
- })
- },
- /**
- * 交卷,不用跳转
- */
- leaveNow() {
- clearInterval(this.timer);
- clearInterval(this.postTimer);
- 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;
- console.log(111);
- 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) {
- 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, "checkboxScore1");
- //没选错
- 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;
- }
- });
- }
- console.log(checkboxScore, "checkboxScore2");
- 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) {
- 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) {
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item.type == 4) {
- allScore += item.score;
- if (item.ques && item.ques.length) {
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- } else if (item.type == 5) {
- allScore += item.score;
- if (item.ques && (item.ques.imageList.length || item.ques.text)) {
- doQuestionNum++;
- doQuestionIds.push(item.questionId);
- }
- }
- });
- //大于及格
- if (score >= passScore) {
- reportStatus = 1;
- } else {
- reportStatus = 0;
- }
- console.log(333);
- //交卷
- this.$request
- .examRecordEdit({
- examId: this.examId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- reportStatus: reportStatus,
- recordId: this.recordId,
- rightQuestionNum: number,
- lessQuestionNum: lessQuestionNum,
- status: 1,
- moduleExamId: this.moduleId || 0,
- chapterExamId: this.chapterId || 0,
- doQuestionIds: doQuestionIds.join(","),
- rightQuestionIds: rightQuestionIds.join(","),
- doQuestionNum: doQuestionNum,
- performance: score,
- totalScore: allScore,
- examTime: parseInt(this.allTimes),
- doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
- historyExamJson: JSON.stringify(this.questionList),
- })
- .then((res) => {
- this.punchClock()
- });
- console.log(222);
- //错题集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) => {
- this.loading = false;
- })
- .catch((err) => {
- this.loading = false;
- });
- },
- },
- 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,
- doMode: this.doMode
- };
- },
- doMode() {
- return this.number ? 2 : 1
- },
- examType() {
- return this.$route.query.examType || (this.number ? 2 : 0)
- }
- },
- };
- </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 {
- &__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;
- text-align: justify;
- /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;
- }
- &.user_choose {
- background: #007aff;
- }
- }
- &.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;
- }
- .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;
- padding: 0;
- 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;
- }
- }
- }
- }
- &__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;
- border-bottom: 1px solid #eeeeee;
- .back-btn {
- display: block;
- margin: 0 auto;
- width: 160px;
- }
- .title {
- float: left;
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- color: #333333;
- }
- .time {
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #666666;
- float: right;
- }
- }
- &__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,
- &.check_ans {
- 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,
- &.check_ans {
- 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>
|