wrong-bank.vue 80 KB

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