index.vue 53 KB

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