index.vue 105 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068
  1. <template>
  2. <div class="course-exam">
  3. <Header></Header>
  4. <section class="section">
  5. <div class="container">
  6. <div class="section__header">
  7. <!-- <el-breadcrumb separator="/">
  8. <el-breadcrumb-item
  9. v-for="(item, index) in $route.matched"
  10. :key="index"
  11. :to="{ path: item.path }"
  12. >{{ item.name }}</el-breadcrumb-item
  13. >
  14. </el-breadcrumb> -->
  15. </div>
  16. <div class="section__body">
  17. <div class="explain-record">
  18. <div class="explain-record__body clearfix">
  19. <div class="left-box">
  20. <Header-tab-box :num="questionOverNum(true)" :allNum="lastCount" @prevQuestion="prevQuestion"
  21. @nextQuestion="nextQuestion">
  22. </Header-tab-box>
  23. <div class="left-box__body">
  24. <template v-for="(question, questionIndex) in questionList">
  25. <div class="question" v-if="question.type == 1 && current == questionIndex" :key="questionIndex">
  26. <div class="question__title">
  27. {{ questionIndex + 1 }}、单选题
  28. </div>
  29. <div class="question__desc" v-html="question.content"></div>
  30. <div class="question__content">
  31. <div class="question-list" v-if="!question.ques">
  32. <div class="radio" v-for="(item, index) in question.jsonStr" :key="index" @click="
  33. radioSelect(
  34. question,
  35. questionIndex,
  36. item.optionsId
  37. )
  38. ">
  39. <div>
  40. {{ ast[index] }}. {{ item.content }}
  41. <div v-if="item.imgUrl">
  42. <img style="max-width: 100%" :src="$tools.splitImgHost(item.imgUrl)" alt="" />
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="question-list" v-if="question.ques">
  48. <div class="radio" :class="{
  49. right:
  50. bankType == 1 &&
  51. (item.optionsId == question.ques ||
  52. item.optionsId == question.ans),
  53. wrong:
  54. bankType == 1 &&
  55. item.optionsId == question.ques &&
  56. question.ques != question.ans,
  57. user_choose:
  58. bankType == 2 &&
  59. item.optionsId == question.ques,
  60. }" v-for="(item, index) in question.jsonStr" :key="index" @click="
  61. radioSelect(
  62. question,
  63. questionIndex,
  64. item.optionsId
  65. )
  66. ">
  67. <div>
  68. {{ ast[index] }}. {{ item.content }}
  69. <div v-if="item.imgUrl">
  70. <img :src="$tools.splitImgHost(item.imgUrl)" alt="" />
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="answer-list" v-if="bankType == 1 && question.ques">
  76. <div class="answer-list__left">
  77. 正确答案:{{ ast[question.ans - 1] }}
  78. </div>
  79. <div class="answer-list__left">
  80. 我的答案:{{ ast[question.ques - 1] }}
  81. </div>
  82. </div>
  83. <div class="explain-list" v-if="bankType == 1 && question.ques">
  84. <div class="explain-list__header">答案解析:</div>
  85. <div class="explain-list__body" v-html="question.analysisContent"></div>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="question" v-if="question.type == 2 && current == questionIndex" :key="questionIndex">
  90. <div class="question__title">
  91. {{ questionIndex + 1 }}、多选题
  92. </div>
  93. <div class="question__desc" v-html="question.content"></div>
  94. <div class="question__content">
  95. <div class="question-list" v-if="!question.ques">
  96. <el-checkbox class="checkbox" v-for="(item, index) in question.jsonStr" :key="index"
  97. :label="item.optionsId" v-model="item.checked">
  98. <div>
  99. {{ ast[index] }}. {{ item.content }}
  100. <div v-if="item.imgUrl">
  101. <img :src="$tools.splitImgHost(item.imgUrl)" alt="" />
  102. </div>
  103. </div>
  104. </el-checkbox>
  105. </div>
  106. <div class="question-list" v-if="question.ques">
  107. <el-checkbox :disabled="bankType == 2 ? false : true" class="checkbox" :class="{
  108. right:
  109. bankType == 1 &&
  110. (question.ques.indexOf(item.optionsId) != -1 ||
  111. question.ans.indexOf(item.optionsId) != -1),
  112. wrong:
  113. bankType == 1 &&
  114. question.ques.indexOf(item.optionsId) != -1 &&
  115. question.ans.indexOf(item.optionsId) == -1,
  116. user_choose:
  117. bankType == 2 &&
  118. question.ques.indexOf(item.optionsId) != -1,
  119. }" v-for="(item, index) in question.jsonStr" :key="index" :label="item.optionsId"
  120. v-model="item.checked">
  121. <div>
  122. {{ ast[index] }}. {{ item.content }}
  123. <div v-if="item.imgUrl">
  124. <img :src="$tools.splitImgHost(item.imgUrl)" alt="" />
  125. </div>
  126. </div>
  127. </el-checkbox>
  128. </div>
  129. <div class="answer-list" v-if="bankType == 1 && question.ques">
  130. <div class="answer-list__left">
  131. 正确答案:
  132. <template v-for="ansItem in question.ans">{{
  133. ast[ansItem - 1]
  134. }}</template>
  135. </div>
  136. <div class="answer-list__left">
  137. 我的答案:
  138. <template v-for="quesItem in question.ques">{{
  139. ast[quesItem - 1]
  140. }}</template>
  141. </div>
  142. </div>
  143. <div class="explain-list" v-if="bankType == 1 && question.ques">
  144. <div class="explain-list__header">答案解析:</div>
  145. <div class="explain-list__body" v-html="question.analysisContent"></div>
  146. </div>
  147. </div>
  148. <div class="question__btns">
  149. <div v-if="
  150. bankType == 2 || (bankType == 1 && !question.ques)
  151. " class="submit" @click="checkboxSubmit(question, questionIndex)">
  152. 确认答案
  153. </div>
  154. </div>
  155. </div>
  156. <div class="question" v-if="question.type == 3 && current == questionIndex" :key="questionIndex">
  157. <div class="question__title">
  158. {{ questionIndex + 1 }}、判断题
  159. </div>
  160. <div class="question__desc" v-html="question.content"></div>
  161. <div class="question__content">
  162. <div class="question-list" v-if="!question.ques">
  163. <div class="radio" v-for="(item, index) in judge" :key="index"
  164. @click="judgeSelect(question, questionIndex, index)">
  165. <div>
  166. {{ ast[index] }}. {{ item }}
  167. <div v-if="item.imgUrl">
  168. <img style="max-width: 100%" :src="$tools.splitImgHost(item.imgUrl)" alt="" />
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="question-list" v-if="question.ques">
  174. <!-- right:
  175. bankType == 1 && (index == question.ques || index == question.ans),
  176. wrong:
  177. bankType == 1 && (index == question.ques &&
  178. question.ques != question.ans),
  179. user_choose: bankType == 2 && (index == question.ques), -->
  180. <div class="radio" :class="{
  181. right:
  182. bankType == 1 &&
  183. (index == (question.ques == 1 ? 0 : 1) ||
  184. index != question.ans),
  185. wrong:
  186. bankType == 1 &&
  187. index == (question.ques == 1 ? 0 : 1) &&
  188. question.ques != question.ans,
  189. user_choose:
  190. bankType == 2 &&
  191. index == (question.ques == 1 ? 0 : 1),
  192. }" v-for="(item, index) in judge" :key="index"
  193. @click="judgeSelect(question, questionIndex, index)">
  194. <div>
  195. {{ ast[index] }}. {{ item }}
  196. <div v-if="item.imgUrl">
  197. <img style="max-width: 100%" :src="$tools.splitImgHost(item.imgUrl)" alt="" />
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. <div class="answer-list" v-if="bankType == 1 && question.ques">
  203. <div class="answer-list__left">
  204. 正确答案:{{ ast[question.ans == 1 ? 0 : 1] }}
  205. </div>
  206. <div class="answer-list__left">
  207. 我的答案:{{ ast[question.ques == 1 ? 0 : 1] }}
  208. </div>
  209. </div>
  210. <div class="explain-list" v-if="bankType == 1 && question.ques">
  211. <div class="explain-list__header">答案解析:</div>
  212. <div class="explain-list__body" v-html="question.analysisContent"></div>
  213. </div>
  214. </div>
  215. </div>
  216. <div class="question" v-if="question.type == 4 && current == questionIndex" :key="questionIndex">
  217. <div class="question__title">
  218. {{ questionIndex + 1 }}、案例题
  219. </div>
  220. <div class="question__desc" v-html="question.content"></div>
  221. <div class="question__content">
  222. <el-tabs v-model="question.tabIndex">
  223. <el-tab-pane v-for="(json, jsonIndex) in question.jsonStr" :label="'问题' + (jsonIndex + 1)"
  224. :name="jsonIndex + ''" :key="jsonIndex">
  225. <div class="question" v-if="json.type == 1" :key="questionIndex">
  226. <div class="question__title">
  227. {{ jsonIndex + 1 }}、单选题
  228. </div>
  229. <div class="question__desc" v-html="json.content"></div>
  230. <div class="question__content">
  231. <div class="question-list" v-if="!question.ques[jsonIndex]">
  232. <div class="radio" v-for="(item, index) in json.optionsList" :key="index" @click="
  233. radioSelectChild(
  234. questionIndex,
  235. jsonIndex,
  236. item.optionsId
  237. )
  238. ">
  239. <div>
  240. {{ ast[index] }}. {{ item.content }}
  241. <div v-if="item.imgUrl">
  242. <img style="max-width: 100%" :src="
  243. $tools.splitImgHost(item.imgUrl)
  244. " alt="" />
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. <div class="question-list" v-if="question.ques[jsonIndex]">
  250. <div class="radio" :class="{
  251. right:
  252. bankType == 1 &&
  253. (item.optionsId ==
  254. question.ques[jsonIndex] ||
  255. item.optionsId ==
  256. question.ans[jsonIndex]),
  257. wrong:
  258. bankType == 1 &&
  259. item.optionsId ==
  260. question.ques[jsonIndex] &&
  261. question.ques[jsonIndex] !=
  262. question.ans[jsonIndex],
  263. user_choose:
  264. bankType == 2 &&
  265. item.optionsId ==
  266. question.ques[jsonIndex],
  267. }" v-for="(item, index) in json.optionsList" :key="index" @click="
  268. radioSelectChild(
  269. questionIndex,
  270. jsonIndex,
  271. item.optionsId
  272. )
  273. ">
  274. <div>
  275. {{ ast[index] }}. {{ item.content }}
  276. <div v-if="item.imgUrl">
  277. <img style="max-width: 100%" :src="
  278. $tools.splitImgHost(item.imgUrl)
  279. " alt="" />
  280. </div>
  281. </div>
  282. </div>
  283. </div>
  284. <div class="answer-list" v-if="
  285. bankType == 1 && question.ques[jsonIndex]
  286. ">
  287. <div class="answer-list__left">
  288. 正确答案:{{
  289. ast[question.ans[jsonIndex] - 1]
  290. }}
  291. </div>
  292. <div class="answer-list__left">
  293. 我的答案:{{
  294. ast[question.ques[jsonIndex] - 1]
  295. }}
  296. </div>
  297. </div>
  298. <div class="explain-list" v-if="
  299. bankType == 1 && question.ques[jsonIndex]
  300. ">
  301. <div class="explain-list__header">
  302. 答案解析:
  303. </div>
  304. <div class="explain-list__body" v-html="json.analysisContent"></div>
  305. </div>
  306. </div>
  307. <div class="question__btns"></div>
  308. </div>
  309. <div class="question" v-if="json.type == 2" :key="jsonIndex">
  310. <div class="question__title">
  311. {{ jsonIndex + 1 }}、多选题
  312. </div>
  313. <div class="question__desc" v-html="json.content"></div>
  314. <div class="question__content">
  315. <div class="question-list" v-if="!question.ques[jsonIndex]">
  316. <el-checkbox class="checkbox" v-for="(item, index) in json.optionsList" :key="index"
  317. :label="item.optionsId" v-model="item.checked">
  318. <div>
  319. {{ ast[index] }}. {{ item.content }}
  320. <div v-if="item.imgUrl">
  321. <img style="max-width: 100%" :src="
  322. $tools.splitImgHost(item.imgUrl)
  323. " alt="" />
  324. </div>
  325. </div>
  326. </el-checkbox>
  327. </div>
  328. <div class="question-list" v-if="question.ques[jsonIndex]">
  329. <el-checkbox :disabled="bankType == 2 ? false : true" class="checkbox" :class="{
  330. right:
  331. bankType == 1 &&
  332. (question.ques[jsonIndex].indexOf(
  333. item.optionsId
  334. ) != -1 ||
  335. question.ans[jsonIndex].indexOf(
  336. item.optionsId
  337. ) != -1),
  338. wrong:
  339. bankType == 1 &&
  340. question.ques[jsonIndex].indexOf(
  341. item.optionsId
  342. ) != -1 &&
  343. question.ans[jsonIndex].indexOf(
  344. item.optionsId
  345. ) == -1,
  346. user_choose:
  347. bankType == 2 &&
  348. question.ques[jsonIndex].indexOf(
  349. item.optionsId
  350. ) != -1,
  351. }" v-for="(item, index) in json.optionsList" :key="index" :label="item.optionsId"
  352. v-model="item.checked">
  353. <div>
  354. {{ ast[index] }}. {{ item.content }}
  355. <div v-if="item.imgUrl">
  356. <img style="max-width: 100%" :src="
  357. $tools.splitImgHost(item.imgUrl)
  358. " alt="" />
  359. </div>
  360. </div>
  361. </el-checkbox>
  362. </div>
  363. <div class="answer-list" v-if="
  364. bankType == 1 && question.ques[jsonIndex]
  365. ">
  366. <div class="answer-list__left">
  367. 正确答案:
  368. <template v-for="ansItem in question.ans[jsonIndex]">{{ ast[ansItem - 1]
  369. }}</template>
  370. </div>
  371. <div class="answer-list__left">
  372. 我的答案:
  373. <template v-for="quesItem in question.ques[
  374. jsonIndex
  375. ]">{{ ast[quesItem - 1] }}</template>
  376. </div>
  377. </div>
  378. <div class="explain-list" v-if="
  379. bankType == 1 && question.ques[jsonIndex]
  380. ">
  381. <div class="explain-list__header">
  382. 答案解析:
  383. </div>
  384. <div class="explain-list__body" v-html="json.analysisContent"></div>
  385. </div>
  386. </div>
  387. <div class="question__btns">
  388. <div v-if="
  389. bankType == 2 ||
  390. (bankType == 1 && !question.ques[jsonIndex])
  391. " class="submit" @click="
  392. checkboxSubmitChild(
  393. questionIndex,
  394. jsonIndex
  395. )
  396. ">
  397. 确认答案
  398. </div>
  399. </div>
  400. </div>
  401. <div class="question" v-if="json.type == 3" :key="jsonIndex">
  402. <div class="question__title">
  403. {{ jsonIndex + 1 }}、判断题
  404. </div>
  405. <div class="question__desc" v-html="json.content"></div>
  406. <div class="question__content">
  407. <div class="question-list" v-if="!question.ques[jsonIndex]">
  408. <div class="radio" v-for="(item, index) in judge" :key="index" @click="
  409. judgeSelectChild(
  410. questionIndex,
  411. jsonIndex,
  412. index
  413. )
  414. ">
  415. <div>
  416. {{ ast[index] }}. {{ item }}
  417. <div v-if="item.imgUrl">
  418. <img style="max-width: 100%" :src="
  419. $tools.splitImgHost(item.imgUrl)
  420. " alt="" />
  421. </div>
  422. </div>
  423. </div>
  424. </div>
  425. <div class="question-list" v-if="question.ques[jsonIndex]">
  426. <!-- right:
  427. bankType == 1 && (index == question.ques[jsonIndex] ||
  428. index == question.ans[jsonIndex]),
  429. wrong:
  430. bankType == 1 &&
  431. index == question.ques[jsonIndex] &&
  432. question.ques[jsonIndex] !=
  433. question.ans[jsonIndex]),
  434. user_choose: bankType == 2 && (index == question.ques[jsonIndex]), -->
  435. <div class="radio" :class="{
  436. right:
  437. bankType == 1 &&
  438. (index ==
  439. (question.ques[jsonIndex] == 1
  440. ? 0
  441. : 1) ||
  442. index != question.ans[jsonIndex]),
  443. wrong:
  444. bankType == 1 &&
  445. index ==
  446. (question.ques[jsonIndex] == 1
  447. ? 0
  448. : 1) &&
  449. question.ques[jsonIndex] !=
  450. question.ans[jsonIndex],
  451. user_choose:
  452. bankType == 2 &&
  453. index ==
  454. (question.ques[jsonIndex] == 1
  455. ? 0
  456. : 1),
  457. }" v-for="(item, index) in judge" :key="index" @click="
  458. judgeSelectChild(
  459. questionIndex,
  460. jsonIndex,
  461. index
  462. )
  463. ">
  464. <div>
  465. {{ ast[index] }}. {{ item }}
  466. <div v-if="item.imgUrl">
  467. <img style="max-width: 100%" :src="
  468. $tools.splitImgHost(item.imgUrl)
  469. " alt="" />
  470. </div>
  471. </div>
  472. </div>
  473. </div>
  474. <div class="answer-list" v-if="
  475. bankType == 1 && question.ques[jsonIndex]
  476. ">
  477. <div class="answer-list__left">
  478. 正确答案:{{ ast[question.ans[jsonIndex]] }}
  479. </div>
  480. <div class="answer-list__left">
  481. 我的答案:{{
  482. ast[question.ques[jsonIndex]]
  483. }}
  484. </div>
  485. </div>
  486. <div class="explain-list" v-if="
  487. bankType == 1 && question.ques[jsonIndex]
  488. ">
  489. <div class="explain-list__header">
  490. 答案解析:
  491. </div>
  492. <div class="explain-list__body" v-html="json.analysisContent"></div>
  493. </div>
  494. </div>
  495. <div class="question__btns"></div>
  496. </div>
  497. <div class="question" v-if="json.type == 5" :key="jsonIndex">
  498. <div class="question__title">
  499. {{ jsonIndex + 1 }}、简答题
  500. </div>
  501. <div class="question__desc" v-html="json.content"></div>
  502. <div class="question__content">
  503. <div class="question-list textarea" v-if="
  504. bankType == 2 ||
  505. (bankType == 1 &&
  506. !(
  507. question.ques[jsonIndex] &&
  508. (question.ques[jsonIndex].imageList
  509. .length ||
  510. question.ques[jsonIndex].text)
  511. ))
  512. ">
  513. <el-input type="textarea" rows="5" v-model="json.ansText.text" resize="none">
  514. </el-input>
  515. <div class="upload clearfix">
  516. <div class="upload__imgs" v-for="(img, imgIndex) in json.ansText
  517. .imageList" :key="imgIndex">
  518. <img :src="$tools.splitImgHost(img, true)" alt="" />
  519. </div>
  520. <div class="upload__btn">
  521. <i class="el-icon-plus icon"></i>
  522. <p>上传图片</p>
  523. <input @change="
  524. uploadImgChild(
  525. $event,
  526. questionIndex,
  527. jsonIndex
  528. )
  529. " type="file" />
  530. </div>
  531. </div>
  532. </div>
  533. <div class="explain-list" v-if="
  534. bankType == 1 &&
  535. question.ques[jsonIndex] &&
  536. (question.ques[jsonIndex].imageList
  537. .length ||
  538. question.ques[jsonIndex].text)
  539. ">
  540. <div class="explain-list__header">
  541. 我的答案:
  542. </div>
  543. <div class="explain-list__body">
  544. <div>
  545. {{ question.ques[jsonIndex].text }}
  546. </div>
  547. <div class="upload clearfix">
  548. <div class="upload__imgs" v-for="(img, imgIndex) in question.ques[
  549. jsonIndex
  550. ].imageList" :key="imgIndex">
  551. <img :src="$tools.splitImgHost(img, true)" alt="" />
  552. </div>
  553. </div>
  554. </div>
  555. <div class="explain-list__header">
  556. 答案解析:
  557. </div>
  558. <div class="explain-list__body" v-html="question.analysisContent"></div>
  559. </div>
  560. </div>
  561. <div class="question__btns">
  562. <div v-if="
  563. bankType == 2 ||
  564. (bankType == 1 &&
  565. !(
  566. question.ques[jsonIndex] &&
  567. (question.ques[jsonIndex].imageList
  568. .length ||
  569. question.ques[jsonIndex].text)
  570. ))
  571. " class="submit" @click="
  572. ansSubmitChild(
  573. question,
  574. questionIndex,
  575. jsonIndex
  576. )
  577. ">
  578. 确认答案
  579. </div>
  580. </div>
  581. </div>
  582. </el-tab-pane>
  583. </el-tabs>
  584. </div>
  585. </div>
  586. <div class="question" v-if="question.type == 5 && current == questionIndex" :key="questionIndex">
  587. <div class="question__title">
  588. {{ questionIndex + 1 }}、简答题
  589. </div>
  590. <div class="question__desc" v-html="question.content"></div>
  591. <div class="question__content">
  592. <div class="question-list textarea" v-if="
  593. bankType == 2 ||
  594. (bankType == 1 &&
  595. !question.ques.imageList.length &&
  596. !question.ques.text)
  597. ">
  598. <el-input type="textarea" rows="5" v-model="question.ansText.text" resize="none"></el-input>
  599. <div class="upload clearfix">
  600. <div class="upload__imgs" v-for="(img, imgIndex) in question.ansText
  601. .imageList" :key="imgIndex">
  602. <img :src="$tools.splitImgHost(img, true)" alt="" />
  603. </div>
  604. <div class="upload__btn">
  605. <i class="el-icon-plus icon"></i>
  606. <p>上传图片</p>
  607. <input @change="
  608. uploadImg($event, question, questionIndex)
  609. " type="file" />
  610. </div>
  611. </div>
  612. </div>
  613. <div class="explain-list" v-if="
  614. bankType == 1 &&
  615. (question.ques.imageList.length ||
  616. question.ques.text)
  617. ">
  618. <div class="explain-list__header">我的答案:</div>
  619. <div class="explain-list__body">
  620. <div>{{ question.ques.text }}</div>
  621. <div class="upload clearfix">
  622. <div class="upload__imgs" v-for="(img, imgIndex) in question.ques
  623. .imageList" :key="imgIndex">
  624. <img :src="$tools.splitImgHost(img, true)" alt="" />
  625. </div>
  626. </div>
  627. </div>
  628. <div class="explain-list__header">答案解析:</div>
  629. <div class="explain-list__body" v-html="question.analysisContent"></div>
  630. </div>
  631. </div>
  632. <div class="question__btns">
  633. <div v-if="
  634. bankType == 2 ||
  635. (bankType == 1 &&
  636. !question.ques.imageList.length &&
  637. !question.ques.text)
  638. " class="submit" @click="ansSubmit(question, questionIndex)">
  639. 确认答案
  640. </div>
  641. </div>
  642. </div>
  643. </template>
  644. </div>
  645. <Collection-box :param="param" @sumit="getCollectInfo(current)" :showT="!collectList[current]">
  646. </Collection-box>
  647. </div>
  648. <div class="right-box">
  649. <div class="right-box__header">
  650. <el-button type="primary" round plain size="small" class="back-btn" @click="$router.back(-1)">返回
  651. </el-button>
  652. </div>
  653. <div class="right-box__footer">
  654. <el-button type="primary" :loading="loading" class="submit" @click="submit">交卷</el-button>
  655. </div>
  656. <div class="right-box__header">
  657. <div class="title">答题卡</div>
  658. <div class="time" v-if="allTimes">
  659. {{ countdown(lastTime) }}
  660. </div>
  661. </div>
  662. <div class="right-box__body">
  663. <div class="card">
  664. <div class="card__note">
  665. <div class="item">
  666. <div class="box green"></div>
  667. 正确
  668. </div>
  669. <div class="item">
  670. <div class="box red"></div>
  671. 错误
  672. </div>
  673. <div class="item">
  674. <div class="box blue"></div>
  675. 已做未评改
  676. </div>
  677. <div class="item">
  678. <div class="box yellow"></div>
  679. 少选
  680. </div>
  681. <div class="item">
  682. <div class="box white"></div>
  683. 未做
  684. </div>
  685. </div>
  686. <div class="card__content">
  687. <ul class="list">
  688. <li class="item white" v-for="(item, index) in questionList" :key="index" :class="{
  689. green: bankType == 1 && isRight(item, index),
  690. red: bankType == 1 && isWrong(item, index),
  691. yellow: bankType == 1 && isPart(item, index),
  692. blue: bankType == 1 && isOver(item, index),
  693. check_ans: bankType == 2 && isCheck(item, index),
  694. }" @click="changeIndex(index)">
  695. {{ index + 1 }}
  696. </li>
  697. </ul>
  698. </div>
  699. </div>
  700. </div>
  701. </div>
  702. </div>
  703. </div>
  704. </div>
  705. </div>
  706. </section>
  707. <ToolBar></ToolBar>
  708. <Footer></Footer>
  709. </div>
  710. </template>
  711. <script>
  712. import Footer from "@/components/footer/index";
  713. import Header from "@/components/header/index";
  714. import ToolBar from "@/components/toolbar/index";
  715. import CollectionBox from "@/components/common/CollectionBox.vue";
  716. import HeaderTabBox from "../../components/exam/HeaderTabBox.vue";
  717. import { mapMutations } from "vuex";
  718. export default {
  719. name: "BankExplain",
  720. components: {
  721. Footer,
  722. Header,
  723. ToolBar,
  724. CollectionBox,
  725. HeaderTabBox,
  726. },
  727. data() {
  728. return {
  729. recordId: 0,
  730. tabIndex: "1",
  731. textarea: "",
  732. questionIndex: 0,
  733. checked: false,
  734. activeName: "1",
  735. questionList: [],
  736. goodsExamConfig: [],
  737. goodsDetail: {},
  738. bankList: [],
  739. judge: ["正确", "错误"],
  740. ast: [
  741. "A",
  742. "B",
  743. "C",
  744. "D",
  745. "E",
  746. "F",
  747. "G",
  748. "H",
  749. "I",
  750. "J",
  751. "K",
  752. "L",
  753. "M",
  754. "N",
  755. "O",
  756. "P",
  757. "Q",
  758. "R",
  759. "S",
  760. "T",
  761. "U",
  762. "V",
  763. "W",
  764. "X",
  765. "Y",
  766. "Z",
  767. ],
  768. loading: false,
  769. needPhoto: false,
  770. lastTime: 0, //剩余考试时长
  771. allTimes: 0, //总考试时长
  772. lastCount: 0,
  773. examId: 0,
  774. goodsId: 0,
  775. moduleId: 0,
  776. chapterId: 0,
  777. current: 0,
  778. bankType: 0,
  779. timer: null,
  780. orderGoodsId: "",
  781. collectList: [],
  782. isSubmit: false,
  783. postTimer: null,
  784. number: '',
  785. };
  786. },
  787. async mounted() {
  788. this.orderGoodsId = this.$route.query.orderGoodsId || "";
  789. this.current = +this.$route.query.current || 0;
  790. this.goodsId = this.$route.params.goodsId;
  791. this.number = this.$route.query.number
  792. this.examId = this.$route.query.examId;
  793. this.moduleId = this.$route.query.moduleId;
  794. this.chapterId = this.$route.query.chapterId;
  795. if (!this.number) {
  796. await this.bankExam();
  797. this.goodsQuestionList();
  798. } else {
  799. // 随机练习
  800. this.goodsExamRandomList();
  801. }
  802. },
  803. beforeDestroy() {
  804. clearInterval(this.postTimer);
  805. clearInterval(this.timer);
  806. try {
  807. this.$msgbox.close();
  808. } catch (err) { }
  809. },
  810. beforeRouteLeave(to, from, next) {
  811. if (this.isSubmit) {
  812. //交卷
  813. next();
  814. } else {
  815. //离开
  816. if (this.bankType == 1) {
  817. console.log(1);
  818. let ansCount = this.questionOverNum(true); //已答题数
  819. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  820. //所有题目答完
  821. if (this.lastCount == 0) {
  822. // this.testOver = true;
  823. this.$nextTick(() => {
  824. this.$confirm("您还未交卷,确定结束做题吗?", "温馨提示", {
  825. confirmButtonText: "结束做题",
  826. cancelButtonText: "下次继续",
  827. type: "warning",
  828. })
  829. .then(() => {
  830. this.examSubmit();
  831. })
  832. .catch(() => {
  833. this.examRecordEdit();
  834. next();
  835. });
  836. });
  837. //未答完
  838. } else {
  839. this.$nextTick(() => {
  840. this.$confirm(
  841. `您还有${this.lastCount}道题未作答, 现在继续作答,还是下次继续?`,
  842. "温馨提示",
  843. {
  844. confirmButtonText: "继续作答",
  845. cancelButtonText: "下次继续",
  846. type: "warning",
  847. }
  848. )
  849. .then(() => {
  850. // confirmButton回调
  851. })
  852. .catch(() => {
  853. this.examRecordEdit();
  854. next();
  855. });
  856. });
  857. // this.isLastCount = true;
  858. }
  859. } else if (this.bankType == 2) {
  860. console.log(2);
  861. let ansCount = this.questionOverNum(true); //已答题数
  862. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  863. //所有题目答完
  864. if (this.lastCount == 0) {
  865. this.$nextTick(() => {
  866. this.$confirm(`您已完成所有题目,快去交卷吧!`, "温馨提示", {
  867. confirmButtonText: "立即交卷",
  868. cancelButtonText: "暂不交卷",
  869. type: "warning",
  870. })
  871. .then(() => {
  872. // confirmButton回调
  873. this.examSubmit();
  874. next();
  875. })
  876. .catch(() => { });
  877. });
  878. //未答完
  879. } else {
  880. this.$nextTick(() => {
  881. this.$confirm(
  882. `您当前正在测试,还剩${this.lastCount}道题未完成,离开视为交卷`,
  883. "温馨提示",
  884. {
  885. confirmButtonText: "继续离开",
  886. cancelButtonText: "暂不离开",
  887. type: "warning",
  888. }
  889. )
  890. .then(() => {
  891. // confirmButton回调
  892. console.log(12);
  893. this.leaveNow();
  894. next();
  895. })
  896. .catch(() => { });
  897. });
  898. }
  899. }
  900. }
  901. },
  902. methods: {
  903. ...mapMutations(["setExamResult"]),
  904. toFixed(num) {
  905. if (num) {
  906. let str = String(num).indexOf(".");
  907. if (str != -1) {
  908. return +num.toFixed(2);
  909. } else {
  910. return num;
  911. }
  912. } else {
  913. return 0;
  914. }
  915. },
  916. /**
  917. * @param {Object} current
  918. * 获取收藏信息
  919. */
  920. getCollectInfo(current) {
  921. this.$request
  922. .getCollectInfo({
  923. examId: this.examId,
  924. questionId: this.questionList[current].questionId,
  925. goodsId: this.goodsId,
  926. orderGoodsId: this.orderGoodsId,
  927. doMode: this.doMode
  928. })
  929. .then((res) => {
  930. this.$set(this.collectList, current, res.data);
  931. })
  932. .catch((err) => {
  933. this.$set(this.collectList, current, false);
  934. });
  935. },
  936. /**
  937. * 是否做完所有题目
  938. */
  939. isDoOver() {
  940. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  941. if (this.questionList.length == questionOverNum) {
  942. //全部做完弹窗
  943. this.$nextTick(() => {
  944. this.$confirm(`您已完成所有题目,快去交卷吧!`, "温馨提示", {
  945. confirmButtonText: "立即交卷",
  946. cancelButtonText: "暂不交卷",
  947. type: "warning",
  948. })
  949. .then(() => {
  950. // confirmButton回调
  951. this.examSubmit();
  952. })
  953. .catch(() => { });
  954. });
  955. }
  956. },
  957. /**
  958. * 请求题目列表
  959. */
  960. goodsQuestionList() {
  961. this.$request
  962. .goodsQuestionList({
  963. examId: this.examId,
  964. })
  965. .then(async (res) => {
  966. if (!res.data.length) {
  967. this.$message({
  968. type: "warning",
  969. message: "该试卷暂无题目",
  970. });
  971. return;
  972. }
  973. this.allTimes = res.data[0].answerTime * 60;
  974. this.lastTime = res.data[0].answerTime && res.data[0].answerTime * 60;
  975. //考试时间到了自动交卷
  976. if (this.lastTime) {
  977. this.timer = setInterval(() => {
  978. if (this.lastTime <= 0) {
  979. clearInterval(this.timer);
  980. this.$confirm(`考试时间已到,系统将自动交卷`, "提示", {
  981. confirmButtonText: "立即交卷",
  982. closeOnClickModal: false,
  983. showCancelButton: false,
  984. closeOnPressEscape: false,
  985. distinguishCancelAndClose: false,
  986. showClose: false,
  987. });
  988. setTimeout(() => {
  989. try {
  990. this.$msgbox.close();
  991. } catch (err) { }
  992. this.examSubmit();
  993. }, 3000);
  994. return;
  995. }
  996. this.lastTime--;
  997. }, 1000);
  998. } else {
  999. }
  1000. res.data.forEach((item, index) => {
  1001. item.jsonStr = JSON.parse(item.jsonStr);
  1002. if (item.type == 2) {
  1003. //多选
  1004. item.jsonStr.forEach((str) => {
  1005. str.optionsId = "" + str.optionsId;
  1006. });
  1007. let arr = item.answerQuestion.split(",");
  1008. arr.forEach((a, i) => {
  1009. arr[i] = "" + a;
  1010. });
  1011. item.ans = arr;
  1012. item.quesSelect = [];
  1013. item.analysisContent &&
  1014. (item.analysisContent = item.analysisContent.replace(
  1015. /<img/gi,
  1016. '<img style="max-width:100%;"'
  1017. ));
  1018. item.content &&
  1019. (item.content = item.content.replace(
  1020. /<img/gi,
  1021. '<img style="max-width:100%;"'
  1022. ));
  1023. return;
  1024. } else if (item.type == 5) {
  1025. //简答题
  1026. item.ansText = {
  1027. text: "",
  1028. imageList: [],
  1029. };
  1030. item.ques = {
  1031. text: "",
  1032. imageList: [],
  1033. };
  1034. item.analysisContent &&
  1035. (item.analysisContent = item.analysisContent.replace(
  1036. /<img/gi,
  1037. '<img style="max-width:100%;"'
  1038. ));
  1039. item.content &&
  1040. (item.content = item.content.replace(
  1041. /<img/gi,
  1042. '<img style="max-width:100%;"'
  1043. ));
  1044. return;
  1045. } else if (item.type == 4) {
  1046. //案例题
  1047. console.log(item.jsonStr);
  1048. item.ques = [];
  1049. item.tabIndex = "0";
  1050. let ansArr = [];
  1051. item.jsonStr.forEach((json, index) => {
  1052. if (json.type == 1) {
  1053. ansArr[index] = json.answerQuestion;
  1054. json.content &&
  1055. (json.content = json.content.replace(
  1056. /<img/gi,
  1057. '<img style="max-width:100%;"'
  1058. ));
  1059. } else if (json.type == 2) {
  1060. json.optionsList.forEach((str) => {
  1061. str.optionsId = "" + str.optionsId;
  1062. });
  1063. let arr = json.answerQuestion.split(",");
  1064. arr.forEach((a, i) => {
  1065. arr[i] = "" + a;
  1066. });
  1067. ansArr[index] = arr;
  1068. json.content &&
  1069. (json.content = json.content.replace(
  1070. /<img/gi,
  1071. '<img style="max-width:100%;"'
  1072. ));
  1073. } else if (json.type == 3) {
  1074. ansArr[index] = json.answerQuestion;
  1075. json.content &&
  1076. (json.content = json.content.replace(
  1077. /<img/gi,
  1078. '<img style="max-width:100%;"'
  1079. ));
  1080. } else if (json.type == 5) {
  1081. ansArr[index] = {
  1082. text: "",
  1083. imageList: [],
  1084. };
  1085. json.ansText = {
  1086. text: "",
  1087. imageList: [],
  1088. };
  1089. json.ques = {
  1090. text: "",
  1091. imageList: [],
  1092. };
  1093. json.content &&
  1094. (json.content = json.content.replace(
  1095. /<img/gi,
  1096. '<img style="max-width:100%;"'
  1097. ));
  1098. }
  1099. });
  1100. item.ans = ansArr;
  1101. return;
  1102. }
  1103. item.analysisContent &&
  1104. (item.analysisContent = item.analysisContent.replace(
  1105. /<img/gi,
  1106. '<img style="max-width:100%;"'
  1107. ));
  1108. item.content &&
  1109. (item.content = item.content.replace(
  1110. /<img/gi,
  1111. '<img style="max-width:100%;"'
  1112. ));
  1113. item.ques = "";
  1114. item.ans = item.answerQuestion;
  1115. });
  1116. this.questionList = res.data;
  1117. this.lastCount = this.questionList.length;
  1118. this.getCollectInfo(this.current);
  1119. await this.examRecord();
  1120. });
  1121. },
  1122. // 随机练习题目
  1123. goodsExamRandomList() {
  1124. this.$request
  1125. .goodsExamRandomList({
  1126. goodsId: this.goodsId,
  1127. number: this.number,
  1128. orderGoodsId: this.orderGoodsId
  1129. }).then(async (res) => {
  1130. if (!res.data.questionList.length) {
  1131. this.$message({
  1132. type: "warning",
  1133. message: "该试卷暂无题目",
  1134. });
  1135. return;
  1136. }
  1137. this.examId = res.data.examId
  1138. this.bankExam()
  1139. res.data.questionList.forEach((item, index) => {
  1140. item.jsonStr = JSON.parse(item.jsonStr);
  1141. console.log(item.type, "item");
  1142. if (item.type == 2) {
  1143. //多选
  1144. item.jsonStr.forEach((str) => {
  1145. str.optionsId = "" + str.optionsId;
  1146. });
  1147. let arr = item.answerQuestion.split(",");
  1148. arr.forEach((a, i) => {
  1149. arr[i] = "" + a;
  1150. });
  1151. item.ans = arr;
  1152. item.quesSelect = [];
  1153. item.analysisContent &&
  1154. (item.analysisContent = item.analysisContent.replace(
  1155. /<img/gi,
  1156. '<img style="max-width:100%;"'
  1157. ));
  1158. item.content &&
  1159. (item.content = item.content.replace(
  1160. /<img/gi,
  1161. '<img style="max-width:100%;"'
  1162. ));
  1163. return;
  1164. } else if (item.type == 5) {
  1165. //简答题
  1166. item.ansText = {
  1167. text: "",
  1168. imageList: [],
  1169. };
  1170. item.ques = {
  1171. text: "",
  1172. imageList: [],
  1173. };
  1174. item.analysisContent &&
  1175. (item.analysisContent = item.analysisContent.replace(
  1176. /<img/gi,
  1177. '<img style="max-width:100%;"'
  1178. ));
  1179. item.content &&
  1180. (item.content = item.content.replace(
  1181. /<img/gi,
  1182. '<img style="max-width:100%;"'
  1183. ));
  1184. return;
  1185. } else if (item.type == 4) {
  1186. //案例题
  1187. console.log(item.jsonStr);
  1188. item.ques = [];
  1189. item.tabIndex = "0";
  1190. let ansArr = [];
  1191. item.jsonStr.forEach((json, index) => {
  1192. if (json.type == 1) {
  1193. ansArr[index] = json.answerQuestion;
  1194. json.content &&
  1195. (json.content = json.content.replace(
  1196. /<img/gi,
  1197. '<img style="max-width:100%;"'
  1198. ));
  1199. } else if (json.type == 2) {
  1200. json.optionsList.forEach((str) => {
  1201. str.optionsId = "" + str.optionsId;
  1202. });
  1203. let arr = json.answerQuestion.split(",");
  1204. arr.forEach((a, i) => {
  1205. arr[i] = "" + a;
  1206. });
  1207. ansArr[index] = arr;
  1208. json.content &&
  1209. (json.content = json.content.replace(
  1210. /<img/gi,
  1211. '<img style="max-width:100%;"'
  1212. ));
  1213. } else if (json.type == 3) {
  1214. ansArr[index] = json.answerQuestion;
  1215. json.content &&
  1216. (json.content = json.content.replace(
  1217. /<img/gi,
  1218. '<img style="max-width:100%;"'
  1219. ));
  1220. } else if (json.type == 5) {
  1221. ansArr[index] = {
  1222. text: "",
  1223. imageList: [],
  1224. };
  1225. json.ansText = {
  1226. text: "",
  1227. imageList: [],
  1228. };
  1229. json.ques = {
  1230. text: "",
  1231. imageList: [],
  1232. };
  1233. json.content &&
  1234. (json.content = json.content.replace(
  1235. /<img/gi,
  1236. '<img style="max-width:100%;"'
  1237. ));
  1238. }
  1239. });
  1240. item.ans = ansArr;
  1241. return;
  1242. }
  1243. item.analysisContent &&
  1244. (item.analysisContent = item.analysisContent.replace(
  1245. /<img/gi,
  1246. '<img style="max-width:100%;"'
  1247. ));
  1248. item.content &&
  1249. (item.content = item.content.replace(
  1250. /<img/gi,
  1251. '<img style="max-width:100%;"'
  1252. ));
  1253. item.ques = "";
  1254. item.ans = item.answerQuestion;
  1255. });
  1256. this.questionList = res.data.questionList;
  1257. this.lastCount = this.questionList.length;
  1258. this.getCollectInfo(this.current);
  1259. await this.examRecord();
  1260. })
  1261. },
  1262. /**
  1263. * 记录总题数,获取recordId
  1264. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1265. */
  1266. examRecord(hasSpecial) {
  1267. return new Promise((resolve) => {
  1268. let self = this;
  1269. let questionList = 0;
  1270. // if(!hasSpecial) {
  1271. this.questionList.forEach((item, index) => {
  1272. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1273. questionList++;
  1274. }
  1275. });
  1276. // } else {
  1277. // questionList = this.questionList.length;
  1278. // }
  1279. this.$request
  1280. .examRecord({
  1281. chapterExamId: this.chapterId || 0,
  1282. moduleExamId: this.moduleId || 0,
  1283. examId: this.examId,
  1284. goodsId: this.goodsId,
  1285. orderGoodsId: this.orderGoodsId,
  1286. totalQuestionNum: questionList,
  1287. allQuestionNum: this.questionList.length,
  1288. doMode: this.doMode
  1289. })
  1290. .then((res) => {
  1291. this.recordId = res.data;
  1292. if (this.bankType == 1) {
  1293. this.examRecordEdit();
  1294. clearInterval(this.postTimer);
  1295. this.postTimer = setInterval(() => {
  1296. this.examRecordEdit();
  1297. }, 5000);
  1298. }
  1299. });
  1300. });
  1301. },
  1302. /**
  1303. * 离开页面统计回答正确题数
  1304. */
  1305. examRecordEdit() {
  1306. clearInterval(this.postTimer);
  1307. clearInterval(this.timer);
  1308. let number = 0;
  1309. let score = 0;
  1310. let doQuestionNum = 0;
  1311. let doQuestionIds = []; //做过的题目id
  1312. let lessQuestionNum = 0;
  1313. this.questionList.forEach((item, index) => {
  1314. if (item.type == 1) {
  1315. if (item.ques == item.ans) {
  1316. score += item.score;
  1317. number++;
  1318. }
  1319. if (item.ques) {
  1320. doQuestionNum++;
  1321. doQuestionIds.push(item.questionId);
  1322. }
  1323. } else if (item.type == 2) {
  1324. let isRight =
  1325. item.ans &&
  1326. item.ans.every((quesItem, quesIndex) => {
  1327. if (item.ques) {
  1328. return item.ques[quesIndex] == item.ans[quesIndex];
  1329. } else {
  1330. return false;
  1331. }
  1332. });
  1333. if (isRight) {
  1334. score += item.score;
  1335. number++;
  1336. } else {
  1337. let hasPart = false;
  1338. let checkboxScore = 1; //获取单题总分数
  1339. item.ques &&
  1340. item.ques.forEach((ques, quesIndex) => {
  1341. //选错一个全扣
  1342. if (item.ques) {
  1343. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1344. checkboxScore = 0;
  1345. }
  1346. } else {
  1347. checkboxScore = 0;
  1348. }
  1349. });
  1350. console.log(checkboxScore);
  1351. //没选错
  1352. if (checkboxScore) {
  1353. checkboxScore = 0;
  1354. item.ans.forEach((ans, quesIndex) => {
  1355. //漏选扣一部分,对n题给n X partScore 分
  1356. if (item.ques) {
  1357. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  1358. checkboxScore += item.partScore;
  1359. hasPart = true;
  1360. }
  1361. } else {
  1362. checkboxScore = 0;
  1363. }
  1364. });
  1365. }
  1366. if (!hasPart) {
  1367. //0分
  1368. } else {
  1369. //部分分
  1370. // number++;
  1371. lessQuestionNum++;
  1372. score += checkboxScore;
  1373. }
  1374. }
  1375. if (item.ques && item.ques.length) {
  1376. doQuestionNum++;
  1377. doQuestionIds.push(item.questionId);
  1378. }
  1379. } else if (item.type == 3) {
  1380. if (item.ques == item.ans) {
  1381. score += item.score;
  1382. number++;
  1383. }
  1384. if (item.ques) {
  1385. doQuestionNum++;
  1386. doQuestionIds.push(item.questionId);
  1387. }
  1388. } else if (item == 4) {
  1389. if (item.ques.length) {
  1390. doQuestionNum++;
  1391. doQuestionIds.push(item.questionId);
  1392. }
  1393. } else if (item.type == 5) {
  1394. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  1395. doQuestionNum++;
  1396. doQuestionIds.push(item.questionId);
  1397. }
  1398. }
  1399. });
  1400. this.$request
  1401. .examRecordEdit({
  1402. examId: this.examId,
  1403. goodsId: this.goodsId,
  1404. recordId: this.recordId,
  1405. orderGoodsId: this.orderGoodsId,
  1406. doQuestionIds: doQuestionIds.join(","),
  1407. rightQuestionNum: number,
  1408. moduleExamId: this.moduleId || 0,
  1409. chapterExamId: this.chapterId || 0,
  1410. lessQuestionNum: lessQuestionNum,
  1411. status: 0,
  1412. doQuestionNum: doQuestionNum,
  1413. historyExamJson: JSON.stringify(this.questionList),
  1414. })
  1415. .then((res) => {
  1416. this.punchClock()
  1417. });
  1418. },
  1419. /**
  1420. * 获取试卷类型2考试,1练习
  1421. */
  1422. bankExam() {
  1423. return new Promise((resolve) => {
  1424. this.$request.bankExam(this.examId).then((res) => {
  1425. this.bankType = res.data.doType;
  1426. if (this.bankType == 2) {
  1427. this.needBack = true;
  1428. }
  1429. resolve();
  1430. });
  1431. });
  1432. },
  1433. /**
  1434. * @param {Object}
  1435. * 单选点击确认
  1436. */
  1437. radioSelect(question, questionIndex, optionsId) {
  1438. // if (this.questionList[questionIndex].ques) return;
  1439. if (this.questionList[questionIndex].ques && this.bankType == 1) {
  1440. return;
  1441. }
  1442. this.$set(this.questionList[questionIndex], "ques", optionsId);
  1443. this.isDoOver();
  1444. // if (
  1445. // this.questionList[questionIndex].ques !=
  1446. // this.questionList[questionIndex].ans
  1447. // ) {
  1448. // this.$request
  1449. // .examWrongRecord({
  1450. // orderGoodsId: this.orderGoodsId,
  1451. // examId: this.examId,
  1452. // goodsId: this.goodsId,
  1453. // moduleExamId: this.moduleId || 0,
  1454. // chapterExamId: this.chapterId || 0,
  1455. // questionIds: [this.questionList[questionIndex].questionId],
  1456. // recordId: this.recordId,
  1457. // type 1,
  1458. // })
  1459. // .then((res) => {});
  1460. // }
  1461. },
  1462. /**
  1463. * @param {Object}
  1464. * 案例单选点击
  1465. */
  1466. radioSelectChild(questionIndex, jsonIndex, optionsId) {
  1467. // if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1468. if (
  1469. this.questionList[questionIndex].ques[jsonIndex] &&
  1470. this.bankType == 1
  1471. ) {
  1472. return;
  1473. }
  1474. this.$set(this.questionList[questionIndex].ques, jsonIndex, optionsId);
  1475. this.isDoOver();
  1476. },
  1477. /**
  1478. * 多选点击确认
  1479. */
  1480. checkboxSubmit(question, questionIndex) {
  1481. // if (this.questionList[questionIndex].ques) return;
  1482. if (this.questionList[questionIndex].ques && this.bankType == 1) {
  1483. return;
  1484. }
  1485. let arr = [];
  1486. this.questionList[questionIndex].jsonStr.forEach((item) => {
  1487. if (item.checked) {
  1488. arr.push(item.optionsId);
  1489. }
  1490. });
  1491. if (!arr.length) {
  1492. delete this.questionList[questionIndex].ques;
  1493. this.$message({
  1494. type: "warning",
  1495. message: "请选择答案",
  1496. });
  1497. return;
  1498. }
  1499. this.$set(this.questionList[questionIndex], "ques", arr);
  1500. this.isDoOver();
  1501. // let isWrong = this.questionList[questionIndex].ques.some((item, i) => {
  1502. // return this.questionList[questionIndex].ans.indexOf(item) == -1;
  1503. // })
  1504. // // 回答错误
  1505. // if (isWrong) {
  1506. // this.$request
  1507. // .examWrongRecord({
  1508. // orderGoodsId: this.orderGoodsId,
  1509. // examId: this.examId,
  1510. // goodsId: this.goodsId,
  1511. // moduleExamId: this.moduleId || 0,
  1512. // chapterExamId: this.chapterId || 0,
  1513. // questionIds: [this.questionList[questionIndex].questionId],
  1514. // recordId: this.recordId,
  1515. // type 1,
  1516. // })
  1517. // .then((res) => {});
  1518. // }
  1519. },
  1520. /**
  1521. * @param {Object}
  1522. * 案例多选确认
  1523. */
  1524. checkboxSubmitChild(questionIndex, ansIndex) {
  1525. // if (this.questionList[questionIndex].ques[ansIndex]) return;
  1526. if (
  1527. this.questionList[questionIndex].ques[ansIndex] &&
  1528. this.bankType == 1
  1529. ) {
  1530. return;
  1531. }
  1532. let arr = [];
  1533. this.questionList[questionIndex].jsonStr[ansIndex].optionsList.forEach(
  1534. (item) => {
  1535. if (item.checked) {
  1536. arr.push(item.optionsId);
  1537. }
  1538. }
  1539. );
  1540. if (!arr.length) {
  1541. delete this.questionList[questionIndex].ques[ansIndex];
  1542. this.$message({
  1543. type: "warning",
  1544. message: "请选择答案",
  1545. });
  1546. return;
  1547. }
  1548. this.$set(this.questionList[questionIndex].ques, ansIndex, arr);
  1549. this.isDoOver();
  1550. },
  1551. /**
  1552. * 判断点击确认
  1553. */
  1554. judgeSelect(question, questionIndex, index) {
  1555. console.log(this.bankType)
  1556. // if (question.ques) return;
  1557. if (question.ques && this.bankType == 1) {
  1558. return;
  1559. }
  1560. this.$set(
  1561. this.questionList[questionIndex],
  1562. "ques",
  1563. index == 0 ? "1" : "0"
  1564. );
  1565. this.isDoOver();
  1566. // if (
  1567. // this.questionList[questionIndex].ques !=
  1568. // this.questionList[questionIndex].ans
  1569. // ) {
  1570. // this.$request
  1571. // .examWrongRecord({
  1572. // orderGoodsId: this.orderGoodsId,
  1573. // examId: this.examId,
  1574. // goodsId: this.goodsId,
  1575. // moduleExamId: this.moduleId || 0,
  1576. // chapterExamId: this.chapterId || 0,
  1577. // questionIds: [this.questionList[questionIndex].questionId],
  1578. // recordId: this.recordId,
  1579. // type 1,
  1580. // })
  1581. // .then((res) => {});
  1582. // }
  1583. },
  1584. judgeSelectChild(questionIndex, jsonIndex, index) {
  1585. console.log(this.questionList[questionIndex].ques[jsonIndex]);
  1586. // if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1587. if (
  1588. this.questionList[questionIndex].ques[jsonIndex] &&
  1589. this.bankType == 1
  1590. ) {
  1591. return;
  1592. }
  1593. this.$set(
  1594. this.questionList[questionIndex].ques,
  1595. jsonIndex,
  1596. index == 0 ? "1" : "0"
  1597. );
  1598. this.isDoOver();
  1599. },
  1600. /**
  1601. * 上传图片
  1602. */
  1603. uploadImg(e, question, questionIndex) {
  1604. var file = e.target.files[0];
  1605. if (file.size > 2 * 1024 * 1024) {
  1606. this.$message.warn("图片不得大于2000kb");
  1607. return;
  1608. }
  1609. var type = e.target.value.toLowerCase().split(".").splice(-1);
  1610. if (
  1611. type[0] != "jpg" &&
  1612. type[0] != "png" &&
  1613. type[0] != "jpeg" &&
  1614. type[0] != "gif"
  1615. ) {
  1616. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  1617. e.target.value = "";
  1618. return;
  1619. }
  1620. this.$upload.upload(file, 0).then((res) => {
  1621. question.ansText.imageList.push(res);
  1622. });
  1623. },
  1624. /**
  1625. * 案例上传图片
  1626. */
  1627. uploadImgChild(e, questionIndex, jsonIndex) {
  1628. var file = e.target.files[0];
  1629. if (file.size > 2 * 1024 * 1024) {
  1630. this.$message.warn("图片不得大于2000kb");
  1631. return;
  1632. }
  1633. var type = e.target.value.toLowerCase().split(".").splice(-1);
  1634. if (
  1635. type[0] != "jpg" &&
  1636. type[0] != "png" &&
  1637. type[0] != "jpeg" &&
  1638. type[0] != "gif"
  1639. ) {
  1640. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  1641. e.target.value = "";
  1642. return;
  1643. }
  1644. this.$upload.upload(file, 0).then((res) => {
  1645. this.questionList[questionIndex].jsonStr[
  1646. jsonIndex
  1647. ].ansText.imageList.push(res);
  1648. });
  1649. },
  1650. isOver(item, index) {
  1651. if (this.questionList[index].ques) {
  1652. if (item.type == 4) {
  1653. //案例题
  1654. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1655. if (
  1656. jsonItem.type == 1 ||
  1657. jsonItem.type == 2 ||
  1658. jsonItem.type == 3
  1659. ) {
  1660. if (item.ques[indexs]) {
  1661. return true;
  1662. } else {
  1663. return false;
  1664. }
  1665. } else if (jsonItem.type == 5) {
  1666. if (
  1667. item.ques[indexs] &&
  1668. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  1669. ) {
  1670. console.log("chil");
  1671. return true;
  1672. } else {
  1673. return false;
  1674. }
  1675. }
  1676. });
  1677. if (isOver) {
  1678. return true;
  1679. } else {
  1680. return false;
  1681. }
  1682. } else if (item.type == 5) {
  1683. //简答题
  1684. //每一项都相等
  1685. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  1686. return true;
  1687. }
  1688. //判断
  1689. } else {
  1690. return false;
  1691. }
  1692. } else {
  1693. return false;
  1694. }
  1695. },
  1696. ansSubmit(question, questionIndex) {
  1697. if (!question.ansText.text && !question.ansText.imageList.length) {
  1698. this.$message({
  1699. type: "warning",
  1700. message: "请输入内容或上传图片",
  1701. });
  1702. return;
  1703. }
  1704. question.ques.imageList = question.ansText.imageList;
  1705. question.ques.text = question.ansText.text;
  1706. this.isDoOver();
  1707. console.log(question.ques);
  1708. },
  1709. ansSubmitChild(question, questionIndex, jsonIndex) {
  1710. if (
  1711. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text &&
  1712. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.imageList
  1713. .length
  1714. ) {
  1715. this.$message({
  1716. type: "warning",
  1717. message: "请输入内容或上传图片",
  1718. });
  1719. return;
  1720. }
  1721. this.$set(this.questionList[questionIndex].ques, jsonIndex, {
  1722. imageList:
  1723. this.questionList[questionIndex].jsonStr[jsonIndex].ansText
  1724. .imageList || [],
  1725. text:
  1726. this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text ||
  1727. "",
  1728. });
  1729. this.isDoOver();
  1730. },
  1731. changeIndex(index) {
  1732. this.current = index;
  1733. this.getCollectInfo(this.current);
  1734. },
  1735. nextQuestion() {
  1736. if (this.current >= this.questionList.length - 1) {
  1737. this.$message({
  1738. type: "warning",
  1739. message: "已经是最后一题了!",
  1740. });
  1741. return;
  1742. }
  1743. this.current++;
  1744. this.getCollectInfo(this.current);
  1745. },
  1746. prevQuestion() {
  1747. if (this.current == 0) {
  1748. this.$message({
  1749. type: "warning",
  1750. message: "已经是第一题了!",
  1751. });
  1752. return;
  1753. } else {
  1754. this.current--;
  1755. this.getCollectInfo(this.current);
  1756. }
  1757. },
  1758. isCheck(item, index) {
  1759. if (this.questionList[index].ques) {
  1760. return true;
  1761. }
  1762. },
  1763. isRight(item, index) {
  1764. //单选
  1765. if (this.questionList[index].ques) {
  1766. if (item.type == 1) {
  1767. console.log(
  1768. this.questionList[index].ques == this.questionList[index].ans
  1769. );
  1770. return this.questionList[index].ques == this.questionList[index].ans;
  1771. //多选
  1772. } else if (item.type == 2) {
  1773. //每一项都相等
  1774. return this.questionList[index].ans.every((item, i) => {
  1775. return item == this.questionList[index].ques[i];
  1776. });
  1777. //判断
  1778. } else if (item.type == 3) {
  1779. return this.questionList[index].ques == this.questionList[index].ans;
  1780. } else {
  1781. return false;
  1782. }
  1783. } else {
  1784. return false;
  1785. }
  1786. },
  1787. isWrong(item, index) {
  1788. if (this.questionList[index].ques) {
  1789. //单选
  1790. if (item.type == 1) {
  1791. return this.questionList[index].ques != this.questionList[index].ans;
  1792. //多选
  1793. } else if (item.type == 2) {
  1794. //每一项都相等
  1795. return this.questionList[index].ques.some((item, i) => {
  1796. return this.questionList[index].ans.indexOf(item) == -1;
  1797. });
  1798. //判断
  1799. } else if (item.type == 3) {
  1800. return this.questionList[index].ques != this.questionList[index].ans;
  1801. } else {
  1802. return false;
  1803. }
  1804. } else {
  1805. return false;
  1806. }
  1807. },
  1808. isPart(item, index) {
  1809. if (this.questionList[index].ques) {
  1810. if (item.type == 2) {
  1811. let isWrong = this.questionList[index].ques.some((item, i) => {
  1812. return this.questionList[index].ans.indexOf(item) == -1;
  1813. });
  1814. let isRight = this.questionList[index].ans.every((item, i) => {
  1815. return item == this.questionList[index].ques[i];
  1816. });
  1817. if (!isRight && !isWrong) {
  1818. return true;
  1819. }
  1820. }
  1821. } else {
  1822. return false;
  1823. }
  1824. },
  1825. right(bankIndex, ansIndex, option) {
  1826. if (
  1827. this.questionList[bankIndex].ques[ansIndex] &&
  1828. this.questionList[bankIndex].ans[ansIndex]
  1829. ) {
  1830. if (
  1831. this.questionList[bankIndex].ques[ansIndex].indexOf(
  1832. option.optionsId
  1833. ) != -1 ||
  1834. this.questionList[bankIndex].ans[ansIndex].indexOf(
  1835. option.optionsId
  1836. ) != -1
  1837. ) {
  1838. return true;
  1839. } else {
  1840. return false;
  1841. }
  1842. } else {
  1843. return false;
  1844. }
  1845. },
  1846. wrong(bankIndex, ansIndex, option) {
  1847. if (
  1848. this.questionList[bankIndex].ques[ansIndex] &&
  1849. this.questionList[bankIndex].ans[ansIndex]
  1850. ) {
  1851. if (
  1852. this.questionList[bankIndex].ques[ansIndex].indexOf(
  1853. option.optionsId
  1854. ) != -1 &&
  1855. this.questionList[bankIndex].ans[ansIndex].indexOf(
  1856. option.optionsId
  1857. ) == -1
  1858. ) {
  1859. return true;
  1860. } else {
  1861. return false;
  1862. }
  1863. } else {
  1864. return false;
  1865. }
  1866. },
  1867. /**
  1868. * 获取已经回答的题目数
  1869. * hasSpecail (是否包含简答和案例)
  1870. */
  1871. questionOverNum(hasSpecail) {
  1872. let count = 0;
  1873. this.questionList.forEach((item) => {
  1874. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1875. if (item.ques) {
  1876. count++;
  1877. }
  1878. } else if (item.type == 4) {
  1879. //案例题
  1880. if (hasSpecail) {
  1881. let isOver = item.jsonStr.every((jsonItem, index) => {
  1882. if (
  1883. jsonItem.type == 1 ||
  1884. jsonItem.type == 2 ||
  1885. jsonItem.type == 3
  1886. ) {
  1887. if (item.ques[index]) {
  1888. return true;
  1889. } else {
  1890. return false;
  1891. }
  1892. } else if (jsonItem.type == 5) {
  1893. if (
  1894. item.ques[index] &&
  1895. (item.ques[index].text || item.ques[index].imageList.length)
  1896. ) {
  1897. return true;
  1898. } else {
  1899. return false;
  1900. }
  1901. }
  1902. });
  1903. if (isOver) {
  1904. count++;
  1905. console.log(item, 4441);
  1906. }
  1907. }
  1908. } else if (item.type == 5) {
  1909. //简答题
  1910. if (hasSpecail) {
  1911. if (item.ques && (item.ques.text || item.ques.imageList.length)) {
  1912. console.log(5, item);
  1913. count++;
  1914. }
  1915. }
  1916. }
  1917. });
  1918. return count;
  1919. },
  1920. submit() {
  1921. let ansCount = this.questionOverNum(true); //已答题数
  1922. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1923. //没有答完
  1924. if (this.lastCount > 0) {
  1925. this.$confirm(
  1926. `您还有${this.lastCount}道题未作答, 现在继续作答,还是下次继续?`,
  1927. "提示",
  1928. {
  1929. confirmButtonText: "立即交卷",
  1930. cancelButtonText: "继续做题",
  1931. closeOnClickModal: false,
  1932. closeOnPressEscape: false,
  1933. distinguishCancelAndClose: false,
  1934. showClose: false,
  1935. }
  1936. )
  1937. .then((_) => {
  1938. this.examSubmit();
  1939. })
  1940. .catch((_) => { });
  1941. return;
  1942. }
  1943. if (this.bankType == 2) {
  1944. if (this.lastTime > 0) {
  1945. let lastTime = this.countdown(this.lastTime);
  1946. this.$confirm(`时间还剩余${lastTime},确定交卷吗?`, "提示", {
  1947. confirmButtonText: "交卷",
  1948. cancelButtonText: "继续答题",
  1949. closeOnClickModal: false,
  1950. closeOnPressEscape: false,
  1951. distinguishCancelAndClose: false,
  1952. showClose: false,
  1953. })
  1954. .then((_) => {
  1955. this.examSubmit();
  1956. })
  1957. .catch((_) => { });
  1958. return;
  1959. }
  1960. }
  1961. this.examSubmit();
  1962. },
  1963. /**
  1964. * @param {Object} second倒计时过滤器
  1965. */
  1966. countdown(second) {
  1967. if (second) {
  1968. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1969. let m = parseInt((second / 60) % 60); // 计算分数
  1970. let s = parseInt(second % 60); // 计算当前秒数
  1971. if (h < 10) h = "0" + h;
  1972. if (m < 10) m = "0" + m;
  1973. if (s < 10) s = "0" + s;
  1974. return h + ":" + m + ":" + s;
  1975. } else {
  1976. return "";
  1977. }
  1978. },
  1979. /**
  1980. * 交卷,跳转报告页
  1981. */
  1982. examSubmit() {
  1983. this.loading = true;
  1984. clearInterval(this.timer);
  1985. clearInterval(this.postTimer);
  1986. let score = 0; //计算总分
  1987. let reportStatus = 0;
  1988. let number = 0; //做对的题目数量
  1989. let doQuestionNum = 0; //做过的题目数量
  1990. let allScore = 0; //总分
  1991. let passScore = 0;
  1992. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  1993. let doQuestionIds = []; //做过的题目id
  1994. let rightQuestionIds = []; //做对的题目id
  1995. let lessQuestionNum = 0;
  1996. this.questionList.forEach((item, index) => {
  1997. passScore = item.passScore;
  1998. if (item.type == 1) {
  1999. //正确
  2000. if (item.ques == item.ans) {
  2001. item.scoreResult = item.score;
  2002. score += item.score;
  2003. number++;
  2004. rightQuestionIds.push(item.questionId);
  2005. } else {
  2006. //错误
  2007. item.scoreResult = 0;
  2008. if (item.ques) {
  2009. doWrongQuestionIds.push(item.questionId);
  2010. }
  2011. }
  2012. allScore += item.score;
  2013. if (item.ques) {
  2014. doQuestionNum++;
  2015. doQuestionIds.push(item.questionId);
  2016. }
  2017. } else if (item.type == 2) {
  2018. let isRight =
  2019. item.ans &&
  2020. item.ans.every((quesItem, quesIndex) => {
  2021. if (item.ques) {
  2022. return item.ques[quesIndex] == item.ans[quesIndex];
  2023. } else {
  2024. return false;
  2025. }
  2026. });
  2027. if (isRight) {
  2028. score += item.score;
  2029. number++;
  2030. item.scoreResult = item.score;
  2031. rightQuestionIds.push(item.questionId);
  2032. } else {
  2033. let hasPart = false;
  2034. let checkboxScore = 1; //获取单题总分数
  2035. item.ques &&
  2036. item.ques.forEach((ques, quesIndex) => {
  2037. //选错一个全扣
  2038. if (item.ques) {
  2039. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  2040. checkboxScore = 0;
  2041. }
  2042. } else {
  2043. checkboxScore = 0;
  2044. }
  2045. });
  2046. console.log(checkboxScore, "checkboxScore1");
  2047. //没选错
  2048. if (checkboxScore) {
  2049. checkboxScore = 0;
  2050. item.ans.forEach((ans, quesIndex) => {
  2051. //漏选扣一部分,对n题给n X partScore 分
  2052. if (item.ques) {
  2053. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  2054. checkboxScore += item.partScore;
  2055. hasPart = true;
  2056. }
  2057. } else {
  2058. checkboxScore = 0;
  2059. }
  2060. });
  2061. }
  2062. console.log(checkboxScore, "checkboxScore2");
  2063. if (!hasPart) {
  2064. //0分
  2065. item.scoreResult = 0;
  2066. if (item.ques) {
  2067. doWrongQuestionIds.push(item.questionId);
  2068. }
  2069. } else {
  2070. //部分分
  2071. // number++;
  2072. lessQuestionNum++;
  2073. // doWrongQuestionIds.push(item.questionId);
  2074. item.scoreResult = checkboxScore;
  2075. score += checkboxScore;
  2076. // rightQuestionIds.push(item.questionId)
  2077. }
  2078. }
  2079. allScore += item.score;
  2080. if (item.ques && item.ques.length) {
  2081. doQuestionNum++;
  2082. doQuestionIds.push(item.questionId);
  2083. }
  2084. } else if (item.type == 3) {
  2085. if (item.ques == item.ans) {
  2086. item.scoreResult = item.score;
  2087. score += item.score;
  2088. number++;
  2089. rightQuestionIds.push(item.questionId);
  2090. } else {
  2091. item.scoreResult = 0;
  2092. if (item.ques) {
  2093. doWrongQuestionIds.push(item.questionId);
  2094. }
  2095. }
  2096. allScore += item.score;
  2097. if (item.ques) {
  2098. doQuestionNum++;
  2099. doQuestionIds.push(item.questionId);
  2100. }
  2101. } else if (item.type == 4) {
  2102. allScore += item.score;
  2103. if (item.ques && item.ques.length) {
  2104. doQuestionNum++;
  2105. doQuestionIds.push(item.questionId);
  2106. }
  2107. } else if (item.type == 5) {
  2108. allScore += item.score;
  2109. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2110. doQuestionNum++;
  2111. doQuestionIds.push(item.questionId);
  2112. }
  2113. }
  2114. });
  2115. //大于及格
  2116. if (score >= passScore) {
  2117. reportStatus = 1;
  2118. } else {
  2119. reportStatus = 0;
  2120. }
  2121. // setTimeout(() => {
  2122. // let result = {
  2123. // chapterId: this.chapterId,
  2124. // moduleId: this.moduleId,
  2125. // examId: this.examId,
  2126. // recordId: this.recordId,
  2127. // };
  2128. // this.setExamResult(result);
  2129. // this.$router.push({
  2130. // path: "/bank-report/" + this.goodsId,
  2131. // });
  2132. // }, 1000);
  2133. // return;
  2134. //交卷 /exam/record/edit
  2135. this.$request
  2136. .examRecordEdit({
  2137. examId: this.examId,
  2138. goodsId: this.goodsId,
  2139. orderGoodsId: this.orderGoodsId,
  2140. reportStatus: reportStatus,
  2141. recordId: this.recordId,
  2142. lessQuestionNum: lessQuestionNum,
  2143. rightQuestionNum: number,
  2144. status: 1,
  2145. moduleExamId: this.moduleId || 0,
  2146. chapterExamId: this.chapterId || 0,
  2147. doQuestionIds: doQuestionIds.join(","),
  2148. rightQuestionIds: rightQuestionIds.join(","),
  2149. doQuestionNum: doQuestionNum,
  2150. performance: score,
  2151. totalScore: allScore,
  2152. examTime: parseInt(this.allTimes),
  2153. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2154. historyExamJson: JSON.stringify(this.questionList),
  2155. })
  2156. .then((res) => {
  2157. this.isSubmit = true;
  2158. this.loading = false;
  2159. this.$message({
  2160. type: "success",
  2161. message: "交卷成功",
  2162. });
  2163. this.punchClock()
  2164. setTimeout(() => {
  2165. this.$router.replace({
  2166. path: "/bank-report/" + this.goodsId,
  2167. query: {
  2168. orderGoodsId: this.orderGoodsId,
  2169. chapterId: this.chapterId,
  2170. moduleId: this.moduleId,
  2171. examId: this.examId,
  2172. recordId: this.recordId,
  2173. examType: this.examType
  2174. },
  2175. });
  2176. }, 1000);
  2177. })
  2178. .catch((err) => {
  2179. this.loading = false;
  2180. });
  2181. //错题集id提交(客观题)/exam/wwrong/record
  2182. this.$request
  2183. .examWrongRecord({
  2184. orderGoodsId: this.orderGoodsId,
  2185. examId: this.examId,
  2186. goodsId: this.goodsId,
  2187. questionIds: doWrongQuestionIds,
  2188. recordId: this.recordId,
  2189. type: 1,
  2190. doMode: this.doMode
  2191. })
  2192. .then((res) => { })
  2193. .catch((err) => { });
  2194. },
  2195. // 打卡
  2196. punchClock() {
  2197. if (this.examType != 1) {
  2198. return
  2199. }
  2200. this.$request.punchClock({
  2201. chapterExamId: this.chapterId,
  2202. examId: this.examId,
  2203. goodsId: this.goodsId,
  2204. moduleExamId: this.moduleId,
  2205. recordTime: new Date(new Date().setHours(0, 0, 0, 0)) / 1000,
  2206. })
  2207. },
  2208. /**
  2209. * 交卷,不用跳转
  2210. */
  2211. leaveNow() {
  2212. clearInterval(this.timer);
  2213. clearInterval(this.postTimer);
  2214. let score = 0; //计算总分
  2215. let reportStatus = 0;
  2216. let number = 0; //做对的题目数量
  2217. let doQuestionNum = 0; //做过的题目数量
  2218. let allScore = 0; //总分
  2219. let passScore = 0;
  2220. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  2221. let doQuestionIds = []; //做过的题目id
  2222. let rightQuestionIds = []; //做对的题目id
  2223. let lessQuestionNum = 0;
  2224. console.log(111);
  2225. this.questionList.forEach((item, index) => {
  2226. passScore = item.passScore;
  2227. if (item.type == 1) {
  2228. //正确
  2229. if (item.ques == item.ans) {
  2230. item.scoreResult = item.score;
  2231. score += item.score;
  2232. number++;
  2233. rightQuestionIds.push(item.questionId);
  2234. } else {
  2235. //错误
  2236. item.scoreResult = 0;
  2237. if (item.ques) {
  2238. doWrongQuestionIds.push(item.questionId);
  2239. }
  2240. }
  2241. allScore += item.score;
  2242. if (item.ques) {
  2243. doQuestionNum++;
  2244. doQuestionIds.push(item.questionId);
  2245. }
  2246. } else if (item.type == 2) {
  2247. let isRight =
  2248. item.ans &&
  2249. item.ans.every((quesItem, quesIndex) => {
  2250. if (item.ques) {
  2251. return item.ques[quesIndex] == item.ans[quesIndex];
  2252. } else {
  2253. return false;
  2254. }
  2255. });
  2256. if (isRight) {
  2257. score += item.score;
  2258. number++;
  2259. item.scoreResult = item.score;
  2260. rightQuestionIds.push(item.questionId);
  2261. } else {
  2262. let hasPart = false;
  2263. let checkboxScore = 1; //获取单题总分数
  2264. item.ques &&
  2265. item.ques.forEach((ques, quesIndex) => {
  2266. //选错一个全扣
  2267. if (item.ques) {
  2268. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  2269. checkboxScore = 0;
  2270. }
  2271. } else {
  2272. checkboxScore = 0;
  2273. }
  2274. });
  2275. console.log(checkboxScore, "checkboxScore1");
  2276. //没选错
  2277. if (checkboxScore) {
  2278. checkboxScore = 0;
  2279. item.ans.forEach((ans, quesIndex) => {
  2280. //漏选扣一部分,对n题给n X partScore 分
  2281. if (item.ques) {
  2282. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  2283. checkboxScore += item.partScore;
  2284. hasPart = true;
  2285. }
  2286. } else {
  2287. checkboxScore = 0;
  2288. }
  2289. });
  2290. }
  2291. console.log(checkboxScore, "checkboxScore2");
  2292. if (!hasPart) {
  2293. //0分
  2294. item.scoreResult = 0;
  2295. if (item.ques) {
  2296. doWrongQuestionIds.push(item.questionId);
  2297. }
  2298. } else {
  2299. //部分分
  2300. // number++;
  2301. lessQuestionNum++;
  2302. // doWrongQuestionIds.push(item.questionId);
  2303. item.scoreResult = checkboxScore;
  2304. score += checkboxScore;
  2305. // rightQuestionIds.push(item.questionId)
  2306. }
  2307. }
  2308. allScore += item.score;
  2309. if (item.ques && item.ques.length) {
  2310. doQuestionNum++;
  2311. doQuestionIds.push(item.questionId);
  2312. }
  2313. } else if (item.type == 3) {
  2314. if (item.ques == item.ans) {
  2315. item.scoreResult = item.score;
  2316. score += item.score;
  2317. number++;
  2318. rightQuestionIds.push(item.questionId);
  2319. } else {
  2320. item.scoreResult = 0;
  2321. if (item.ques) {
  2322. doWrongQuestionIds.push(item.questionId);
  2323. }
  2324. }
  2325. allScore += item.score;
  2326. if (item.ques) {
  2327. doQuestionNum++;
  2328. doQuestionIds.push(item.questionId);
  2329. }
  2330. } else if (item.type == 4) {
  2331. allScore += item.score;
  2332. if (item.ques && item.ques.length) {
  2333. doQuestionNum++;
  2334. doQuestionIds.push(item.questionId);
  2335. }
  2336. } else if (item.type == 5) {
  2337. allScore += item.score;
  2338. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2339. doQuestionNum++;
  2340. doQuestionIds.push(item.questionId);
  2341. }
  2342. }
  2343. });
  2344. //大于及格
  2345. if (score >= passScore) {
  2346. reportStatus = 1;
  2347. } else {
  2348. reportStatus = 0;
  2349. }
  2350. console.log(333);
  2351. //交卷
  2352. this.$request
  2353. .examRecordEdit({
  2354. examId: this.examId,
  2355. goodsId: this.goodsId,
  2356. orderGoodsId: this.orderGoodsId,
  2357. reportStatus: reportStatus,
  2358. recordId: this.recordId,
  2359. rightQuestionNum: number,
  2360. lessQuestionNum: lessQuestionNum,
  2361. status: 1,
  2362. moduleExamId: this.moduleId || 0,
  2363. chapterExamId: this.chapterId || 0,
  2364. doQuestionIds: doQuestionIds.join(","),
  2365. rightQuestionIds: rightQuestionIds.join(","),
  2366. doQuestionNum: doQuestionNum,
  2367. performance: score,
  2368. totalScore: allScore,
  2369. examTime: parseInt(this.allTimes),
  2370. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2371. historyExamJson: JSON.stringify(this.questionList),
  2372. })
  2373. .then((res) => {
  2374. this.punchClock()
  2375. });
  2376. console.log(222);
  2377. //错题集id提交(客观题)
  2378. this.$request
  2379. .examWrongRecord({
  2380. orderGoodsId: this.orderGoodsId,
  2381. examId: this.examId,
  2382. goodsId: this.goodsId,
  2383. questionIds: doWrongQuestionIds,
  2384. recordId: this.recordId,
  2385. type: 1,
  2386. doMode: this.doMode
  2387. })
  2388. .then((res) => {
  2389. this.loading = false;
  2390. })
  2391. .catch((err) => {
  2392. this.loading = false;
  2393. });
  2394. },
  2395. },
  2396. computed: {
  2397. param() {
  2398. return {
  2399. examId: this.examId,
  2400. questionId: this.questionList[this.current]
  2401. ? this.questionList[this.current].questionId
  2402. : undefined,
  2403. goodsId: this.goodsId,
  2404. orderGoodsId: this.orderGoodsId,
  2405. collectQuestionId: this.collectList[this.current]
  2406. ? this.collectList[this.current].collectQuestionId
  2407. : undefined,
  2408. doMode: this.doMode
  2409. };
  2410. },
  2411. doMode() {
  2412. return this.number ? 2 : 1
  2413. },
  2414. examType() {
  2415. return this.$route.query.examType || (this.number ? 2 : 0)
  2416. }
  2417. },
  2418. };
  2419. </script>
  2420. <!-- Add "scoped" attribute to limit CSS to this component only -->
  2421. <style scoped lang="scss">
  2422. .course-exam {
  2423. .section {
  2424. overflow: hidden;
  2425. &__header {
  2426. height: 20px;
  2427. margin-top: 20px;
  2428. }
  2429. &__body {
  2430. .explain-record {
  2431. &__body {
  2432. margin-bottom: 20px;
  2433. border: 1px solid #eee;
  2434. .left-box {
  2435. position: relative;
  2436. float: left;
  2437. width: 970px;
  2438. min-height: 630px;
  2439. border: 1px solid #eee;
  2440. &__body {
  2441. .question {
  2442. padding: 12px 0 0 12px;
  2443. display: flex;
  2444. flex-direction: column;
  2445. height: 100%;
  2446. &__title {
  2447. padding-left: 12px;
  2448. font-size: 16px;
  2449. font-family: Microsoft YaHei;
  2450. font-weight: bold;
  2451. color: #333333;
  2452. line-height: 24px;
  2453. }
  2454. &__desc {
  2455. padding-left: 12px;
  2456. margin-top: 20px;
  2457. font-size: 16px;
  2458. font-family: Microsoft YaHei;
  2459. font-weight: 400;
  2460. color: #666666;
  2461. line-height: 24px;
  2462. text-align: justify;
  2463. /deep/ img {
  2464. max-width: 100% !important;
  2465. }
  2466. }
  2467. &__content {
  2468. /deep/ .el-tabs__item {
  2469. height: 40px;
  2470. line-height: 40px;
  2471. }
  2472. .question__content {
  2473. height: auto;
  2474. overflow: auto;
  2475. }
  2476. .question-list {
  2477. padding: 24px 0 24px 24px;
  2478. border-bottom: 1px solid #eee;
  2479. .checkbox,
  2480. .radio {
  2481. cursor: pointer;
  2482. margin-right: 24px;
  2483. padding: 0 24px;
  2484. display: flex;
  2485. align-items: center;
  2486. margin-top: 2px;
  2487. min-height: 40px;
  2488. padding-top: 10px;
  2489. padding-bottom: 10px;
  2490. background: #f5f9ff;
  2491. border-radius: 8px;
  2492. box-sizing: border-box;
  2493. &.right {
  2494. background: #37c65b;
  2495. }
  2496. &.wrong {
  2497. background: #ff3a30;
  2498. }
  2499. &.user_choose {
  2500. background: #007aff;
  2501. }
  2502. }
  2503. &.textarea {
  2504. margin-right: 12px;
  2505. .upload {
  2506. margin-top: 10px;
  2507. &__imgs {
  2508. margin-right: 10px;
  2509. width: 80px;
  2510. height: 80px;
  2511. background: #ffffff;
  2512. border: 1px solid #eeeeee;
  2513. border-radius: 4px;
  2514. position: relative;
  2515. display: flex;
  2516. float: left;
  2517. align-items: center;
  2518. justify-content: center;
  2519. img {
  2520. max-width: 100%;
  2521. max-height: 100%;
  2522. }
  2523. }
  2524. &__btn {
  2525. margin-right: 10px;
  2526. width: 80px;
  2527. height: 80px;
  2528. background: #ffffff;
  2529. border: 1px solid #eeeeee;
  2530. border-radius: 4px;
  2531. position: relative;
  2532. display: flex;
  2533. float: left;
  2534. align-items: center;
  2535. justify-content: center;
  2536. flex-direction: column;
  2537. .icon {
  2538. font-size: 20px;
  2539. color: #3f8dfd;
  2540. }
  2541. p {
  2542. font-size: 12px;
  2543. font-family: Microsoft YaHei;
  2544. font-weight: 400;
  2545. color: #999999;
  2546. line-height: 24px;
  2547. }
  2548. input {
  2549. position: absolute;
  2550. left: 0;
  2551. top: 0;
  2552. display: block;
  2553. width: 100%;
  2554. height: 100%;
  2555. opacity: 0;
  2556. }
  2557. }
  2558. }
  2559. }
  2560. /deep/ .el-checkbox__input.is-checked+.el-checkbox__label {
  2561. color: #000 !important;
  2562. }
  2563. .el-checkbox__input.is-disabled+span.el-checkbox__label {
  2564. color: #000;
  2565. }
  2566. /deep/ .el-checkbox {
  2567. white-space: normal;
  2568. }
  2569. }
  2570. .answer-list {
  2571. height: 40px;
  2572. // border-top: 1px solid #eee;
  2573. border-bottom: 1px solid #eee;
  2574. // margin-top: 24px;
  2575. display: flex;
  2576. align-items: center;
  2577. justify-content: space-between;
  2578. padding: 0 24px;
  2579. &__left {
  2580. font-size: 16px;
  2581. font-family: Microsoft YaHei;
  2582. font-weight: 400;
  2583. color: #333333;
  2584. line-height: 24px;
  2585. }
  2586. &__right {
  2587. font-size: 16px;
  2588. font-family: Microsoft YaHei;
  2589. font-weight: 400;
  2590. color: #333333;
  2591. line-height: 24px;
  2592. }
  2593. }
  2594. .explain-list {
  2595. padding: 12px 24px;
  2596. &__header {
  2597. font-size: 16px;
  2598. font-family: Microsoft YaHei;
  2599. font-weight: bold;
  2600. color: #666666;
  2601. line-height: 24px;
  2602. }
  2603. &__body {
  2604. margin-top: 12px;
  2605. font-size: 16px;
  2606. font-family: Microsoft YaHei;
  2607. font-weight: 400;
  2608. color: #666666;
  2609. line-height: 24px;
  2610. }
  2611. .upload {
  2612. margin-top: 10px;
  2613. &__imgs {
  2614. margin-right: 10px;
  2615. width: 80px;
  2616. height: 80px;
  2617. background: #ffffff;
  2618. border: 1px solid #eeeeee;
  2619. border-radius: 4px;
  2620. position: relative;
  2621. display: flex;
  2622. float: left;
  2623. align-items: center;
  2624. justify-content: center;
  2625. img {
  2626. max-width: 100%;
  2627. max-height: 100%;
  2628. }
  2629. }
  2630. }
  2631. }
  2632. .question {
  2633. padding-bottom: 58px;
  2634. }
  2635. }
  2636. &__btns {
  2637. position: relative;
  2638. height: 32px;
  2639. .submit {
  2640. cursor: pointer;
  2641. margin: 0 auto;
  2642. width: 140px;
  2643. height: 32px;
  2644. padding: 0;
  2645. color: #fff;
  2646. background: #3f8dfd;
  2647. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  2648. border-radius: 16px;
  2649. text-align: center;
  2650. line-height: 32px;
  2651. font-size: 16px;
  2652. }
  2653. }
  2654. }
  2655. }
  2656. &__footer {
  2657. height: 40px;
  2658. display: flex;
  2659. justify-content: space-around;
  2660. align-items: center;
  2661. .btn {
  2662. cursor: pointer;
  2663. width: 140px;
  2664. height: 32px;
  2665. background: #ffffff;
  2666. border: 1px solid #3f8dfd;
  2667. border-radius: 16px;
  2668. line-height: 32px;
  2669. text-align: center;
  2670. color: #3f8dfd;
  2671. }
  2672. }
  2673. }
  2674. .right-box {
  2675. float: right;
  2676. width: 299px;
  2677. border-right: 1px solid #eee;
  2678. &__header {
  2679. height: 40px;
  2680. line-height: 40px;
  2681. border-bottom: 1px solid #eeeeee;
  2682. .back-btn {
  2683. display: block;
  2684. margin: 0 auto;
  2685. width: 160px;
  2686. }
  2687. .title {
  2688. float: left;
  2689. font-size: 16px;
  2690. font-family: Microsoft YaHei;
  2691. font-weight: bold;
  2692. color: #333333;
  2693. }
  2694. .time {
  2695. font-size: 16px;
  2696. font-family: Microsoft YaHei;
  2697. font-weight: 400;
  2698. color: #666666;
  2699. float: right;
  2700. }
  2701. }
  2702. &__body {
  2703. height: 510px;
  2704. border-bottom: 1px solid #eee;
  2705. .card {
  2706. &__note {
  2707. display: flex;
  2708. height: 64px;
  2709. align-items: center;
  2710. border-bottom: 1px solid #eee;
  2711. flex-wrap: wrap;
  2712. .item {
  2713. display: flex;
  2714. align-items: center;
  2715. margin-left: 10px;
  2716. width: 84px;
  2717. font-size: 12px;
  2718. .box {
  2719. margin-right: 5px;
  2720. width: 16px;
  2721. height: 16px;
  2722. border-radius: 4px;
  2723. &.white {
  2724. background: #ffffff;
  2725. border: 1px solid #eeeeee;
  2726. }
  2727. &.green {
  2728. background: #37c65b;
  2729. }
  2730. &.red {
  2731. background: #ff3a30;
  2732. }
  2733. &.yellow {
  2734. background: #ffc53d;
  2735. }
  2736. &.blue,
  2737. &.check_ans {
  2738. background: #3f8dfd;
  2739. }
  2740. }
  2741. }
  2742. }
  2743. &__content {
  2744. height: 440px;
  2745. overflow-y: scroll;
  2746. &::-webkit-scrollbar {
  2747. width: 6px;
  2748. }
  2749. &::-webkit-scrollbar-track {
  2750. background-color: #fff;
  2751. -webkit-border-radius: 2em;
  2752. -moz-border-radius: 2em;
  2753. border-radius: 2em;
  2754. }
  2755. &::-webkit-scrollbar-thumb {
  2756. background-color: #eeeeee;
  2757. -webkit-border-radius: 2em;
  2758. -moz-border-radius: 2em;
  2759. border-radius: 2em;
  2760. }
  2761. .list {
  2762. display: flex;
  2763. flex-wrap: wrap;
  2764. .item {
  2765. width: 40px;
  2766. height: 40px;
  2767. border-radius: 10px;
  2768. text-align: center;
  2769. line-height: 40px;
  2770. margin-left: 16px;
  2771. margin-top: 16px;
  2772. cursor: pointer;
  2773. &.white {
  2774. line-height: 38px;
  2775. color: #333333;
  2776. background: #ffffff;
  2777. border: 1px solid #eeeeee;
  2778. }
  2779. &.green {
  2780. color: #fff;
  2781. background: #37c65b;
  2782. }
  2783. &.red {
  2784. color: #fff;
  2785. background: #ff3a30;
  2786. }
  2787. &.blue,
  2788. &.check_ans {
  2789. color: #fff;
  2790. background: #3f8dfd;
  2791. }
  2792. &.yellow {
  2793. background: #ffc53d;
  2794. }
  2795. &.disabled {
  2796. cursor: not-allowed;
  2797. line-height: 38px;
  2798. color: #eeeeee;
  2799. background: #ffffff;
  2800. border: 1px solid #eeeeee;
  2801. }
  2802. }
  2803. }
  2804. }
  2805. }
  2806. }
  2807. &__footer {
  2808. border-bottom: 1px solid #eee;
  2809. height: 40px;
  2810. display: flex;
  2811. align-items: center;
  2812. justify-content: center;
  2813. .submit {
  2814. cursor: pointer;
  2815. width: 140px;
  2816. height: 32px;
  2817. padding: 0;
  2818. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  2819. border-radius: 16px;
  2820. line-height: 32px;
  2821. text-align: center;
  2822. font-size: 16px;
  2823. }
  2824. }
  2825. }
  2826. }
  2827. }
  2828. }
  2829. }
  2830. .take-photo {
  2831. /deep/ .el-dialog__header {
  2832. display: none;
  2833. }
  2834. /deep/ .el-dialog__body {
  2835. padding: 0;
  2836. overflow: unset;
  2837. }
  2838. &__close {
  2839. cursor: pointer;
  2840. position: absolute;
  2841. right: 0;
  2842. top: -28px;
  2843. width: 24px;
  2844. height: 24px;
  2845. line-height: 24px;
  2846. text-align: center;
  2847. color: #eee;
  2848. border: 1px solid #eee;
  2849. border-radius: 50%;
  2850. }
  2851. &__header {
  2852. height: 40px;
  2853. border-bottom: 1px solid #eee;
  2854. line-height: 40px;
  2855. font-size: 16px;
  2856. font-family: Microsoft YaHei;
  2857. font-weight: bold;
  2858. color: #333333;
  2859. padding-left: 24px;
  2860. }
  2861. &__body {
  2862. height: 400px;
  2863. padding: 40px 24px;
  2864. .left-box {
  2865. width: 336px;
  2866. float: left;
  2867. .title {
  2868. font-size: 16px;
  2869. font-family: Microsoft YaHei;
  2870. font-weight: bold;
  2871. color: #ff3b30;
  2872. line-height: 24px;
  2873. }
  2874. .content {
  2875. font-size: 14px;
  2876. font-family: Microsoft YaHei;
  2877. font-weight: 400;
  2878. color: #333333;
  2879. line-height: 28px;
  2880. margin-top: 32px;
  2881. }
  2882. }
  2883. .right-box {
  2884. float: right;
  2885. width: 400px;
  2886. height: 300px;
  2887. video {
  2888. width: 100%;
  2889. height: 100%;
  2890. }
  2891. }
  2892. }
  2893. &__footer {
  2894. height: 90px;
  2895. border-top: 1px solid #eee;
  2896. text-align: center;
  2897. .take {
  2898. display: inline-block;
  2899. width: 200px;
  2900. height: 40px;
  2901. padding: 0;
  2902. border-radius: 20px;
  2903. text-align: center;
  2904. line-height: 40px;
  2905. margin: 24px auto;
  2906. }
  2907. }
  2908. }
  2909. }
  2910. </style>