index.vue 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521
  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. /deep/ img {
  1002. max-width: 100% !important;
  1003. max-height: 400px !important;
  1004. }
  1005. }
  1006. &__content {
  1007. flex: 1;
  1008. overflow-y: scroll;
  1009. &::-webkit-scrollbar {
  1010. width: 6px;
  1011. }
  1012. &::-webkit-scrollbar-track {
  1013. background-color: #fff;
  1014. -webkit-border-radius: 2em;
  1015. -moz-border-radius: 2em;
  1016. border-radius: 2em;
  1017. }
  1018. &::-webkit-scrollbar-thumb {
  1019. background-color: #eeeeee;
  1020. -webkit-border-radius: 2em;
  1021. -moz-border-radius: 2em;
  1022. border-radius: 2em;
  1023. }
  1024. /deep/ .el-tabs__item {
  1025. padding: 0 20px !important;
  1026. height: 40px;
  1027. line-height: 40px;
  1028. }
  1029. .question__content {
  1030. height: auto;
  1031. overflow: auto;
  1032. }
  1033. .question-list {
  1034. padding: 24px 0 0 24px;
  1035. .checkbox,
  1036. .radio {
  1037. cursor: pointer;
  1038. margin-right: 24px;
  1039. padding: 0 24px;
  1040. display: flex;
  1041. align-items: center;
  1042. margin-top: 2px;
  1043. min-height: 40px;
  1044. padding-top: 10px;
  1045. padding-bottom: 10px;
  1046. background: #f5f9ff;
  1047. border-radius: 8px;
  1048. box-sizing: border-box;
  1049. &.right {
  1050. background: #37c65b;
  1051. }
  1052. &.wrong {
  1053. background: #ff3a30;
  1054. }
  1055. }
  1056. &.textarea {
  1057. margin-right: 12px;
  1058. .upload {
  1059. margin-top: 10px;
  1060. &__imgs {
  1061. margin-right: 10px;
  1062. width: 80px;
  1063. height: 80px;
  1064. background: #ffffff;
  1065. border: 1px solid #eeeeee;
  1066. border-radius: 4px;
  1067. position: relative;
  1068. display: flex;
  1069. float: left;
  1070. align-items: center;
  1071. justify-content: center;
  1072. img {
  1073. max-width: 100%;
  1074. max-height: 100%;
  1075. }
  1076. }
  1077. &__btn {
  1078. margin-right: 10px;
  1079. width: 80px;
  1080. height: 80px;
  1081. background: #ffffff;
  1082. border: 1px solid #eeeeee;
  1083. border-radius: 4px;
  1084. position: relative;
  1085. display: flex;
  1086. float: left;
  1087. align-items: center;
  1088. justify-content: center;
  1089. flex-direction: column;
  1090. .icon {
  1091. font-size: 20px;
  1092. color: #3f8dfd;
  1093. }
  1094. p {
  1095. font-size: 12px;
  1096. font-family: Microsoft YaHei;
  1097. font-weight: 400;
  1098. color: #999999;
  1099. line-height: 24px;
  1100. }
  1101. input {
  1102. position: absolute;
  1103. left: 0;
  1104. top: 0;
  1105. display: block;
  1106. width: 100%;
  1107. height: 100%;
  1108. opacity: 0;
  1109. }
  1110. }
  1111. }
  1112. }
  1113. /deep/ .el-checkbox {
  1114. white-space: pre-wrap;
  1115. }
  1116. }
  1117. .answer-list {
  1118. height: 40px;
  1119. border-top: 1px solid #eee;
  1120. border-bottom: 1px solid #eee;
  1121. margin-top: 24px;
  1122. display: flex;
  1123. align-items: center;
  1124. justify-content: space-between;
  1125. padding: 0 24px;
  1126. &__left {
  1127. font-size: 16px;
  1128. font-family: Microsoft YaHei;
  1129. font-weight: 400;
  1130. color: #333333;
  1131. line-height: 24px;
  1132. }
  1133. &__right {
  1134. font-size: 16px;
  1135. font-family: Microsoft YaHei;
  1136. font-weight: 400;
  1137. color: #333333;
  1138. line-height: 24px;
  1139. }
  1140. }
  1141. .explain-list {
  1142. padding: 12px 24px;
  1143. &__header {
  1144. font-size: 16px;
  1145. font-family: Microsoft YaHei;
  1146. font-weight: bold;
  1147. color: #666666;
  1148. line-height: 24px;
  1149. }
  1150. &__body {
  1151. margin-top: 12px;
  1152. font-size: 16px;
  1153. font-family: Microsoft YaHei;
  1154. font-weight: 400;
  1155. color: #666666;
  1156. line-height: 24px;
  1157. }
  1158. .upload {
  1159. margin-top: 10px;
  1160. &__imgs {
  1161. margin-right: 10px;
  1162. width: 80px;
  1163. height: 80px;
  1164. background: #ffffff;
  1165. border: 1px solid #eeeeee;
  1166. border-radius: 4px;
  1167. position: relative;
  1168. display: flex;
  1169. float: left;
  1170. align-items: center;
  1171. justify-content: center;
  1172. img {
  1173. max-width: 100%;
  1174. max-height: 100%;
  1175. }
  1176. }
  1177. }
  1178. }
  1179. }
  1180. &__btns {
  1181. position: relative;
  1182. height: 32px;
  1183. .submit {
  1184. cursor: pointer;
  1185. margin: 0 auto;
  1186. width: 140px;
  1187. height: 32px;
  1188. background: #3f8dfd;
  1189. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  1190. border-radius: 16px;
  1191. text-align: center;
  1192. line-height: 32px;
  1193. color: #fff;
  1194. font-size: 16px;
  1195. }
  1196. .collect {
  1197. cursor: pointer;
  1198. position: absolute;
  1199. right: 0;
  1200. top: 5px;
  1201. font-size: 12px;
  1202. font-family: Microsoft YaHei;
  1203. font-weight: 400;
  1204. color: #3f8dfd;
  1205. line-height: 24px;
  1206. }
  1207. }
  1208. }
  1209. }
  1210. &__footer {
  1211. height: 40px;
  1212. display: flex;
  1213. justify-content: space-around;
  1214. align-items: center;
  1215. .btn {
  1216. cursor: pointer;
  1217. width: 140px;
  1218. height: 32px;
  1219. background: #ffffff;
  1220. border: 1px solid #3f8dfd;
  1221. border-radius: 16px;
  1222. line-height: 32px;
  1223. text-align: center;
  1224. color: #3f8dfd;
  1225. }
  1226. }
  1227. }
  1228. .right-box {
  1229. float: right;
  1230. width: 300px;
  1231. &__header {
  1232. height: 40px;
  1233. line-height: 40px;
  1234. font-size: 16px;
  1235. font-family: Microsoft YaHei;
  1236. font-weight: bold;
  1237. color: #333333;
  1238. text-align: center;
  1239. border-bottom: 1px solid #eeeeee;
  1240. }
  1241. &__body {
  1242. height: 720px;
  1243. border-bottom: 1px solid #eee;
  1244. .card {
  1245. &__note {
  1246. display: flex;
  1247. height: 40px;
  1248. align-items: center;
  1249. border-bottom: 1px solid #eee;
  1250. .item {
  1251. display: flex;
  1252. align-items: center;
  1253. margin-left: 10px;
  1254. .box {
  1255. margin-right: 5px;
  1256. width: 16px;
  1257. height: 16px;
  1258. border-radius: 4px;
  1259. &.white {
  1260. background: #ffffff;
  1261. border: 1px solid #eeeeee;
  1262. }
  1263. &.green {
  1264. background: #37c65b;
  1265. }
  1266. &.red {
  1267. background: #ff3a30;
  1268. }
  1269. &.blue {
  1270. background: #3f8dfd;
  1271. }
  1272. }
  1273. }
  1274. }
  1275. &__content {
  1276. height: 410px;
  1277. overflow-y: scroll;
  1278. &::-webkit-scrollbar {
  1279. width: 6px;
  1280. }
  1281. &::-webkit-scrollbar-track {
  1282. background-color: #fff;
  1283. -webkit-border-radius: 2em;
  1284. -moz-border-radius: 2em;
  1285. border-radius: 2em;
  1286. }
  1287. &::-webkit-scrollbar-thumb {
  1288. background-color: #eeeeee;
  1289. -webkit-border-radius: 2em;
  1290. -moz-border-radius: 2em;
  1291. border-radius: 2em;
  1292. }
  1293. .list {
  1294. display: flex;
  1295. flex-wrap: wrap;
  1296. .item {
  1297. width: 40px;
  1298. height: 40px;
  1299. border-radius: 10px;
  1300. text-align: center;
  1301. line-height: 40px;
  1302. margin-left: 16px;
  1303. margin-top: 16px;
  1304. cursor: pointer;
  1305. &.white {
  1306. line-height: 38px;
  1307. color: #333333;
  1308. background: #ffffff;
  1309. border: 1px solid #eeeeee;
  1310. }
  1311. &.green {
  1312. color: #fff;
  1313. background: #37c65b;
  1314. }
  1315. &.red {
  1316. color: #fff;
  1317. background: #ff3a30;
  1318. }
  1319. &.blue {
  1320. border: 1rpx solid #eeeeee;
  1321. color: #fff;
  1322. background: #3f8dfd;
  1323. }
  1324. &.disabled {
  1325. cursor: not-allowed;
  1326. line-height: 38px;
  1327. color: #eeeeee;
  1328. background: #ffffff;
  1329. border: 1px solid #eeeeee;
  1330. }
  1331. }
  1332. }
  1333. }
  1334. }
  1335. }
  1336. &__footer {
  1337. height: 40px;
  1338. display: flex;
  1339. align-items: center;
  1340. justify-content: center;
  1341. .submit {
  1342. cursor: pointer;
  1343. width: 140px;
  1344. height: 32px;
  1345. background: #3f8dfd;
  1346. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  1347. border-radius: 16px;
  1348. line-height: 32px;
  1349. text-align: center;
  1350. color: #fff;
  1351. font-size: 16px;
  1352. }
  1353. }
  1354. }
  1355. }
  1356. }
  1357. }
  1358. }
  1359. .take-photo {
  1360. /deep/ .el-dialog__header {
  1361. display: none;
  1362. }
  1363. /deep/ .el-dialog__body {
  1364. padding: 0;
  1365. overflow: unset;
  1366. }
  1367. &__close {
  1368. cursor: pointer;
  1369. position: absolute;
  1370. right: 0;
  1371. top: -28px;
  1372. width: 24px;
  1373. height: 24px;
  1374. line-height: 24px;
  1375. text-align: center;
  1376. color: #eee;
  1377. border: 1px solid #eee;
  1378. border-radius: 50%;
  1379. }
  1380. &__header {
  1381. height: 40px;
  1382. border-bottom: 1px solid #eee;
  1383. line-height: 40px;
  1384. font-size: 16px;
  1385. font-family: Microsoft YaHei;
  1386. font-weight: bold;
  1387. color: #333333;
  1388. padding-left: 24px;
  1389. }
  1390. &__body {
  1391. height: 400px;
  1392. padding: 40px 24px;
  1393. .left-box {
  1394. width: 336px;
  1395. float: left;
  1396. .title {
  1397. font-size: 16px;
  1398. font-family: Microsoft YaHei;
  1399. font-weight: bold;
  1400. color: #ff3b30;
  1401. line-height: 24px;
  1402. }
  1403. .content {
  1404. font-size: 14px;
  1405. font-family: Microsoft YaHei;
  1406. font-weight: 400;
  1407. color: #333333;
  1408. line-height: 28px;
  1409. margin-top: 32px;
  1410. }
  1411. }
  1412. .right-box {
  1413. float: right;
  1414. width: 400px;
  1415. height: 300px;
  1416. video {
  1417. width: 100%;
  1418. height: 100%;
  1419. }
  1420. }
  1421. }
  1422. &__footer {
  1423. height: 90px;
  1424. border-top: 1px solid #eee;
  1425. text-align: center;
  1426. .take {
  1427. display: inline-block;
  1428. width: 200px;
  1429. height: 40px;
  1430. padding: 0;
  1431. border-radius: 20px;
  1432. text-align: center;
  1433. line-height: 40px;
  1434. margin: 24px auto;
  1435. }
  1436. }
  1437. }
  1438. }
  1439. </style>