index.vue 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676
  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. <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. >
  61. <div>
  62. {{ ast[index] }}. {{ item.content }}
  63. <div v-if="item.imgUrl">
  64. <img
  65. style="max-width: 100%"
  66. :src="$tools.splitImgHost(item.imgUrl)"
  67. alt=""
  68. />
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="question-list" v-if="question.ques">
  74. <div
  75. class="radio"
  76. :class="{
  77. right:
  78. item.optionsId == question.ques ||
  79. item.optionsId == question.ans,
  80. wrong:
  81. item.optionsId == question.ques &&
  82. question.ques != question.ans,
  83. }"
  84. v-for="(item, index) in question.jsonStr"
  85. :key="index"
  86. >
  87. <div>
  88. {{ ast[index] }}. {{ item.content }}
  89. <div v-if="item.imgUrl">
  90. <img
  91. style="max-width: 100%"
  92. :src="$tools.splitImgHost(item.imgUrl)"
  93. alt=""
  94. />
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="answer-list">
  100. <div class="answer-list__left">
  101. 正确答案:{{ ast[question.ans - 1] }}
  102. </div>
  103. <div class="answer-list__left">
  104. 我的答案:{{ ast[question.ques - 1] }}
  105. </div>
  106. </div>
  107. <div class="explain-list">
  108. <div class="explain-list__header">答案解析:</div>
  109. <div
  110. class="explain-list__body"
  111. v-html="question.analysisContent"
  112. ></div>
  113. </div>
  114. </div>
  115. <div class="question__btns">
  116. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  117. </div>
  118. </div>
  119. <div
  120. class="question"
  121. v-if="question.type == 2 && current == questionIndex"
  122. :key="questionIndex"
  123. >
  124. <div class="question__title">
  125. {{ questionIndex + 1 }}、多选题
  126. </div>
  127. <div
  128. class="question__desc"
  129. v-html="question.content"
  130. ></div>
  131. <div class="question__content">
  132. <div class="question-list" v-if="!question.ques">
  133. <el-checkbox
  134. disabled
  135. class="checkbox"
  136. v-for="(item, index) in question.jsonStr"
  137. :key="index"
  138. :label="item.optionsId"
  139. v-model="item.checked"
  140. >
  141. <div>
  142. {{ ast[index] }}. {{ item.content }}
  143. <div v-if="item.imgUrl">
  144. <img
  145. style="max-width: 100%"
  146. :src="$tools.splitImgHost(item.imgUrl)"
  147. alt=""
  148. />
  149. </div>
  150. </div>
  151. </el-checkbox>
  152. </div>
  153. <div class="question-list" v-if="question.ques">
  154. <el-checkbox
  155. disabled
  156. class="checkbox"
  157. :class="{
  158. right:
  159. question.ques.indexOf(item.optionsId) != -1 ||
  160. question.ans.indexOf(item.optionsId) != -1,
  161. wrong:
  162. question.ques.indexOf(item.optionsId) != -1 &&
  163. question.ans.indexOf(item.optionsId) == -1,
  164. }"
  165. v-for="(item, index) in question.jsonStr"
  166. :key="index"
  167. :label="item.optionsId"
  168. v-model="item.checked"
  169. >
  170. <div>
  171. {{ ast[index] }}. {{ item.content }}
  172. <div v-if="item.imgUrl">
  173. <img
  174. style="max-width: 100%"
  175. :src="$tools.splitImgHost(item.imgUrl)"
  176. alt=""
  177. />
  178. </div>
  179. </div>
  180. </el-checkbox>
  181. </div>
  182. <div class="answer-list">
  183. <div class="answer-list__left">
  184. 正确答案:
  185. <template v-for="ansItem in question.ans">{{
  186. ast[ansItem - 1]
  187. }}</template>
  188. </div>
  189. <div class="answer-list__left">
  190. 我的答案:
  191. <template v-for="quesItem in question.ques">{{
  192. ast[quesItem - 1]
  193. }}</template>
  194. </div>
  195. </div>
  196. <div class="explain-list">
  197. <div class="explain-list__header">答案解析:</div>
  198. <div
  199. class="explain-list__body"
  200. v-html="question.analysisContent"
  201. ></div>
  202. </div>
  203. </div>
  204. <div class="question__btns">
  205. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  206. </div>
  207. </div>
  208. <div
  209. class="question"
  210. v-if="question.type == 3 && current == questionIndex"
  211. :key="questionIndex"
  212. >
  213. <div class="question__title">
  214. {{ questionIndex + 1 }}、判断题
  215. </div>
  216. <div
  217. class="question__desc"
  218. v-html="question.content"
  219. ></div>
  220. <div class="question__content">
  221. <div class="question-list" v-if="!question.ques">
  222. <div
  223. class="radio"
  224. v-for="(item, index) in judge"
  225. :key="index"
  226. >
  227. <div>
  228. {{ ast[index] }}. {{ item }}
  229. <div v-if="item.imgUrl">
  230. <img
  231. style="max-width: 100%"
  232. :src="$tools.splitImgHost(item.imgUrl)"
  233. alt=""
  234. />
  235. </div>
  236. </div>
  237. </div>
  238. </div>
  239. <div class="question-list" v-if="question.ques">
  240. <div
  241. class="radio"
  242. :class="{
  243. right:
  244. index == question.ques || index == question.ans,
  245. wrong:
  246. index == question.ques &&
  247. question.ques != question.ans,
  248. }"
  249. v-for="(item, index) in judge"
  250. :key="index"
  251. >
  252. <div>
  253. {{ ast[index] }}. {{ item }}
  254. <div v-if="item.imgUrl">
  255. <img
  256. style="max-width: 100%"
  257. :src="$tools.splitImgHost(item.imgUrl)"
  258. alt=""
  259. />
  260. </div>
  261. </div>
  262. </div>
  263. </div>
  264. <div class="answer-list">
  265. <div class="answer-list__left">
  266. 正确答案:{{ ast[question.ans] }}
  267. </div>
  268. <div class="answer-list__left">
  269. 我的答案:{{ ast[question.ques] }}
  270. </div>
  271. </div>
  272. <div class="explain-list">
  273. <div class="explain-list__header">答案解析:</div>
  274. <div
  275. class="explain-list__body"
  276. v-html="question.analysisContent"
  277. ></div>
  278. </div>
  279. </div>
  280. <div class="question__btns">
  281. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  282. </div>
  283. </div>
  284. <div
  285. class="question"
  286. v-if="question.type == 4 && current == questionIndex"
  287. :key="questionIndex"
  288. >
  289. <div class="question__title">
  290. {{ questionIndex + 1 }}、案例题
  291. </div>
  292. <div
  293. class="question__desc"
  294. v-html="question.content"
  295. ></div>
  296. <div class="question__content">
  297. <el-tabs v-model="question.tabIndex">
  298. <el-tab-pane
  299. v-for="(json, jsonIndex) in question.jsonStr"
  300. :label="'问题' + (jsonIndex + 1)"
  301. :name="jsonIndex + ''"
  302. :key="jsonIndex"
  303. >
  304. <div
  305. class="question"
  306. v-if="json.type == 1"
  307. :key="questionIndex"
  308. >
  309. <div class="question__title">
  310. {{ jsonIndex + 1 }}、单选题
  311. </div>
  312. <div
  313. class="question__desc"
  314. v-html="json.content"
  315. ></div>
  316. <div class="question__content">
  317. <div
  318. class="question-list"
  319. v-if="!question.ques[jsonIndex]"
  320. >
  321. <div
  322. class="radio"
  323. v-for="(item, index) in json.optionsList"
  324. :key="index"
  325. >
  326. <div>
  327. {{ ast[index] }}. {{ item.content }}
  328. <div v-if="item.imgUrl">
  329. <img
  330. style="max-width: 100%"
  331. :src="
  332. $tools.splitImgHost(item.imgUrl)
  333. "
  334. alt=""
  335. />
  336. </div>
  337. </div>
  338. </div>
  339. </div>
  340. <div
  341. class="question-list"
  342. v-if="question.ques[jsonIndex]"
  343. >
  344. <div
  345. class="radio"
  346. :class="{
  347. right:
  348. item.optionsId ==
  349. question.ques[jsonIndex] ||
  350. item.optionsId ==
  351. question.ans[jsonIndex],
  352. wrong:
  353. item.optionsId ==
  354. question.ques[jsonIndex] &&
  355. question.ques[jsonIndex] !=
  356. question.ans[jsonIndex],
  357. }"
  358. v-for="(item, index) in json.optionsList"
  359. :key="index"
  360. >
  361. <div>
  362. {{ ast[index] }}. {{ item.content }}
  363. <div v-if="item.imgUrl">
  364. <img
  365. style="max-width: 100%"
  366. :src="
  367. $tools.splitImgHost(item.imgUrl)
  368. "
  369. alt=""
  370. />
  371. </div>
  372. </div>
  373. </div>
  374. </div>
  375. <div class="answer-list">
  376. <div class="answer-list__left">
  377. 正确答案:{{
  378. ast[question.ans[jsonIndex] - 1]
  379. }}
  380. </div>
  381. <div class="answer-list__left">
  382. 我的答案:{{
  383. ast[question.ques[jsonIndex] - 1]
  384. }}
  385. </div>
  386. </div>
  387. <div class="explain-list">
  388. <div class="explain-list__header">
  389. 答案解析:
  390. </div>
  391. <div
  392. class="explain-list__body"
  393. v-html="json.analysisContent"
  394. ></div>
  395. </div>
  396. </div>
  397. <div class="question__btns"></div>
  398. </div>
  399. <div
  400. class="question"
  401. v-if="json.type == 2"
  402. :key="jsonIndex"
  403. >
  404. <div class="question__title">
  405. {{ jsonIndex + 1 }}、多选题
  406. </div>
  407. <div
  408. class="question__desc"
  409. v-html="json.content"
  410. ></div>
  411. <div class="question__content">
  412. <div
  413. class="question-list"
  414. v-if="!question.ques[jsonIndex]"
  415. >
  416. <el-checkbox
  417. disabled
  418. class="checkbox"
  419. v-for="(item, index) in json.optionsList"
  420. :key="index"
  421. :label="item.optionsId"
  422. v-model="item.checked"
  423. >
  424. <div>
  425. {{ ast[index] }}. {{ item.content }}
  426. <div v-if="item.imgUrl">
  427. <img
  428. style="max-width: 100%"
  429. :src="
  430. $tools.splitImgHost(item.imgUrl)
  431. "
  432. alt=""
  433. />
  434. </div>
  435. </div>
  436. </el-checkbox>
  437. </div>
  438. <div
  439. class="question-list"
  440. v-if="question.ques[jsonIndex]"
  441. >
  442. <el-checkbox
  443. disabled
  444. class="checkbox"
  445. :class="{
  446. right:
  447. question.ques[jsonIndex].indexOf(
  448. item.optionsId
  449. ) != -1 ||
  450. question.ans[jsonIndex].indexOf(
  451. item.optionsId
  452. ) != -1,
  453. wrong:
  454. question.ques[jsonIndex].indexOf(
  455. item.optionsId
  456. ) != -1 &&
  457. question.ans[jsonIndex].indexOf(
  458. item.optionsId
  459. ) == -1,
  460. }"
  461. v-for="(item, index) in json.optionsList"
  462. :key="index"
  463. :label="item.optionsId"
  464. v-model="item.checked"
  465. >
  466. <div>
  467. {{ ast[index] }}. {{ item.content }}
  468. <div v-if="item.imgUrl">
  469. <img
  470. style="max-width: 100%"
  471. :src="
  472. $tools.splitImgHost(item.imgUrl)
  473. "
  474. alt=""
  475. />
  476. </div>
  477. </div>
  478. </el-checkbox>
  479. </div>
  480. <div class="answer-list">
  481. <div class="answer-list__left">
  482. 正确答案:
  483. <template
  484. v-for="ansItem in question.ans[jsonIndex]"
  485. >{{ ast[ansItem - 1] }}</template
  486. >
  487. </div>
  488. <div class="answer-list__left">
  489. 我的答案:
  490. <template
  491. v-for="quesItem in question.ques[
  492. jsonIndex
  493. ]"
  494. >{{ ast[quesItem - 1] }}</template
  495. >
  496. </div>
  497. </div>
  498. <div class="explain-list">
  499. <div class="explain-list__header">
  500. 答案解析:
  501. </div>
  502. <div
  503. class="explain-list__body"
  504. v-html="json.analysisContent"
  505. ></div>
  506. </div>
  507. </div>
  508. <div class="question__btns"></div>
  509. </div>
  510. <div
  511. class="question"
  512. v-if="json.type == 3"
  513. :key="jsonIndex"
  514. >
  515. <div class="question__title">
  516. {{ jsonIndex + 1 }}、判断题
  517. </div>
  518. <div
  519. class="question__desc"
  520. v-html="json.content"
  521. ></div>
  522. <div class="question__content">
  523. <div
  524. class="question-list"
  525. v-if="!question.ques[jsonIndex]"
  526. >
  527. <div
  528. class="radio"
  529. v-for="(item, index) in judge"
  530. :key="index"
  531. >
  532. <div>
  533. {{ ast[index] }}. {{ item }}
  534. <div v-if="item.imgUrl">
  535. <img
  536. style="max-width: 100%"
  537. :src="
  538. $tools.splitImgHost(item.imgUrl)
  539. "
  540. alt=""
  541. />
  542. </div>
  543. </div>
  544. </div>
  545. </div>
  546. <div
  547. class="question-list"
  548. v-if="question.ques[jsonIndex]"
  549. >
  550. <div
  551. class="radio"
  552. :class="{
  553. right:
  554. index == question.ques[jsonIndex] ||
  555. index == question.ans[jsonIndex],
  556. wrong:
  557. index == question.ques[jsonIndex] &&
  558. question.ques[jsonIndex] !=
  559. question.ans[jsonIndex],
  560. }"
  561. v-for="(item, index) in judge"
  562. :key="index"
  563. >
  564. <div>
  565. {{ ast[index] }}. {{ item }}
  566. <div v-if="item.imgUrl">
  567. <img
  568. style="max-width: 100%"
  569. :src="
  570. $tools.splitImgHost(item.imgUrl)
  571. "
  572. alt=""
  573. />
  574. </div>
  575. </div>
  576. </div>
  577. </div>
  578. <div class="answer-list">
  579. <div class="answer-list__left">
  580. 正确答案:{{ ast[question.ans[jsonIndex]] }}
  581. </div>
  582. <div class="answer-list__left">
  583. 我的答案:{{
  584. ast[question.ques[jsonIndex]]
  585. }}
  586. </div>
  587. </div>
  588. <div class="explain-list">
  589. <div class="explain-list__header">
  590. 答案解析:
  591. </div>
  592. <div
  593. class="explain-list__body"
  594. v-html="json.analysisContent"
  595. ></div>
  596. </div>
  597. </div>
  598. <div class="question__btns"></div>
  599. </div>
  600. <div
  601. class="question"
  602. v-if="json.type == 5"
  603. :key="jsonIndex"
  604. >
  605. <div class="question__title">
  606. {{ jsonIndex + 1 }}、简答题
  607. </div>
  608. <div
  609. class="question__desc"
  610. v-html="json.content"
  611. ></div>
  612. <div class="question__content">
  613. <div class="explain-list">
  614. <div class="explain-list__header">
  615. 我的答案:
  616. </div>
  617. <div class="explain-list__body">
  618. <div>
  619. {{
  620. question.ques[jsonIndex] &&
  621. question.ques[jsonIndex].text
  622. }}
  623. </div>
  624. <div class="upload clearfix">
  625. <div
  626. class="upload__imgs"
  627. v-for="(img, imgIndex) in question.ques[
  628. jsonIndex
  629. ] && question.ques[jsonIndex].imageList"
  630. :key="imgIndex"
  631. >
  632. <img
  633. :src="$tools.splitImgHost(img, true)"
  634. alt=""
  635. />
  636. </div>
  637. </div>
  638. </div>
  639. <div class="explain-list__header">
  640. 答案解析:
  641. </div>
  642. <div
  643. class="explain-list__body"
  644. v-html="question.analysisContent"
  645. ></div>
  646. </div>
  647. </div>
  648. <div class="question__btns"></div>
  649. </div>
  650. </el-tab-pane>
  651. </el-tabs>
  652. </div>
  653. <div class="question__btns">
  654. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  655. </div>
  656. </div>
  657. <div
  658. class="question"
  659. v-if="question.type == 5 && current == questionIndex"
  660. :key="questionIndex"
  661. >
  662. <div class="question__title">
  663. {{ questionIndex + 1 }}、简答题
  664. </div>
  665. <div
  666. class="question__desc"
  667. v-html="question.content"
  668. ></div>
  669. <div class="question__content">
  670. <div class="explain-list">
  671. <div class="explain-list__header">我的答案:</div>
  672. <div class="explain-list__body">
  673. <div>{{ question.ques.text }}</div>
  674. <div class="upload clearfix">
  675. <div
  676. class="upload__imgs"
  677. v-for="(img, imgIndex) in question.ques
  678. .imageList"
  679. :key="imgIndex"
  680. >
  681. <img
  682. :src="$tools.splitImgHost(img, true)"
  683. alt=""
  684. />
  685. </div>
  686. </div>
  687. </div>
  688. <div class="explain-list__header">答案解析:</div>
  689. <div
  690. class="explain-list__body"
  691. v-html="question.analysisContent"
  692. ></div>
  693. </div>
  694. </div>
  695. <div class="question__btns">
  696. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  697. </div>
  698. </div>
  699. </template>
  700. </div>
  701. </div>
  702. <div class="right-box">
  703. <div class="right-box__header">
  704. <el-button
  705. type="primary"
  706. round
  707. plain
  708. size="small"
  709. class="back-btn"
  710. @click="$router.back(-1)"
  711. >返回</el-button
  712. >
  713. </div>
  714. <div class="right-box__header">答题卡</div>
  715. <div class="right-box__body">
  716. <div class="card">
  717. <div class="card__note">
  718. <div class="item">
  719. <div class="box green"></div>
  720. 正确
  721. </div>
  722. <div class="item">
  723. <div class="box red"></div>
  724. 错误
  725. </div>
  726. <div class="item">
  727. <div class="box blue"></div>
  728. 已做未评改
  729. </div>
  730. <div class="item">
  731. <div class="box yellow"></div>
  732. 少选
  733. </div>
  734. <div class="item">
  735. <div class="box white"></div>
  736. 未做
  737. </div>
  738. </div>
  739. <div class="card__content">
  740. <ul class="list">
  741. <li
  742. class="item white"
  743. v-for="(item, index) in questionList"
  744. :key="index"
  745. :class="{
  746. green: isRight(item, index),
  747. red: isWrong(item, index),
  748. yellow: isPart(item, index),
  749. blue: isOver(item, index),
  750. }"
  751. @click="changeIndex(index)"
  752. >
  753. {{ index + 1 }}
  754. </li>
  755. </ul>
  756. </div>
  757. </div>
  758. </div>
  759. </div>
  760. </div>
  761. </div>
  762. </div>
  763. </div>
  764. </section>
  765. <ToolBar></ToolBar>
  766. <Footer></Footer>
  767. </div>
  768. </template>
  769. <script>
  770. import Footer from "@/components/footer/index";
  771. import Header from "@/components/header/index";
  772. import ToolBar from "@/components/toolbar/index";
  773. import { mapMutations } from "vuex";
  774. export default {
  775. name: "BankExplain",
  776. components: {
  777. Footer,
  778. Header,
  779. ToolBar,
  780. },
  781. data() {
  782. return {
  783. recordId: 0,
  784. questionIndex: 0,
  785. checked: false,
  786. questionList: [],
  787. judge: ["错误", "正确"],
  788. ast: [
  789. "A",
  790. "B",
  791. "C",
  792. "D",
  793. "E",
  794. "F",
  795. "G",
  796. "H",
  797. "I",
  798. "J",
  799. "K",
  800. "L",
  801. "M",
  802. "N",
  803. "O",
  804. "P",
  805. "Q",
  806. "R",
  807. "S",
  808. "T",
  809. "U",
  810. "V",
  811. "W",
  812. "X",
  813. "Y",
  814. "Z",
  815. ],
  816. lastCount: 0,
  817. examId: 0,
  818. goodsId: 0,
  819. courseId: 0,
  820. gradeId: 0,
  821. moduleId: 0,
  822. chapterId: 0,
  823. current: 0,
  824. };
  825. },
  826. async mounted() {
  827. this.recordId = this.$route.params.recordId;
  828. this.examId = this.$route.query.examId;
  829. this.moduleId = this.$route.query.moduleId;
  830. this.chapterId = this.$route.query.chapterId;
  831. this.goodsId = this.$route.query.goodsId;
  832. this.goodsQuestionList();
  833. },
  834. methods: {
  835. ...mapMutations(["setExamResult"]),
  836. toFixed(num) {
  837. if (num) {
  838. let str = String(num).indexOf(".");
  839. if (str != -1) {
  840. return +num.toFixed(2);
  841. } else {
  842. return num;
  843. }
  844. } else {
  845. return 0;
  846. }
  847. },
  848. changeIndex(index) {
  849. this.current = index;
  850. },
  851. /**
  852. * 请求题目列表
  853. */
  854. goodsQuestionList() {
  855. this.$request.examReport(this.recordId).then(async (res) => {
  856. this.questionList = JSON.parse(res.data.historyExamJson);
  857. });
  858. },
  859. nextQuestion() {
  860. if (this.current >= this.questionList.length - 1) {
  861. this.$message({
  862. type: "warning",
  863. message: "已经是最后一题了!",
  864. });
  865. return;
  866. }
  867. this.current++;
  868. },
  869. prevQuestion() {
  870. if (this.current == 0) {
  871. this.$message({
  872. type: "warning",
  873. message: "已经是第一题了!",
  874. });
  875. return;
  876. } else {
  877. this.current--;
  878. }
  879. },
  880. isOver(item, index) {
  881. if (this.questionList[index].ques) {
  882. if (item.type == 4) {
  883. //案例题
  884. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  885. if (
  886. jsonItem.type == 1 ||
  887. jsonItem.type == 2 ||
  888. jsonItem.type == 3
  889. ) {
  890. if (item.ques[indexs]) {
  891. return true;
  892. } else {
  893. return false;
  894. }
  895. } else if (jsonItem.type == 5) {
  896. // if (
  897. // item.ques[indexs] &&
  898. // (item.ques[indexs].text || item.ques[indexs].imageList.length)
  899. // ) {
  900. // console.log("chil");
  901. // return true;
  902. // } else {
  903. // return false;
  904. // }
  905. }
  906. });
  907. if (isOver) {
  908. return true;
  909. } else {
  910. return false;
  911. }
  912. } else if (item.type == 5) {
  913. //简答题
  914. //每一项都相等
  915. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  916. return true;
  917. }
  918. //判断
  919. } else {
  920. return false;
  921. }
  922. } else {
  923. return false;
  924. }
  925. },
  926. isRight(item, index) {
  927. //单选
  928. if (this.questionList[index].ques) {
  929. if (item.type == 1) {
  930. console.log(
  931. this.questionList[index].ques == this.questionList[index].ans
  932. );
  933. return this.questionList[index].ques == this.questionList[index].ans;
  934. //多选
  935. } else if (item.type == 2) {
  936. //每一项都相等
  937. return this.questionList[index].ans.every((item, i) => {
  938. return item == this.questionList[index].ques[i];
  939. });
  940. //判断
  941. } else if (item.type == 3) {
  942. return this.questionList[index].ques == this.questionList[index].ans;
  943. } else {
  944. return false;
  945. }
  946. } else {
  947. return false;
  948. }
  949. },
  950. isWrong(item, index) {
  951. if (this.questionList[index].ques) {
  952. //单选
  953. if (item.type == 1) {
  954. return this.questionList[index].ques != this.questionList[index].ans;
  955. //多选
  956. } else if (item.type == 2) {
  957. //每一项都相等
  958. return this.questionList[index].ques.some((item, i) => {
  959. return this.questionList[index].ans.indexOf(item) == -1;
  960. });
  961. //判断
  962. } else if (item.type == 3) {
  963. return this.questionList[index].ques != this.questionList[index].ans;
  964. } else {
  965. return false;
  966. }
  967. } else {
  968. return false;
  969. }
  970. },
  971. isPart(item, index) {
  972. if (this.questionList[index].ques) {
  973. if (item.type == 2) {
  974. let isWrong = this.questionList[index].ques.some((item, i) => {
  975. return this.questionList[index].ans.indexOf(item) == -1;
  976. });
  977. let isRight = this.questionList[index].ans.every((item, i) => {
  978. return item == this.questionList[index].ques[i];
  979. });
  980. if (!isRight && !isWrong) {
  981. return true;
  982. }
  983. }
  984. } else {
  985. return false;
  986. }
  987. },
  988. right(bankIndex, ansIndex, option) {
  989. if (
  990. this.questionList[bankIndex].ques[ansIndex] &&
  991. this.questionList[bankIndex].ans[ansIndex]
  992. ) {
  993. if (
  994. this.questionList[bankIndex].ques[ansIndex].indexOf(
  995. option.optionsId
  996. ) != -1 ||
  997. this.questionList[bankIndex].ans[ansIndex].indexOf(
  998. option.optionsId
  999. ) != -1
  1000. ) {
  1001. return true;
  1002. } else {
  1003. return false;
  1004. }
  1005. } else {
  1006. return false;
  1007. }
  1008. },
  1009. wrong(bankIndex, ansIndex, option) {
  1010. if (
  1011. this.questionList[bankIndex].ques[ansIndex] &&
  1012. this.questionList[bankIndex].ans[ansIndex]
  1013. ) {
  1014. if (
  1015. this.questionList[bankIndex].ques[ansIndex].indexOf(
  1016. option.optionsId
  1017. ) != -1 &&
  1018. this.questionList[bankIndex].ans[ansIndex].indexOf(
  1019. option.optionsId
  1020. ) == -1
  1021. ) {
  1022. return true;
  1023. } else {
  1024. return false;
  1025. }
  1026. } else {
  1027. return false;
  1028. }
  1029. },
  1030. /**
  1031. * 获取已经回答的题目数
  1032. * hasSpecail (是否包含简答和案例)
  1033. */
  1034. questionOverNum(hasSpecail) {
  1035. let count = 0;
  1036. this.questionList.forEach((item) => {
  1037. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1038. if (item.ques) {
  1039. count++;
  1040. }
  1041. } else if (item.type == 4) {
  1042. //案例题
  1043. if (hasSpecail) {
  1044. let isOver = item.jsonStr.every((jsonItem, index) => {
  1045. if (
  1046. jsonItem.type == 1 ||
  1047. jsonItem.type == 2 ||
  1048. jsonItem.type == 3
  1049. ) {
  1050. if (item.ques[index]) {
  1051. return true;
  1052. } else {
  1053. return false;
  1054. }
  1055. } else if (jsonItem.type == 5) {
  1056. // if (
  1057. // item.ques[index] &&
  1058. // (item.ques[index].text || item.ques[index].imageList.length)
  1059. // ) {
  1060. // return true;
  1061. // } else {
  1062. // return false;
  1063. // }
  1064. }
  1065. });
  1066. if (isOver) {
  1067. count++;
  1068. console.log(item, 444);
  1069. }
  1070. }
  1071. } else if (item.type == 5) {
  1072. //简答题
  1073. if (hasSpecail) {
  1074. // if (item.ques && (item.ques.text || item.ques.imageList.length)) {
  1075. // console.log(5, item);
  1076. // count++;
  1077. // }
  1078. }
  1079. }
  1080. });
  1081. return count;
  1082. },
  1083. collect() {
  1084. this.$message({
  1085. message: "试做题目,不支持收藏~",
  1086. type: "warning",
  1087. });
  1088. return;
  1089. },
  1090. },
  1091. };
  1092. </script>
  1093. <!-- Add "scoped" attribute to limit CSS to this component only -->
  1094. <style scoped lang="scss">
  1095. .course-exam {
  1096. .section {
  1097. overflow: hidden;
  1098. &__header {
  1099. height: 20px;
  1100. margin-top: 20px;
  1101. }
  1102. &__body {
  1103. .explain-record {
  1104. &__header {
  1105. }
  1106. &__body {
  1107. margin-bottom: 20px;
  1108. border: 1px solid #eee;
  1109. .left-box {
  1110. float: left;
  1111. width: 970px;
  1112. min-height: 630px;
  1113. border: 1px solid #eee;
  1114. &__header {
  1115. height: 40px;
  1116. padding-left: 12px;
  1117. border-bottom: 1px solid #eeeeee;
  1118. display: flex;
  1119. align-items: center;
  1120. .progress {
  1121. width: 636px;
  1122. }
  1123. .text {
  1124. margin-left: 15px;
  1125. font-size: 16px;
  1126. span {
  1127. font-family: Microsoft YaHei;
  1128. font-weight: bold;
  1129. color: #3f8dfd;
  1130. line-height: 24px;
  1131. }
  1132. }
  1133. }
  1134. &__body {
  1135. .question {
  1136. padding: 12px 0 0 12px;
  1137. &__title {
  1138. padding-left: 12px;
  1139. font-size: 16px;
  1140. font-family: Microsoft YaHei;
  1141. font-weight: bold;
  1142. color: #333333;
  1143. line-height: 24px;
  1144. }
  1145. &__desc {
  1146. padding-left: 12px;
  1147. margin-top: 20px;
  1148. font-size: 16px;
  1149. font-family: Microsoft YaHei;
  1150. font-weight: 400;
  1151. color: #666666;
  1152. line-height: 24px;
  1153. /deep/ img {
  1154. max-width: 100% !important;
  1155. }
  1156. }
  1157. &__content {
  1158. /deep/ .el-tabs__item {
  1159. height: 40px;
  1160. line-height: 40px;
  1161. }
  1162. .question__content {
  1163. height: auto;
  1164. overflow: auto;
  1165. }
  1166. .question-list {
  1167. padding: 24px 0 0 24px;
  1168. .checkbox,
  1169. .radio {
  1170. cursor: pointer;
  1171. margin-right: 24px;
  1172. padding: 0 24px;
  1173. display: flex;
  1174. align-items: center;
  1175. margin-top: 2px;
  1176. min-height: 40px;
  1177. padding-top: 10px;
  1178. padding-bottom: 10px;
  1179. background: #f5f9ff;
  1180. border-radius: 8px;
  1181. box-sizing: border-box;
  1182. &.right {
  1183. background: #37c65b;
  1184. }
  1185. &.wrong {
  1186. background: #ff3a30;
  1187. }
  1188. }
  1189. &.textarea {
  1190. margin-right: 12px;
  1191. .upload {
  1192. margin-top: 10px;
  1193. &__imgs {
  1194. margin-right: 10px;
  1195. width: 80px;
  1196. height: 80px;
  1197. background: #ffffff;
  1198. border: 1px solid #eeeeee;
  1199. border-radius: 4px;
  1200. position: relative;
  1201. display: flex;
  1202. float: left;
  1203. align-items: center;
  1204. justify-content: center;
  1205. img {
  1206. max-width: 100%;
  1207. max-height: 100%;
  1208. }
  1209. }
  1210. &__btn {
  1211. margin-right: 10px;
  1212. width: 80px;
  1213. height: 80px;
  1214. background: #ffffff;
  1215. border: 1px solid #eeeeee;
  1216. border-radius: 4px;
  1217. position: relative;
  1218. display: flex;
  1219. float: left;
  1220. align-items: center;
  1221. justify-content: center;
  1222. flex-direction: column;
  1223. .icon {
  1224. font-size: 20px;
  1225. color: #3f8dfd;
  1226. }
  1227. p {
  1228. font-size: 12px;
  1229. font-family: Microsoft YaHei;
  1230. font-weight: 400;
  1231. color: #999999;
  1232. line-height: 24px;
  1233. }
  1234. input {
  1235. position: absolute;
  1236. left: 0;
  1237. top: 0;
  1238. display: block;
  1239. width: 100%;
  1240. height: 100%;
  1241. opacity: 0;
  1242. }
  1243. }
  1244. }
  1245. }
  1246. /deep/
  1247. .el-checkbox__input.is-disabled
  1248. + span.el-checkbox__label {
  1249. color: #000;
  1250. }
  1251. /deep/ .el-checkbox {
  1252. white-space: normal;
  1253. }
  1254. }
  1255. .answer-list {
  1256. height: 40px;
  1257. border-top: 1px solid #eee;
  1258. border-bottom: 1px solid #eee;
  1259. margin-top: 24px;
  1260. display: flex;
  1261. align-items: center;
  1262. justify-content: space-between;
  1263. padding: 0 24px;
  1264. &__left {
  1265. font-size: 16px;
  1266. font-family: Microsoft YaHei;
  1267. font-weight: 400;
  1268. color: #333333;
  1269. line-height: 24px;
  1270. }
  1271. &__right {
  1272. font-size: 16px;
  1273. font-family: Microsoft YaHei;
  1274. font-weight: 400;
  1275. color: #333333;
  1276. line-height: 24px;
  1277. }
  1278. }
  1279. .explain-list {
  1280. padding: 12px 24px;
  1281. &__header {
  1282. font-size: 16px;
  1283. font-family: Microsoft YaHei;
  1284. font-weight: bold;
  1285. color: #666666;
  1286. line-height: 24px;
  1287. }
  1288. &__body {
  1289. margin-top: 12px;
  1290. font-size: 16px;
  1291. font-family: Microsoft YaHei;
  1292. font-weight: 400;
  1293. color: #666666;
  1294. line-height: 24px;
  1295. }
  1296. .upload {
  1297. margin-top: 10px;
  1298. &__imgs {
  1299. margin-right: 10px;
  1300. width: 80px;
  1301. height: 80px;
  1302. background: #ffffff;
  1303. border: 1px solid #eeeeee;
  1304. border-radius: 4px;
  1305. position: relative;
  1306. display: flex;
  1307. float: left;
  1308. align-items: center;
  1309. justify-content: center;
  1310. img {
  1311. max-width: 100%;
  1312. max-height: 100%;
  1313. }
  1314. }
  1315. }
  1316. }
  1317. }
  1318. &__btns {
  1319. position: relative;
  1320. height: 32px;
  1321. .submit {
  1322. cursor: pointer;
  1323. margin: 0 auto;
  1324. width: 140px;
  1325. height: 32px;
  1326. background: #3f8dfd;
  1327. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  1328. border-radius: 16px;
  1329. text-align: center;
  1330. line-height: 32px;
  1331. color: #fff;
  1332. font-size: 16px;
  1333. }
  1334. .collect {
  1335. cursor: pointer;
  1336. position: absolute;
  1337. right: 0;
  1338. top: 5px;
  1339. font-size: 12px;
  1340. font-family: Microsoft YaHei;
  1341. font-weight: 400;
  1342. color: #3f8dfd;
  1343. line-height: 24px;
  1344. }
  1345. }
  1346. }
  1347. }
  1348. &__footer {
  1349. height: 40px;
  1350. display: flex;
  1351. justify-content: space-around;
  1352. align-items: center;
  1353. .btn {
  1354. cursor: pointer;
  1355. width: 140px;
  1356. height: 32px;
  1357. background: #ffffff;
  1358. border: 1px solid #3f8dfd;
  1359. border-radius: 16px;
  1360. line-height: 32px;
  1361. text-align: center;
  1362. color: #3f8dfd;
  1363. }
  1364. }
  1365. }
  1366. .right-box {
  1367. float: right;
  1368. width: 299px;
  1369. border-right: 1px solid #eee;
  1370. &__header {
  1371. height: 40px;
  1372. line-height: 40px;
  1373. font-size: 16px;
  1374. font-family: Microsoft YaHei;
  1375. font-weight: bold;
  1376. color: #333333;
  1377. text-align: center;
  1378. border-bottom: 1px solid #eeeeee;
  1379. .back-btn {
  1380. display: block;
  1381. margin: 0 auto;
  1382. width: 160px;
  1383. }
  1384. }
  1385. &__body {
  1386. height: 510px;
  1387. border-bottom: 1px solid #eee;
  1388. .card {
  1389. &__note {
  1390. display: flex;
  1391. height: 64px;
  1392. align-items: center;
  1393. border-bottom: 1px solid #eee;
  1394. flex-wrap: wrap;
  1395. .item {
  1396. display: flex;
  1397. align-items: center;
  1398. margin-left: 10px;
  1399. width: 84px;
  1400. font-size: 12px;
  1401. .box {
  1402. margin-right: 5px;
  1403. width: 16px;
  1404. height: 16px;
  1405. border-radius: 4px;
  1406. &.white {
  1407. background: #ffffff;
  1408. border: 1px solid #eeeeee;
  1409. }
  1410. &.green {
  1411. background: #37c65b;
  1412. }
  1413. &.red {
  1414. background: #ff3a30;
  1415. }
  1416. &.yellow {
  1417. background: #ffc53d;
  1418. }
  1419. &.blue {
  1420. background: #3f8dfd;
  1421. }
  1422. }
  1423. }
  1424. }
  1425. &__content {
  1426. height: 440px;
  1427. overflow-y: scroll;
  1428. &::-webkit-scrollbar {
  1429. width: 6px;
  1430. }
  1431. &::-webkit-scrollbar-track {
  1432. background-color: #fff;
  1433. -webkit-border-radius: 2em;
  1434. -moz-border-radius: 2em;
  1435. border-radius: 2em;
  1436. }
  1437. &::-webkit-scrollbar-thumb {
  1438. background-color: #eeeeee;
  1439. -webkit-border-radius: 2em;
  1440. -moz-border-radius: 2em;
  1441. border-radius: 2em;
  1442. }
  1443. .list {
  1444. display: flex;
  1445. flex-wrap: wrap;
  1446. .item {
  1447. width: 40px;
  1448. height: 40px;
  1449. border-radius: 10px;
  1450. text-align: center;
  1451. line-height: 40px;
  1452. margin-left: 16px;
  1453. margin-top: 16px;
  1454. cursor: pointer;
  1455. &.white {
  1456. line-height: 38px;
  1457. color: #333333;
  1458. background: #ffffff;
  1459. border: 1px solid #eeeeee;
  1460. }
  1461. &.green {
  1462. color: #fff;
  1463. background: #37c65b;
  1464. }
  1465. &.red {
  1466. color: #fff;
  1467. background: #ff3a30;
  1468. }
  1469. &.blue {
  1470. border: 1rpx solid #eeeeee;
  1471. color: #fff;
  1472. background: #3f8dfd;
  1473. }
  1474. &.yellow {
  1475. background: #ffc53d;
  1476. }
  1477. &.disabled {
  1478. cursor: not-allowed;
  1479. line-height: 38px;
  1480. color: #eeeeee;
  1481. background: #ffffff;
  1482. border: 1px solid #eeeeee;
  1483. }
  1484. }
  1485. }
  1486. }
  1487. }
  1488. }
  1489. &__footer {
  1490. border-bottom: 1px solid #eee;
  1491. height: 40px;
  1492. display: flex;
  1493. align-items: center;
  1494. justify-content: center;
  1495. .submit {
  1496. cursor: pointer;
  1497. width: 140px;
  1498. height: 32px;
  1499. background: #3f8dfd;
  1500. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  1501. border-radius: 16px;
  1502. line-height: 32px;
  1503. text-align: center;
  1504. color: #fff;
  1505. font-size: 16px;
  1506. }
  1507. }
  1508. }
  1509. }
  1510. }
  1511. }
  1512. &__footer {
  1513. height: 20px;
  1514. margin-top: 20px;
  1515. }
  1516. }
  1517. .take-photo {
  1518. /deep/ .el-dialog__header {
  1519. display: none;
  1520. }
  1521. /deep/ .el-dialog__body {
  1522. padding: 0;
  1523. overflow: unset;
  1524. }
  1525. &__close {
  1526. cursor: pointer;
  1527. position: absolute;
  1528. right: 0;
  1529. top: -28px;
  1530. width: 24px;
  1531. height: 24px;
  1532. line-height: 24px;
  1533. text-align: center;
  1534. color: #eee;
  1535. border: 1px solid #eee;
  1536. border-radius: 50%;
  1537. }
  1538. &__header {
  1539. height: 40px;
  1540. border-bottom: 1px solid #eee;
  1541. line-height: 40px;
  1542. font-size: 16px;
  1543. font-family: Microsoft YaHei;
  1544. font-weight: bold;
  1545. color: #333333;
  1546. padding-left: 24px;
  1547. }
  1548. &__body {
  1549. height: 400px;
  1550. padding: 40px 24px;
  1551. .left-box {
  1552. width: 336px;
  1553. float: left;
  1554. .title {
  1555. font-size: 16px;
  1556. font-family: Microsoft YaHei;
  1557. font-weight: bold;
  1558. color: #ff3b30;
  1559. line-height: 24px;
  1560. }
  1561. .content {
  1562. font-size: 14px;
  1563. font-family: Microsoft YaHei;
  1564. font-weight: 400;
  1565. color: #333333;
  1566. line-height: 28px;
  1567. margin-top: 32px;
  1568. }
  1569. }
  1570. .right-box {
  1571. float: right;
  1572. width: 400px;
  1573. height: 300px;
  1574. video {
  1575. width: 100%;
  1576. height: 100%;
  1577. }
  1578. }
  1579. }
  1580. &__footer {
  1581. height: 90px;
  1582. border-top: 1px solid #eee;
  1583. text-align: center;
  1584. .take {
  1585. display: inline-block;
  1586. width: 200px;
  1587. height: 40px;
  1588. padding: 0;
  1589. border-radius: 20px;
  1590. text-align: center;
  1591. line-height: 40px;
  1592. margin: 24px auto;
  1593. }
  1594. }
  1595. }
  1596. }
  1597. </style>