collect-bank.vue 81 KB

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