index.vue 53 KB

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