index.vue 59 KB

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