index.vue 92 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737
  1. <template>
  2. <div class="course-exam">
  3. <Header></Header>
  4. <section class="section">
  5. <div class="container">
  6. <div class="section__header">
  7. <!-- <el-breadcrumb separator="/">
  8. <el-breadcrumb-item
  9. v-for="(item, index) in $route.matched"
  10. :key="index"
  11. :to="{ path: item.path }"
  12. >{{ item.name }}</el-breadcrumb-item
  13. >
  14. </el-breadcrumb> -->
  15. </div>
  16. <div class="section__body">
  17. <div class="explain-record">
  18. <div class="explain-record__body">
  19. <div class="left-box">
  20. <div class="left-box__header">
  21. <el-progress
  22. class="progress"
  23. :text-inside="true"
  24. :stroke-width="26"
  25. :percentage="
  26. toFixed(
  27. (questionOverNum(true) / questionList.length) * 100
  28. ) || 0
  29. "
  30. ></el-progress>
  31. <div class="text">
  32. 已完成<span>{{ questionOverNum(true) }}</span
  33. >/{{ questionList.length }}道题
  34. </div>
  35. </div>
  36. <div class="left-box__body">
  37. <template v-for="(question, questionIndex) in questionList">
  38. <div
  39. class="question"
  40. v-if="question.type == 1 && current == questionIndex"
  41. :key="questionIndex"
  42. >
  43. <div class="question__title">
  44. {{ questionIndex + 1 }}、单选题
  45. </div>
  46. <div
  47. class="question__desc"
  48. v-html="question.content"
  49. ></div>
  50. <div class="question__content">
  51. <div class="question-list" v-if="!question.ques">
  52. <div
  53. class="radio"
  54. v-for="(item, index) in question.jsonStr"
  55. :key="index"
  56. @click="
  57. radioSelect(
  58. question,
  59. questionIndex,
  60. item.optionsId
  61. )
  62. "
  63. >
  64. <div>{{ ast[index] }}. {{ item.content }}</div>
  65. </div>
  66. </div>
  67. <div class="question-list" v-if="question.ques">
  68. <div
  69. class="radio"
  70. :class="{
  71. right:
  72. item.optionsId == question.ques ||
  73. item.optionsId == question.ans,
  74. wrong:
  75. item.optionsId == question.ques &&
  76. question.ques != question.ans,
  77. }"
  78. v-for="(item, index) in question.jsonStr"
  79. :key="index"
  80. >
  81. <div>{{ ast[index] }}. {{ item.content }}</div>
  82. </div>
  83. </div>
  84. <div class="answer-list" v-if="question.ques">
  85. <div class="answer-list__left">
  86. 正确答案:{{ ast[question.ans - 1] }}
  87. </div>
  88. <div class="answer-list__left">
  89. 我的答案:{{ ast[question.ques - 1] }}
  90. </div>
  91. </div>
  92. <div class="explain-list" v-if="question.ques">
  93. <div class="explain-list__header">答案解析:</div>
  94. <div
  95. class="explain-list__body"
  96. v-html="question.analysisContent"
  97. ></div>
  98. </div>
  99. </div>
  100. <div class="question__btns">
  101. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  102. </div>
  103. </div>
  104. <div
  105. class="question"
  106. v-if="question.type == 2 && current == questionIndex"
  107. :key="questionIndex"
  108. >
  109. <div class="question__title">
  110. {{ questionIndex + 1 }}、多选题
  111. </div>
  112. <div
  113. class="question__desc"
  114. v-html="question.content"
  115. ></div>
  116. <div class="question__content">
  117. <div class="question-list" v-if="!question.ques">
  118. <el-checkbox
  119. class="checkbox"
  120. v-for="(item, index) in question.jsonStr"
  121. :key="index"
  122. :label="item.optionsId"
  123. v-model="item.checked"
  124. >
  125. <div>{{ ast[index] }}. {{ item.content }}</div>
  126. </el-checkbox>
  127. </div>
  128. <div class="question-list" v-if="question.ques">
  129. <el-checkbox
  130. disabled
  131. class="checkbox"
  132. :class="{
  133. right:
  134. question.ques.indexOf(item.optionsId) != -1 ||
  135. question.ans.indexOf(item.optionsId) != -1,
  136. wrong:
  137. question.ques.indexOf(item.optionsId) != -1 &&
  138. question.ans.indexOf(item.optionsId) == -1,
  139. }"
  140. v-for="(item, index) in question.jsonStr"
  141. :key="index"
  142. :label="item.optionsId"
  143. v-model="item.checked"
  144. >
  145. <div>{{ ast[index] }}. {{ item.content }}</div>
  146. </el-checkbox>
  147. </div>
  148. <div class="answer-list" v-if="question.ques">
  149. <div class="answer-list__left">
  150. 正确答案:
  151. <template v-for="ansItem in question.ans">{{
  152. ast[ansItem - 1]
  153. }}</template>
  154. </div>
  155. <div class="answer-list__left">
  156. 我的答案:
  157. <template v-for="quesItem in question.ques">{{
  158. ast[quesItem - 1]
  159. }}</template>
  160. </div>
  161. </div>
  162. <div class="explain-list" v-if="question.ques">
  163. <div class="explain-list__header">答案解析:</div>
  164. <div
  165. class="explain-list__body"
  166. v-if="question.analysisContent"
  167. ></div>
  168. </div>
  169. </div>
  170. <div class="question__btns">
  171. <div
  172. v-if="!question.ques"
  173. class="submit"
  174. @click="checkboxSubmit(question, questionIndex)"
  175. >
  176. 确认答案
  177. </div>
  178. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  179. </div>
  180. </div>
  181. <div
  182. class="question"
  183. v-if="question.type == 3 && current == questionIndex"
  184. :key="questionIndex"
  185. >
  186. <div class="question__title">
  187. {{ questionIndex + 1 }}、判断题
  188. </div>
  189. <div
  190. class="question__desc"
  191. v-html="question.content"
  192. ></div>
  193. <div class="question__content">
  194. <div class="question-list" v-if="!question.ques">
  195. <div
  196. class="radio"
  197. v-for="(item, index) in judge"
  198. :key="index"
  199. @click="judgeSelect(question, questionIndex, index)"
  200. >
  201. <div>{{ ast[index] }}. {{ item }}</div>
  202. </div>
  203. </div>
  204. <div class="question-list" v-if="question.ques">
  205. <div
  206. class="radio"
  207. :class="{
  208. right:
  209. index == question.ques || index == question.ans,
  210. wrong:
  211. index == question.ques &&
  212. question.ques != question.ans,
  213. }"
  214. v-for="(item, index) in judge"
  215. :key="index"
  216. >
  217. <div>{{ ast[index] }}. {{ item }}</div>
  218. </div>
  219. </div>
  220. <div class="answer-list" v-if="question.ques">
  221. <div class="answer-list__left">
  222. 正确答案:{{ ast[question.ans] }}
  223. </div>
  224. <div class="answer-list__left">
  225. 我的答案:{{ ast[question.ques] }}
  226. </div>
  227. </div>
  228. <div class="explain-list" v-if="question.ques">
  229. <div class="explain-list__header">答案解析:</div>
  230. <div
  231. class="explain-list__body"
  232. v-html="question.analysisContent"
  233. ></div>
  234. </div>
  235. </div>
  236. <div class="question__btns">
  237. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  238. </div>
  239. </div>
  240. <div
  241. class="question"
  242. v-if="question.type == 4 && current == questionIndex"
  243. :key="questionIndex"
  244. >
  245. <div class="question__title">
  246. {{ questionIndex + 1 }}、案例题
  247. </div>
  248. <div class="question__content">
  249. <el-tabs v-model="question.tabIndex">
  250. <el-tab-pane
  251. v-for="(json, jsonIndex) in question.jsonStr"
  252. :label="'问题' + (jsonIndex + 1)"
  253. :name="jsonIndex + ''"
  254. :key="jsonIndex"
  255. >
  256. <div
  257. class="question"
  258. v-if="json.type == 1"
  259. :key="questionIndex"
  260. >
  261. <div class="question__title">
  262. {{ jsonIndex + 1 }}、单选题
  263. </div>
  264. <div
  265. class="question__desc"
  266. v-html="json.content"
  267. ></div>
  268. <div class="question__content">
  269. <div
  270. class="question-list"
  271. v-if="!question.ques[jsonIndex]"
  272. >
  273. <div
  274. class="radio"
  275. v-for="(item, index) in json.optionsList"
  276. :key="index"
  277. @click="
  278. radioSelectChild(
  279. questionIndex,
  280. jsonIndex,
  281. item.optionsId
  282. )
  283. "
  284. >
  285. <div>
  286. {{ ast[index] }}. {{ item.content }}
  287. </div>
  288. </div>
  289. </div>
  290. <div
  291. class="question-list"
  292. v-if="question.ques[jsonIndex]"
  293. >
  294. <div
  295. class="radio"
  296. :class="{
  297. right:
  298. item.optionsId ==
  299. question.ques[jsonIndex] ||
  300. item.optionsId ==
  301. question.ans[jsonIndex],
  302. wrong:
  303. item.optionsId ==
  304. question.ques[jsonIndex] &&
  305. question.ques[jsonIndex] !=
  306. question.ans[jsonIndex],
  307. }"
  308. v-for="(item, index) in json.optionsList"
  309. :key="index"
  310. >
  311. <div>
  312. {{ ast[index] }}. {{ item.content }}
  313. </div>
  314. </div>
  315. </div>
  316. <div
  317. class="answer-list"
  318. v-if="question.ques[jsonIndex]"
  319. >
  320. <div class="answer-list__left">
  321. 正确答案:{{
  322. ast[question.ans[jsonIndex] - 1]
  323. }}
  324. </div>
  325. <div class="answer-list__left">
  326. 我的答案:{{
  327. ast[question.ques[jsonIndex] - 1]
  328. }}
  329. </div>
  330. </div>
  331. <div
  332. class="explain-list"
  333. v-if="question.ques[jsonIndex]"
  334. >
  335. <div class="explain-list__header">
  336. 答案解析:
  337. </div>
  338. <div
  339. class="explain-list__body"
  340. v-html="json.analysisContent"
  341. ></div>
  342. </div>
  343. </div>
  344. <div class="question__btns"></div>
  345. </div>
  346. <div
  347. class="question"
  348. v-if="json.type == 2"
  349. :key="jsonIndex"
  350. >
  351. <div class="question__title">
  352. {{ jsonIndex + 1 }}、多选题
  353. </div>
  354. <div
  355. class="question__desc"
  356. v-html="json.content"
  357. ></div>
  358. <div class="question__content">
  359. <div
  360. class="question-list"
  361. v-if="!question.ques[jsonIndex]"
  362. >
  363. <el-checkbox
  364. class="checkbox"
  365. v-for="(item, index) in json.optionsList"
  366. :key="index"
  367. :label="item.optionsId"
  368. v-model="item.checked"
  369. >
  370. <div>
  371. {{ ast[index] }}. {{ item.content }}
  372. </div>
  373. </el-checkbox>
  374. </div>
  375. <div
  376. class="question-list"
  377. v-if="question.ques[jsonIndex]"
  378. >
  379. <el-checkbox
  380. disabled
  381. class="checkbox"
  382. :class="{
  383. right:
  384. question.ques[jsonIndex].indexOf(
  385. item.optionsId
  386. ) != -1 ||
  387. question.ans[jsonIndex].indexOf(
  388. item.optionsId
  389. ) != -1,
  390. wrong:
  391. question.ques[jsonIndex].indexOf(
  392. item.optionsId
  393. ) != -1 &&
  394. question.ans[jsonIndex].indexOf(
  395. item.optionsId
  396. ) == -1,
  397. }"
  398. v-for="(item, index) in json.optionsList"
  399. :key="index"
  400. :label="item.optionsId"
  401. v-model="item.checked"
  402. >
  403. <div>
  404. {{ ast[index] }}. {{ item.content }}
  405. </div>
  406. </el-checkbox>
  407. </div>
  408. <div
  409. class="answer-list"
  410. v-if="question.ques[jsonIndex]"
  411. >
  412. <div class="answer-list__left">
  413. 正确答案:
  414. <template
  415. v-for="ansItem in question.ans[jsonIndex]"
  416. >{{ ast[ansItem - 1] }}</template
  417. >
  418. </div>
  419. <div class="answer-list__left">
  420. 我的答案:
  421. <template
  422. v-for="quesItem in question.ques[
  423. jsonIndex
  424. ]"
  425. >{{ ast[quesItem - 1] }}</template
  426. >
  427. </div>
  428. </div>
  429. <div
  430. class="explain-list"
  431. v-if="question.ques[jsonIndex]"
  432. >
  433. <div class="explain-list__header">
  434. 答案解析:
  435. </div>
  436. <div
  437. class="explain-list__body"
  438. v-html="json.analysisContent"
  439. ></div>
  440. </div>
  441. </div>
  442. <div class="question__btns">
  443. <div
  444. v-if="!question.ques[jsonIndex]"
  445. class="submit"
  446. @click="
  447. checkboxSubmitChild(
  448. questionIndex,
  449. jsonIndex
  450. )
  451. "
  452. >
  453. 确认答案
  454. </div>
  455. </div>
  456. </div>
  457. <div
  458. class="question"
  459. v-if="json.type == 3"
  460. :key="jsonIndex"
  461. >
  462. <div class="question__title">
  463. {{ jsonIndex + 1 }}、判断题
  464. </div>
  465. <div
  466. class="question__desc"
  467. v-html="json.content"
  468. ></div>
  469. <div class="question__content">
  470. <div
  471. class="question-list"
  472. v-if="!question.ques[jsonIndex]"
  473. >
  474. <div
  475. class="radio"
  476. v-for="(item, index) in judge"
  477. :key="index"
  478. @click="
  479. judgeSelectChild(
  480. questionIndex,
  481. jsonIndex,
  482. index
  483. )
  484. "
  485. >
  486. <div>{{ ast[index] }}. {{ item }}</div>
  487. </div>
  488. </div>
  489. <div
  490. class="question-list"
  491. v-if="question.ques[jsonIndex]"
  492. >
  493. <div
  494. class="radio"
  495. :class="{
  496. right:
  497. index == question.ques[jsonIndex] ||
  498. index == question.ans[jsonIndex],
  499. wrong:
  500. index == question.ques[jsonIndex] &&
  501. question.ques[jsonIndex] !=
  502. question.ans[jsonIndex],
  503. }"
  504. v-for="(item, index) in judge"
  505. :key="index"
  506. >
  507. <div>{{ ast[index] }}. {{ item }}</div>
  508. </div>
  509. </div>
  510. <div
  511. class="answer-list"
  512. v-if="question.ques[jsonIndex]"
  513. >
  514. <div class="answer-list__left">
  515. 正确答案:{{ ast[question.ans[jsonIndex]] }}
  516. </div>
  517. <div class="answer-list__left">
  518. 我的答案:{{
  519. ast[question.ques[jsonIndex]]
  520. }}
  521. </div>
  522. </div>
  523. <div
  524. class="explain-list"
  525. v-if="question.ques[jsonIndex]"
  526. >
  527. <div class="explain-list__header">
  528. 答案解析:
  529. </div>
  530. <div
  531. class="explain-list__body"
  532. v-html="json.analysisContent"
  533. ></div>
  534. </div>
  535. </div>
  536. <div class="question__btns"></div>
  537. </div>
  538. <div
  539. class="question"
  540. v-if="json.type == 5"
  541. :key="jsonIndex"
  542. >
  543. <div class="question__title">
  544. {{ jsonIndex }}、简答题
  545. </div>
  546. <div
  547. class="question__desc"
  548. v-html="json.content"
  549. ></div>
  550. <div class="question__content">
  551. <div
  552. class="question-list textarea"
  553. v-if="
  554. !(
  555. question.ques[jsonIndex] &&
  556. (question.ques[jsonIndex].imageList
  557. .length ||
  558. question.ques[jsonIndex].text)
  559. )
  560. "
  561. >
  562. <el-input
  563. type="textarea"
  564. rows="5"
  565. v-model="json.ansText.text"
  566. resize="none"
  567. ></el-input>
  568. <div class="upload clearfix">
  569. <div
  570. class="upload__imgs"
  571. v-for="(img, imgIndex) in json.ansText
  572. .imageList"
  573. :key="imgIndex"
  574. >
  575. <img
  576. :src="$tools.splitImgHost(img, true)"
  577. alt=""
  578. />
  579. </div>
  580. <div class="upload__btn">
  581. <i class="el-icon-plus icon"></i>
  582. <p>上传图片</p>
  583. <input
  584. @change="
  585. uploadImgChild(
  586. $event,
  587. questionIndex,
  588. jsonIndex
  589. )
  590. "
  591. type="file"
  592. />
  593. </div>
  594. </div>
  595. </div>
  596. <div
  597. class="explain-list"
  598. v-if="
  599. question.ques[jsonIndex] &&
  600. (question.ques[jsonIndex].imageList
  601. .length ||
  602. question.ques[jsonIndex].text)
  603. "
  604. >
  605. <div class="explain-list__header">
  606. 我的答案:
  607. </div>
  608. <div class="explain-list__body">
  609. <div>
  610. {{ question.ques[jsonIndex].text }}
  611. </div>
  612. <div class="upload clearfix">
  613. <div
  614. class="upload__imgs"
  615. v-for="(img, imgIndex) in question.ques[
  616. jsonIndex
  617. ].imageList"
  618. :key="imgIndex"
  619. >
  620. <img
  621. :src="$tools.splitImgHost(img, true)"
  622. alt=""
  623. />
  624. </div>
  625. </div>
  626. </div>
  627. <div class="explain-list__header">
  628. 答案解析:
  629. </div>
  630. <div
  631. class="explain-list__body"
  632. v-html="question.analysisContent"
  633. ></div>
  634. </div>
  635. </div>
  636. <div class="question__btns">
  637. <div
  638. v-if="
  639. !(
  640. question.ques[jsonIndex] &&
  641. (question.ques[jsonIndex].imageList
  642. .length ||
  643. question.ques[jsonIndex].text)
  644. )
  645. "
  646. class="submit"
  647. @click="
  648. ansSubmitChild(
  649. question,
  650. questionIndex,
  651. jsonIndex
  652. )
  653. "
  654. >
  655. 确认答案
  656. </div>
  657. </div>
  658. </div>
  659. </el-tab-pane>
  660. </el-tabs>
  661. </div>
  662. <div class="question__btns">
  663. <!-- <div class="collect" @click="collect">收藏本题</div>+ -->
  664. </div>
  665. </div>
  666. <div
  667. class="question"
  668. v-if="question.type == 5 && current == questionIndex"
  669. :key="questionIndex"
  670. >
  671. <div class="question__title">
  672. {{ questionIndex }}、简答题
  673. </div>
  674. <div
  675. class="question__desc"
  676. v-html="question.content"
  677. ></div>
  678. <div class="question__content">
  679. <div
  680. class="question-list textarea"
  681. v-if="
  682. !question.ques.imageList.length &&
  683. !question.ques.text
  684. "
  685. >
  686. <el-input
  687. type="textarea"
  688. rows="5"
  689. v-model="question.ansText.text"
  690. resize="none"
  691. ></el-input>
  692. <div class="upload clearfix">
  693. <div
  694. class="upload__imgs"
  695. v-for="(img, imgIndex) in question.ansText
  696. .imageList"
  697. :key="imgIndex"
  698. >
  699. <img
  700. :src="$tools.splitImgHost(img, true)"
  701. alt=""
  702. />
  703. </div>
  704. <div class="upload__btn">
  705. <i class="el-icon-plus icon"></i>
  706. <p>上传图片</p>
  707. <input
  708. @change="
  709. uploadImg($event, question, questionIndex)
  710. "
  711. type="file"
  712. />
  713. </div>
  714. </div>
  715. </div>
  716. <div
  717. class="explain-list"
  718. v-if="
  719. question.ques.imageList.length || question.ques.text
  720. "
  721. >
  722. <div class="explain-list__header">我的答案:</div>
  723. <div class="explain-list__body">
  724. <div>{{ question.ques.text }}</div>
  725. <div class="upload clearfix">
  726. <div
  727. class="upload__imgs"
  728. v-for="(img, imgIndex) in question.ques
  729. .imageList"
  730. :key="imgIndex"
  731. >
  732. <img
  733. :src="$tools.splitImgHost(img, true)"
  734. alt=""
  735. />
  736. </div>
  737. </div>
  738. </div>
  739. <div class="explain-list__header">答案解析:</div>
  740. <div
  741. class="explain-list__body"
  742. v-html="question.analysisContent"
  743. ></div>
  744. </div>
  745. </div>
  746. <div class="question__btns">
  747. <div
  748. v-if="
  749. !question.ques.imageList.length &&
  750. !question.ques.text
  751. "
  752. class="submit"
  753. @click="ansSubmit(question, questionIndex)"
  754. >
  755. 确认答案
  756. </div>
  757. <!-- <div class="collect" @click="collect">收藏本题</div> -->
  758. </div>
  759. </div>
  760. </template>
  761. </div>
  762. <div class="left-box__footer">
  763. <div class="btn" @click="prevQuestion">上一题</div>
  764. <div class="btn" @click="nextQuestion">下一题</div>
  765. </div>
  766. </div>
  767. <div class="right-box">
  768. <div class="right-box__header">
  769. <el-button
  770. type="primary"
  771. round
  772. plain
  773. size="small"
  774. class="back-btn"
  775. @click="$router.back(-1)"
  776. >返回</el-button
  777. >
  778. </div>
  779. <div class="right-box__header">
  780. <div class="title">答题卡</div>
  781. <div class="time" v-if="allTimes">
  782. 剩余时间 {{ lastTime }}
  783. </div>
  784. </div>
  785. <div class="right-box__body">
  786. <div class="card">
  787. <div class="card__note">
  788. <div class="item">
  789. <div class="box green"></div>
  790. 正确
  791. </div>
  792. <div class="item">
  793. <div class="box red"></div>
  794. 错误
  795. </div>
  796. <div class="item">
  797. <div class="box blue"></div>
  798. 已做未评改
  799. </div>
  800. <div class="item">
  801. <div class="box white"></div>
  802. 未做
  803. </div>
  804. </div>
  805. <div class="card__content">
  806. <ul class="list">
  807. <li
  808. class="item white"
  809. v-for="(item, index) in questionList"
  810. :key="index"
  811. :class="{
  812. green: isRight(item, index),
  813. red: isWrong(item, index),
  814. blue: isOver(item, index),
  815. }"
  816. @click="changeIndex(index)"
  817. >
  818. {{ index + 1 }}
  819. </li>
  820. </ul>
  821. </div>
  822. </div>
  823. </div>
  824. <div class="right-box__footer">
  825. <div class="submit" @click="submit">交卷</div>
  826. </div>
  827. </div>
  828. </div>
  829. </div>
  830. </div>
  831. </div>
  832. </section>
  833. <ToolBar></ToolBar>
  834. <Footer></Footer>
  835. <el-dialog
  836. width="800px"
  837. class="take-photo"
  838. :visible.sync="takePhotoModal"
  839. :close-on-click-modal="false"
  840. :close-on-press-escape="false"
  841. :show-close="false"
  842. >
  843. <div class="take-photo__content">
  844. <!-- <div class="take-photo__close" @click="takePhotoModal = false">X</div> -->
  845. <div class="take-photo__header">人脸验证</div>
  846. <div class="take-photo__body clearfix">
  847. <div class="left-box">
  848. <div class="title">重要提示:</div>
  849. <div class="content">
  850. <p>1、请保证摄像头正对自己,避免头像偏左或者偏右。</p>
  851. <p>
  852. 2、请保证拍照环境光线充足(照片太暗或曝光会降低验证通过率)。
  853. </p>
  854. <p>
  855. 3、请保证整个头像在人脸识别区域内,脸部无遮挡装饰物(佩戴眼镜会降低通过率)。
  856. </p>
  857. <p>
  858. 4、如果下面视频中出现黑屏,摄像头可能被其他进程占用,请关闭其他调用摄像头的程序,重新刷新当前页面重新拍照识别。
  859. </p>
  860. </div>
  861. </div>
  862. <div class="right-box">
  863. <img v-show="!isTaking" :src="faceUrl" alt="" />
  864. <video v-show="isTaking" id="video" :src="stream"></video>
  865. </div>
  866. </div>
  867. <div class="take-photo__footer">
  868. <el-button
  869. type="primary"
  870. v-if="isTaking"
  871. class="take"
  872. @click="onPhoto"
  873. >拍照</el-button
  874. >
  875. <el-button
  876. type="primary"
  877. v-if="!isTaking"
  878. class="take"
  879. @click="reTake"
  880. :loading="loading"
  881. >重拍</el-button
  882. >
  883. <el-button
  884. type="primary"
  885. v-if="!isTaking"
  886. class="take"
  887. @click="takeOk"
  888. :loading="loading"
  889. >确认</el-button
  890. >
  891. </div>
  892. </div>
  893. </el-dialog>
  894. </div>
  895. </template>
  896. <script>
  897. import Footer from "@/components/footer/index";
  898. import Header from "@/components/header/index";
  899. import ToolBar from "@/components/toolbar/index";
  900. import { mapMutations } from "vuex";
  901. export default {
  902. name: "BankExplain",
  903. components: {
  904. Footer,
  905. Header,
  906. ToolBar,
  907. },
  908. data() {
  909. return {
  910. hasTake: false,
  911. recordId: 0,
  912. tabIndex: "1",
  913. textarea: "",
  914. questionIndex: 0,
  915. checked: false,
  916. activeName: "1",
  917. questionList: [],
  918. goodsExamConfig: [],
  919. goodsDetail: {},
  920. bankList: [],
  921. judge: ["错误", "正确"],
  922. ast: [
  923. "A",
  924. "B",
  925. "C",
  926. "D",
  927. "E",
  928. "F",
  929. "G",
  930. "H",
  931. "I",
  932. "J",
  933. "K",
  934. "L",
  935. "M",
  936. "N",
  937. "O",
  938. "P",
  939. "Q",
  940. "R",
  941. "S",
  942. "T",
  943. "U",
  944. "V",
  945. "W",
  946. "X",
  947. "Y",
  948. "Z",
  949. ],
  950. needPhoto: false,
  951. lastTime: 0, //剩余考试时长
  952. allTimes: 0, //总考试时长
  953. lastCount: 0,
  954. examId: 0,
  955. goodsId: 0,
  956. courseId: 0,
  957. gradeId: 0,
  958. moduleId: 0,
  959. chapterId: 0,
  960. faceUrl: "",
  961. stream: null,
  962. ossAvatarUrl: "",
  963. orderGoodsId: 0,
  964. current: 0,
  965. timer: null,
  966. takePhotoModal: false,
  967. isTaking: true, //是否正在拍照
  968. stream: null,
  969. loading: false,
  970. };
  971. },
  972. async mounted() {
  973. this.goodsId = this.$route.params.goodsId;
  974. this.examId = this.$route.query.examId;
  975. this.courseId = this.$route.query.courseId;
  976. this.gradeId = this.$route.query.gradeId;
  977. this.moduleId = this.$route.query.moduleId;
  978. this.chapterId = this.$route.query.chapterId;
  979. this.orderGoodsId = this.$route.query.orderGoodsId;
  980. await this.getGoodsDetail();
  981. this.goodsQuestionList();
  982. this.bankExam();
  983. },
  984. beforeDestroy() {
  985. clearInterval(this.timer);
  986. try {
  987. this.$msgbox.close();
  988. } catch (err) {}
  989. },
  990. methods: {
  991. ...mapMutations(["setExamResult"]),
  992. toFixed(num) {
  993. if (num) {
  994. let str = String(num).indexOf(".");
  995. if (str != -1) {
  996. return +num.toFixed(2);
  997. } else {
  998. return num;
  999. }
  1000. } else {
  1001. return 0;
  1002. }
  1003. },
  1004. getGoodsDetail() {
  1005. return new Promise((resolve) => {
  1006. let self = this;
  1007. this.$request.goodsDetail(this.goodsId).then((res) => {
  1008. self.goodsDetail = res.data;
  1009. if (self.goodsDetail.goodsPhotoExamConfig) {
  1010. let goodsPhotoExamConfig = JSON.parse(
  1011. self.goodsDetail.goodsPhotoExamConfig
  1012. );
  1013. if (goodsPhotoExamConfig.photograph > 0) {
  1014. self.needPhoto = true;
  1015. }
  1016. }
  1017. resolve();
  1018. });
  1019. });
  1020. },
  1021. /**
  1022. * 请求题目列表
  1023. */
  1024. goodsQuestionList() {
  1025. this.$request
  1026. .goodsQuestionList({
  1027. examId: this.examId,
  1028. })
  1029. .then(async (res) => {
  1030. if (!res.data.length) {
  1031. this.$message({
  1032. type: "warning",
  1033. message: "该试卷暂无题目",
  1034. });
  1035. return;
  1036. }
  1037. this.allTimes = res.data[0].answerTime * 60;
  1038. this.lastTime = res.data[0].answerTime && res.data[0].answerTime * 60;
  1039. res.data.forEach((item, index) => {
  1040. if (typeof item.jsonStr == "string") {
  1041. item.jsonStr = JSON.parse(item.jsonStr);
  1042. if (item.type == 2) {
  1043. //多选
  1044. item.jsonStr.forEach((str) => {
  1045. str.optionsId = "" + str.optionsId;
  1046. });
  1047. let arr = item.answerQuestion.split(",");
  1048. arr.forEach((a, i) => {
  1049. arr[i] = "" + a;
  1050. });
  1051. item.ans = arr;
  1052. item.quesSelect = [];
  1053. item.analysisContent &&
  1054. (item.analysisContent = item.analysisContent.replace(
  1055. /<img/gi,
  1056. '<img style="max-width:100%;"'
  1057. ));
  1058. item.content &&
  1059. (item.content = item.content.replace(
  1060. /<img/gi,
  1061. '<img style="max-width:100%;"'
  1062. ));
  1063. return;
  1064. } else if (item.type == 5) {
  1065. //简答题
  1066. item.ansText = {
  1067. text: "",
  1068. imageList: [],
  1069. };
  1070. item.ques = {
  1071. text: "",
  1072. imageList: [],
  1073. };
  1074. item.analysisContent &&
  1075. (item.analysisContent = item.analysisContent.replace(
  1076. /<img/gi,
  1077. '<img style="max-width:100%;"'
  1078. ));
  1079. item.content &&
  1080. (item.content = item.content.replace(
  1081. /<img/gi,
  1082. '<img style="max-width:100%;"'
  1083. ));
  1084. return;
  1085. } else if (item.type == 4) {
  1086. //案例题
  1087. item.ques = [];
  1088. item.tabIndex = "0";
  1089. let ansArr = [];
  1090. item.jsonStr.forEach((json, index) => {
  1091. if (json.type == 1) {
  1092. ansArr[index] = json.answerQuestion;
  1093. json.content &&
  1094. (json.content = json.content.replace(
  1095. /<img/gi,
  1096. '<img style="max-width:100%;"'
  1097. ));
  1098. } else if (json.type == 2) {
  1099. json.optionsList.forEach((str) => {
  1100. str.optionsId = "" + str.optionsId;
  1101. });
  1102. let arr = json.answerQuestion.split(",");
  1103. arr.forEach((a, i) => {
  1104. arr[i] = "" + a;
  1105. });
  1106. ansArr[index] = arr;
  1107. json.content &&
  1108. (json.content = json.content.replace(
  1109. /<img/gi,
  1110. '<img style="max-width:100%;"'
  1111. ));
  1112. } else if (json.type == 3) {
  1113. ansArr[index] = json.answerQuestion;
  1114. json.content &&
  1115. (json.content = json.content.replace(
  1116. /<img/gi,
  1117. '<img style="max-width:100%;"'
  1118. ));
  1119. } else if (json.type == 5) {
  1120. ansArr[index] = {
  1121. text: "",
  1122. imageList: [],
  1123. };
  1124. json.ansText = {
  1125. text: "",
  1126. imageList: [],
  1127. };
  1128. json.ques = {
  1129. text: "",
  1130. imageList: [],
  1131. };
  1132. json.content &&
  1133. (json.content = json.content.replace(
  1134. /<img/gi,
  1135. '<img style="max-width:100%;"'
  1136. ));
  1137. }
  1138. });
  1139. item.ans = ansArr;
  1140. return;
  1141. }
  1142. item.analysisContent &&
  1143. (item.analysisContent = item.analysisContent.replace(
  1144. /<img/gi,
  1145. '<img style="max-width:100%;"'
  1146. ));
  1147. item.content &&
  1148. (item.content = item.content.replace(
  1149. /<img/gi,
  1150. '<img style="max-width:100%;"'
  1151. ));
  1152. item.ques = "";
  1153. item.ans = item.answerQuestion;
  1154. }
  1155. });
  1156. this.questionList = res.data;
  1157. this.lastCount = this.questionList.length;
  1158. await this.examRecord();
  1159. });
  1160. },
  1161. //拍照
  1162. openPhoto() {
  1163. this.$nextTick(() => {
  1164. if (
  1165. (window.navigator.mediaDevices &&
  1166. window.navigator.mediaDevices.getUserMedia) ||
  1167. window.navigator.getUserMedia ||
  1168. window.navigator.webkitGetUserMedia ||
  1169. window.navigator.mozGetUserMedia
  1170. ) {
  1171. console.log(this.getUserMedia, "getUserMedia");
  1172. // 调用用户媒体设备, 访问摄像头
  1173. this.getUserMedia(
  1174. {
  1175. video: {
  1176. width: 400,
  1177. height: 300,
  1178. },
  1179. },
  1180. this.photographSuccess,
  1181. this.photographError
  1182. );
  1183. } else {
  1184. this.photographError();
  1185. }
  1186. });
  1187. },
  1188. async takeOk() {
  1189. this.loading = true;
  1190. let compareFaceData = await this.faceRecognition();
  1191. if (compareFaceData == 0) {
  1192. this.$message({
  1193. type: "warning",
  1194. message: "人脸匹配不通过,请重新拍照上传",
  1195. });
  1196. setTimeout(() => {
  1197. this.loading = false;
  1198. this.reTake();
  1199. }, 2000);
  1200. return;
  1201. }
  1202. if (compareFaceData >= 80) {
  1203. const waitYS = await this.imageInfos();
  1204. this.postStudyRecord(); //提交记录
  1205. }
  1206. this.$message({
  1207. type: "success",
  1208. message: "拍照成功",
  1209. });
  1210. this.loading = false;
  1211. this.takePhotoModal = false;
  1212. this.isTaking = true;
  1213. },
  1214. postStudyRecord() {
  1215. let self = this;
  1216. let data = {
  1217. photo: self.ossAvatarUrl,
  1218. recordId: self.recordId,
  1219. };
  1220. console.log(data, "拍照提交");
  1221. this.$request
  1222. .studyExamPhotoRecord(data)
  1223. .then((res) => {
  1224. this.hasTake = true;
  1225. console.log(res, "拍照提交结果");
  1226. self.ossAvatarUrl = "";
  1227. //拍照
  1228. if (this.lastTime) {
  1229. this.timer = setInterval(() => {
  1230. if (this.lastTime <= 0) {
  1231. clearInterval(this.timer);
  1232. this.$confirm("考试时间已到,系统将自动交卷", "提示", {
  1233. showConfirmButton: false,
  1234. closeOnClickModal: false,
  1235. showCancelButton: false,
  1236. closeOnPressEscape: false,
  1237. distinguishCancelAndClose: false,
  1238. showClose: false,
  1239. });
  1240. setTimeout(() => {
  1241. this.examSubmit();
  1242. }, 3000);
  1243. return;
  1244. }
  1245. this.lastTime--;
  1246. }, 1000);
  1247. }
  1248. })
  1249. .catch((err) => {
  1250. this.$message({
  1251. type: "warning",
  1252. message: err.msg,
  1253. });
  1254. });
  1255. },
  1256. imageInfos() {
  1257. var self = this;
  1258. return new Promise(async (resolve, reject) => {
  1259. const waitUpload = await self.uploadFile(self.faceUrl, 0);
  1260. resolve(waitUpload);
  1261. });
  1262. },
  1263. uploadFile(options, int) {
  1264. var self = this;
  1265. return new Promise((resolve, reject) => {
  1266. var data = {
  1267. imageStatus: int,
  1268. gradeId: this.gradeId,
  1269. orderGoodsId: this.orderGoodsId,
  1270. };
  1271. self.$request
  1272. .getPolicy(data)
  1273. .then((res) => {
  1274. var ossToken = res.data.resultContent;
  1275. if (ossToken.host == null || ossToken.host == undefined) {
  1276. this.$message({
  1277. type: "warning",
  1278. message: "上传路径报错" + JSON.stringify(res.data),
  1279. });
  1280. return;
  1281. }
  1282. let data = this.$tools.convertBase64UrlToBlob(this.faceUrl);
  1283. this.$upload
  1284. .upload(data, 0)
  1285. .then((res) => {
  1286. this.ossAvatarUrl = res;
  1287. resolve(res);
  1288. })
  1289. .catch((err) => {
  1290. this.$message({
  1291. type: "warning",
  1292. message: "上传接口报错,请重新拍照上传",
  1293. });
  1294. this.reTake();
  1295. });
  1296. })
  1297. .catch((err) => {
  1298. this.$message({
  1299. type: "warning",
  1300. message: "签名错误" + JSON.stringify(err),
  1301. });
  1302. return;
  1303. });
  1304. });
  1305. },
  1306. faceRecognition() {
  1307. return new Promise((resolve) => {
  1308. this.$request
  1309. .faceCertificationCompareFace({
  1310. imageA: this.faceUrl,
  1311. orderGoodsId: this.orderGoodsId,
  1312. gradeId: this.gradeId,
  1313. })
  1314. .then((res) => {
  1315. console.log(res, "res");
  1316. resolve(res.data);
  1317. })
  1318. .catch((err) => {
  1319. this.loading = false;
  1320. this.$message({
  1321. type: "warning",
  1322. message: err.msg,
  1323. });
  1324. });
  1325. });
  1326. },
  1327. /**
  1328. * 点击重拍
  1329. */
  1330. reTake() {
  1331. this.faceUrl = "";
  1332. this.isTaking = true;
  1333. this.getUserMedia({
  1334. video: {
  1335. width: 400,
  1336. height: 300,
  1337. },
  1338. });
  1339. },
  1340. // 点击拍照按钮
  1341. onPhoto() {
  1342. // if (this.isIE) {
  1343. // window.webcam.capture();
  1344. // } else {
  1345. const canvas = document.createElement("canvas");
  1346. canvas.width = 400;
  1347. canvas.height = 300;
  1348. const context = canvas.getContext("2d");
  1349. const video = document.getElementById("video");
  1350. context.drawImage(video, 0, 0, 400, 300);
  1351. this.faceUrl = canvas.toDataURL("image/png");
  1352. this.isTaking = false;
  1353. // }
  1354. },
  1355. getUserMedia(constraints, success, error) {
  1356. if (window.navigator.mediaDevices.getUserMedia) {
  1357. // 最新的标准API
  1358. window.navigator.mediaDevices
  1359. .getUserMedia(constraints)
  1360. .then(success)
  1361. .catch(error);
  1362. } else if (window.navigator.webkitGetUserMedia) {
  1363. // webkit核心浏览器
  1364. window.navigator.webkitGetUserMedia(constraints, success, error);
  1365. } else if (window.navigator.mozGetUserMedia) {
  1366. // firfox浏览器
  1367. window.navigator.mozGetUserMedia(constraints, success, error);
  1368. } else if (window.navigator.getUserMedia) {
  1369. // 旧版API
  1370. window.navigator.getUserMedia(constraints, success, error);
  1371. }
  1372. },
  1373. photographSuccess(stream) {
  1374. // 兼容webkit核心浏览器
  1375. this.isTaking = true;
  1376. this.takePhotoModal = true;
  1377. this.$nextTick(() => {
  1378. const video = document.getElementById("video");
  1379. // 将视频流设置为video元素的源
  1380. console.dir(video);
  1381. video.srcObject = stream;
  1382. this.mediaStreamTrack =
  1383. typeof stream.stop === "function" ? stream : stream.getTracks()[0];
  1384. video.play();
  1385. });
  1386. },
  1387. photographError(err) {
  1388. this.$confirm(
  1389. "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
  1390. "提示",
  1391. {
  1392. showConfirmButton: false,
  1393. closeOnClickModal: false,
  1394. showCancelButton: false,
  1395. closeOnPressEscape: false,
  1396. distinguishCancelAndClose: false,
  1397. showClose: false,
  1398. }
  1399. );
  1400. },
  1401. /**
  1402. * 记录总题数,获取recordId
  1403. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1404. */
  1405. examRecord(hasSpecial) {
  1406. return new Promise((resolve) => {
  1407. let self = this;
  1408. let questionList = 0;
  1409. // if(!hasSpecial) {
  1410. this.questionList.forEach((item, index) => {
  1411. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1412. questionList++;
  1413. }
  1414. });
  1415. // } else {
  1416. // questionList = this.questionList.length;
  1417. // }
  1418. this.$request
  1419. .bankRecord({
  1420. chapterExamId: this.chapterId || 0,
  1421. moduleExamId: this.moduleId || 0,
  1422. examId: this.examId,
  1423. goodsId: this.goodsId,
  1424. gradeId: this.gradeId,
  1425. totalQuestionNum: questionList,
  1426. allQuestionNum: this.questionList.length,
  1427. })
  1428. .then((res) => {
  1429. this.recordId = res.data;
  1430. if (self.needPhoto) {
  1431. this.openPhoto();
  1432. } else {
  1433. if (this.lastTime) {
  1434. this.timer = setInterval(() => {
  1435. if (this.lastTime <= 0) {
  1436. clearInterval(this.timer);
  1437. this.$confirm("考试时间已到,系统将自动交卷", "提示", {
  1438. showConfirmButton: false,
  1439. closeOnClickModal: false,
  1440. showCancelButton: false,
  1441. closeOnPressEscape: false,
  1442. distinguishCancelAndClose: false,
  1443. showClose: false,
  1444. });
  1445. setTimeout(() => {
  1446. this.examSubmit();
  1447. }, 2000);
  1448. return;
  1449. }
  1450. this.lastTime--;
  1451. }, 1000);
  1452. }
  1453. resolve();
  1454. }
  1455. });
  1456. });
  1457. },
  1458. /**
  1459. * 获取试卷类型2考试,1练习
  1460. */
  1461. bankExam() {
  1462. this.$request.bankExam(this.examId).then((res) => {
  1463. this.bankType = res.data.doType;
  1464. if (this.bankType == 2) {
  1465. this.needBack = true;
  1466. }
  1467. });
  1468. },
  1469. /**
  1470. * @param {Object}
  1471. * 单选点击确认
  1472. */
  1473. radioSelect(question, questionIndex, optionsId) {
  1474. if (this.questionList[questionIndex].ques) return;
  1475. this.$set(this.questionList[questionIndex], "ques", optionsId);
  1476. },
  1477. /**
  1478. * @param {Object}
  1479. * 案例单选点击
  1480. */
  1481. radioSelectChild(questionIndex, jsonIndex, optionsId) {
  1482. if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1483. this.$set(this.questionList[questionIndex].ques, jsonIndex, optionsId);
  1484. },
  1485. /**
  1486. * 多选点击确认
  1487. */
  1488. checkboxSubmit(question, questionIndex) {
  1489. if (this.questionList[questionIndex].ques) return;
  1490. let arr = [];
  1491. this.questionList[questionIndex].jsonStr.forEach((item) => {
  1492. if (item.checked) {
  1493. arr.push(item.optionsId);
  1494. }
  1495. });
  1496. if (!arr.length) {
  1497. this.$message({
  1498. type: "warning",
  1499. message: "请选择答案",
  1500. });
  1501. return;
  1502. }
  1503. this.$set(this.questionList[questionIndex], "ques", arr);
  1504. },
  1505. /**
  1506. * @param {Object}
  1507. * 案例多选确认
  1508. */
  1509. checkboxSubmitChild(questionIndex, ansIndex) {
  1510. if (this.questionList[questionIndex].ques[ansIndex]) return;
  1511. let arr = [];
  1512. this.questionList[questionIndex].jsonStr[ansIndex].optionsList.forEach(
  1513. (item) => {
  1514. if (item.checked) {
  1515. arr.push(item.optionsId);
  1516. }
  1517. }
  1518. );
  1519. if (!arr.length) {
  1520. this.$message({
  1521. type: "warning",
  1522. message: "请选择答案",
  1523. });
  1524. return;
  1525. }
  1526. this.$set(this.questionList[questionIndex].ques, ansIndex, arr);
  1527. },
  1528. /**
  1529. * 判断点击确认
  1530. */
  1531. judgeSelect(question, questionIndex, index) {
  1532. if (question.ques) return;
  1533. this.$set(this.questionList[questionIndex], "ques", index + "");
  1534. },
  1535. judgeSelectChild(questionIndex, jsonIndex, index) {
  1536. console.log(this.questionList[questionIndex].ques[jsonIndex]);
  1537. if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1538. this.$set(this.questionList[questionIndex].ques, jsonIndex, index + "");
  1539. },
  1540. /**
  1541. * 上传图片
  1542. */
  1543. uploadImg(e, question, questionIndex) {
  1544. var file = e.target.files[0];
  1545. if (file.size > 2 * 1024 * 1024) {
  1546. this.$message.warn("图片不得大于2000kb");
  1547. return;
  1548. }
  1549. var type = e.target.value.toLowerCase().split(".").splice(-1);
  1550. if (
  1551. type[0] != "jpg" &&
  1552. type[0] != "png" &&
  1553. type[0] != "jpeg" &&
  1554. type[0] != "gif"
  1555. ) {
  1556. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  1557. e.target.value = "";
  1558. return;
  1559. }
  1560. this.$upload.upload(file, 0).then((res) => {
  1561. question.ansText.imageList.push(res);
  1562. });
  1563. },
  1564. /**
  1565. * 案例上传图片
  1566. */
  1567. uploadImgChild(e, questionIndex, jsonIndex) {
  1568. var file = e.target.files[0];
  1569. if (file.size > 2 * 1024 * 1024) {
  1570. this.$message.warn("图片不得大于2000kb");
  1571. return;
  1572. }
  1573. var type = e.target.value.toLowerCase().split(".").splice(-1);
  1574. if (
  1575. type[0] != "jpg" &&
  1576. type[0] != "png" &&
  1577. type[0] != "jpeg" &&
  1578. type[0] != "gif"
  1579. ) {
  1580. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  1581. e.target.value = "";
  1582. return;
  1583. }
  1584. this.$upload.upload(file, 0).then((res) => {
  1585. this.questionList[questionIndex].jsonStr[
  1586. jsonIndex
  1587. ].ansText.imageList.push(res);
  1588. });
  1589. },
  1590. isOver(item, index) {
  1591. if (this.questionList[index].ques) {
  1592. if (item.type == 4) {
  1593. //案例题
  1594. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1595. if (
  1596. jsonItem.type == 1 ||
  1597. jsonItem.type == 2 ||
  1598. jsonItem.type == 3
  1599. ) {
  1600. if (item.ques[indexs]) {
  1601. return true;
  1602. } else {
  1603. return false;
  1604. }
  1605. } else if (jsonItem.type == 5) {
  1606. if (
  1607. item.ques[indexs] &&
  1608. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  1609. ) {
  1610. console.log("chil");
  1611. return true;
  1612. } else {
  1613. return false;
  1614. }
  1615. }
  1616. });
  1617. if (isOver) {
  1618. return true;
  1619. } else {
  1620. return false;
  1621. }
  1622. } else if (item.type == 5) {
  1623. //简答题
  1624. //每一项都相等
  1625. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  1626. return true;
  1627. }
  1628. //判断
  1629. } else {
  1630. return false;
  1631. }
  1632. } else {
  1633. return false;
  1634. }
  1635. },
  1636. ansSubmit(question, questionIndex) {
  1637. if (!question.ansText.text && !question.ansText.imageList.length) {
  1638. this.$message({
  1639. type: "warning",
  1640. message: "请输入内容或上传图片",
  1641. });
  1642. return;
  1643. }
  1644. question.ques.imageList = question.ansText.imageList;
  1645. question.ques.text = question.ansText.text;
  1646. console.log(question.ques);
  1647. },
  1648. ansSubmitChild(question, questionIndex, jsonIndex) {
  1649. if (
  1650. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text &&
  1651. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.imageList
  1652. .length
  1653. ) {
  1654. this.$message({
  1655. type: "warning",
  1656. message: "请输入内容或上传图片",
  1657. });
  1658. return;
  1659. }
  1660. this.$set(this.questionList[questionIndex].ques, jsonIndex, {
  1661. imageList:
  1662. this.questionList[questionIndex].jsonStr[jsonIndex].ansText
  1663. .imageList || [],
  1664. text:
  1665. this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text ||
  1666. "",
  1667. });
  1668. },
  1669. changeIndex(index) {
  1670. this.current = index;
  1671. },
  1672. nextQuestion() {
  1673. if (this.current >= this.questionList.length - 1) {
  1674. this.$message({
  1675. type: "warning",
  1676. message: "已经是最后一题了!",
  1677. });
  1678. return;
  1679. }
  1680. this.current++;
  1681. },
  1682. prevQuestion() {
  1683. if (this.current == 0) {
  1684. this.$message({
  1685. type: "warning",
  1686. message: "已经是第一题了!",
  1687. });
  1688. return;
  1689. } else {
  1690. this.current--;
  1691. }
  1692. },
  1693. isRight(item, index) {
  1694. //单选
  1695. if (this.questionList[index].ques) {
  1696. if (item.type == 1) {
  1697. console.log(
  1698. this.questionList[index].ques == this.questionList[index].ans
  1699. );
  1700. return this.questionList[index].ques == this.questionList[index].ans;
  1701. //多选
  1702. } else if (item.type == 2) {
  1703. //每一项都相等
  1704. return this.questionList[index].ans.every((item, i) => {
  1705. return item == this.questionList[index].ques[i];
  1706. });
  1707. //判断
  1708. } else if (item.type == 3) {
  1709. return this.questionList[index].ques == this.questionList[index].ans;
  1710. } else {
  1711. return false;
  1712. }
  1713. } else {
  1714. return false;
  1715. }
  1716. },
  1717. isWrong(item, index) {
  1718. if (this.questionList[index].ques) {
  1719. //单选
  1720. if (item.type == 1) {
  1721. return this.questionList[index].ques != this.questionList[index].ans;
  1722. //多选
  1723. } else if (item.type == 2) {
  1724. //每一项都相等
  1725. return this.questionList[index].ans.some((item, i) => {
  1726. return item != this.questionList[index].ques[i];
  1727. });
  1728. //判断
  1729. } else if (item.type == 3) {
  1730. return this.questionList[index].ques != this.questionList[index].ans;
  1731. } else {
  1732. return false;
  1733. }
  1734. } else {
  1735. return false;
  1736. }
  1737. },
  1738. right(bankIndex, ansIndex, option) {
  1739. if (
  1740. this.questionList[bankIndex].ques[ansIndex] &&
  1741. this.questionList[bankIndex].ans[ansIndex]
  1742. ) {
  1743. if (
  1744. this.questionList[bankIndex].ques[ansIndex].indexOf(
  1745. option.optionsId
  1746. ) != -1 ||
  1747. this.questionList[bankIndex].ans[ansIndex].indexOf(
  1748. option.optionsId
  1749. ) != -1
  1750. ) {
  1751. return true;
  1752. } else {
  1753. return false;
  1754. }
  1755. } else {
  1756. return false;
  1757. }
  1758. },
  1759. wrong(bankIndex, ansIndex, option) {
  1760. if (
  1761. this.questionList[bankIndex].ques[ansIndex] &&
  1762. this.questionList[bankIndex].ans[ansIndex]
  1763. ) {
  1764. if (
  1765. this.questionList[bankIndex].ques[ansIndex].indexOf(
  1766. option.optionsId
  1767. ) != -1 &&
  1768. this.questionList[bankIndex].ans[ansIndex].indexOf(
  1769. option.optionsId
  1770. ) == -1
  1771. ) {
  1772. return true;
  1773. } else {
  1774. return false;
  1775. }
  1776. } else {
  1777. return false;
  1778. }
  1779. },
  1780. /**
  1781. * 获取已经回答的题目数
  1782. * hasSpecail (是否包含简答和案例)
  1783. */
  1784. questionOverNum(hasSpecail) {
  1785. let count = 0;
  1786. this.questionList.forEach((item) => {
  1787. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1788. if (item.ques) {
  1789. count++;
  1790. }
  1791. } else if (item.type == 4) {
  1792. //案例题
  1793. if (hasSpecail) {
  1794. let isOver = item.jsonStr.every((jsonItem, index) => {
  1795. if (
  1796. jsonItem.type == 1 ||
  1797. jsonItem.type == 2 ||
  1798. jsonItem.type == 3
  1799. ) {
  1800. if (item.ques[index]) {
  1801. return true;
  1802. } else {
  1803. return false;
  1804. }
  1805. } else if (jsonItem.type == 5) {
  1806. if (
  1807. item.ques[index] &&
  1808. (item.ques[index].text || item.ques[index].imageList.length)
  1809. ) {
  1810. return true;
  1811. } else {
  1812. return false;
  1813. }
  1814. }
  1815. });
  1816. if (isOver) {
  1817. count++;
  1818. console.log(item, 444);
  1819. }
  1820. }
  1821. } else if (item.type == 5) {
  1822. //简答题
  1823. if (hasSpecail) {
  1824. if (item.ques && (item.ques.text || item.ques.imageList.length)) {
  1825. console.log(5, item);
  1826. count++;
  1827. }
  1828. }
  1829. }
  1830. });
  1831. return count;
  1832. },
  1833. collect() {
  1834. this.$message({
  1835. message: "试做题目,不支持收藏~",
  1836. type: "warning",
  1837. });
  1838. return;
  1839. },
  1840. submit() {
  1841. let ansCount = this.questionOverNum(true); //已答题数
  1842. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1843. //没有答完
  1844. if (this.lastCount !== 0) {
  1845. this.$confirm(
  1846. `您还有${this.lastCount}道题未作答, 现在继续作答,还是下次继续?`,
  1847. "提示",
  1848. {
  1849. confirmButtonText: "立即交卷",
  1850. cancelButtonText: "继续做题",
  1851. closeOnClickModal: false,
  1852. closeOnPressEscape: false,
  1853. distinguishCancelAndClose: false,
  1854. showClose: false,
  1855. }
  1856. )
  1857. .then((_) => {
  1858. this.examSubmit();
  1859. })
  1860. .catch((_) => {});
  1861. return;
  1862. }
  1863. if (this.bankType == 2) {
  1864. if (this.lastTime > 0) {
  1865. let lastTime = this.countdown(this.lastTime);
  1866. this.$confirm(`时间还剩余${lastTime},确定交卷吗?`, "提示", {
  1867. confirmButtonText: "交卷",
  1868. cancelButtonText: "继续答题",
  1869. closeOnClickModal: false,
  1870. closeOnPressEscape: false,
  1871. distinguishCancelAndClose: false,
  1872. showClose: false,
  1873. })
  1874. .then((_) => {
  1875. this.examSubmit();
  1876. })
  1877. .catch((_) => {});
  1878. return;
  1879. }
  1880. }
  1881. this.examSubmit();
  1882. },
  1883. /**
  1884. * @param {Object} second倒计时过滤器
  1885. */
  1886. countdown(second) {
  1887. if (second) {
  1888. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1889. let m = parseInt((second / 60) % 60); // 计算分数
  1890. let s = parseInt(second % 60); // 计算当前秒数
  1891. if (h < 10) h = "0" + h;
  1892. if (m < 10) m = "0" + m;
  1893. if (s < 10) s = "0" + s;
  1894. return h + ":" + m + ":" + s;
  1895. } else {
  1896. return "";
  1897. }
  1898. },
  1899. examSubmit() {
  1900. if (this.needPhoto && !this.hasTake) {
  1901. this.$confirm("未拍照成功不能交卷", "提示", {
  1902. closeOnClickModal: false,
  1903. showCancelButton: false,
  1904. closeOnPressEscape: false,
  1905. distinguishCancelAndClose: false,
  1906. showClose: false,
  1907. });
  1908. return;
  1909. }
  1910. let score = 0; //计算总分
  1911. let reportStatus = 0;
  1912. let number = 0; //做对的题目数量
  1913. let doQuestionNum = 0; //做过的题目数量
  1914. let allScore = 0; //总分
  1915. let passScore = 0;
  1916. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  1917. let doQuestionIds = []; //做过的题目id
  1918. let rightQuestionIds = []; //做对的题目id
  1919. this.questionList.forEach((item, index) => {
  1920. passScore = item.passScore;
  1921. if (item.type == 1) {
  1922. //正确
  1923. if (item.ques == item.ans) {
  1924. item.scoreResult = item.score;
  1925. score += item.score;
  1926. number++;
  1927. rightQuestionIds.push(item.questionId);
  1928. } else {
  1929. //错误
  1930. item.scoreResult = 0;
  1931. doWrongQuestionIds.push(item.questionId);
  1932. }
  1933. allScore += item.score;
  1934. if (item.ques) {
  1935. doQuestionNum++;
  1936. doQuestionIds.push(item.questionId);
  1937. }
  1938. } else if (item.type == 2) {
  1939. let isRight =
  1940. item.ans &&
  1941. item.ans.every((quesItem, quesIndex) => {
  1942. if (item.ques) {
  1943. return item.ques[quesIndex] == item.ans[quesIndex];
  1944. } else {
  1945. return false;
  1946. }
  1947. });
  1948. if (isRight) {
  1949. score += item.score;
  1950. number++;
  1951. item.scoreResult = item.score;
  1952. rightQuestionIds.push(item.questionId);
  1953. } else {
  1954. let checkboxScore = item.score; //获取单题总分数
  1955. item.ques &&
  1956. item.ques.forEach((ques, quesIndex) => {
  1957. //选错一个全扣
  1958. if (item.ques) {
  1959. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1960. checkboxScore = 0;
  1961. }
  1962. } else {
  1963. checkboxScore = 0;
  1964. }
  1965. });
  1966. console.log(checkboxScore);
  1967. //没选错
  1968. if (checkboxScore) {
  1969. checkboxScore = 0;
  1970. item.ans.forEach((ans, quesIndex) => {
  1971. //漏选扣一部分,对n题给n X partScore 分
  1972. if (item.ques) {
  1973. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  1974. checkboxScore += item.partScore;
  1975. }
  1976. } else {
  1977. checkboxScore = 0;
  1978. }
  1979. });
  1980. }
  1981. if (checkboxScore <= 0) {
  1982. //0分
  1983. item.scoreResult = 0;
  1984. doWrongQuestionIds.push(item.questionId);
  1985. } else {
  1986. //部分分
  1987. // number++;
  1988. doWrongQuestionIds.push(item.questionId);
  1989. item.scoreResult = checkboxScore;
  1990. score += checkboxScore;
  1991. // rightQuestionIds.push(item.questionId)
  1992. }
  1993. }
  1994. allScore += item.score;
  1995. if (item.ques && item.ques.length) {
  1996. doQuestionNum++;
  1997. doQuestionIds.push(item.questionId);
  1998. }
  1999. } else if (item.type == 3) {
  2000. if (item.ques == item.ans) {
  2001. item.scoreResult = item.score;
  2002. score += item.score;
  2003. number++;
  2004. rightQuestionIds.push(item.questionId);
  2005. } else {
  2006. item.scoreResult = 0;
  2007. doWrongQuestionIds.push(item.questionId);
  2008. }
  2009. allScore += item.score;
  2010. if (item.ques) {
  2011. doQuestionNum++;
  2012. doQuestionIds.push(item.questionId);
  2013. }
  2014. } else if (item.type == 4) {
  2015. allScore += item.score;
  2016. if (item.ques && item.ques.length) {
  2017. doQuestionNum++;
  2018. doQuestionIds.push(item.questionId);
  2019. }
  2020. } else if (item.type == 5) {
  2021. allScore += item.score;
  2022. if (item.ques && (item.ques.imageList || item.ques.text)) {
  2023. doQuestionNum++;
  2024. doQuestionIds.push(item.questionId);
  2025. }
  2026. }
  2027. });
  2028. //大于分及格
  2029. if (score >= passScore) {
  2030. reportStatus = 1;
  2031. } else {
  2032. reportStatus = 0;
  2033. }
  2034. clearInterval(this.timer);
  2035. //交卷
  2036. this.$request
  2037. .bankRecordEdit({
  2038. moduleId: this.moduleId || 0,
  2039. chapterId: this.chapterId || 0,
  2040. gradeId: this.gradeId,
  2041. examId: this.examId,
  2042. goodsId: this.goodsId,
  2043. reportStatus: reportStatus,
  2044. recordId: this.recordId,
  2045. courseId: this.courseId,
  2046. rightQuestionNum: number,
  2047. status: 1,
  2048. doQuestionIds: doQuestionIds.join(","),
  2049. // rightQuestionIds:rightQuestionIds.join(','),
  2050. // doQuestionNum: doQuestionNum,
  2051. performance: score,
  2052. totalScore: allScore,
  2053. // examTime: parseInt(this.allTimes),
  2054. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2055. // historyExamJson: JSON.stringify(this.questionList)
  2056. })
  2057. .then((res) => {
  2058. this.isSubmit = true;
  2059. clearInterval(this.timer);
  2060. this.$message({
  2061. type: "success",
  2062. message: "交卷成功",
  2063. });
  2064. setTimeout(() => {
  2065. let result = {
  2066. rightQuestionNum: number,
  2067. doWrongQuestionNum: doWrongQuestionIds.length,
  2068. score: score,
  2069. totalScore: allScore,
  2070. reportStatus: reportStatus,
  2071. };
  2072. this.setExamResult(result);
  2073. this.$router.replace({
  2074. path: "/course-report",
  2075. });
  2076. }, 1000);
  2077. })
  2078. .catch((err) => {
  2079. console.log(err, "err");
  2080. });
  2081. },
  2082. },
  2083. };
  2084. </script>
  2085. <!-- Add "scoped" attribute to limit CSS to this component only -->
  2086. <style scoped lang="scss">
  2087. .course-exam {
  2088. .section {
  2089. overflow: hidden;
  2090. &__header {
  2091. height: 20px;
  2092. margin-top: 20px;
  2093. }
  2094. &__body {
  2095. .explain-record {
  2096. &__header {
  2097. }
  2098. &__body {
  2099. height: 800px;
  2100. border: 1px solid #eee;
  2101. .left-box {
  2102. float: left;
  2103. width: 970px;
  2104. border-right: 1px solid #eee;
  2105. &__header {
  2106. height: 40px;
  2107. padding-left: 12px;
  2108. border-bottom: 1px solid #eeeeee;
  2109. display: flex;
  2110. align-items: center;
  2111. .progress {
  2112. width: 636px;
  2113. }
  2114. .text {
  2115. margin-left: 15px;
  2116. font-size: 16px;
  2117. span {
  2118. font-family: Microsoft YaHei;
  2119. font-weight: bold;
  2120. color: #3f8dfd;
  2121. line-height: 24px;
  2122. }
  2123. }
  2124. }
  2125. &__body {
  2126. height: 720px;
  2127. border-bottom: 1px solid #eee;
  2128. .question {
  2129. padding: 12px 0 0 12px;
  2130. display: flex;
  2131. flex-direction: column;
  2132. height: 100%;
  2133. &__title {
  2134. padding-left: 12px;
  2135. font-size: 16px;
  2136. font-family: Microsoft YaHei;
  2137. font-weight: bold;
  2138. color: #333333;
  2139. line-height: 24px;
  2140. }
  2141. &__desc {
  2142. padding-left: 12px;
  2143. margin-top: 20px;
  2144. font-size: 16px;
  2145. font-family: Microsoft YaHei;
  2146. font-weight: 400;
  2147. color: #666666;
  2148. line-height: 24px;
  2149. /deep/ img {
  2150. max-width: 100% !important;
  2151. max-height: 400px !important;
  2152. }
  2153. }
  2154. &__content {
  2155. flex: 1;
  2156. overflow-y: scroll;
  2157. &::-webkit-scrollbar {
  2158. width: 6px;
  2159. }
  2160. &::-webkit-scrollbar-track {
  2161. background-color: #fff;
  2162. -webkit-border-radius: 2em;
  2163. -moz-border-radius: 2em;
  2164. border-radius: 2em;
  2165. }
  2166. &::-webkit-scrollbar-thumb {
  2167. background-color: #eeeeee;
  2168. -webkit-border-radius: 2em;
  2169. -moz-border-radius: 2em;
  2170. border-radius: 2em;
  2171. }
  2172. /deep/ .el-tabs__item {
  2173. padding: 0 20px !important;
  2174. height: 40px;
  2175. line-height: 40px;
  2176. }
  2177. .question__content {
  2178. height: auto;
  2179. overflow: auto;
  2180. }
  2181. .question-list {
  2182. padding: 24px 0 0 24px;
  2183. .checkbox,
  2184. .radio {
  2185. cursor: pointer;
  2186. margin-right: 24px;
  2187. padding: 0 24px;
  2188. display: flex;
  2189. align-items: center;
  2190. margin-top: 2px;
  2191. min-height: 40px;
  2192. padding-top: 10px;
  2193. padding-bottom: 10px;
  2194. background: #f5f9ff;
  2195. border-radius: 8px;
  2196. box-sizing: border-box;
  2197. &.right {
  2198. background: #37c65b;
  2199. }
  2200. &.wrong {
  2201. background: #ff3a30;
  2202. }
  2203. }
  2204. &.textarea {
  2205. margin-right: 12px;
  2206. .upload {
  2207. margin-top: 10px;
  2208. &__imgs {
  2209. margin-right: 10px;
  2210. width: 80px;
  2211. height: 80px;
  2212. background: #ffffff;
  2213. border: 1px solid #eeeeee;
  2214. border-radius: 4px;
  2215. position: relative;
  2216. display: flex;
  2217. float: left;
  2218. align-items: center;
  2219. justify-content: center;
  2220. img {
  2221. max-width: 100%;
  2222. max-height: 100%;
  2223. }
  2224. }
  2225. &__btn {
  2226. margin-right: 10px;
  2227. width: 80px;
  2228. height: 80px;
  2229. background: #ffffff;
  2230. border: 1px solid #eeeeee;
  2231. border-radius: 4px;
  2232. position: relative;
  2233. display: flex;
  2234. float: left;
  2235. align-items: center;
  2236. justify-content: center;
  2237. flex-direction: column;
  2238. .icon {
  2239. font-size: 20px;
  2240. color: #3f8dfd;
  2241. }
  2242. p {
  2243. font-size: 12px;
  2244. font-family: Microsoft YaHei;
  2245. font-weight: 400;
  2246. color: #999999;
  2247. line-height: 24px;
  2248. }
  2249. input {
  2250. position: absolute;
  2251. left: 0;
  2252. top: 0;
  2253. display: block;
  2254. width: 100%;
  2255. height: 100%;
  2256. opacity: 0;
  2257. }
  2258. }
  2259. }
  2260. }
  2261. /deep/ .el-checkbox {
  2262. white-space: pre-wrap;
  2263. }
  2264. }
  2265. .answer-list {
  2266. height: 40px;
  2267. border-top: 1px solid #eee;
  2268. border-bottom: 1px solid #eee;
  2269. margin-top: 24px;
  2270. display: flex;
  2271. align-items: center;
  2272. justify-content: space-between;
  2273. padding: 0 24px;
  2274. &__left {
  2275. font-size: 16px;
  2276. font-family: Microsoft YaHei;
  2277. font-weight: 400;
  2278. color: #333333;
  2279. line-height: 24px;
  2280. }
  2281. &__right {
  2282. font-size: 16px;
  2283. font-family: Microsoft YaHei;
  2284. font-weight: 400;
  2285. color: #333333;
  2286. line-height: 24px;
  2287. }
  2288. }
  2289. .explain-list {
  2290. padding: 12px 24px;
  2291. &__header {
  2292. font-size: 16px;
  2293. font-family: Microsoft YaHei;
  2294. font-weight: bold;
  2295. color: #666666;
  2296. line-height: 24px;
  2297. }
  2298. &__body {
  2299. margin-top: 12px;
  2300. font-size: 16px;
  2301. font-family: Microsoft YaHei;
  2302. font-weight: 400;
  2303. color: #666666;
  2304. line-height: 24px;
  2305. }
  2306. .upload {
  2307. margin-top: 10px;
  2308. &__imgs {
  2309. margin-right: 10px;
  2310. width: 80px;
  2311. height: 80px;
  2312. background: #ffffff;
  2313. border: 1px solid #eeeeee;
  2314. border-radius: 4px;
  2315. position: relative;
  2316. display: flex;
  2317. float: left;
  2318. align-items: center;
  2319. justify-content: center;
  2320. img {
  2321. max-width: 100%;
  2322. max-height: 100%;
  2323. }
  2324. }
  2325. }
  2326. }
  2327. }
  2328. &__btns {
  2329. position: relative;
  2330. height: 32px;
  2331. .submit {
  2332. cursor: pointer;
  2333. margin: 0 auto;
  2334. width: 140px;
  2335. height: 32px;
  2336. background: #3f8dfd;
  2337. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  2338. border-radius: 16px;
  2339. text-align: center;
  2340. line-height: 32px;
  2341. color: #fff;
  2342. font-size: 16px;
  2343. }
  2344. .collect {
  2345. cursor: pointer;
  2346. position: absolute;
  2347. right: 0;
  2348. top: 5px;
  2349. font-size: 12px;
  2350. font-family: Microsoft YaHei;
  2351. font-weight: 400;
  2352. color: #3f8dfd;
  2353. line-height: 24px;
  2354. }
  2355. }
  2356. }
  2357. }
  2358. &__footer {
  2359. height: 40px;
  2360. display: flex;
  2361. justify-content: space-around;
  2362. align-items: center;
  2363. .btn {
  2364. cursor: pointer;
  2365. width: 140px;
  2366. height: 32px;
  2367. background: #ffffff;
  2368. border: 1px solid #3f8dfd;
  2369. border-radius: 16px;
  2370. line-height: 32px;
  2371. text-align: center;
  2372. color: #3f8dfd;
  2373. }
  2374. }
  2375. }
  2376. .right-box {
  2377. float: right;
  2378. width: 300px;
  2379. &__header {
  2380. height: 40px;
  2381. line-height: 40px;
  2382. border-bottom: 1px solid #eeeeee;
  2383. padding: 0 10px;
  2384. .back-btn {
  2385. display: block;
  2386. margin: 0 auto;
  2387. width: 160px;
  2388. }
  2389. .title {
  2390. float: left;
  2391. font-size: 16px;
  2392. font-family: Microsoft YaHei;
  2393. font-weight: bold;
  2394. color: #333333;
  2395. float: left;
  2396. }
  2397. .time {
  2398. font-size: 16px;
  2399. font-family: Microsoft YaHei;
  2400. font-weight: 400;
  2401. color: #666666;
  2402. float: right;
  2403. }
  2404. }
  2405. &__body {
  2406. height: 720px;
  2407. border-bottom: 1px solid #eee;
  2408. .card {
  2409. &__note {
  2410. display: flex;
  2411. height: 40px;
  2412. align-items: center;
  2413. border-bottom: 1px solid #eee;
  2414. .item {
  2415. display: flex;
  2416. align-items: center;
  2417. margin-left: 10px;
  2418. .box {
  2419. margin-right: 5px;
  2420. width: 16px;
  2421. height: 16px;
  2422. border-radius: 4px;
  2423. &.white {
  2424. background: #ffffff;
  2425. border: 1px solid #eeeeee;
  2426. }
  2427. &.green {
  2428. background: #37c65b;
  2429. }
  2430. &.red {
  2431. background: #ff3a30;
  2432. }
  2433. &.blue {
  2434. background: #3f8dfd;
  2435. }
  2436. }
  2437. }
  2438. }
  2439. &__content {
  2440. height: 630px;
  2441. overflow-y: scroll;
  2442. &::-webkit-scrollbar {
  2443. width: 6px;
  2444. }
  2445. &::-webkit-scrollbar-track {
  2446. background-color: #fff;
  2447. -webkit-border-radius: 2em;
  2448. -moz-border-radius: 2em;
  2449. border-radius: 2em;
  2450. }
  2451. &::-webkit-scrollbar-thumb {
  2452. background-color: #eeeeee;
  2453. -webkit-border-radius: 2em;
  2454. -moz-border-radius: 2em;
  2455. border-radius: 2em;
  2456. }
  2457. .list {
  2458. display: flex;
  2459. flex-wrap: wrap;
  2460. .item {
  2461. width: 40px;
  2462. height: 40px;
  2463. border-radius: 10px;
  2464. text-align: center;
  2465. line-height: 40px;
  2466. margin-left: 16px;
  2467. margin-top: 16px;
  2468. cursor: pointer;
  2469. &.white {
  2470. line-height: 38px;
  2471. color: #333333;
  2472. background: #ffffff;
  2473. border: 1px solid #eeeeee;
  2474. }
  2475. &.green {
  2476. color: #fff;
  2477. background: #37c65b;
  2478. }
  2479. &.red {
  2480. color: #fff;
  2481. background: #ff3a30;
  2482. }
  2483. &.blue {
  2484. border: 1rpx solid #eeeeee;
  2485. color: #fff;
  2486. background: #3f8dfd;
  2487. }
  2488. &.disabled {
  2489. cursor: not-allowed;
  2490. line-height: 38px;
  2491. color: #eeeeee;
  2492. background: #ffffff;
  2493. border: 1px solid #eeeeee;
  2494. }
  2495. }
  2496. }
  2497. }
  2498. }
  2499. }
  2500. &__footer {
  2501. height: 40px;
  2502. display: flex;
  2503. align-items: center;
  2504. justify-content: center;
  2505. .submit {
  2506. cursor: pointer;
  2507. width: 140px;
  2508. height: 32px;
  2509. background: #3f8dfd;
  2510. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  2511. border-radius: 16px;
  2512. line-height: 32px;
  2513. text-align: center;
  2514. color: #fff;
  2515. font-size: 16px;
  2516. }
  2517. }
  2518. }
  2519. }
  2520. }
  2521. }
  2522. }
  2523. .take-photo {
  2524. /deep/ .el-dialog__header {
  2525. display: none;
  2526. }
  2527. /deep/ .el-dialog__body {
  2528. padding: 0;
  2529. overflow: unset;
  2530. }
  2531. &__close {
  2532. cursor: pointer;
  2533. position: absolute;
  2534. right: 0;
  2535. top: -28px;
  2536. width: 24px;
  2537. height: 24px;
  2538. line-height: 24px;
  2539. text-align: center;
  2540. color: #eee;
  2541. border: 1px solid #eee;
  2542. border-radius: 50%;
  2543. }
  2544. &__header {
  2545. height: 40px;
  2546. border-bottom: 1px solid #eee;
  2547. line-height: 40px;
  2548. font-size: 16px;
  2549. font-family: Microsoft YaHei;
  2550. font-weight: bold;
  2551. color: #333333;
  2552. padding-left: 24px;
  2553. }
  2554. &__body {
  2555. height: 400px;
  2556. padding: 40px 24px;
  2557. .left-box {
  2558. width: 336px;
  2559. float: left;
  2560. .title {
  2561. font-size: 16px;
  2562. font-family: Microsoft YaHei;
  2563. font-weight: bold;
  2564. color: #ff3b30;
  2565. line-height: 24px;
  2566. }
  2567. .content {
  2568. font-size: 14px;
  2569. font-family: Microsoft YaHei;
  2570. font-weight: 400;
  2571. color: #333333;
  2572. line-height: 28px;
  2573. margin-top: 32px;
  2574. }
  2575. }
  2576. .right-box {
  2577. float: right;
  2578. width: 400px;
  2579. height: 300px;
  2580. video {
  2581. width: 100%;
  2582. height: 100%;
  2583. }
  2584. }
  2585. }
  2586. &__footer {
  2587. height: 90px;
  2588. border-top: 1px solid #eee;
  2589. text-align: center;
  2590. .take {
  2591. display: inline-block;
  2592. width: 200px;
  2593. height: 40px;
  2594. padding: 0;
  2595. border-radius: 20px;
  2596. text-align: center;
  2597. line-height: 40px;
  2598. margin: 24px auto;
  2599. }
  2600. }
  2601. }
  2602. }
  2603. </style>