index.vue 54 KB

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