index.vue 109 KB

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