wrong-bank.vue 81 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258
  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">
  19. <div class="left-box">
  20. <div class="left-box__header">
  21. <el-progress
  22. class="progress"
  23. :text-inside="true"
  24. :stroke-width="26"
  25. :percentage="
  26. toFixed(
  27. (questionOverNum(true) / questionList.length) * 100
  28. ) || 0
  29. "
  30. ></el-progress>
  31. <div class="text">
  32. 已完成<span>{{ questionOverNum(true) }}</span
  33. >/{{ questionList.length }}道题
  34. </div>
  35. </div>
  36. <div class="left-box__footer">
  37. <div class="btn" @click="prevQuestion">上一题</div>
  38. <div class="btn" @click="nextQuestion">下一题</div>
  39. </div>
  40. <div class="left-box__body">
  41. <template v-for="(question, questionIndex) in questionList">
  42. <div
  43. class="question"
  44. v-if="question.type == 1 && current == questionIndex"
  45. :key="questionIndex"
  46. >
  47. <div class="question__title">
  48. {{ questionIndex + 1 }}、单选题
  49. </div>
  50. <div
  51. class="question__desc"
  52. v-html="question.content"
  53. ></div>
  54. <div class="question__content">
  55. <div class="question-list" v-if="!question.ques">
  56. <div
  57. class="radio"
  58. v-for="(item, index) in question.jsonStr"
  59. :key="index"
  60. @click="
  61. radioSelect(
  62. question,
  63. questionIndex,
  64. item.optionsId
  65. )
  66. "
  67. >
  68. <div>
  69. {{ ast[index] }}. {{ item.content }}
  70. <div v-if="item.imgUrl">
  71. <img
  72. style="max-width: 100%"
  73. :src="$tools.splitImgHost(item.imgUrl)"
  74. alt=""
  75. />
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="question-list" v-if="question.ques">
  81. <div
  82. class="radio"
  83. :class="{
  84. right:
  85. item.optionsId == question.ques ||
  86. item.optionsId == question.ans,
  87. wrong:
  88. item.optionsId == question.ques &&
  89. question.ques != question.ans,
  90. }"
  91. v-for="(item, index) in question.jsonStr"
  92. :key="index"
  93. >
  94. <div>
  95. {{ ast[index] }}. {{ item.content }}
  96. <div v-if="item.imgUrl">
  97. <img
  98. style="max-width: 100%"
  99. :src="$tools.splitImgHost(item.imgUrl)"
  100. alt=""
  101. />
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. <div class="answer-list" v-if="question.ques">
  107. <div class="answer-list__left">
  108. 正确答案:{{ ast[question.ans - 1] }}
  109. </div>
  110. <div class="answer-list__left" v-if="!explain">
  111. 我的答案:{{ ast[question.ques - 1] }}
  112. </div>
  113. </div>
  114. <div class="explain-list" v-if="question.ques">
  115. <div class="explain-list__header">答案解析:</div>
  116. <div
  117. class="explain-list__body"
  118. v-html="question.analysisContent"
  119. ></div>
  120. </div>
  121. </div>
  122. <div class="question__btns">
  123. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  124. </div>
  125. </div>
  126. <div
  127. class="question"
  128. v-if="question.type == 2 && current == questionIndex"
  129. :key="questionIndex"
  130. >
  131. <div class="question__title">
  132. {{ questionIndex + 1 }}、多选题
  133. </div>
  134. <div
  135. class="question__desc"
  136. v-html="question.content"
  137. ></div>
  138. <div class="question__content">
  139. <div class="question-list" v-if="!question.ques">
  140. <el-checkbox
  141. class="checkbox"
  142. v-for="(item, index) in question.jsonStr"
  143. :key="index"
  144. :label="item.optionsId"
  145. v-model="item.checked"
  146. >
  147. <div>
  148. {{ ast[index] }}. {{ item.content }}
  149. <div v-if="item.imgUrl">
  150. <img
  151. style="max-width: 100%"
  152. :src="$tools.splitImgHost(item.imgUrl)"
  153. alt=""
  154. />
  155. </div>
  156. </div>
  157. </el-checkbox>
  158. </div>
  159. <div class="question-list" v-if="question.ques">
  160. <el-checkbox
  161. disabled
  162. class="checkbox"
  163. :class="{
  164. right:
  165. question.ques.indexOf(item.optionsId) != -1 ||
  166. question.ans.indexOf(item.optionsId) != -1,
  167. wrong:
  168. question.ques.indexOf(item.optionsId) != -1 &&
  169. question.ans.indexOf(item.optionsId) == -1,
  170. }"
  171. v-for="(item, index) in question.jsonStr"
  172. :key="index"
  173. :label="item.optionsId"
  174. v-model="item.checked"
  175. >
  176. <div>
  177. {{ ast[index] }}. {{ item.content }}
  178. <div v-if="item.imgUrl">
  179. <img
  180. style="max-width: 100%"
  181. :src="$tools.splitImgHost(item.imgUrl)"
  182. alt=""
  183. />
  184. </div>
  185. </div>
  186. </el-checkbox>
  187. </div>
  188. <div class="answer-list" v-if="question.ques">
  189. <div class="answer-list__left">
  190. 正确答案:
  191. <template v-for="ansItem in question.ans">{{
  192. ast[ansItem - 1]
  193. }}</template>
  194. </div>
  195. <div class="answer-list__left" v-if="!explain">
  196. 我的答案:
  197. <template v-for="quesItem in question.ques">{{
  198. ast[quesItem - 1]
  199. }}</template>
  200. </div>
  201. </div>
  202. <div class="explain-list" v-if="question.ques">
  203. <div class="explain-list__header">答案解析:</div>
  204. <div
  205. class="explain-list__body"
  206. v-html="question.analysisContent"
  207. ></div>
  208. </div>
  209. </div>
  210. <div class="question__btns">
  211. <div
  212. v-if="!question.ques"
  213. class="submit"
  214. @click="checkboxSubmit(question, questionIndex)"
  215. >
  216. 确认答案
  217. </div>
  218. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  219. </div>
  220. </div>
  221. <div
  222. class="question"
  223. v-if="question.type == 3 && current == questionIndex"
  224. :key="questionIndex"
  225. >
  226. <div class="question__title">
  227. {{ questionIndex + 1 }}、判断题
  228. </div>
  229. <div
  230. class="question__desc"
  231. v-html="question.content"
  232. ></div>
  233. <div class="question__content">
  234. <div class="question-list" v-if="!question.ques">
  235. <div
  236. class="radio"
  237. v-for="(item, index) in judge"
  238. :key="index"
  239. @click="judgeSelect(question, questionIndex, index)"
  240. >
  241. <div>
  242. {{ ast[index] }}. {{ item }}
  243. <div v-if="item.imgUrl">
  244. <img
  245. style="max-width: 100%"
  246. :src="$tools.splitImgHost(item.imgUrl)"
  247. alt=""
  248. />
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. <div class="question-list" v-if="question.ques">
  254. <div
  255. class="radio"
  256. :class="{
  257. right:
  258. index == question.ques || index == question.ans,
  259. wrong:
  260. index == question.ques &&
  261. question.ques != question.ans,
  262. }"
  263. v-for="(item, index) in judge"
  264. :key="index"
  265. >
  266. <div>
  267. {{ ast[index] }}. {{ item }}
  268. <div v-if="item.imgUrl">
  269. <img
  270. style="max-width: 100%"
  271. :src="$tools.splitImgHost(item.imgUrl)"
  272. alt=""
  273. />
  274. </div>
  275. </div>
  276. </div>
  277. </div>
  278. <div class="answer-list" v-if="question.ques">
  279. <div class="answer-list__left">
  280. 正确答案:{{ ast[question.ans] }}
  281. </div>
  282. <div class="answer-list__left" v-if="!explain">
  283. 我的答案:{{ ast[question.ques] }}
  284. </div>
  285. </div>
  286. <div class="explain-list" v-if="question.ques">
  287. <div class="explain-list__header">答案解析:</div>
  288. <div
  289. class="explain-list__body"
  290. v-html="question.analysisContent"
  291. ></div>
  292. </div>
  293. </div>
  294. <div class="question__btns">
  295. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  296. </div>
  297. </div>
  298. <div
  299. class="question"
  300. v-if="question.type == 4 && current == questionIndex"
  301. :key="questionIndex"
  302. >
  303. <div class="question__title">
  304. {{ questionIndex + 1 }}、案例题
  305. </div>
  306. <div
  307. class="question__desc"
  308. v-html="question.content"
  309. ></div>
  310. <div class="question__content">
  311. <el-tabs v-model="question.tabIndex">
  312. <el-tab-pane
  313. v-for="(json, jsonIndex) in question.jsonStr"
  314. :label="'问题' + (jsonIndex + 1)"
  315. :name="jsonIndex + ''"
  316. :key="jsonIndex"
  317. >
  318. <div
  319. class="question"
  320. v-if="json.type == 1"
  321. :key="questionIndex"
  322. >
  323. <div class="question__title">
  324. {{ jsonIndex + 1 }}、单选题
  325. </div>
  326. <div
  327. class="question__desc"
  328. v-html="json.content"
  329. ></div>
  330. <div class="question__content">
  331. <div
  332. class="question-list"
  333. v-if="!question.ques[jsonIndex]"
  334. >
  335. <div
  336. class="radio"
  337. v-for="(item, index) in json.optionsList"
  338. :key="index"
  339. @click="
  340. radioSelectChild(
  341. questionIndex,
  342. jsonIndex,
  343. item.optionsId
  344. )
  345. "
  346. >
  347. <div>
  348. {{ ast[index] }}. {{ item.content }}
  349. <div v-if="item.imgUrl">
  350. <img
  351. style="max-width: 100%"
  352. :src="
  353. $tools.splitImgHost(item.imgUrl)
  354. "
  355. alt=""
  356. />
  357. </div>
  358. </div>
  359. </div>
  360. </div>
  361. <div
  362. class="question-list"
  363. v-if="question.ques[jsonIndex]"
  364. >
  365. <div
  366. class="radio"
  367. :class="{
  368. right:
  369. item.optionsId ==
  370. question.ques[jsonIndex] ||
  371. item.optionsId ==
  372. question.ans[jsonIndex],
  373. wrong:
  374. item.optionsId ==
  375. question.ques[jsonIndex] &&
  376. question.ques[jsonIndex] !=
  377. question.ans[jsonIndex],
  378. }"
  379. v-for="(item, index) in json.optionsList"
  380. :key="index"
  381. >
  382. <div>
  383. {{ ast[index] }}. {{ item.content }}
  384. <div v-if="item.imgUrl">
  385. <img
  386. style="max-width: 100%"
  387. :src="
  388. $tools.splitImgHost(item.imgUrl)
  389. "
  390. alt=""
  391. />
  392. </div>
  393. </div>
  394. </div>
  395. </div>
  396. <div
  397. class="answer-list"
  398. v-if="question.ques[jsonIndex]"
  399. >
  400. <div class="answer-list__left">
  401. 正确答案:{{
  402. ast[question.ans[jsonIndex] - 1]
  403. }}
  404. </div>
  405. <div
  406. class="answer-list__left"
  407. v-if="!explain"
  408. >
  409. 我的答案:{{
  410. ast[question.ques[jsonIndex] - 1]
  411. }}
  412. </div>
  413. </div>
  414. <div
  415. class="explain-list"
  416. v-if="question.ques[jsonIndex]"
  417. >
  418. <div class="explain-list__header">
  419. 答案解析:
  420. </div>
  421. <div
  422. class="explain-list__body"
  423. v-html="json.analysisContent"
  424. ></div>
  425. </div>
  426. </div>
  427. <div class="question__btns"></div>
  428. </div>
  429. <div
  430. class="question"
  431. v-if="json.type == 2"
  432. :key="jsonIndex"
  433. >
  434. <div class="question__title">
  435. {{ jsonIndex + 1 }}、多选题
  436. </div>
  437. <div
  438. class="question__desc"
  439. v-html="json.content"
  440. ></div>
  441. <div class="question__content">
  442. <div
  443. class="question-list"
  444. v-if="!question.ques[jsonIndex]"
  445. >
  446. <el-checkbox
  447. class="checkbox"
  448. v-for="(item, index) in json.optionsList"
  449. :key="index"
  450. :label="item.optionsId"
  451. v-model="item.checked"
  452. >
  453. <div>
  454. {{ ast[index] }}. {{ item.content }}
  455. <div v-if="item.imgUrl">
  456. <img
  457. style="max-width: 100%"
  458. :src="
  459. $tools.splitImgHost(item.imgUrl)
  460. "
  461. alt=""
  462. />
  463. </div>
  464. </div>
  465. </el-checkbox>
  466. </div>
  467. <div
  468. class="question-list"
  469. v-if="question.ques[jsonIndex]"
  470. >
  471. <el-checkbox
  472. disabled
  473. class="checkbox"
  474. :class="{
  475. right:
  476. question.ques[jsonIndex].indexOf(
  477. item.optionsId
  478. ) != -1 ||
  479. question.ans[jsonIndex].indexOf(
  480. item.optionsId
  481. ) != -1,
  482. wrong:
  483. question.ques[jsonIndex].indexOf(
  484. item.optionsId
  485. ) != -1 &&
  486. question.ans[jsonIndex].indexOf(
  487. item.optionsId
  488. ) == -1,
  489. }"
  490. v-for="(item, index) in json.optionsList"
  491. :key="index"
  492. :label="item.optionsId"
  493. v-model="item.checked"
  494. >
  495. <div>
  496. {{ ast[index] }}. {{ item.content }}
  497. <div v-if="item.imgUrl">
  498. <img
  499. style="max-width: 100%"
  500. :src="
  501. $tools.splitImgHost(item.imgUrl)
  502. "
  503. alt=""
  504. />
  505. </div>
  506. </div>
  507. </el-checkbox>
  508. </div>
  509. <div
  510. class="answer-list"
  511. v-if="question.ques[jsonIndex]"
  512. >
  513. <div class="answer-list__left">
  514. 正确答案:
  515. <template
  516. v-for="ansItem in question.ans[jsonIndex]"
  517. >{{ ast[ansItem - 1] }}</template
  518. >
  519. </div>
  520. <div
  521. class="answer-list__left"
  522. v-if="!explain"
  523. >
  524. 我的答案:
  525. <template
  526. v-for="quesItem in question.ques[
  527. jsonIndex
  528. ]"
  529. >{{ ast[quesItem - 1] }}</template
  530. >
  531. </div>
  532. </div>
  533. <div
  534. class="explain-list"
  535. v-if="question.ques[jsonIndex]"
  536. >
  537. <div class="explain-list__header">
  538. 答案解析:
  539. </div>
  540. <div
  541. class="explain-list__body"
  542. v-html="json.analysisContent"
  543. ></div>
  544. </div>
  545. </div>
  546. <div class="question__btns">
  547. <div
  548. v-if="!question.ques[jsonIndex]"
  549. class="submit"
  550. @click="
  551. checkboxSubmitChild(
  552. questionIndex,
  553. jsonIndex
  554. )
  555. "
  556. >
  557. 确认答案
  558. </div>
  559. </div>
  560. </div>
  561. <div
  562. class="question"
  563. v-if="json.type == 3"
  564. :key="jsonIndex"
  565. >
  566. <div class="question__title">
  567. {{ jsonIndex + 1 }}、判断题
  568. </div>
  569. <div
  570. class="question__desc"
  571. v-html="json.content"
  572. ></div>
  573. <div class="question__content">
  574. <div
  575. class="question-list"
  576. v-if="!question.ques[jsonIndex]"
  577. >
  578. <div
  579. class="radio"
  580. v-for="(item, index) in judge"
  581. :key="index"
  582. @click="
  583. judgeSelectChild(
  584. questionIndex,
  585. jsonIndex,
  586. index
  587. )
  588. "
  589. >
  590. <div>
  591. {{ ast[index] }}. {{ item }}
  592. <div v-if="item.imgUrl">
  593. <img
  594. style="max-width: 100%"
  595. :src="
  596. $tools.splitImgHost(item.imgUrl)
  597. "
  598. alt=""
  599. />
  600. </div>
  601. </div>
  602. </div>
  603. </div>
  604. <div
  605. class="question-list"
  606. v-if="question.ques[jsonIndex]"
  607. >
  608. <div
  609. class="radio"
  610. :class="{
  611. right:
  612. index == question.ques[jsonIndex] ||
  613. index == question.ans[jsonIndex],
  614. wrong:
  615. index == question.ques[jsonIndex] &&
  616. question.ques[jsonIndex] !=
  617. question.ans[jsonIndex],
  618. }"
  619. v-for="(item, index) in judge"
  620. :key="index"
  621. >
  622. <div>
  623. {{ ast[index] }}. {{ item }}
  624. <div v-if="item.imgUrl">
  625. <img
  626. style="max-width: 100%"
  627. :src="
  628. $tools.splitImgHost(item.imgUrl)
  629. "
  630. alt=""
  631. />
  632. </div>
  633. </div>
  634. </div>
  635. </div>
  636. <div
  637. class="answer-list"
  638. v-if="question.ques[jsonIndex]"
  639. >
  640. <div class="answer-list__left">
  641. 正确答案:{{ ast[question.ans[jsonIndex]] }}
  642. </div>
  643. <div
  644. class="answer-list__left"
  645. v-if="!explain"
  646. >
  647. 我的答案:{{
  648. ast[question.ques[jsonIndex]]
  649. }}
  650. </div>
  651. </div>
  652. <div
  653. class="explain-list"
  654. v-if="question.ques[jsonIndex]"
  655. >
  656. <div class="explain-list__header">
  657. 答案解析:
  658. </div>
  659. <div
  660. class="explain-list__body"
  661. v-html="json.analysisContent"
  662. ></div>
  663. </div>
  664. </div>
  665. <div class="question__btns"></div>
  666. </div>
  667. <div
  668. class="question"
  669. v-if="json.type == 5"
  670. :key="jsonIndex"
  671. >
  672. <div class="question__title">
  673. {{ jsonIndex + 1 }}、简答题
  674. </div>
  675. <div
  676. class="question__desc"
  677. v-html="json.content"
  678. ></div>
  679. <div class="question__content">
  680. <div
  681. class="question-list textarea"
  682. v-if="
  683. !(
  684. question.ques[jsonIndex] &&
  685. (question.ques[jsonIndex].imageList
  686. .length ||
  687. question.ques[jsonIndex].text)
  688. )
  689. "
  690. >
  691. <el-input
  692. type="textarea"
  693. rows="5"
  694. v-model="json.ansText.text"
  695. resize="none"
  696. ></el-input>
  697. <div class="upload clearfix">
  698. <div
  699. class="upload__imgs"
  700. v-for="(img, imgIndex) in json.ansText
  701. .imageList"
  702. :key="imgIndex"
  703. >
  704. <img
  705. :src="$tools.splitImgHost(img, true)"
  706. alt=""
  707. />
  708. </div>
  709. <div class="upload__btn">
  710. <i class="el-icon-plus icon"></i>
  711. <p>上传图片</p>
  712. <input
  713. @change="
  714. uploadImgChild(
  715. $event,
  716. questionIndex,
  717. jsonIndex
  718. )
  719. "
  720. type="file"
  721. />
  722. </div>
  723. </div>
  724. </div>
  725. <div
  726. class="explain-list"
  727. v-if="
  728. question.ques[jsonIndex] &&
  729. (question.ques[jsonIndex].imageList
  730. .length ||
  731. question.ques[jsonIndex].text) &&
  732. !explain
  733. "
  734. >
  735. <div class="explain-list__header">
  736. 我的答案:
  737. </div>
  738. <div class="explain-list__body">
  739. <div>
  740. {{ question.ques[jsonIndex].text }}
  741. </div>
  742. <div class="upload clearfix">
  743. <div
  744. class="upload__imgs"
  745. v-for="(img, imgIndex) in question.ques[
  746. jsonIndex
  747. ].imageList"
  748. :key="imgIndex"
  749. >
  750. <img
  751. :src="$tools.splitImgHost(img, true)"
  752. alt=""
  753. />
  754. </div>
  755. </div>
  756. </div>
  757. <div class="explain-list__header">
  758. 答案解析:
  759. </div>
  760. <div
  761. class="explain-list__body"
  762. v-html="question.analysisContent"
  763. ></div>
  764. </div>
  765. </div>
  766. <div class="question__btns">
  767. <div
  768. v-if="
  769. !(
  770. question.ques[jsonIndex] &&
  771. (question.ques[jsonIndex].imageList
  772. .length ||
  773. question.ques[jsonIndex].text)
  774. )
  775. "
  776. class="submit"
  777. @click="
  778. ansSubmitChild(
  779. question,
  780. questionIndex,
  781. jsonIndex
  782. )
  783. "
  784. >
  785. 确认答案
  786. </div>
  787. </div>
  788. </div>
  789. </el-tab-pane>
  790. </el-tabs>
  791. </div>
  792. <div class="question__btns">
  793. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  794. </div>
  795. </div>
  796. <div
  797. class="question"
  798. v-if="question.type == 5 && current == questionIndex"
  799. :key="questionIndex"
  800. >
  801. <div class="question__title">
  802. {{ questionIndex + 1 }}、简答题
  803. </div>
  804. <div
  805. class="question__desc"
  806. v-html="question.content"
  807. ></div>
  808. <div class="question__content">
  809. <div
  810. class="question-list textarea"
  811. v-if="
  812. !question.ques.imageList.length &&
  813. !question.ques.text
  814. "
  815. >
  816. <el-input
  817. type="textarea"
  818. rows="5"
  819. v-model="question.ansText.text"
  820. resize="none"
  821. ></el-input>
  822. <div class="upload clearfix">
  823. <div
  824. class="upload__imgs"
  825. v-for="(img, imgIndex) in question.ansText
  826. .imageList"
  827. :key="imgIndex"
  828. >
  829. <img
  830. :src="$tools.splitImgHost(img, true)"
  831. alt=""
  832. />
  833. </div>
  834. <div class="upload__btn">
  835. <i class="el-icon-plus icon"></i>
  836. <p>上传图片</p>
  837. <input
  838. @change="
  839. uploadImg($event, question, questionIndex)
  840. "
  841. type="file"
  842. />
  843. </div>
  844. </div>
  845. </div>
  846. <div
  847. class="explain-list"
  848. v-if="
  849. (question.ques.imageList.length ||
  850. question.ques.text) &&
  851. !explain
  852. "
  853. >
  854. <div class="explain-list__header">我的答案:</div>
  855. <div class="explain-list__body">
  856. <div>{{ question.ques.text }}</div>
  857. <div class="upload clearfix">
  858. <div
  859. class="upload__imgs"
  860. v-for="(img, imgIndex) in question.ques
  861. .imageList"
  862. :key="imgIndex"
  863. >
  864. <img
  865. :src="$tools.splitImgHost(img, true)"
  866. alt=""
  867. />
  868. </div>
  869. </div>
  870. </div>
  871. <div class="explain-list__header">答案解析:</div>
  872. <div
  873. class="explain-list__body"
  874. v-html="question.analysisContent"
  875. ></div>
  876. </div>
  877. </div>
  878. <div class="question__btns">
  879. <div
  880. v-if="
  881. !question.ques.imageList.length &&
  882. !question.ques.text
  883. "
  884. class="submit"
  885. @click="ansSubmit(question, questionIndex)"
  886. >
  887. 确认答案
  888. </div>
  889. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  890. </div>
  891. </div>
  892. </template>
  893. </div>
  894. </div>
  895. <div class="right-box">
  896. <div class="right-box__header">
  897. <el-button
  898. type="primary"
  899. round
  900. plain
  901. size="small"
  902. class="back-btn"
  903. @click="$router.back(-1)"
  904. >返回</el-button
  905. >
  906. </div>
  907. <div class="right-box__footer">
  908. <div class="submit" v-if="!explain" @click="submit">交卷</div>
  909. </div>
  910. <div class="right-box__header">答题卡</div>
  911. <div class="right-box__body">
  912. <div class="card">
  913. <div class="card__note">
  914. <div class="item">
  915. <div class="box green"></div>
  916. 正确
  917. </div>
  918. <div class="item">
  919. <div class="box red"></div>
  920. 错误
  921. </div>
  922. <div class="item">
  923. <div class="box blue"></div>
  924. 已做未评改
  925. </div>
  926. <div class="item">
  927. <div class="box yellow"></div>
  928. 少选
  929. </div>
  930. <div class="item">
  931. <div class="box white"></div>
  932. 未做
  933. </div>
  934. </div>
  935. <div class="card__content">
  936. <ul class="list">
  937. <li
  938. class="item white"
  939. v-for="(item, index) in questionList"
  940. :key="index"
  941. :class="{
  942. green: isRight(item, index),
  943. red: isWrong(item, index),
  944. yellow: isPart(item, index),
  945. blue: isOver(item, index),
  946. }"
  947. @click="changeIndex(index)"
  948. >
  949. {{ index + 1 }}
  950. </li>
  951. </ul>
  952. </div>
  953. </div>
  954. </div>
  955. </div>
  956. </div>
  957. </div>
  958. </div>
  959. </div>
  960. </section>
  961. <ToolBar></ToolBar>
  962. <Footer></Footer>
  963. </div>
  964. </template>
  965. <script>
  966. import Footer from "@/components/footer/index";
  967. import Header from "@/components/header/index";
  968. import ToolBar from "@/components/toolbar/index";
  969. import { mapMutations } from "vuex";
  970. export default {
  971. name: "BankExplain",
  972. components: {
  973. Footer,
  974. Header,
  975. ToolBar,
  976. },
  977. data() {
  978. return {
  979. questionIndex: 0,
  980. questionList: [],
  981. orderGoodsId: "",
  982. bankList: [],
  983. judge: ["错误", "正确"],
  984. ast: [
  985. "A",
  986. "B",
  987. "C",
  988. "D",
  989. "E",
  990. "F",
  991. "G",
  992. "H",
  993. "I",
  994. "J",
  995. "K",
  996. "L",
  997. "M",
  998. "N",
  999. "O",
  1000. "P",
  1001. "Q",
  1002. "R",
  1003. "S",
  1004. "T",
  1005. "U",
  1006. "V",
  1007. "W",
  1008. "X",
  1009. "Y",
  1010. "Z",
  1011. ],
  1012. current: 0,
  1013. examId: "",
  1014. explain: "",
  1015. };
  1016. },
  1017. async mounted() {
  1018. this.examId = this.$route.params.examId;
  1019. this.explain = this.$route.query.explain || "";
  1020. this.orderGoodsId = this.$route.query.orderGoodsId || "";
  1021. this.wrongRecordExamQuestionList();
  1022. },
  1023. methods: {
  1024. toFixed(num) {
  1025. if (num) {
  1026. let str = String(num).indexOf(".");
  1027. if (str != -1) {
  1028. return +num.toFixed(2);
  1029. } else {
  1030. return num;
  1031. }
  1032. } else {
  1033. return 0;
  1034. }
  1035. },
  1036. /**
  1037. * 请求题目列表
  1038. */
  1039. wrongRecordExamQuestionList() {
  1040. this.$request
  1041. .wrongRecordExamQuestionList({
  1042. examId: this.examId,
  1043. })
  1044. .then(async (res) => {
  1045. res.rows.forEach((item, index) => {
  1046. if (typeof item.jsonStr == "string") {
  1047. item.jsonStr = JSON.parse(item.jsonStr);
  1048. if (item.type == 2) {
  1049. //多选
  1050. item.jsonStr.forEach((str) => {
  1051. str.optionsId = "" + str.optionsId;
  1052. });
  1053. let arr = item.answerQuestion.split(",");
  1054. arr.forEach((a, i) => {
  1055. arr[i] = "" + a;
  1056. });
  1057. item.ans = arr;
  1058. if (this.explain) {
  1059. item.ques = item.ans;
  1060. }
  1061. item.quesSelect = [];
  1062. item.analysisContent &&
  1063. (item.analysisContent = item.analysisContent.replace(
  1064. /<img/gi,
  1065. '<img style="max-width:100%;"'
  1066. ));
  1067. item.content &&
  1068. (item.content = item.content.replace(
  1069. /<img/gi,
  1070. '<img style="max-width:100%;"'
  1071. ));
  1072. return;
  1073. } else if (item.type == 5) {
  1074. //简答题
  1075. item.ansText = {
  1076. text: "",
  1077. imageList: [],
  1078. };
  1079. item.ques = {
  1080. text: "",
  1081. imageList: [],
  1082. };
  1083. item.analysisContent &&
  1084. (item.analysisContent = item.analysisContent.replace(
  1085. /<img/gi,
  1086. '<img style="max-width:100%;"'
  1087. ));
  1088. item.content &&
  1089. (item.content = item.content.replace(
  1090. /<img/gi,
  1091. '<img style="max-width:100%;"'
  1092. ));
  1093. if (this.explain) {
  1094. item.ques = {
  1095. text: item.analysisContent,
  1096. imageList: [],
  1097. };
  1098. return;
  1099. }
  1100. } else if (item.type == 4) {
  1101. //案例题
  1102. console.log(item.jsonStr);
  1103. item.ques = [];
  1104. item.tabIndex = "0";
  1105. let ansArr = [];
  1106. item.jsonStr.forEach((json, index) => {
  1107. if (json.type == 1) {
  1108. ansArr[index] = json.answerQuestion;
  1109. json.content &&
  1110. (json.content = json.content.replace(
  1111. /<img/gi,
  1112. '<img style="max-width:100%;"'
  1113. ));
  1114. } else if (json.type == 2) {
  1115. json.optionsList.forEach((str) => {
  1116. str.optionsId = "" + str.optionsId;
  1117. });
  1118. let arr = json.answerQuestion.split(",");
  1119. arr.forEach((a, i) => {
  1120. arr[i] = "" + a;
  1121. });
  1122. ansArr[index] = arr;
  1123. json.content &&
  1124. (json.content = json.content.replace(
  1125. /<img/gi,
  1126. '<img style="max-width:100%;"'
  1127. ));
  1128. } else if (json.type == 3) {
  1129. ansArr[index] = json.answerQuestion;
  1130. json.content &&
  1131. (json.content = json.content.replace(
  1132. /<img/gi,
  1133. '<img style="max-width:100%;"'
  1134. ));
  1135. } else if (json.type == 5) {
  1136. ansArr[index] = {
  1137. text: "",
  1138. imageList: [],
  1139. };
  1140. json.ansText = {
  1141. text: "",
  1142. imageList: [],
  1143. };
  1144. json.ques = {
  1145. text: "",
  1146. imageList: [],
  1147. };
  1148. json.content &&
  1149. (json.content = json.content.replace(
  1150. /<img/gi,
  1151. '<img style="max-width:100%;"'
  1152. ));
  1153. }
  1154. });
  1155. item.analysisContent &&
  1156. (item.analysisContent = item.analysisContent.replace(
  1157. /<img/gi,
  1158. '<img style="max-width:100%;"'
  1159. ));
  1160. item.content &&
  1161. (item.content = item.content.replace(
  1162. /<img/gi,
  1163. '<img style="max-width:100%;"'
  1164. ));
  1165. item.ans = ansArr;
  1166. if (this.explain) {
  1167. item.ques = item.ans;
  1168. }
  1169. return;
  1170. }
  1171. item.analysisContent &&
  1172. (item.analysisContent = item.analysisContent.replace(
  1173. /<img/gi,
  1174. '<img style="max-width:100%;"'
  1175. ));
  1176. item.content &&
  1177. (item.content = item.content.replace(
  1178. /<img/gi,
  1179. '<img style="max-width:100%;"'
  1180. ));
  1181. item.ques = "";
  1182. item.ans = item.answerQuestion;
  1183. if (this.explain) {
  1184. item.ques = item.ans;
  1185. }
  1186. } else {
  1187. if (this.explain) {
  1188. item.ques = item.ans;
  1189. }
  1190. }
  1191. });
  1192. this.questionList = res.rows;
  1193. });
  1194. },
  1195. /**
  1196. * @param {Object}
  1197. * 单选点击确认
  1198. */
  1199. radioSelect(question, questionIndex, optionsId) {
  1200. if (this.questionList[questionIndex].ques) return;
  1201. this.$set(this.questionList[questionIndex], "ques", optionsId);
  1202. // 回答错误
  1203. if (
  1204. this.questionList[questionIndex].ques !=
  1205. this.questionList[questionIndex].ans
  1206. ) {
  1207. } else {
  1208. console.log(this.questionList[questionIndex]);
  1209. this.$request
  1210. .wrongRecordDelete({
  1211. examId: this.questionList[questionIndex].examId,
  1212. orderGoodsId: this.questionList[questionIndex].orderGoodsId || "",
  1213. questionId: this.questionList[questionIndex].questionId,
  1214. goodsId: this.questionList[questionIndex].orderGoodsId
  1215. ? ""
  1216. : this.questionList[questionIndex].goodsId,
  1217. })
  1218. .then((res) => {});
  1219. }
  1220. },
  1221. /**
  1222. * @param {Object}
  1223. * 案例单选点击
  1224. */
  1225. radioSelectChild(questionIndex, jsonIndex, optionsId) {
  1226. if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1227. this.$set(this.questionList[questionIndex].ques, jsonIndex, optionsId);
  1228. },
  1229. /**
  1230. * 多选点击确认
  1231. */
  1232. checkboxSubmit(question, questionIndex) {
  1233. if (this.questionList[questionIndex].ques) return;
  1234. let arr = [];
  1235. this.questionList[questionIndex].jsonStr.forEach((item) => {
  1236. if (item.checked) {
  1237. arr.push(item.optionsId);
  1238. }
  1239. });
  1240. if (!arr.length) {
  1241. this.$message({
  1242. type: "warning",
  1243. message: "请选择答案",
  1244. });
  1245. return;
  1246. }
  1247. this.$set(this.questionList[questionIndex], "ques", arr);
  1248. let isWrong = this.questionList[questionIndex].ques.some(
  1249. (quesItem, quesIndex) => {
  1250. return (
  1251. this.questionList[questionIndex].ques[quesIndex] !=
  1252. this.questionList[questionIndex].ans[quesIndex]
  1253. );
  1254. }
  1255. );
  1256. // 回答错误
  1257. if (isWrong) {
  1258. } else {
  1259. let question = this.questionList.find(
  1260. (item) =>
  1261. item.questionId == this.questionList[questionIndex].questionId
  1262. );
  1263. if (question) {
  1264. this.$request
  1265. .wrongRecordDelete({
  1266. examId: question.examId,
  1267. orderGoodsId: question.orderGoodsId,
  1268. goodsId: this.questionList[questionIndex].orderGoodsId
  1269. ? ""
  1270. : this.questionList[questionIndex].goodsId,
  1271. questionId: question.questionId,
  1272. })
  1273. .then((res) => {});
  1274. }
  1275. }
  1276. },
  1277. /**
  1278. * @param {Object}
  1279. * 案例多选确认
  1280. */
  1281. checkboxSubmitChild(questionIndex, ansIndex) {
  1282. if (this.questionList[questionIndex].ques[ansIndex]) return;
  1283. let arr = [];
  1284. this.questionList[questionIndex].jsonStr[ansIndex].optionsList.forEach(
  1285. (item) => {
  1286. if (item.checked) {
  1287. arr.push(item.optionsId);
  1288. }
  1289. }
  1290. );
  1291. if (!arr.length) {
  1292. this.$message({
  1293. type: "warning",
  1294. message: "请选择答案",
  1295. });
  1296. return;
  1297. }
  1298. this.$set(this.questionList[questionIndex].ques, ansIndex, arr);
  1299. },
  1300. /**
  1301. * 判断点击确认
  1302. */
  1303. judgeSelect(question, questionIndex, index) {
  1304. if (question.ques) return;
  1305. this.$set(this.questionList[questionIndex], "ques", index + "");
  1306. // 回答错误
  1307. if (
  1308. this.questionList[questionIndex].ques !=
  1309. this.questionList[questionIndex].ans
  1310. ) {
  1311. } else {
  1312. this.$request
  1313. .wrongRecordDelete({
  1314. examId: this.questionList[questionIndex].examId,
  1315. orderGoodsId: this.questionList[questionIndex].orderGoodsId || "",
  1316. goodsId: this.questionList[questionIndex].orderGoodsId
  1317. ? ""
  1318. : this.questionList[questionIndex].goodsId,
  1319. questionId: this.questionList[questionIndex].questionId,
  1320. })
  1321. .then((res) => {});
  1322. }
  1323. },
  1324. judgeSelectChild(questionIndex, jsonIndex, index) {
  1325. console.log(this.questionList[questionIndex].ques[jsonIndex]);
  1326. if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1327. this.$set(this.questionList[questionIndex].ques, jsonIndex, index + "");
  1328. },
  1329. /**
  1330. * 上传图片
  1331. */
  1332. uploadImg(e, question, questionIndex) {
  1333. var file = e.target.files[0];
  1334. if (file.size > 2 * 1024 * 1024) {
  1335. this.$message.warn("图片不得大于2000kb");
  1336. return;
  1337. }
  1338. var type = e.target.value.toLowerCase().split(".").splice(-1);
  1339. if (
  1340. type[0] != "jpg" &&
  1341. type[0] != "png" &&
  1342. type[0] != "jpeg" &&
  1343. type[0] != "gif"
  1344. ) {
  1345. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  1346. e.target.value = "";
  1347. return;
  1348. }
  1349. this.$upload.upload(file, 0).then((res) => {
  1350. question.ansText.imageList.push(res);
  1351. });
  1352. },
  1353. /**
  1354. * 案例上传图片
  1355. */
  1356. uploadImgChild(e, questionIndex, jsonIndex) {
  1357. var file = e.target.files[0];
  1358. if (file.size > 2 * 1024 * 1024) {
  1359. this.$message.warn("图片不得大于2000kb");
  1360. return;
  1361. }
  1362. var type = e.target.value.toLowerCase().split(".").splice(-1);
  1363. if (
  1364. type[0] != "jpg" &&
  1365. type[0] != "png" &&
  1366. type[0] != "jpeg" &&
  1367. type[0] != "gif"
  1368. ) {
  1369. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  1370. e.target.value = "";
  1371. return;
  1372. }
  1373. this.$upload.upload(file, 0).then((res) => {
  1374. this.questionList[questionIndex].jsonStr[
  1375. jsonIndex
  1376. ].ansText.imageList.push(res);
  1377. });
  1378. },
  1379. isOver(item, index) {
  1380. if (this.questionList[index].ques) {
  1381. if (item.type == 4) {
  1382. //案例题
  1383. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1384. if (
  1385. jsonItem.type == 1 ||
  1386. jsonItem.type == 2 ||
  1387. jsonItem.type == 3
  1388. ) {
  1389. if (item.ques[indexs]) {
  1390. return true;
  1391. } else {
  1392. return false;
  1393. }
  1394. } else if (jsonItem.type == 5) {
  1395. if (
  1396. item.ques[indexs] &&
  1397. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  1398. ) {
  1399. console.log("chil");
  1400. return true;
  1401. } else {
  1402. return false;
  1403. }
  1404. }
  1405. });
  1406. if (isOver) {
  1407. return true;
  1408. } else {
  1409. return false;
  1410. }
  1411. } else if (item.type == 5) {
  1412. //简答题
  1413. //每一项都相等
  1414. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  1415. return true;
  1416. }
  1417. //判断
  1418. } else {
  1419. return false;
  1420. }
  1421. } else {
  1422. return false;
  1423. }
  1424. },
  1425. ansSubmit(question, questionIndex) {
  1426. if (!question.ansText.text && !question.ansText.imageList.length) {
  1427. this.$message({
  1428. type: "warning",
  1429. message: "请输入内容或上传图片",
  1430. });
  1431. return;
  1432. }
  1433. question.ques.imageList = question.ansText.imageList;
  1434. question.ques.text = question.ansText.text;
  1435. console.log(question.ques);
  1436. },
  1437. ansSubmitChild(question, questionIndex, jsonIndex) {
  1438. if (
  1439. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text &&
  1440. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.imageList
  1441. .length
  1442. ) {
  1443. this.$message({
  1444. type: "warning",
  1445. message: "请输入内容或上传图片",
  1446. });
  1447. return;
  1448. }
  1449. this.$set(this.questionList[questionIndex].ques, jsonIndex, {
  1450. imageList:
  1451. this.questionList[questionIndex].jsonStr[jsonIndex].ansText
  1452. .imageList || [],
  1453. text:
  1454. this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text ||
  1455. "",
  1456. });
  1457. },
  1458. changeIndex(index) {
  1459. this.current = index;
  1460. },
  1461. nextQuestion() {
  1462. if (this.current >= this.questionList.length - 1) {
  1463. this.$message({
  1464. type: "warning",
  1465. message: "已经是最后一题了!",
  1466. });
  1467. return;
  1468. }
  1469. this.current++;
  1470. },
  1471. prevQuestion() {
  1472. if (this.current == 0) {
  1473. this.$message({
  1474. type: "warning",
  1475. message: "已经是第一题了!",
  1476. });
  1477. return;
  1478. } else {
  1479. this.current--;
  1480. }
  1481. },
  1482. isRight(item, index) {
  1483. console.log(item);
  1484. //单选
  1485. if (this.questionList[index].ques) {
  1486. if (item.type == 1) {
  1487. console.log(
  1488. this.questionList[index].ques == this.questionList[index].ans
  1489. );
  1490. return this.questionList[index].ques == this.questionList[index].ans;
  1491. //多选
  1492. } else if (item.type == 2) {
  1493. //每一项都相等
  1494. return this.questionList[index].ans.every((item, i) => {
  1495. return item == this.questionList[index].ques[i];
  1496. });
  1497. //判断
  1498. } else if (item.type == 3) {
  1499. return this.questionList[index].ques == this.questionList[index].ans;
  1500. } else {
  1501. return false;
  1502. }
  1503. } else {
  1504. return false;
  1505. }
  1506. },
  1507. isWrong(item, index) {
  1508. if (this.questionList[index].ques) {
  1509. //单选
  1510. if (item.type == 1) {
  1511. return this.questionList[index].ques != this.questionList[index].ans;
  1512. //多选
  1513. } else if (item.type == 2) {
  1514. //每一项都相等
  1515. return this.questionList[index].ques.some((item, i) => {
  1516. return this.questionList[index].ans.indexOf(item) == -1;
  1517. });
  1518. //判断
  1519. } else if (item.type == 3) {
  1520. return this.questionList[index].ques != this.questionList[index].ans;
  1521. } else {
  1522. return false;
  1523. }
  1524. } else {
  1525. return false;
  1526. }
  1527. },
  1528. isPart(item, index) {
  1529. if (this.questionList[index].ques) {
  1530. if (item.type == 2) {
  1531. let isWrong = this.questionList[index].ques.some((item, i) => {
  1532. return this.questionList[index].ans.indexOf(item) == -1;
  1533. });
  1534. let isRight = this.questionList[index].ans.every((item, i) => {
  1535. return item == this.questionList[index].ques[i];
  1536. });
  1537. if (!isRight && !isWrong) {
  1538. return true;
  1539. }
  1540. }
  1541. } else {
  1542. return false;
  1543. }
  1544. },
  1545. right(bankIndex, ansIndex, option) {
  1546. if (
  1547. this.questionList[bankIndex].ques[ansIndex] &&
  1548. this.questionList[bankIndex].ans[ansIndex]
  1549. ) {
  1550. if (
  1551. this.questionList[bankIndex].ques[ansIndex].indexOf(
  1552. option.optionsId
  1553. ) != -1 ||
  1554. this.questionList[bankIndex].ans[ansIndex].indexOf(
  1555. option.optionsId
  1556. ) != -1
  1557. ) {
  1558. return true;
  1559. } else {
  1560. return false;
  1561. }
  1562. } else {
  1563. return false;
  1564. }
  1565. },
  1566. wrong(bankIndex, ansIndex, option) {
  1567. if (
  1568. this.questionList[bankIndex].ques[ansIndex] &&
  1569. this.questionList[bankIndex].ans[ansIndex]
  1570. ) {
  1571. if (
  1572. this.questionList[bankIndex].ques[ansIndex].indexOf(
  1573. option.optionsId
  1574. ) != -1 &&
  1575. this.questionList[bankIndex].ans[ansIndex].indexOf(
  1576. option.optionsId
  1577. ) == -1
  1578. ) {
  1579. return true;
  1580. } else {
  1581. return false;
  1582. }
  1583. } else {
  1584. return false;
  1585. }
  1586. },
  1587. /**
  1588. * 获取已经回答的题目数
  1589. * hasSpecail (是否包含简答和案例)
  1590. */
  1591. questionOverNum(hasSpecail) {
  1592. let count = 0;
  1593. this.questionList.forEach((item) => {
  1594. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1595. if (item.ques) {
  1596. count++;
  1597. }
  1598. } else if (item.type == 4) {
  1599. //案例题
  1600. if (hasSpecail) {
  1601. let isOver = item.jsonStr.every((jsonItem, index) => {
  1602. if (
  1603. jsonItem.type == 1 ||
  1604. jsonItem.type == 2 ||
  1605. jsonItem.type == 3
  1606. ) {
  1607. if (item.ques[index]) {
  1608. return true;
  1609. } else {
  1610. return false;
  1611. }
  1612. } else if (jsonItem.type == 5) {
  1613. if (
  1614. item.ques[index] &&
  1615. (item.ques[index].text || item.ques[index].imageList.length)
  1616. ) {
  1617. return true;
  1618. } else {
  1619. return false;
  1620. }
  1621. }
  1622. });
  1623. if (isOver) {
  1624. count++;
  1625. }
  1626. }
  1627. } else if (item.type == 5) {
  1628. //简答题
  1629. if (hasSpecail) {
  1630. if (item.ques && (item.ques.text || item.ques.imageList.length)) {
  1631. console.log(5, item);
  1632. count++;
  1633. }
  1634. }
  1635. }
  1636. });
  1637. return count;
  1638. },
  1639. collect() {
  1640. this.$message({
  1641. message: "试做题目,不支持收藏~",
  1642. type: "warning",
  1643. });
  1644. return;
  1645. },
  1646. submit() {
  1647. this.$message({
  1648. type: "success",
  1649. message: "交卷成功",
  1650. });
  1651. setTimeout(() => {
  1652. this.$router.back(-1);
  1653. }, 2000);
  1654. },
  1655. },
  1656. };
  1657. </script>
  1658. <!-- Add "scoped" attribute to limit CSS to this component only -->
  1659. <style scoped lang="scss">
  1660. .course-exam {
  1661. .section {
  1662. overflow: hidden;
  1663. &__header {
  1664. height: 20px;
  1665. margin-top: 20px;
  1666. }
  1667. &__body {
  1668. .explain-record {
  1669. &__header {
  1670. }
  1671. &__body {
  1672. margin-bottom: 20px;
  1673. border: 1px solid #eee;
  1674. .left-box {
  1675. float: left;
  1676. width: 970px;
  1677. min-height: 630px;
  1678. border: 1px solid #eee;
  1679. &__header {
  1680. height: 40px;
  1681. padding-left: 12px;
  1682. border-bottom: 1px solid #eeeeee;
  1683. display: flex;
  1684. align-items: center;
  1685. .progress {
  1686. width: 636px;
  1687. }
  1688. .text {
  1689. margin-left: 15px;
  1690. font-size: 16px;
  1691. span {
  1692. font-family: Microsoft YaHei;
  1693. font-weight: bold;
  1694. color: #3f8dfd;
  1695. line-height: 24px;
  1696. }
  1697. }
  1698. }
  1699. &__body {
  1700. border-bottom: 1px solid #eee;
  1701. .question {
  1702. padding: 12px 0 0 12px;
  1703. display: flex;
  1704. flex-direction: column;
  1705. height: 100%;
  1706. &__title {
  1707. padding-left: 12px;
  1708. font-size: 16px;
  1709. font-family: Microsoft YaHei;
  1710. font-weight: bold;
  1711. color: #333333;
  1712. line-height: 24px;
  1713. }
  1714. &__desc {
  1715. padding-left: 12px;
  1716. margin-top: 20px;
  1717. font-size: 16px;
  1718. font-family: Microsoft YaHei;
  1719. font-weight: 400;
  1720. color: #666666;
  1721. line-height: 24px;
  1722. /deep/ img {
  1723. max-width: 100% !important;
  1724. }
  1725. }
  1726. &__content {
  1727. /deep/ .el-tabs__item {
  1728. height: 40px;
  1729. line-height: 40px;
  1730. }
  1731. .question__content {
  1732. height: auto;
  1733. overflow: auto;
  1734. }
  1735. .question-list {
  1736. padding: 24px 0 0 24px;
  1737. .checkbox,
  1738. .radio {
  1739. cursor: pointer;
  1740. margin-right: 24px;
  1741. padding: 0 24px;
  1742. display: flex;
  1743. align-items: center;
  1744. margin-top: 2px;
  1745. min-height: 40px;
  1746. padding-top: 10px;
  1747. padding-bottom: 10px;
  1748. background: #f5f9ff;
  1749. border-radius: 8px;
  1750. box-sizing: border-box;
  1751. &.right {
  1752. background: #37c65b;
  1753. }
  1754. &.wrong {
  1755. background: #ff3a30;
  1756. }
  1757. }
  1758. &.textarea {
  1759. margin-right: 12px;
  1760. .upload {
  1761. margin-top: 10px;
  1762. &__imgs {
  1763. margin-right: 10px;
  1764. width: 80px;
  1765. height: 80px;
  1766. background: #ffffff;
  1767. border: 1px solid #eeeeee;
  1768. border-radius: 4px;
  1769. position: relative;
  1770. display: flex;
  1771. float: left;
  1772. align-items: center;
  1773. justify-content: center;
  1774. img {
  1775. max-width: 100%;
  1776. max-height: 100%;
  1777. }
  1778. }
  1779. &__btn {
  1780. margin-right: 10px;
  1781. width: 80px;
  1782. height: 80px;
  1783. background: #ffffff;
  1784. border: 1px solid #eeeeee;
  1785. border-radius: 4px;
  1786. position: relative;
  1787. display: flex;
  1788. float: left;
  1789. align-items: center;
  1790. justify-content: center;
  1791. flex-direction: column;
  1792. .icon {
  1793. font-size: 20px;
  1794. color: #3f8dfd;
  1795. }
  1796. p {
  1797. font-size: 12px;
  1798. font-family: Microsoft YaHei;
  1799. font-weight: 400;
  1800. color: #999999;
  1801. line-height: 24px;
  1802. }
  1803. input {
  1804. position: absolute;
  1805. left: 0;
  1806. top: 0;
  1807. display: block;
  1808. width: 100%;
  1809. height: 100%;
  1810. opacity: 0;
  1811. }
  1812. }
  1813. }
  1814. }
  1815. /deep/
  1816. .el-checkbox__input.is-disabled
  1817. + span.el-checkbox__label {
  1818. color: #000;
  1819. }
  1820. /deep/ .el-checkbox {
  1821. white-space: normal;
  1822. }
  1823. }
  1824. .answer-list {
  1825. height: 40px;
  1826. border-top: 1px solid #eee;
  1827. border-bottom: 1px solid #eee;
  1828. margin-top: 24px;
  1829. display: flex;
  1830. align-items: center;
  1831. justify-content: space-between;
  1832. padding: 0 24px;
  1833. &__left {
  1834. font-size: 16px;
  1835. font-family: Microsoft YaHei;
  1836. font-weight: 400;
  1837. color: #333333;
  1838. line-height: 24px;
  1839. }
  1840. &__right {
  1841. font-size: 16px;
  1842. font-family: Microsoft YaHei;
  1843. font-weight: 400;
  1844. color: #333333;
  1845. line-height: 24px;
  1846. }
  1847. }
  1848. .explain-list {
  1849. padding: 12px 24px;
  1850. &__header {
  1851. font-size: 16px;
  1852. font-family: Microsoft YaHei;
  1853. font-weight: bold;
  1854. color: #666666;
  1855. line-height: 24px;
  1856. }
  1857. &__body {
  1858. margin-top: 12px;
  1859. font-size: 16px;
  1860. font-family: Microsoft YaHei;
  1861. font-weight: 400;
  1862. color: #666666;
  1863. line-height: 24px;
  1864. }
  1865. .upload {
  1866. margin-top: 10px;
  1867. &__imgs {
  1868. margin-right: 10px;
  1869. width: 80px;
  1870. height: 80px;
  1871. background: #ffffff;
  1872. border: 1px solid #eeeeee;
  1873. border-radius: 4px;
  1874. position: relative;
  1875. display: flex;
  1876. float: left;
  1877. align-items: center;
  1878. justify-content: center;
  1879. img {
  1880. max-width: 100%;
  1881. max-height: 100%;
  1882. }
  1883. }
  1884. }
  1885. }
  1886. }
  1887. &__btns {
  1888. position: relative;
  1889. height: 32px;
  1890. .submit {
  1891. cursor: pointer;
  1892. margin: 0 auto;
  1893. width: 140px;
  1894. height: 32px;
  1895. background: #3f8dfd;
  1896. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  1897. border-radius: 16px;
  1898. text-align: center;
  1899. line-height: 32px;
  1900. color: #fff;
  1901. font-size: 16px;
  1902. }
  1903. .collect {
  1904. cursor: pointer;
  1905. position: absolute;
  1906. right: 0;
  1907. top: 5px;
  1908. font-size: 12px;
  1909. font-family: Microsoft YaHei;
  1910. font-weight: 400;
  1911. color: #3f8dfd;
  1912. line-height: 24px;
  1913. }
  1914. }
  1915. }
  1916. }
  1917. &__footer {
  1918. height: 40px;
  1919. display: flex;
  1920. justify-content: space-around;
  1921. align-items: center;
  1922. .btn {
  1923. cursor: pointer;
  1924. width: 140px;
  1925. height: 32px;
  1926. background: #ffffff;
  1927. border: 1px solid #3f8dfd;
  1928. border-radius: 16px;
  1929. line-height: 32px;
  1930. text-align: center;
  1931. color: #3f8dfd;
  1932. }
  1933. }
  1934. }
  1935. .right-box {
  1936. float: right;
  1937. width: 299px;
  1938. border-right: 1px solid #eee;
  1939. &__header {
  1940. height: 40px;
  1941. line-height: 40px;
  1942. font-size: 16px;
  1943. font-family: Microsoft YaHei;
  1944. font-weight: bold;
  1945. color: #333333;
  1946. text-align: center;
  1947. border-bottom: 1px solid #eeeeee;
  1948. .back-btn {
  1949. display: block;
  1950. margin: 0 auto;
  1951. width: 160px;
  1952. }
  1953. }
  1954. &__body {
  1955. height: 510px;
  1956. border-bottom: 1px solid #eee;
  1957. .card {
  1958. &__note {
  1959. display: flex;
  1960. height: 64px;
  1961. align-items: center;
  1962. border-bottom: 1px solid #eee;
  1963. flex-wrap: wrap;
  1964. .item {
  1965. display: flex;
  1966. align-items: center;
  1967. margin-left: 10px;
  1968. width: 84px;
  1969. font-size: 12px;
  1970. .box {
  1971. margin-right: 5px;
  1972. width: 16px;
  1973. height: 16px;
  1974. border-radius: 4px;
  1975. &.white {
  1976. background: #ffffff;
  1977. border: 1px solid #eeeeee;
  1978. }
  1979. &.green {
  1980. background: #37c65b;
  1981. }
  1982. &.red {
  1983. background: #ff3a30;
  1984. }
  1985. &.yellow {
  1986. background: #ffc53d;
  1987. }
  1988. &.blue {
  1989. background: #3f8dfd;
  1990. }
  1991. }
  1992. }
  1993. }
  1994. &__content {
  1995. height: 440px;
  1996. overflow-y: scroll;
  1997. &::-webkit-scrollbar {
  1998. width: 6px;
  1999. }
  2000. &::-webkit-scrollbar-track {
  2001. background-color: #fff;
  2002. -webkit-border-radius: 2em;
  2003. -moz-border-radius: 2em;
  2004. border-radius: 2em;
  2005. }
  2006. &::-webkit-scrollbar-thumb {
  2007. background-color: #eeeeee;
  2008. -webkit-border-radius: 2em;
  2009. -moz-border-radius: 2em;
  2010. border-radius: 2em;
  2011. }
  2012. .list {
  2013. display: flex;
  2014. flex-wrap: wrap;
  2015. .item {
  2016. width: 40px;
  2017. height: 40px;
  2018. border-radius: 10px;
  2019. text-align: center;
  2020. line-height: 40px;
  2021. margin-left: 16px;
  2022. margin-top: 16px;
  2023. cursor: pointer;
  2024. &.white {
  2025. line-height: 38px;
  2026. color: #333333;
  2027. background: #ffffff;
  2028. border: 1px solid #eeeeee;
  2029. }
  2030. &.green {
  2031. color: #fff;
  2032. background: #37c65b;
  2033. }
  2034. &.red {
  2035. color: #fff;
  2036. background: #ff3a30;
  2037. }
  2038. &.blue {
  2039. border: 1rpx solid #eeeeee;
  2040. color: #fff;
  2041. background: #3f8dfd;
  2042. }
  2043. &.yellow {
  2044. background: #ffc53d;
  2045. }
  2046. &.disabled {
  2047. cursor: not-allowed;
  2048. line-height: 38px;
  2049. color: #eeeeee;
  2050. background: #ffffff;
  2051. border: 1px solid #eeeeee;
  2052. }
  2053. }
  2054. }
  2055. }
  2056. }
  2057. }
  2058. &__footer {
  2059. border-bottom: 1px solid #eee;
  2060. height: 40px;
  2061. display: flex;
  2062. align-items: center;
  2063. justify-content: center;
  2064. .submit {
  2065. cursor: pointer;
  2066. width: 140px;
  2067. height: 32px;
  2068. background: #3f8dfd;
  2069. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  2070. border-radius: 16px;
  2071. line-height: 32px;
  2072. text-align: center;
  2073. color: #fff;
  2074. font-size: 16px;
  2075. }
  2076. }
  2077. }
  2078. }
  2079. }
  2080. }
  2081. }
  2082. .take-photo {
  2083. /deep/ .el-dialog__header {
  2084. display: none;
  2085. }
  2086. /deep/ .el-dialog__body {
  2087. padding: 0;
  2088. overflow: unset;
  2089. }
  2090. &__close {
  2091. cursor: pointer;
  2092. position: absolute;
  2093. right: 0;
  2094. top: -28px;
  2095. width: 24px;
  2096. height: 24px;
  2097. line-height: 24px;
  2098. text-align: center;
  2099. color: #eee;
  2100. border: 1px solid #eee;
  2101. border-radius: 50%;
  2102. }
  2103. &__header {
  2104. height: 40px;
  2105. border-bottom: 1px solid #eee;
  2106. line-height: 40px;
  2107. font-size: 16px;
  2108. font-family: Microsoft YaHei;
  2109. font-weight: bold;
  2110. color: #333333;
  2111. padding-left: 24px;
  2112. }
  2113. &__body {
  2114. height: 400px;
  2115. padding: 40px 24px;
  2116. .left-box {
  2117. width: 336px;
  2118. float: left;
  2119. .title {
  2120. font-size: 16px;
  2121. font-family: Microsoft YaHei;
  2122. font-weight: bold;
  2123. color: #ff3b30;
  2124. line-height: 24px;
  2125. }
  2126. .content {
  2127. font-size: 14px;
  2128. font-family: Microsoft YaHei;
  2129. font-weight: 400;
  2130. color: #333333;
  2131. line-height: 28px;
  2132. margin-top: 32px;
  2133. }
  2134. }
  2135. .right-box {
  2136. float: right;
  2137. width: 400px;
  2138. height: 300px;
  2139. video {
  2140. width: 100%;
  2141. height: 100%;
  2142. }
  2143. }
  2144. }
  2145. &__footer {
  2146. height: 90px;
  2147. border-top: 1px solid #eee;
  2148. text-align: center;
  2149. .take {
  2150. display: inline-block;
  2151. width: 200px;
  2152. height: 40px;
  2153. padding: 0;
  2154. border-radius: 20px;
  2155. text-align: center;
  2156. line-height: 40px;
  2157. margin: 24px auto;
  2158. }
  2159. }
  2160. }
  2161. }
  2162. </style>