wrong-bank.vue 80 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245
  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. :allNum="questionList.length"
  23. @prevQuestion="prevQuestion"
  24. @nextQuestion="nextQuestion"
  25. ></Header-tab-box>
  26. <div class="left-box__body">
  27. <template v-for="(question, questionIndex) in questionList">
  28. <div
  29. class="question"
  30. v-if="question.type == 1 && current == questionIndex"
  31. :key="questionIndex"
  32. >
  33. <div class="question__title">
  34. {{ questionIndex + 1 }}、单选题
  35. </div>
  36. <div
  37. class="question__desc"
  38. v-html="question.content"
  39. ></div>
  40. <div class="question__content">
  41. <div class="question-list" v-if="!question.ques">
  42. <div
  43. class="radio"
  44. v-for="(item, index) in question.jsonStr"
  45. :key="index"
  46. @click="
  47. radioSelect(
  48. question,
  49. questionIndex,
  50. item.optionsId
  51. )
  52. "
  53. >
  54. <div>
  55. {{ ast[index] }}. {{ item.content }}
  56. <div v-if="item.imgUrl">
  57. <img
  58. style="max-width: 100%"
  59. :src="$tools.splitImgHost(item.imgUrl)"
  60. alt=""
  61. />
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="question-list" v-if="question.ques">
  67. <div
  68. class="radio"
  69. :class="{
  70. right:
  71. item.optionsId == question.ques ||
  72. item.optionsId == question.ans,
  73. wrong:
  74. item.optionsId == question.ques &&
  75. question.ques != question.ans,
  76. }"
  77. v-for="(item, index) in question.jsonStr"
  78. :key="index"
  79. >
  80. <div>
  81. {{ ast[index] }}. {{ item.content }}
  82. <div v-if="item.imgUrl">
  83. <img
  84. style="max-width: 100%"
  85. :src="$tools.splitImgHost(item.imgUrl)"
  86. alt=""
  87. />
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="answer-list" v-if="question.ques">
  93. <div class="answer-list__left">
  94. 题目答案:{{ ast[question.ans - 1] }}
  95. </div>
  96. <div class="answer-list__left" v-if="!explain">
  97. 我的答案:{{ ast[question.ques - 1] }}
  98. </div>
  99. </div>
  100. <div class="explain-list" v-if="question.ques">
  101. <div class="explain-list__header">答案解析:</div>
  102. <div
  103. class="explain-list__body"
  104. v-html="question.analysisContent"
  105. ></div>
  106. </div>
  107. </div>
  108. <div class="question__btns">
  109. <!-- <div class="collect" @click="collect"></div> -->
  110. </div>
  111. </div>
  112. <div
  113. class="question"
  114. v-if="question.type == 2 && current == questionIndex"
  115. :key="questionIndex"
  116. >
  117. <div class="question__title">
  118. {{ questionIndex + 1 }}、多选题
  119. </div>
  120. <div
  121. class="question__desc"
  122. v-html="question.content"
  123. ></div>
  124. <div class="question__content">
  125. <div class="question-list" v-if="!question.ques">
  126. <el-checkbox
  127. class="checkbox"
  128. v-for="(item, index) in question.jsonStr"
  129. :key="index"
  130. :label="item.optionsId"
  131. v-model="item.checked"
  132. >
  133. <div>
  134. {{ ast[index] }}. {{ item.content }}
  135. <div v-if="item.imgUrl">
  136. <img
  137. style="max-width: 100%"
  138. :src="$tools.splitImgHost(item.imgUrl)"
  139. alt=""
  140. />
  141. </div>
  142. </div>
  143. </el-checkbox>
  144. </div>
  145. <div class="question-list" v-if="question.ques">
  146. <el-checkbox
  147. disabled
  148. class="checkbox"
  149. :class="{
  150. right:
  151. question.ques.indexOf(item.optionsId) != -1 ||
  152. question.ans.indexOf(item.optionsId) != -1,
  153. wrong:
  154. question.ques.indexOf(item.optionsId) != -1 &&
  155. question.ans.indexOf(item.optionsId) == -1,
  156. }"
  157. v-for="(item, index) in question.jsonStr"
  158. :key="index"
  159. :label="item.optionsId"
  160. v-model="item.checked"
  161. >
  162. <div>
  163. {{ ast[index] }}. {{ item.content }}
  164. <div v-if="item.imgUrl">
  165. <img
  166. style="max-width: 100%"
  167. :src="$tools.splitImgHost(item.imgUrl)"
  168. alt=""
  169. />
  170. </div>
  171. </div>
  172. </el-checkbox>
  173. </div>
  174. <div class="answer-list" v-if="question.ques">
  175. <div class="answer-list__left">
  176. 题目答案:
  177. <template v-for="ansItem in question.ans">{{
  178. ast[ansItem - 1]
  179. }}</template>
  180. </div>
  181. <div class="answer-list__left" v-if="!explain">
  182. 我的答案:
  183. <template v-for="quesItem in question.ques">{{
  184. ast[quesItem - 1]
  185. }}</template>
  186. </div>
  187. </div>
  188. <div class="explain-list" v-if="question.ques">
  189. <div class="explain-list__header">答案解析:</div>
  190. <div
  191. class="explain-list__body"
  192. v-html="question.analysisContent"
  193. ></div>
  194. </div>
  195. </div>
  196. <div class="question__btns">
  197. <div
  198. v-if="!question.ques"
  199. class="submit"
  200. @click="checkboxSubmit(question, questionIndex)"
  201. >
  202. 确认答案
  203. </div>
  204. <!-- <div class="collect" @click="collect"></div> -->
  205. </div>
  206. </div>
  207. <div
  208. class="question"
  209. v-if="question.type == 3 && current == questionIndex"
  210. :key="questionIndex"
  211. >
  212. <div class="question__title">
  213. {{ questionIndex + 1 }}、判断题
  214. </div>
  215. <div
  216. class="question__desc"
  217. v-html="question.content"
  218. ></div>
  219. <div class="question__content">
  220. <div class="question-list" v-if="!question.ques">
  221. <div
  222. class="radio"
  223. v-for="(item, index) in judge"
  224. :key="index"
  225. @click="judgeSelect(question, questionIndex, index)"
  226. >
  227. <div>
  228. {{ ast[index] }}. {{ item }}
  229. <div v-if="item.imgUrl">
  230. <img
  231. style="max-width: 100%"
  232. :src="$tools.splitImgHost(item.imgUrl)"
  233. alt=""
  234. />
  235. </div>
  236. </div>
  237. </div>
  238. </div>
  239. <div class="question-list" v-if="question.ques">
  240. <div
  241. class="radio"
  242. :class="{
  243. right:
  244. index == (question.ques == 1 ? 0 : 1) ||
  245. index != question.ans,
  246. wrong:
  247. index == (question.ques == 1 ? 0 : 1) &&
  248. question.ques != question.ans,
  249. }"
  250. v-for="(item, index) in judge"
  251. :key="index"
  252. >
  253. <div>
  254. {{ ast[index] }}. {{ item }}
  255. <div v-if="item.imgUrl">
  256. <img
  257. style="max-width: 100%"
  258. :src="$tools.splitImgHost(item.imgUrl)"
  259. alt=""
  260. />
  261. </div>
  262. </div>
  263. </div>
  264. </div>
  265. <div class="answer-list" v-if="question.ques">
  266. <div class="answer-list__left">
  267. 题目答案:{{ ast[question.ans == 1 ? 0 : 1] }}
  268. </div>
  269. <div class="answer-list__left" v-if="!explain">
  270. 我的答案:{{ ast[question.ques == 1 ? 0 : 1] }}
  271. </div>
  272. </div>
  273. <div class="explain-list" v-if="question.ques">
  274. <div class="explain-list__header">答案解析:</div>
  275. <div
  276. class="explain-list__body"
  277. v-html="question.analysisContent"
  278. ></div>
  279. </div>
  280. </div>
  281. <div class="question__btns">
  282. <!-- <div class="collect" @click="collect"></div> -->
  283. </div>
  284. </div>
  285. <div
  286. class="question"
  287. v-if="question.type == 4 && current == questionIndex"
  288. :key="questionIndex"
  289. >
  290. <div class="question__title">
  291. {{ questionIndex + 1 }}、案例题
  292. </div>
  293. <div
  294. class="question__desc"
  295. v-html="question.content"
  296. ></div>
  297. <div class="question__content">
  298. <el-tabs v-model="question.tabIndex">
  299. <el-tab-pane
  300. v-for="(json, jsonIndex) in question.jsonStr"
  301. :label="'问题' + (jsonIndex + 1)"
  302. :name="jsonIndex + ''"
  303. :key="jsonIndex"
  304. >
  305. <div
  306. class="question"
  307. v-if="json.type == 1"
  308. :key="questionIndex"
  309. >
  310. <div class="question__title">
  311. {{ jsonIndex + 1 }}、单选题
  312. </div>
  313. <div
  314. class="question__desc"
  315. v-html="json.content"
  316. ></div>
  317. <div class="question__content">
  318. <div
  319. class="question-list"
  320. v-if="!question.ques[jsonIndex]"
  321. >
  322. <div
  323. class="radio"
  324. v-for="(item, index) in json.optionsList"
  325. :key="index"
  326. @click="
  327. radioSelectChild(
  328. questionIndex,
  329. jsonIndex,
  330. item.optionsId
  331. )
  332. "
  333. >
  334. <div>
  335. {{ ast[index] }}. {{ item.content }}
  336. <div v-if="item.imgUrl">
  337. <img
  338. style="max-width: 100%"
  339. :src="
  340. $tools.splitImgHost(item.imgUrl)
  341. "
  342. alt=""
  343. />
  344. </div>
  345. </div>
  346. </div>
  347. </div>
  348. <div
  349. class="question-list"
  350. v-if="question.ques[jsonIndex]"
  351. >
  352. <div
  353. class="radio"
  354. :class="{
  355. right:
  356. item.optionsId ==
  357. question.ques[jsonIndex] ||
  358. item.optionsId ==
  359. question.ans[jsonIndex],
  360. wrong:
  361. item.optionsId ==
  362. question.ques[jsonIndex] &&
  363. question.ques[jsonIndex] !=
  364. question.ans[jsonIndex],
  365. }"
  366. v-for="(item, index) in json.optionsList"
  367. :key="index"
  368. >
  369. <div>
  370. {{ ast[index] }}. {{ item.content }}
  371. <div v-if="item.imgUrl">
  372. <img
  373. style="max-width: 100%"
  374. :src="
  375. $tools.splitImgHost(item.imgUrl)
  376. "
  377. alt=""
  378. />
  379. </div>
  380. </div>
  381. </div>
  382. </div>
  383. <div
  384. class="answer-list"
  385. v-if="question.ques[jsonIndex]"
  386. >
  387. <div class="answer-list__left">
  388. 题目答案:{{
  389. ast[question.ans[jsonIndex] - 1]
  390. }}
  391. </div>
  392. <div
  393. class="answer-list__left"
  394. v-if="!explain"
  395. >
  396. 我的答案:{{
  397. ast[question.ques[jsonIndex] - 1]
  398. }}
  399. </div>
  400. </div>
  401. <div
  402. class="explain-list"
  403. v-if="question.ques[jsonIndex]"
  404. >
  405. <div class="explain-list__header">
  406. 答案解析:
  407. </div>
  408. <div
  409. class="explain-list__body"
  410. v-html="json.analysisContent"
  411. ></div>
  412. </div>
  413. </div>
  414. <div class="question__btns"></div>
  415. </div>
  416. <div
  417. class="question"
  418. v-if="json.type == 2"
  419. :key="jsonIndex"
  420. >
  421. <div class="question__title">
  422. {{ jsonIndex + 1 }}、多选题
  423. </div>
  424. <div
  425. class="question__desc"
  426. v-html="json.content"
  427. ></div>
  428. <div class="question__content">
  429. <div
  430. class="question-list"
  431. v-if="!question.ques[jsonIndex]"
  432. >
  433. <el-checkbox
  434. class="checkbox"
  435. v-for="(item, index) in json.optionsList"
  436. :key="index"
  437. :label="item.optionsId"
  438. v-model="item.checked"
  439. >
  440. <div>
  441. {{ ast[index] }}. {{ item.content }}
  442. <div v-if="item.imgUrl">
  443. <img
  444. style="max-width: 100%"
  445. :src="
  446. $tools.splitImgHost(item.imgUrl)
  447. "
  448. alt=""
  449. />
  450. </div>
  451. </div>
  452. </el-checkbox>
  453. </div>
  454. <div
  455. class="question-list"
  456. v-if="question.ques[jsonIndex]"
  457. >
  458. <el-checkbox
  459. disabled
  460. class="checkbox"
  461. :class="{
  462. right:
  463. question.ques[jsonIndex].indexOf(
  464. item.optionsId
  465. ) != -1 ||
  466. question.ans[jsonIndex].indexOf(
  467. item.optionsId
  468. ) != -1,
  469. wrong:
  470. question.ques[jsonIndex].indexOf(
  471. item.optionsId
  472. ) != -1 &&
  473. question.ans[jsonIndex].indexOf(
  474. item.optionsId
  475. ) == -1,
  476. }"
  477. v-for="(item, index) in json.optionsList"
  478. :key="index"
  479. :label="item.optionsId"
  480. v-model="item.checked"
  481. >
  482. <div>
  483. {{ ast[index] }}. {{ item.content }}
  484. <div v-if="item.imgUrl">
  485. <img
  486. style="max-width: 100%"
  487. :src="
  488. $tools.splitImgHost(item.imgUrl)
  489. "
  490. alt=""
  491. />
  492. </div>
  493. </div>
  494. </el-checkbox>
  495. </div>
  496. <div
  497. class="answer-list"
  498. v-if="question.ques[jsonIndex]"
  499. >
  500. <div class="answer-list__left">
  501. 题目答案:
  502. <template
  503. v-for="ansItem in question.ans[jsonIndex]"
  504. >{{ ast[ansItem - 1] }}</template
  505. >
  506. </div>
  507. <div
  508. class="answer-list__left"
  509. v-if="!explain"
  510. >
  511. 我的答案:
  512. <template
  513. v-for="quesItem in question.ques[
  514. jsonIndex
  515. ]"
  516. >{{ ast[quesItem - 1] }}</template
  517. >
  518. </div>
  519. </div>
  520. <div
  521. class="explain-list"
  522. v-if="question.ques[jsonIndex]"
  523. >
  524. <div class="explain-list__header">
  525. 答案解析:
  526. </div>
  527. <div
  528. class="explain-list__body"
  529. v-html="json.analysisContent"
  530. ></div>
  531. </div>
  532. </div>
  533. <div class="question__btns">
  534. <div
  535. v-if="!question.ques[jsonIndex]"
  536. class="submit"
  537. @click="
  538. checkboxSubmitChild(
  539. questionIndex,
  540. jsonIndex
  541. )
  542. "
  543. >
  544. 确认答案
  545. </div>
  546. </div>
  547. </div>
  548. <div
  549. class="question"
  550. v-if="json.type == 3"
  551. :key="jsonIndex"
  552. >
  553. <div class="question__title">
  554. {{ jsonIndex + 1 }}、判断题
  555. </div>
  556. <div
  557. class="question__desc"
  558. v-html="json.content"
  559. ></div>
  560. <div class="question__content">
  561. <div
  562. class="question-list"
  563. v-if="!question.ques[jsonIndex]"
  564. >
  565. <div
  566. class="radio"
  567. v-for="(item, index) in judge"
  568. :key="index"
  569. @click="
  570. judgeSelectChild(
  571. questionIndex,
  572. jsonIndex,
  573. index
  574. )
  575. "
  576. >
  577. <div>
  578. {{ ast[index] }}. {{ item }}
  579. <div v-if="item.imgUrl">
  580. <img
  581. style="max-width: 100%"
  582. :src="
  583. $tools.splitImgHost(item.imgUrl)
  584. "
  585. alt=""
  586. />
  587. </div>
  588. </div>
  589. </div>
  590. </div>
  591. <div
  592. class="question-list"
  593. v-if="question.ques[jsonIndex]"
  594. >
  595. <div
  596. class="radio"
  597. :class="{
  598. right:
  599. index ==
  600. (question.ques[jsonIndex] == 1
  601. ? 0
  602. : 1) ||
  603. index != question.ans[jsonIndex],
  604. wrong:
  605. index ==
  606. (question.ques[jsonIndex] == 1
  607. ? 0
  608. : 1) &&
  609. question.ques[jsonIndex] !=
  610. question.ans[jsonIndex],
  611. }"
  612. v-for="(item, index) in judge"
  613. :key="index"
  614. >
  615. <div>
  616. {{ ast[index] }}. {{ item }}
  617. <div v-if="item.imgUrl">
  618. <img
  619. style="max-width: 100%"
  620. :src="
  621. $tools.splitImgHost(item.imgUrl)
  622. "
  623. alt=""
  624. />
  625. </div>
  626. </div>
  627. </div>
  628. </div>
  629. <div
  630. class="answer-list"
  631. v-if="question.ques[jsonIndex]"
  632. >
  633. <div class="answer-list__left">
  634. 题目答案:{{
  635. ast[question.ans[jsonIndex] == 1 ? 0 : 1]
  636. }}
  637. </div>
  638. <div
  639. class="answer-list__left"
  640. v-if="!explain"
  641. >
  642. 我的答案:{{
  643. ast[question.ques[jsonIndex] == 1 ? 0 : 1]
  644. }}
  645. </div>
  646. </div>
  647. <div
  648. class="explain-list"
  649. v-if="question.ques[jsonIndex]"
  650. >
  651. <div class="explain-list__header">
  652. 答案解析:
  653. </div>
  654. <div
  655. class="explain-list__body"
  656. v-html="json.analysisContent"
  657. ></div>
  658. </div>
  659. </div>
  660. <div class="question__btns"></div>
  661. </div>
  662. <div
  663. class="question"
  664. v-if="json.type == 5"
  665. :key="jsonIndex"
  666. >
  667. <div class="question__title">
  668. {{ jsonIndex + 1 }}、简答题
  669. </div>
  670. <div
  671. class="question__desc"
  672. v-html="json.content"
  673. ></div>
  674. <div class="question__content">
  675. <div
  676. class="question-list textarea"
  677. v-if="
  678. !(
  679. question.ques[jsonIndex] &&
  680. (question.ques[jsonIndex].imageList
  681. .length ||
  682. question.ques[jsonIndex].text)
  683. )
  684. "
  685. >
  686. <el-input
  687. type="textarea"
  688. rows="5"
  689. v-model="json.ansText.text"
  690. resize="none"
  691. ></el-input>
  692. <div class="upload clearfix">
  693. <div
  694. class="upload__imgs"
  695. v-for="(img, imgIndex) in json.ansText
  696. .imageList"
  697. :key="imgIndex"
  698. >
  699. <img
  700. :src="$tools.splitImgHost(img, true)"
  701. alt=""
  702. />
  703. </div>
  704. <div class="upload__btn">
  705. <i class="el-icon-plus icon"></i>
  706. <p>上传图片</p>
  707. <input
  708. @change="
  709. uploadImgChild(
  710. $event,
  711. questionIndex,
  712. jsonIndex
  713. )
  714. "
  715. type="file"
  716. />
  717. </div>
  718. </div>
  719. </div>
  720. <div
  721. class="explain-list"
  722. v-if="
  723. question.ques[jsonIndex] &&
  724. (question.ques[jsonIndex].imageList
  725. .length ||
  726. question.ques[jsonIndex].text) &&
  727. !explain
  728. "
  729. >
  730. <div class="explain-list__header">
  731. 我的答案:
  732. </div>
  733. <div class="explain-list__body">
  734. <div>
  735. {{ question.ques[jsonIndex].text }}
  736. </div>
  737. <div class="upload clearfix">
  738. <div
  739. class="upload__imgs"
  740. v-for="(img, imgIndex) in question.ques[
  741. jsonIndex
  742. ].imageList"
  743. :key="imgIndex"
  744. >
  745. <img
  746. :src="$tools.splitImgHost(img, true)"
  747. alt=""
  748. />
  749. </div>
  750. </div>
  751. </div>
  752. <div class="explain-list__header">
  753. 答案解析:
  754. </div>
  755. <div
  756. class="explain-list__body"
  757. v-html="question.analysisContent"
  758. ></div>
  759. </div>
  760. </div>
  761. <div class="question__btns">
  762. <div
  763. v-if="
  764. !(
  765. question.ques[jsonIndex] &&
  766. (question.ques[jsonIndex].imageList
  767. .length ||
  768. question.ques[jsonIndex].text)
  769. )
  770. "
  771. class="submit"
  772. @click="
  773. ansSubmitChild(
  774. question,
  775. questionIndex,
  776. jsonIndex
  777. )
  778. "
  779. >
  780. 确认答案
  781. </div>
  782. </div>
  783. </div>
  784. </el-tab-pane>
  785. </el-tabs>
  786. </div>
  787. <div class="question__btns">
  788. <!-- <div class="collect" @click="collect"></div> -->
  789. </div>
  790. </div>
  791. <div
  792. class="question"
  793. v-if="question.type == 5 && current == questionIndex"
  794. :key="questionIndex"
  795. >
  796. <div class="question__title">
  797. {{ questionIndex + 1 }}、简答题
  798. </div>
  799. <div
  800. class="question__desc"
  801. v-html="question.content"
  802. ></div>
  803. <div class="question__content">
  804. <div
  805. class="question-list textarea"
  806. v-if="
  807. !question.ques.imageList.length &&
  808. !question.ques.text
  809. "
  810. >
  811. <el-input
  812. type="textarea"
  813. rows="5"
  814. v-model="question.ansText.text"
  815. resize="none"
  816. ></el-input>
  817. <div class="upload clearfix">
  818. <div
  819. class="upload__imgs"
  820. v-for="(img, imgIndex) in question.ansText
  821. .imageList"
  822. :key="imgIndex"
  823. >
  824. <img
  825. :src="$tools.splitImgHost(img, true)"
  826. alt=""
  827. />
  828. </div>
  829. <div class="upload__btn">
  830. <i class="el-icon-plus icon"></i>
  831. <p>上传图片</p>
  832. <input
  833. @change="
  834. uploadImg($event, question, questionIndex)
  835. "
  836. type="file"
  837. />
  838. </div>
  839. </div>
  840. </div>
  841. <div
  842. class="explain-list"
  843. v-if="
  844. (question.ques.imageList.length ||
  845. question.ques.text) &&
  846. !explain
  847. "
  848. >
  849. <div class="explain-list__header">我的答案:</div>
  850. <div class="explain-list__body">
  851. <div>{{ question.ques.text }}</div>
  852. <div class="upload clearfix">
  853. <div
  854. class="upload__imgs"
  855. v-for="(img, imgIndex) in question.ques
  856. .imageList"
  857. :key="imgIndex"
  858. >
  859. <img
  860. :src="$tools.splitImgHost(img, true)"
  861. alt=""
  862. />
  863. </div>
  864. </div>
  865. </div>
  866. <div class="explain-list__header">答案解析:</div>
  867. <div
  868. class="explain-list__body"
  869. v-html="question.analysisContent"
  870. ></div>
  871. </div>
  872. </div>
  873. <div class="question__btns">
  874. <div
  875. v-if="
  876. !question.ques.imageList.length &&
  877. !question.ques.text
  878. "
  879. class="submit"
  880. @click="ansSubmit(question, questionIndex)"
  881. >
  882. 确认答案
  883. </div>
  884. <!-- <div class="collect" @click="collect"></div> -->
  885. </div>
  886. </div>
  887. </template>
  888. </div>
  889. </div>
  890. <div class="right-box">
  891. <div class="right-box__header">
  892. <el-button
  893. type="primary"
  894. round
  895. plain
  896. size="small"
  897. class="back-btn"
  898. @click="$router.back(-1)"
  899. >返回</el-button
  900. >
  901. </div>
  902. <!-- <div class="right-box__footer">
  903. <div class="submit" v-if="!explain" @click="submit">交卷</div>
  904. </div> -->
  905. <div class="right-box__header">答题卡</div>
  906. <div class="right-box__body">
  907. <div class="card">
  908. <div class="card__note">
  909. <div class="item">
  910. <div class="box green"></div>
  911. 正确
  912. </div>
  913. <div class="item">
  914. <div class="box red"></div>
  915. 错误
  916. </div>
  917. <div class="item">
  918. <div class="box blue"></div>
  919. 已做未评改
  920. </div>
  921. <div class="item">
  922. <div class="box yellow"></div>
  923. 少选
  924. </div>
  925. <div class="item">
  926. <div class="box white"></div>
  927. 未做
  928. </div>
  929. </div>
  930. <div class="card__content">
  931. <ul class="list">
  932. <li
  933. class="item white"
  934. v-for="(item, index) in questionList"
  935. :key="index"
  936. :class="{
  937. green: isRight(item, index),
  938. red: isWrong(item, index),
  939. yellow: isPart(item, index),
  940. blue: isOver(item, index),
  941. }"
  942. @click="changeIndex(index)"
  943. >
  944. {{ index + 1 }}
  945. </li>
  946. </ul>
  947. </div>
  948. </div>
  949. </div>
  950. </div>
  951. </div>
  952. </div>
  953. </div>
  954. </div>
  955. </section>
  956. <ToolBar></ToolBar>
  957. <Footer></Footer>
  958. </div>
  959. </template>
  960. <script>
  961. import Footer from "@/components/footer/index";
  962. import Header from "@/components/header/index";
  963. import ToolBar from "@/components/toolbar/index";
  964. import HeaderTabBox from "../../components/exam/HeaderTabBox.vue";
  965. import { mapMutations } from "vuex";
  966. export default {
  967. name: "BankExplain",
  968. components: {
  969. Footer,
  970. Header,
  971. ToolBar,
  972. HeaderTabBox
  973. },
  974. data() {
  975. return {
  976. questionIndex: 0,
  977. questionList: [],
  978. orderGoodsId: "",
  979. bankList: [],
  980. judge: ["正确", "错误"],
  981. ast: [
  982. "A",
  983. "B",
  984. "C",
  985. "D",
  986. "E",
  987. "F",
  988. "G",
  989. "H",
  990. "I",
  991. "J",
  992. "K",
  993. "L",
  994. "M",
  995. "N",
  996. "O",
  997. "P",
  998. "Q",
  999. "R",
  1000. "S",
  1001. "T",
  1002. "U",
  1003. "V",
  1004. "W",
  1005. "X",
  1006. "Y",
  1007. "Z",
  1008. ],
  1009. current: 0,
  1010. examId: "",
  1011. explain: "",
  1012. };
  1013. },
  1014. async mounted() {
  1015. this.examId = this.$route.params.examId;
  1016. this.explain = this.$route.query.explain || "";
  1017. this.orderGoodsId = this.$route.query.orderGoodsId || "";
  1018. this.wrongRecordExamQuestionList();
  1019. },
  1020. methods: {
  1021. toFixed(num) {
  1022. if (num) {
  1023. let str = String(num).indexOf(".");
  1024. if (str != -1) {
  1025. return +num.toFixed(2);
  1026. } else {
  1027. return num;
  1028. }
  1029. } else {
  1030. return 0;
  1031. }
  1032. },
  1033. /**
  1034. * 请求题目列表
  1035. */
  1036. wrongRecordExamQuestionList() {
  1037. this.$request
  1038. .wrongRecordExamQuestionList({
  1039. examId: this.examId,
  1040. })
  1041. .then(async (res) => {
  1042. res.rows.forEach((item, index) => {
  1043. if (typeof item.jsonStr == "string") {
  1044. item.jsonStr = JSON.parse(item.jsonStr);
  1045. if (item.type == 2) {
  1046. //多选
  1047. item.jsonStr.forEach((str) => {
  1048. str.optionsId = "" + str.optionsId;
  1049. });
  1050. let arr = item.answerQuestion.split(",");
  1051. arr.forEach((a, i) => {
  1052. arr[i] = "" + a;
  1053. });
  1054. item.ans = arr;
  1055. if (this.explain) {
  1056. item.ques = item.ans;
  1057. }
  1058. item.quesSelect = [];
  1059. item.analysisContent &&
  1060. (item.analysisContent = item.analysisContent.replace(
  1061. /<img/gi,
  1062. '<img style="max-width:100%;"'
  1063. ));
  1064. item.content &&
  1065. (item.content = item.content.replace(
  1066. /<img/gi,
  1067. '<img style="max-width:100%;"'
  1068. ));
  1069. return;
  1070. } else if (item.type == 5) {
  1071. //简答题
  1072. item.ansText = {
  1073. text: "",
  1074. imageList: [],
  1075. };
  1076. item.ques = {
  1077. text: "",
  1078. imageList: [],
  1079. };
  1080. item.analysisContent &&
  1081. (item.analysisContent = item.analysisContent.replace(
  1082. /<img/gi,
  1083. '<img style="max-width:100%;"'
  1084. ));
  1085. item.content &&
  1086. (item.content = item.content.replace(
  1087. /<img/gi,
  1088. '<img style="max-width:100%;"'
  1089. ));
  1090. if (this.explain) {
  1091. item.ques = {
  1092. text: item.analysisContent,
  1093. imageList: [],
  1094. };
  1095. return;
  1096. }
  1097. } else if (item.type == 4) {
  1098. //案例题
  1099. console.log(item.jsonStr);
  1100. item.ques = [];
  1101. item.tabIndex = "0";
  1102. let ansArr = [];
  1103. item.jsonStr.forEach((json, index) => {
  1104. if (json.type == 1) {
  1105. ansArr[index] = json.answerQuestion;
  1106. json.content &&
  1107. (json.content = json.content.replace(
  1108. /<img/gi,
  1109. '<img style="max-width:100%;"'
  1110. ));
  1111. } else if (json.type == 2) {
  1112. json.optionsList.forEach((str) => {
  1113. str.optionsId = "" + str.optionsId;
  1114. });
  1115. let arr = json.answerQuestion.split(",");
  1116. arr.forEach((a, i) => {
  1117. arr[i] = "" + a;
  1118. });
  1119. ansArr[index] = arr;
  1120. json.content &&
  1121. (json.content = json.content.replace(
  1122. /<img/gi,
  1123. '<img style="max-width:100%;"'
  1124. ));
  1125. } else if (json.type == 3) {
  1126. ansArr[index] = json.answerQuestion;
  1127. json.content &&
  1128. (json.content = json.content.replace(
  1129. /<img/gi,
  1130. '<img style="max-width:100%;"'
  1131. ));
  1132. } else if (json.type == 5) {
  1133. ansArr[index] = {
  1134. text: "",
  1135. imageList: [],
  1136. };
  1137. json.ansText = {
  1138. text: "",
  1139. imageList: [],
  1140. };
  1141. json.ques = {
  1142. text: "",
  1143. imageList: [],
  1144. };
  1145. json.content &&
  1146. (json.content = json.content.replace(
  1147. /<img/gi,
  1148. '<img style="max-width:100%;"'
  1149. ));
  1150. }
  1151. });
  1152. item.analysisContent &&
  1153. (item.analysisContent = item.analysisContent.replace(
  1154. /<img/gi,
  1155. '<img style="max-width:100%;"'
  1156. ));
  1157. item.content &&
  1158. (item.content = item.content.replace(
  1159. /<img/gi,
  1160. '<img style="max-width:100%;"'
  1161. ));
  1162. item.ans = ansArr;
  1163. if (this.explain) {
  1164. item.ques = item.ans;
  1165. }
  1166. return;
  1167. }
  1168. item.analysisContent &&
  1169. (item.analysisContent = item.analysisContent.replace(
  1170. /<img/gi,
  1171. '<img style="max-width:100%;"'
  1172. ));
  1173. item.content &&
  1174. (item.content = item.content.replace(
  1175. /<img/gi,
  1176. '<img style="max-width:100%;"'
  1177. ));
  1178. item.ques = "";
  1179. item.ans = item.answerQuestion;
  1180. if (this.explain) {
  1181. item.ques = item.ans;
  1182. }
  1183. } else {
  1184. if (this.explain) {
  1185. item.ques = item.ans;
  1186. }
  1187. }
  1188. });
  1189. this.questionList = res.rows;
  1190. });
  1191. },
  1192. /**
  1193. * @param {Object}
  1194. * 单选点击确认
  1195. */
  1196. radioSelect(question, questionIndex, optionsId) {
  1197. if (this.questionList[questionIndex].ques) return;
  1198. this.$set(this.questionList[questionIndex], "ques", optionsId);
  1199. // 回答错误
  1200. if (
  1201. this.questionList[questionIndex].ques !=
  1202. this.questionList[questionIndex].ans
  1203. ) {
  1204. } else {
  1205. console.log(this.questionList[questionIndex]);
  1206. this.$request
  1207. .wrongRecordDelete({
  1208. examId: this.questionList[questionIndex].examId,
  1209. orderGoodsId: this.questionList[questionIndex].orderGoodsId || "",
  1210. questionId: this.questionList[questionIndex].questionId,
  1211. goodsId: this.questionList[questionIndex].orderGoodsId
  1212. ? ""
  1213. : this.questionList[questionIndex].goodsId,
  1214. })
  1215. .then((res) => {});
  1216. }
  1217. },
  1218. /**
  1219. * @param {Object}
  1220. * 案例单选点击
  1221. */
  1222. radioSelectChild(questionIndex, jsonIndex, optionsId) {
  1223. if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1224. this.$set(this.questionList[questionIndex].ques, jsonIndex, optionsId);
  1225. },
  1226. /**
  1227. * 多选点击确认
  1228. */
  1229. checkboxSubmit(question, questionIndex) {
  1230. if (this.questionList[questionIndex].ques) return;
  1231. let arr = [];
  1232. this.questionList[questionIndex].jsonStr.forEach((item) => {
  1233. if (item.checked) {
  1234. arr.push(item.optionsId);
  1235. }
  1236. });
  1237. if (!arr.length) {
  1238. this.$message({
  1239. type: "warning",
  1240. message: "请选择答案",
  1241. });
  1242. return;
  1243. }
  1244. this.$set(this.questionList[questionIndex], "ques", arr);
  1245. let isWrong = this.questionList[questionIndex].ques.some(
  1246. (quesItem, quesIndex) => {
  1247. return (
  1248. this.questionList[questionIndex].ques[quesIndex] !=
  1249. this.questionList[questionIndex].ans[quesIndex]
  1250. );
  1251. }
  1252. );
  1253. // 回答错误
  1254. if (isWrong) {
  1255. } else {
  1256. let question = this.questionList.find(
  1257. (item) =>
  1258. item.questionId == this.questionList[questionIndex].questionId
  1259. );
  1260. if (question) {
  1261. this.$request
  1262. .wrongRecordDelete({
  1263. examId: question.examId,
  1264. orderGoodsId: question.orderGoodsId,
  1265. goodsId: this.questionList[questionIndex].orderGoodsId
  1266. ? ""
  1267. : this.questionList[questionIndex].goodsId,
  1268. questionId: question.questionId,
  1269. })
  1270. .then((res) => {});
  1271. }
  1272. }
  1273. },
  1274. /**
  1275. * @param {Object}
  1276. * 案例多选确认
  1277. */
  1278. checkboxSubmitChild(questionIndex, ansIndex) {
  1279. if (this.questionList[questionIndex].ques[ansIndex]) return;
  1280. let arr = [];
  1281. this.questionList[questionIndex].jsonStr[ansIndex].optionsList.forEach(
  1282. (item) => {
  1283. if (item.checked) {
  1284. arr.push(item.optionsId);
  1285. }
  1286. }
  1287. );
  1288. if (!arr.length) {
  1289. this.$message({
  1290. type: "warning",
  1291. message: "请选择答案",
  1292. });
  1293. return;
  1294. }
  1295. this.$set(this.questionList[questionIndex].ques, ansIndex, arr);
  1296. },
  1297. /**
  1298. * 判断点击确认
  1299. */
  1300. judgeSelect(question, questionIndex, index) {
  1301. if (question.ques) return;
  1302. this.$set(
  1303. this.questionList[questionIndex],
  1304. "ques",
  1305. index == 0 ? "1" : "0"
  1306. );
  1307. // 回答错误
  1308. if (
  1309. this.questionList[questionIndex].ques !=
  1310. this.questionList[questionIndex].ans
  1311. ) {
  1312. } else {
  1313. this.$request
  1314. .wrongRecordDelete({
  1315. examId: this.questionList[questionIndex].examId,
  1316. orderGoodsId: this.questionList[questionIndex].orderGoodsId || "",
  1317. goodsId: this.questionList[questionIndex].orderGoodsId
  1318. ? ""
  1319. : this.questionList[questionIndex].goodsId,
  1320. questionId: this.questionList[questionIndex].questionId,
  1321. })
  1322. .then((res) => {});
  1323. }
  1324. },
  1325. judgeSelectChild(questionIndex, jsonIndex, index) {
  1326. console.log(this.questionList[questionIndex].ques[jsonIndex]);
  1327. if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1328. this.$set(
  1329. this.questionList[questionIndex].ques,
  1330. jsonIndex,
  1331. index == 0 ? "1" : "0"
  1332. );
  1333. },
  1334. /**
  1335. * 上传图片
  1336. */
  1337. uploadImg(e, question, questionIndex) {
  1338. var file = e.target.files[0];
  1339. if (file.size > 2 * 1024 * 1024) {
  1340. this.$message.warn("图片不得大于2000kb");
  1341. return;
  1342. }
  1343. var type = e.target.value.toLowerCase().split(".").splice(-1);
  1344. if (
  1345. type[0] != "jpg" &&
  1346. type[0] != "png" &&
  1347. type[0] != "jpeg" &&
  1348. type[0] != "gif"
  1349. ) {
  1350. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  1351. e.target.value = "";
  1352. return;
  1353. }
  1354. this.$upload.upload(file, 0).then((res) => {
  1355. question.ansText.imageList.push(res);
  1356. });
  1357. },
  1358. /**
  1359. * 案例上传图片
  1360. */
  1361. uploadImgChild(e, questionIndex, jsonIndex) {
  1362. var file = e.target.files[0];
  1363. if (file.size > 2 * 1024 * 1024) {
  1364. this.$message.warn("图片不得大于2000kb");
  1365. return;
  1366. }
  1367. var type = e.target.value.toLowerCase().split(".").splice(-1);
  1368. if (
  1369. type[0] != "jpg" &&
  1370. type[0] != "png" &&
  1371. type[0] != "jpeg" &&
  1372. type[0] != "gif"
  1373. ) {
  1374. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  1375. e.target.value = "";
  1376. return;
  1377. }
  1378. this.$upload.upload(file, 0).then((res) => {
  1379. this.questionList[questionIndex].jsonStr[
  1380. jsonIndex
  1381. ].ansText.imageList.push(res);
  1382. });
  1383. },
  1384. isOver(item, index) {
  1385. if (this.questionList[index].ques) {
  1386. if (item.type == 4) {
  1387. //案例题
  1388. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1389. if (
  1390. jsonItem.type == 1 ||
  1391. jsonItem.type == 2 ||
  1392. jsonItem.type == 3
  1393. ) {
  1394. if (item.ques[indexs]) {
  1395. return true;
  1396. } else {
  1397. return false;
  1398. }
  1399. } else if (jsonItem.type == 5) {
  1400. if (
  1401. item.ques[indexs] &&
  1402. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  1403. ) {
  1404. console.log("chil");
  1405. return true;
  1406. } else {
  1407. return false;
  1408. }
  1409. }
  1410. });
  1411. if (isOver) {
  1412. return true;
  1413. } else {
  1414. return false;
  1415. }
  1416. } else if (item.type == 5) {
  1417. //简答题
  1418. //每一项都相等
  1419. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  1420. return true;
  1421. }
  1422. //判断
  1423. } else {
  1424. return false;
  1425. }
  1426. } else {
  1427. return false;
  1428. }
  1429. },
  1430. ansSubmit(question, questionIndex) {
  1431. if (!question.ansText.text && !question.ansText.imageList.length) {
  1432. this.$message({
  1433. type: "warning",
  1434. message: "请输入内容或上传图片",
  1435. });
  1436. return;
  1437. }
  1438. question.ques.imageList = question.ansText.imageList;
  1439. question.ques.text = question.ansText.text;
  1440. console.log(question.ques);
  1441. },
  1442. ansSubmitChild(question, questionIndex, jsonIndex) {
  1443. if (
  1444. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text &&
  1445. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.imageList
  1446. .length
  1447. ) {
  1448. this.$message({
  1449. type: "warning",
  1450. message: "请输入内容或上传图片",
  1451. });
  1452. return;
  1453. }
  1454. this.$set(this.questionList[questionIndex].ques, jsonIndex, {
  1455. imageList:
  1456. this.questionList[questionIndex].jsonStr[jsonIndex].ansText
  1457. .imageList || [],
  1458. text:
  1459. this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text ||
  1460. "",
  1461. });
  1462. },
  1463. changeIndex(index) {
  1464. this.current = index;
  1465. },
  1466. nextQuestion() {
  1467. if (this.current >= this.questionList.length - 1) {
  1468. this.$message({
  1469. type: "warning",
  1470. message: "已经是最后一题了!",
  1471. });
  1472. return;
  1473. }
  1474. this.current++;
  1475. },
  1476. prevQuestion() {
  1477. if (this.current == 0) {
  1478. this.$message({
  1479. type: "warning",
  1480. message: "已经是第一题了!",
  1481. });
  1482. return;
  1483. } else {
  1484. this.current--;
  1485. }
  1486. },
  1487. isRight(item, index) {
  1488. console.log(item);
  1489. //单选
  1490. if (this.questionList[index].ques) {
  1491. if (item.type == 1) {
  1492. console.log(
  1493. this.questionList[index].ques == this.questionList[index].ans
  1494. );
  1495. return this.questionList[index].ques == this.questionList[index].ans;
  1496. //多选
  1497. } else if (item.type == 2) {
  1498. //每一项都相等
  1499. return this.questionList[index].ans.every((item, i) => {
  1500. return item == this.questionList[index].ques[i];
  1501. });
  1502. //判断
  1503. } else if (item.type == 3) {
  1504. return this.questionList[index].ques == this.questionList[index].ans;
  1505. } else {
  1506. return false;
  1507. }
  1508. } else {
  1509. return false;
  1510. }
  1511. },
  1512. isWrong(item, index) {
  1513. if (this.questionList[index].ques) {
  1514. //单选
  1515. if (item.type == 1) {
  1516. return this.questionList[index].ques != this.questionList[index].ans;
  1517. //多选
  1518. } else if (item.type == 2) {
  1519. //每一项都相等
  1520. return this.questionList[index].ques.some((item, i) => {
  1521. return this.questionList[index].ans.indexOf(item) == -1;
  1522. });
  1523. //判断
  1524. } else if (item.type == 3) {
  1525. return this.questionList[index].ques != this.questionList[index].ans;
  1526. } else {
  1527. return false;
  1528. }
  1529. } else {
  1530. return false;
  1531. }
  1532. },
  1533. isPart(item, index) {
  1534. if (this.questionList[index].ques) {
  1535. if (item.type == 2) {
  1536. let isWrong = this.questionList[index].ques.some((item, i) => {
  1537. return this.questionList[index].ans.indexOf(item) == -1;
  1538. });
  1539. let isRight = this.questionList[index].ans.every((item, i) => {
  1540. return item == this.questionList[index].ques[i];
  1541. });
  1542. if (!isRight && !isWrong) {
  1543. return true;
  1544. }
  1545. }
  1546. } else {
  1547. return false;
  1548. }
  1549. },
  1550. right(bankIndex, ansIndex, option) {
  1551. if (
  1552. this.questionList[bankIndex].ques[ansIndex] &&
  1553. this.questionList[bankIndex].ans[ansIndex]
  1554. ) {
  1555. if (
  1556. this.questionList[bankIndex].ques[ansIndex].indexOf(
  1557. option.optionsId
  1558. ) != -1 ||
  1559. this.questionList[bankIndex].ans[ansIndex].indexOf(
  1560. option.optionsId
  1561. ) != -1
  1562. ) {
  1563. return true;
  1564. } else {
  1565. return false;
  1566. }
  1567. } else {
  1568. return false;
  1569. }
  1570. },
  1571. wrong(bankIndex, ansIndex, option) {
  1572. if (
  1573. this.questionList[bankIndex].ques[ansIndex] &&
  1574. this.questionList[bankIndex].ans[ansIndex]
  1575. ) {
  1576. if (
  1577. this.questionList[bankIndex].ques[ansIndex].indexOf(
  1578. option.optionsId
  1579. ) != -1 &&
  1580. this.questionList[bankIndex].ans[ansIndex].indexOf(
  1581. option.optionsId
  1582. ) == -1
  1583. ) {
  1584. return true;
  1585. } else {
  1586. return false;
  1587. }
  1588. } else {
  1589. return false;
  1590. }
  1591. },
  1592. /**
  1593. * 获取已经回答的题目数
  1594. * hasSpecail (是否包含简答和案例)
  1595. */
  1596. questionOverNum(hasSpecail) {
  1597. let count = 0;
  1598. this.questionList.forEach((item) => {
  1599. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1600. if (item.ques) {
  1601. count++;
  1602. }
  1603. } else if (item.type == 4) {
  1604. //案例题
  1605. if (hasSpecail) {
  1606. let isOver = item.jsonStr.every((jsonItem, index) => {
  1607. if (
  1608. jsonItem.type == 1 ||
  1609. jsonItem.type == 2 ||
  1610. jsonItem.type == 3
  1611. ) {
  1612. if (item.ques[index]) {
  1613. return true;
  1614. } else {
  1615. return false;
  1616. }
  1617. } else if (jsonItem.type == 5) {
  1618. if (
  1619. item.ques[index] &&
  1620. (item.ques[index].text || item.ques[index].imageList.length)
  1621. ) {
  1622. return true;
  1623. } else {
  1624. return false;
  1625. }
  1626. }
  1627. });
  1628. if (isOver) {
  1629. count++;
  1630. }
  1631. }
  1632. } else if (item.type == 5) {
  1633. //简答题
  1634. if (hasSpecail) {
  1635. if (item.ques && (item.ques.text || item.ques.imageList.length)) {
  1636. console.log(5, item);
  1637. count++;
  1638. }
  1639. }
  1640. }
  1641. });
  1642. return count;
  1643. },
  1644. collect() {
  1645. this.$message({
  1646. message: "试做题目,不支持收藏~",
  1647. type: "warning",
  1648. });
  1649. return;
  1650. },
  1651. submit() {
  1652. this.$message({
  1653. type: "success",
  1654. message: "交卷成功",
  1655. });
  1656. setTimeout(() => {
  1657. this.$router.back(-1);
  1658. }, 2000);
  1659. },
  1660. },
  1661. };
  1662. </script>
  1663. <!-- Add "scoped" attribute to limit CSS to this component only -->
  1664. <style scoped lang="scss">
  1665. .course-exam {
  1666. .section {
  1667. overflow: hidden;
  1668. &__header {
  1669. height: 20px;
  1670. margin-top: 20px;
  1671. }
  1672. &__body {
  1673. .explain-record {
  1674. &__header {
  1675. }
  1676. &__body {
  1677. margin-bottom: 20px;
  1678. border: 1px solid #eee;
  1679. .left-box {
  1680. float: left;
  1681. width: 970px;
  1682. min-height: 630px;
  1683. border: 1px solid #eee;
  1684. &__body {
  1685. border-bottom: 1px solid #eee;
  1686. .question {
  1687. padding: 12px 0 0 12px;
  1688. display: flex;
  1689. flex-direction: column;
  1690. height: 100%;
  1691. &__title {
  1692. padding-left: 12px;
  1693. font-size: 16px;
  1694. font-family: Microsoft YaHei;
  1695. font-weight: bold;
  1696. color: #333333;
  1697. line-height: 24px;
  1698. }
  1699. &__desc {
  1700. padding-left: 12px;
  1701. margin-top: 20px;
  1702. font-size: 16px;
  1703. font-family: Microsoft YaHei;
  1704. font-weight: 400;
  1705. color: #666666;
  1706. line-height: 24px;
  1707. /deep/ img {
  1708. max-width: 100% !important;
  1709. }
  1710. }
  1711. &__content {
  1712. /deep/ .el-tabs__item {
  1713. height: 40px;
  1714. line-height: 40px;
  1715. }
  1716. .question__content {
  1717. height: auto;
  1718. overflow: auto;
  1719. }
  1720. .question-list {
  1721. padding: 24px 0 0 24px;
  1722. .checkbox,
  1723. .radio {
  1724. cursor: pointer;
  1725. margin-right: 24px;
  1726. padding: 0 24px;
  1727. display: flex;
  1728. align-items: center;
  1729. margin-top: 2px;
  1730. min-height: 40px;
  1731. padding-top: 10px;
  1732. padding-bottom: 10px;
  1733. background: #f5f9ff;
  1734. border-radius: 8px;
  1735. box-sizing: border-box;
  1736. &.right {
  1737. background: #37c65b;
  1738. }
  1739. &.wrong {
  1740. background: #ff3a30;
  1741. }
  1742. }
  1743. &.textarea {
  1744. margin-right: 12px;
  1745. .upload {
  1746. margin-top: 10px;
  1747. &__imgs {
  1748. margin-right: 10px;
  1749. width: 80px;
  1750. height: 80px;
  1751. background: #ffffff;
  1752. border: 1px solid #eeeeee;
  1753. border-radius: 4px;
  1754. position: relative;
  1755. display: flex;
  1756. float: left;
  1757. align-items: center;
  1758. justify-content: center;
  1759. img {
  1760. max-width: 100%;
  1761. max-height: 100%;
  1762. }
  1763. }
  1764. &__btn {
  1765. margin-right: 10px;
  1766. width: 80px;
  1767. height: 80px;
  1768. background: #ffffff;
  1769. border: 1px solid #eeeeee;
  1770. border-radius: 4px;
  1771. position: relative;
  1772. display: flex;
  1773. float: left;
  1774. align-items: center;
  1775. justify-content: center;
  1776. flex-direction: column;
  1777. .icon {
  1778. font-size: 20px;
  1779. color: #3f8dfd;
  1780. }
  1781. p {
  1782. font-size: 12px;
  1783. font-family: Microsoft YaHei;
  1784. font-weight: 400;
  1785. color: #999999;
  1786. line-height: 24px;
  1787. }
  1788. input {
  1789. position: absolute;
  1790. left: 0;
  1791. top: 0;
  1792. display: block;
  1793. width: 100%;
  1794. height: 100%;
  1795. opacity: 0;
  1796. }
  1797. }
  1798. }
  1799. }
  1800. /deep/
  1801. .el-checkbox__input.is-checked
  1802. + .el-checkbox__label {
  1803. color: #000 !important;
  1804. }
  1805. /deep/
  1806. .el-checkbox__input.is-disabled
  1807. + span.el-checkbox__label {
  1808. color: #000;
  1809. }
  1810. /deep/ .el-checkbox {
  1811. white-space: normal;
  1812. }
  1813. }
  1814. .answer-list {
  1815. height: 40px;
  1816. border-top: 1px solid #eee;
  1817. border-bottom: 1px solid #eee;
  1818. margin-top: 24px;
  1819. display: flex;
  1820. align-items: center;
  1821. justify-content: space-between;
  1822. padding: 0 24px;
  1823. &__left {
  1824. font-size: 16px;
  1825. font-family: Microsoft YaHei;
  1826. font-weight: 400;
  1827. color: #333333;
  1828. line-height: 24px;
  1829. }
  1830. &__right {
  1831. font-size: 16px;
  1832. font-family: Microsoft YaHei;
  1833. font-weight: 400;
  1834. color: #333333;
  1835. line-height: 24px;
  1836. }
  1837. }
  1838. .explain-list {
  1839. padding: 12px 24px;
  1840. &__header {
  1841. font-size: 16px;
  1842. font-family: Microsoft YaHei;
  1843. font-weight: bold;
  1844. color: #666666;
  1845. line-height: 24px;
  1846. }
  1847. &__body {
  1848. margin-top: 12px;
  1849. font-size: 16px;
  1850. font-family: Microsoft YaHei;
  1851. font-weight: 400;
  1852. color: #666666;
  1853. line-height: 24px;
  1854. }
  1855. .upload {
  1856. margin-top: 10px;
  1857. &__imgs {
  1858. margin-right: 10px;
  1859. width: 80px;
  1860. height: 80px;
  1861. background: #ffffff;
  1862. border: 1px solid #eeeeee;
  1863. border-radius: 4px;
  1864. position: relative;
  1865. display: flex;
  1866. float: left;
  1867. align-items: center;
  1868. justify-content: center;
  1869. img {
  1870. max-width: 100%;
  1871. max-height: 100%;
  1872. }
  1873. }
  1874. }
  1875. }
  1876. }
  1877. &__btns {
  1878. position: relative;
  1879. height: 32px;
  1880. .submit {
  1881. cursor: pointer;
  1882. margin: 0 auto;
  1883. width: 140px;
  1884. height: 32px;
  1885. background: #3f8dfd;
  1886. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  1887. border-radius: 16px;
  1888. text-align: center;
  1889. line-height: 32px;
  1890. color: #fff;
  1891. font-size: 16px;
  1892. }
  1893. .collect {
  1894. cursor: pointer;
  1895. position: absolute;
  1896. right: 0;
  1897. top: 5px;
  1898. font-size: 12px;
  1899. font-family: Microsoft YaHei;
  1900. font-weight: 400;
  1901. color: #3f8dfd;
  1902. line-height: 24px;
  1903. }
  1904. }
  1905. }
  1906. }
  1907. &__footer {
  1908. height: 40px;
  1909. display: flex;
  1910. justify-content: space-around;
  1911. align-items: center;
  1912. .btn {
  1913. cursor: pointer;
  1914. width: 140px;
  1915. height: 32px;
  1916. background: #ffffff;
  1917. border: 1px solid #3f8dfd;
  1918. border-radius: 16px;
  1919. line-height: 32px;
  1920. text-align: center;
  1921. color: #3f8dfd;
  1922. }
  1923. }
  1924. }
  1925. .right-box {
  1926. float: right;
  1927. width: 299px;
  1928. border-right: 1px solid #eee;
  1929. &__header {
  1930. height: 40px;
  1931. line-height: 40px;
  1932. font-size: 16px;
  1933. font-family: Microsoft YaHei;
  1934. font-weight: bold;
  1935. color: #333333;
  1936. text-align: center;
  1937. border-bottom: 1px solid #eeeeee;
  1938. .back-btn {
  1939. display: block;
  1940. margin: 0 auto;
  1941. width: 160px;
  1942. }
  1943. }
  1944. &__body {
  1945. height: 510px;
  1946. border-bottom: 1px solid #eee;
  1947. .card {
  1948. &__note {
  1949. display: flex;
  1950. height: 64px;
  1951. align-items: center;
  1952. border-bottom: 1px solid #eee;
  1953. flex-wrap: wrap;
  1954. .item {
  1955. display: flex;
  1956. align-items: center;
  1957. margin-left: 10px;
  1958. width: 84px;
  1959. font-size: 12px;
  1960. .box {
  1961. margin-right: 5px;
  1962. width: 16px;
  1963. height: 16px;
  1964. border-radius: 4px;
  1965. &.white {
  1966. background: #ffffff;
  1967. border: 1px solid #eeeeee;
  1968. }
  1969. &.green {
  1970. background: #37c65b;
  1971. }
  1972. &.red {
  1973. background: #ff3a30;
  1974. }
  1975. &.yellow {
  1976. background: #ffc53d;
  1977. }
  1978. &.blue {
  1979. background: #3f8dfd;
  1980. }
  1981. }
  1982. }
  1983. }
  1984. &__content {
  1985. height: 440px;
  1986. overflow-y: scroll;
  1987. &::-webkit-scrollbar {
  1988. width: 6px;
  1989. }
  1990. &::-webkit-scrollbar-track {
  1991. background-color: #fff;
  1992. -webkit-border-radius: 2em;
  1993. -moz-border-radius: 2em;
  1994. border-radius: 2em;
  1995. }
  1996. &::-webkit-scrollbar-thumb {
  1997. background-color: #eeeeee;
  1998. -webkit-border-radius: 2em;
  1999. -moz-border-radius: 2em;
  2000. border-radius: 2em;
  2001. }
  2002. .list {
  2003. display: flex;
  2004. flex-wrap: wrap;
  2005. .item {
  2006. width: 40px;
  2007. height: 40px;
  2008. border-radius: 10px;
  2009. text-align: center;
  2010. line-height: 40px;
  2011. margin-left: 16px;
  2012. margin-top: 16px;
  2013. cursor: pointer;
  2014. &.white {
  2015. line-height: 38px;
  2016. color: #333333;
  2017. background: #ffffff;
  2018. border: 1px solid #eeeeee;
  2019. }
  2020. &.green {
  2021. color: #fff;
  2022. background: #37c65b;
  2023. }
  2024. &.red {
  2025. color: #fff;
  2026. background: #ff3a30;
  2027. }
  2028. &.blue {
  2029. border: 1rpx solid #eeeeee;
  2030. color: #fff;
  2031. background: #3f8dfd;
  2032. }
  2033. &.yellow {
  2034. background: #ffc53d;
  2035. }
  2036. &.disabled {
  2037. cursor: not-allowed;
  2038. line-height: 38px;
  2039. color: #eeeeee;
  2040. background: #ffffff;
  2041. border: 1px solid #eeeeee;
  2042. }
  2043. }
  2044. }
  2045. }
  2046. }
  2047. }
  2048. &__footer {
  2049. border-bottom: 1px solid #eee;
  2050. height: 40px;
  2051. display: flex;
  2052. align-items: center;
  2053. justify-content: center;
  2054. .submit {
  2055. cursor: pointer;
  2056. width: 140px;
  2057. height: 32px;
  2058. background: #3f8dfd;
  2059. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  2060. border-radius: 16px;
  2061. line-height: 32px;
  2062. text-align: center;
  2063. color: #fff;
  2064. font-size: 16px;
  2065. }
  2066. }
  2067. }
  2068. }
  2069. }
  2070. }
  2071. }
  2072. .take-photo {
  2073. /deep/ .el-dialog__header {
  2074. display: none;
  2075. }
  2076. /deep/ .el-dialog__body {
  2077. padding: 0;
  2078. overflow: unset;
  2079. }
  2080. &__close {
  2081. cursor: pointer;
  2082. position: absolute;
  2083. right: 0;
  2084. top: -28px;
  2085. width: 24px;
  2086. height: 24px;
  2087. line-height: 24px;
  2088. text-align: center;
  2089. color: #eee;
  2090. border: 1px solid #eee;
  2091. border-radius: 50%;
  2092. }
  2093. &__header {
  2094. height: 40px;
  2095. border-bottom: 1px solid #eee;
  2096. line-height: 40px;
  2097. font-size: 16px;
  2098. font-family: Microsoft YaHei;
  2099. font-weight: bold;
  2100. color: #333333;
  2101. padding-left: 24px;
  2102. }
  2103. &__body {
  2104. height: 400px;
  2105. padding: 40px 24px;
  2106. .left-box {
  2107. width: 336px;
  2108. float: left;
  2109. .title {
  2110. font-size: 16px;
  2111. font-family: Microsoft YaHei;
  2112. font-weight: bold;
  2113. color: #ff3b30;
  2114. line-height: 24px;
  2115. }
  2116. .content {
  2117. font-size: 14px;
  2118. font-family: Microsoft YaHei;
  2119. font-weight: 400;
  2120. color: #333333;
  2121. line-height: 28px;
  2122. margin-top: 32px;
  2123. }
  2124. }
  2125. .right-box {
  2126. float: right;
  2127. width: 400px;
  2128. height: 300px;
  2129. video {
  2130. width: 100%;
  2131. height: 100%;
  2132. }
  2133. }
  2134. }
  2135. &__footer {
  2136. height: 90px;
  2137. border-top: 1px solid #eee;
  2138. text-align: center;
  2139. .take {
  2140. display: inline-block;
  2141. width: 200px;
  2142. height: 40px;
  2143. padding: 0;
  2144. border-radius: 20px;
  2145. text-align: center;
  2146. line-height: 40px;
  2147. margin: 24px auto;
  2148. }
  2149. }
  2150. }
  2151. }
  2152. </style>