index.vue 109 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158
  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 == 0) {
  1451. this.$message({
  1452. type: "warning",
  1453. message: "人脸匹配不通过,请重新拍照上传",
  1454. });
  1455. setTimeout(() => {
  1456. this.loading = false;
  1457. this.reTake();
  1458. }, 2000);
  1459. return;
  1460. }
  1461. if (compareFaceData >= 80) {
  1462. const waitYS = await this.imageInfos();
  1463. this.postStudyRecord(); //提交记录
  1464. }
  1465. this.$message({
  1466. type: "success",
  1467. message: "拍照成功",
  1468. });
  1469. this.loading = false;
  1470. this.takePhotoModal = false;
  1471. this.isTaking = true;
  1472. },
  1473. postStudyRecord() {
  1474. let self = this;
  1475. let data = {
  1476. photo: self.ossAvatarUrl,
  1477. recordId: self.recordId,
  1478. };
  1479. if (this.ossAvatarUrl) {
  1480. data.similarity = this.compareFaceData; // 相似度
  1481. }
  1482. this.$request
  1483. .studyExamPhotoRecord(data)
  1484. .then((res) => {
  1485. this.hasTake = true;
  1486. // console.log(res, "拍照提交结果");
  1487. self.ossAvatarUrl = "";
  1488. //拍照
  1489. if (this.lastTime) {
  1490. this.timer = setInterval(() => {
  1491. if (this.lastTime <= 0) {
  1492. clearInterval(this.timer);
  1493. this.$confirm("考试时间已到,系统将自动交卷", "提示", {
  1494. showConfirmButton: false,
  1495. closeOnClickModal: false,
  1496. showCancelButton: false,
  1497. closeOnPressEscape: false,
  1498. distinguishCancelAndClose: false,
  1499. showClose: false,
  1500. });
  1501. setTimeout(() => {
  1502. this.examSubmit();
  1503. }, 3000);
  1504. return;
  1505. }
  1506. this.lastTime--;
  1507. }, 1000);
  1508. }
  1509. })
  1510. .catch((err) => {
  1511. this.$message({
  1512. type: "warning",
  1513. message: err.msg,
  1514. });
  1515. });
  1516. },
  1517. imageInfos() {
  1518. var self = this;
  1519. return new Promise(async (resolve, reject) => {
  1520. const waitUpload = await self.uploadFile(self.faceUrl, 0);
  1521. resolve(waitUpload);
  1522. });
  1523. },
  1524. uploadFile(options, int) {
  1525. var self = this;
  1526. return new Promise((resolve, reject) => {
  1527. var data = {
  1528. imageStatus: int,
  1529. gradeId: this.gradeId,
  1530. orderGoodsId: this.orderGoodsId,
  1531. };
  1532. self.$request
  1533. .getPolicy(data)
  1534. .then((res) => {
  1535. var ossToken = res.data.resultContent;
  1536. if (ossToken.host == null || ossToken.host == undefined) {
  1537. this.$message({
  1538. type: "warning",
  1539. message: "上传路径报错" + JSON.stringify(res.data),
  1540. });
  1541. return;
  1542. }
  1543. let data = this.$tools.convertBase64UrlToBlob(this.faceUrl);
  1544. this.$upload
  1545. .upload(data, 0)
  1546. .then((res) => {
  1547. this.ossAvatarUrl = res;
  1548. resolve(res);
  1549. })
  1550. .catch((err) => {
  1551. this.$message({
  1552. type: "warning",
  1553. message: "上传接口报错,请重新拍照上传",
  1554. });
  1555. this.reTake();
  1556. });
  1557. })
  1558. .catch((err) => {
  1559. this.$message({
  1560. type: "warning",
  1561. message: "签名错误" + JSON.stringify(err),
  1562. });
  1563. return;
  1564. });
  1565. });
  1566. },
  1567. faceRecognition() {
  1568. return new Promise((resolve) => {
  1569. this.$request
  1570. .faceCertificationCompareFace({
  1571. imageA: this.faceUrl,
  1572. orderGoodsId: this.orderGoodsId,
  1573. gradeId: this.gradeId,
  1574. })
  1575. .then((res) => {
  1576. resolve(res.data);
  1577. })
  1578. .catch((err) => {
  1579. if (err.toString().indexOf("timeout") != -1) {
  1580. err = {
  1581. msg: "拍照超时,请重新拍照",
  1582. };
  1583. }
  1584. this.loading = false;
  1585. this.$message({
  1586. type: "warning",
  1587. message: err.msg,
  1588. });
  1589. });
  1590. });
  1591. },
  1592. /**
  1593. * 点击重拍
  1594. */
  1595. reTake() {
  1596. this.faceUrl = "";
  1597. this.isTaking = true;
  1598. this.getUserMedia({
  1599. video: {
  1600. width: 400,
  1601. height: 400,
  1602. },
  1603. });
  1604. },
  1605. // 点击拍照按钮
  1606. onPhoto() {
  1607. // if (this.isIE) {
  1608. // window.webcam.capture();
  1609. // } else {
  1610. const canvas = document.createElement("canvas");
  1611. canvas.width = 400;
  1612. canvas.height = 400;
  1613. const context = canvas.getContext("2d");
  1614. const video = document.getElementById("video");
  1615. context.drawImage(video, 0, 0, 400, 400);
  1616. this.faceUrl = canvas.toDataURL("image/png");
  1617. this.isTaking = false;
  1618. // }
  1619. },
  1620. getUserMedia(constraints, success, error) {
  1621. if (window.navigator.mediaDevices.getUserMedia) {
  1622. // 最新的标准API
  1623. window.navigator.mediaDevices
  1624. .getUserMedia(constraints)
  1625. .then(success)
  1626. .catch(error);
  1627. } else if (window.navigator.webkitGetUserMedia) {
  1628. // webkit核心浏览器
  1629. window.navigator.webkitGetUserMedia(constraints, success, error);
  1630. } else if (window.navigator.mozGetUserMedia) {
  1631. // firfox浏览器
  1632. window.navigator.mozGetUserMedia(constraints, success, error);
  1633. } else if (window.navigator.getUserMedia) {
  1634. // 旧版API
  1635. window.navigator.getUserMedia(constraints, success, error);
  1636. }
  1637. },
  1638. photographSuccess(stream) {
  1639. // 兼容webkit核心浏览器
  1640. this.isTaking = true;
  1641. this.takePhotoModal = true;
  1642. this.$nextTick(() => {
  1643. const video = document.getElementById("video");
  1644. // 将视频流设置为video元素的源
  1645. // console.dir(video);
  1646. video.srcObject = stream;
  1647. this.mediaStreamTrack =
  1648. typeof stream.stop === "function" ? stream : stream.getTracks()[0];
  1649. video.play();
  1650. });
  1651. },
  1652. photographError(err) {
  1653. this.$confirm(
  1654. "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
  1655. "提示",
  1656. {
  1657. confirmButtonText: "返回",
  1658. showConfirmButton: true,
  1659. closeOnClickModal: false,
  1660. showCancelButton: false,
  1661. closeOnPressEscape: false,
  1662. distinguishCancelAndClose: false,
  1663. showClose: false,
  1664. }
  1665. ).then(() => {
  1666. this.$router.go(-1);
  1667. });
  1668. },
  1669. /**
  1670. * 记录总题数,获取recordId
  1671. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1672. */
  1673. examRecord(hasSpecial) {
  1674. return new Promise((resolve) => {
  1675. let self = this;
  1676. let questionList = 0;
  1677. // if(!hasSpecial) {
  1678. this.questionList.forEach((item, index) => {
  1679. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1680. questionList++;
  1681. }
  1682. });
  1683. // } else {
  1684. // questionList = this.questionList.length;
  1685. // }
  1686. this.$request
  1687. .bankRecord({
  1688. courseId: this.courseId,
  1689. chapterId: this.chapterId || 0,
  1690. moduleId: this.moduleId || 0,
  1691. sectionId: this.sectionId || 0,
  1692. goodsId: this.goodsId,
  1693. examId: this.examId,
  1694. type: this.type,
  1695. gradeId: this.gradeId,
  1696. totalQuestionNum: questionList,
  1697. allQuestionNum: this.questionList.length,
  1698. orderGoodsId: this.orderGoodsId,
  1699. })
  1700. .then((res) => {
  1701. this.recordId = res.data;
  1702. // 节不需要拍照
  1703. if (self.needPhoto && this.type != 2) {
  1704. this.openPhoto();
  1705. } else {
  1706. if (this.lastTime) {
  1707. this.timer = setInterval(() => {
  1708. if (this.lastTime <= 0) {
  1709. clearInterval(this.timer);
  1710. this.$confirm("考试时间已到,系统将自动交卷", "提示", {
  1711. showConfirmButton: false,
  1712. closeOnClickModal: false,
  1713. showCancelButton: false,
  1714. closeOnPressEscape: false,
  1715. distinguishCancelAndClose: false,
  1716. showClose: false,
  1717. });
  1718. setTimeout(() => {
  1719. this.examSubmit();
  1720. }, 2000);
  1721. return;
  1722. }
  1723. this.lastTime--;
  1724. }, 1000);
  1725. }
  1726. resolve();
  1727. }
  1728. });
  1729. });
  1730. },
  1731. /**
  1732. * 获取试卷类型2考试,1练习
  1733. */
  1734. bankExam() {
  1735. this.$request.bankExam(this.examId).then((res) => {
  1736. this.bankType = res.data.doType;
  1737. if (this.bankType == 2) {
  1738. this.needBack = true;
  1739. }
  1740. });
  1741. },
  1742. /**
  1743. * @param {Object}
  1744. * 单选点击确认
  1745. */
  1746. radioSelect(question, questionIndex, optionsId) {
  1747. // if (this.questionList[questionIndex].ques) return;
  1748. if (this.questionList[questionIndex].ques && this.bankType == 1) {
  1749. return;
  1750. }
  1751. this.$set(this.questionList[questionIndex], "ques", optionsId);
  1752. },
  1753. /**
  1754. * @param {Object}
  1755. * 案例单选点击
  1756. */
  1757. radioSelectChild(questionIndex, jsonIndex, optionsId) {
  1758. // if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1759. if (
  1760. this.questionList[questionIndex].ques[jsonIndex] &&
  1761. this.bankType == 1
  1762. ) {
  1763. return;
  1764. }
  1765. this.$set(this.questionList[questionIndex].ques, jsonIndex, optionsId);
  1766. },
  1767. /**
  1768. * 多选点击确认
  1769. */
  1770. checkboxSubmit(question, questionIndex) {
  1771. // if (this.questionList[questionIndex].ques) return;
  1772. if (this.questionList[questionIndex].ques && this.bankType == 1) {
  1773. return;
  1774. }
  1775. let arr = [];
  1776. this.questionList[questionIndex].jsonStr.forEach((item) => {
  1777. if (item.checked) {
  1778. arr.push(item.optionsId);
  1779. }
  1780. });
  1781. if (!arr.length) {
  1782. delete this.questionList[questionIndex].ques;
  1783. this.$message({
  1784. type: "warning",
  1785. message: "请选择答案",
  1786. });
  1787. return;
  1788. }
  1789. this.$set(this.questionList[questionIndex], "ques", arr);
  1790. },
  1791. /**
  1792. * @param {Object}
  1793. * 案例多选确认
  1794. */
  1795. checkboxSubmitChild(questionIndex, ansIndex) {
  1796. // if (this.questionList[questionIndex].ques[ansIndex]) return;
  1797. if (
  1798. this.questionList[questionIndex].ques[ansIndex] &&
  1799. this.bankType == 1
  1800. ) {
  1801. return;
  1802. }
  1803. let arr = [];
  1804. this.questionList[questionIndex].jsonStr[ansIndex].optionsList.forEach(
  1805. (item) => {
  1806. if (item.checked) {
  1807. arr.push(item.optionsId);
  1808. }
  1809. }
  1810. );
  1811. if (!arr.length) {
  1812. delete this.questionList[questionIndex].ques[ansIndex];
  1813. this.$message({
  1814. type: "warning",
  1815. message: "请选择答案",
  1816. });
  1817. return;
  1818. }
  1819. this.$set(this.questionList[questionIndex].ques, ansIndex, arr);
  1820. },
  1821. /**
  1822. * 判断点击确认
  1823. */
  1824. judgeSelect(question, questionIndex, index) {
  1825. // if (question.ques) return;
  1826. if (question.ques && this.bankType == 1) {
  1827. return;
  1828. }
  1829. this.$set(
  1830. this.questionList[questionIndex],
  1831. "ques",
  1832. index == 0 ? "1" : "0"
  1833. );
  1834. },
  1835. judgeSelectChild(questionIndex, jsonIndex, index) {
  1836. // console.log(this.questionList[questionIndex].ques[jsonIndex]);
  1837. // if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1838. if (
  1839. this.questionList[questionIndex].ques[jsonIndex] &&
  1840. this.bankType == 1
  1841. ) {
  1842. return;
  1843. }
  1844. this.$set(
  1845. this.questionList[questionIndex].ques,
  1846. jsonIndex,
  1847. index == 0 ? "1" : "0"
  1848. );
  1849. },
  1850. /**
  1851. * 上传图片
  1852. */
  1853. uploadImg(e, question, questionIndex) {
  1854. var file = e.target.files[0];
  1855. if (file.size > 2 * 1024 * 1024) {
  1856. this.$message.warn("图片不得大于2000kb");
  1857. return;
  1858. }
  1859. var type = e.target.value.toLowerCase().split(".").splice(-1);
  1860. if (
  1861. type[0] != "jpg" &&
  1862. type[0] != "png" &&
  1863. type[0] != "jpeg" &&
  1864. type[0] != "gif"
  1865. ) {
  1866. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  1867. e.target.value = "";
  1868. return;
  1869. }
  1870. this.$upload.upload(file, 0).then((res) => {
  1871. question.ansText.imageList.push(res);
  1872. });
  1873. },
  1874. /**
  1875. * 案例上传图片
  1876. */
  1877. uploadImgChild(e, questionIndex, jsonIndex) {
  1878. var file = e.target.files[0];
  1879. if (file.size > 2 * 1024 * 1024) {
  1880. this.$message.warn("图片不得大于2000kb");
  1881. return;
  1882. }
  1883. var type = e.target.value.toLowerCase().split(".").splice(-1);
  1884. if (
  1885. type[0] != "jpg" &&
  1886. type[0] != "png" &&
  1887. type[0] != "jpeg" &&
  1888. type[0] != "gif"
  1889. ) {
  1890. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  1891. e.target.value = "";
  1892. return;
  1893. }
  1894. this.$upload.upload(file, 0).then((res) => {
  1895. this.questionList[questionIndex].jsonStr[
  1896. jsonIndex
  1897. ].ansText.imageList.push(res);
  1898. });
  1899. },
  1900. isOver(item, index) {
  1901. if (this.questionList[index].ques) {
  1902. if (item.type == 4) {
  1903. //案例题
  1904. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1905. if (
  1906. jsonItem.type == 1 ||
  1907. jsonItem.type == 2 ||
  1908. jsonItem.type == 3
  1909. ) {
  1910. if (item.ques[indexs]) {
  1911. return true;
  1912. } else {
  1913. return false;
  1914. }
  1915. } else if (jsonItem.type == 5) {
  1916. if (
  1917. item.ques[indexs] &&
  1918. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  1919. ) {
  1920. return true;
  1921. } else {
  1922. return false;
  1923. }
  1924. }
  1925. });
  1926. if (isOver) {
  1927. return true;
  1928. } else {
  1929. return false;
  1930. }
  1931. } else if (item.type == 5) {
  1932. //简答题
  1933. //每一项都相等
  1934. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  1935. return true;
  1936. }
  1937. //判断
  1938. } else {
  1939. return false;
  1940. }
  1941. } else {
  1942. return false;
  1943. }
  1944. },
  1945. ansSubmit(question, questionIndex) {
  1946. if (!question.ansText.text && !question.ansText.imageList.length) {
  1947. this.$message({
  1948. type: "warning",
  1949. message: "请输入内容或上传图片",
  1950. });
  1951. return;
  1952. }
  1953. question.ques.imageList = question.ansText.imageList;
  1954. question.ques.text = question.ansText.text;
  1955. },
  1956. ansSubmitChild(question, questionIndex, jsonIndex) {
  1957. if (
  1958. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text &&
  1959. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.imageList
  1960. .length
  1961. ) {
  1962. this.$message({
  1963. type: "warning",
  1964. message: "请输入内容或上传图片",
  1965. });
  1966. return;
  1967. }
  1968. this.$set(this.questionList[questionIndex].ques, jsonIndex, {
  1969. imageList:
  1970. this.questionList[questionIndex].jsonStr[jsonIndex].ansText
  1971. .imageList || [],
  1972. text:
  1973. this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text ||
  1974. "",
  1975. });
  1976. },
  1977. changeIndex(index) {
  1978. this.current = index;
  1979. this.getCollectInfo(this.current);
  1980. },
  1981. nextQuestion() {
  1982. if (this.current >= this.questionList.length - 1) {
  1983. this.$message({
  1984. type: "warning",
  1985. message: "已经是最后一题了!",
  1986. });
  1987. return;
  1988. }
  1989. this.current++;
  1990. this.getCollectInfo(this.current);
  1991. },
  1992. prevQuestion() {
  1993. if (this.current == 0) {
  1994. this.$message({
  1995. type: "warning",
  1996. message: "已经是第一题了!",
  1997. });
  1998. return;
  1999. } else {
  2000. this.current--;
  2001. this.getCollectInfo(this.current);
  2002. }
  2003. },
  2004. isCheck(item, index) {
  2005. if (this.questionList[index].ques) {
  2006. return true;
  2007. }
  2008. },
  2009. isRight(item, index) {
  2010. //单选
  2011. if (this.questionList[index].ques) {
  2012. if (item.type == 1) {
  2013. return this.questionList[index].ques == this.questionList[index].ans;
  2014. //多选
  2015. } else if (item.type == 2) {
  2016. //每一项都相等
  2017. return this.questionList[index].ans.every((item, i) => {
  2018. return item == this.questionList[index].ques[i];
  2019. });
  2020. //判断
  2021. } else if (item.type == 3) {
  2022. return this.questionList[index].ques == this.questionList[index].ans;
  2023. } else {
  2024. return false;
  2025. }
  2026. } else {
  2027. return false;
  2028. }
  2029. },
  2030. isWrong(item, index) {
  2031. if (this.questionList[index].ques) {
  2032. //单选
  2033. if (item.type == 1) {
  2034. return this.questionList[index].ques != this.questionList[index].ans;
  2035. //多选
  2036. } else if (item.type == 2) {
  2037. //每一项都相等
  2038. return this.questionList[index].ques.some((item, i) => {
  2039. return this.questionList[index].ans.indexOf(item) == -1;
  2040. });
  2041. //判断
  2042. } else if (item.type == 3) {
  2043. return this.questionList[index].ques != this.questionList[index].ans;
  2044. } else {
  2045. return false;
  2046. }
  2047. } else {
  2048. return false;
  2049. }
  2050. },
  2051. isPart(item, index) {
  2052. if (this.questionList[index].ques) {
  2053. if (item.type == 2) {
  2054. let isWrong = this.questionList[index].ques.some((item, i) => {
  2055. return this.questionList[index].ans.indexOf(item) == -1;
  2056. });
  2057. let isRight = this.questionList[index].ans.every((item, i) => {
  2058. return item == this.questionList[index].ques[i];
  2059. });
  2060. if (!isRight && !isWrong) {
  2061. return true;
  2062. }
  2063. }
  2064. } else {
  2065. return false;
  2066. }
  2067. },
  2068. right(bankIndex, ansIndex, option) {
  2069. if (
  2070. this.questionList[bankIndex].ques[ansIndex] &&
  2071. this.questionList[bankIndex].ans[ansIndex]
  2072. ) {
  2073. if (
  2074. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2075. option.optionsId
  2076. ) != -1 ||
  2077. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2078. option.optionsId
  2079. ) != -1
  2080. ) {
  2081. return true;
  2082. } else {
  2083. return false;
  2084. }
  2085. } else {
  2086. return false;
  2087. }
  2088. },
  2089. wrong(bankIndex, ansIndex, option) {
  2090. if (
  2091. this.questionList[bankIndex].ques[ansIndex] &&
  2092. this.questionList[bankIndex].ans[ansIndex]
  2093. ) {
  2094. if (
  2095. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2096. option.optionsId
  2097. ) != -1 &&
  2098. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2099. option.optionsId
  2100. ) == -1
  2101. ) {
  2102. return true;
  2103. } else {
  2104. return false;
  2105. }
  2106. } else {
  2107. return false;
  2108. }
  2109. },
  2110. /**
  2111. * 获取已经回答的题目数
  2112. * hasSpecail (是否包含简答和案例)
  2113. */
  2114. questionOverNum(hasSpecail) {
  2115. let count = 0;
  2116. this.questionList.forEach((item) => {
  2117. if (item.type == 1 || item.type == 2 || item.type == 3) {
  2118. if (item.ques) {
  2119. count++;
  2120. }
  2121. } else if (item.type == 4) {
  2122. //案例题
  2123. if (hasSpecail) {
  2124. let isOver = item.jsonStr.every((jsonItem, index) => {
  2125. if (
  2126. jsonItem.type == 1 ||
  2127. jsonItem.type == 2 ||
  2128. jsonItem.type == 3
  2129. ) {
  2130. if (item.ques[index]) {
  2131. return true;
  2132. } else {
  2133. return false;
  2134. }
  2135. } else if (jsonItem.type == 5) {
  2136. if (
  2137. item.ques[index] &&
  2138. (item.ques[index].text || item.ques[index].imageList.length)
  2139. ) {
  2140. return true;
  2141. } else {
  2142. return false;
  2143. }
  2144. }
  2145. });
  2146. if (isOver) {
  2147. count++;
  2148. }
  2149. }
  2150. } else if (item.type == 5) {
  2151. //简答题
  2152. if (hasSpecail) {
  2153. if (item.ques && (item.ques.text || item.ques.imageList.length)) {
  2154. count++;
  2155. }
  2156. }
  2157. }
  2158. });
  2159. return count;
  2160. },
  2161. collect(state, index) {
  2162. if (!state) {
  2163. this.$request
  2164. .collectQuestion({
  2165. examId: this.examId,
  2166. questionId: this.questionList[index].questionId,
  2167. goodsId: this.goodsId || "",
  2168. orderGoodsId: this.orderGoodsId,
  2169. })
  2170. .then((res) => {
  2171. this.$set(this.collectList, index, true);
  2172. this.$message.success("收藏成功");
  2173. this.getCollectInfo(index);
  2174. });
  2175. } else {
  2176. this.$request
  2177. .deleteCollectQuestion(this.collectList[index].collectQuestionId)
  2178. .then((res) => {
  2179. this.$set(this.collectList, index, false);
  2180. this.$message.success("取消收藏成功");
  2181. });
  2182. }
  2183. return;
  2184. },
  2185. submit() {
  2186. let ansCount = this.questionOverNum(true); //已答题数
  2187. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  2188. //没有答完
  2189. if (this.lastCount !== 0) {
  2190. this.$confirm(
  2191. `您还有${this.lastCount}道题未作答, 现在继续作答,还是下次继续?`,
  2192. "提示",
  2193. {
  2194. confirmButtonText: "立即交卷",
  2195. cancelButtonText: "继续做题",
  2196. closeOnClickModal: false,
  2197. closeOnPressEscape: false,
  2198. distinguishCancelAndClose: false,
  2199. showClose: false,
  2200. }
  2201. )
  2202. .then((_) => {
  2203. this.examSubmit();
  2204. })
  2205. .catch((_) => {});
  2206. return;
  2207. }
  2208. if (this.bankType == 2) {
  2209. if (this.lastTime > 0) {
  2210. let lastTime = this.countdown(this.lastTime);
  2211. this.$confirm(`时间还剩余${lastTime},确定交卷吗?`, "提示", {
  2212. confirmButtonText: "交卷",
  2213. cancelButtonText: "继续答题",
  2214. closeOnClickModal: false,
  2215. closeOnPressEscape: false,
  2216. distinguishCancelAndClose: false,
  2217. showClose: false,
  2218. })
  2219. .then((_) => {
  2220. this.examSubmit();
  2221. })
  2222. .catch((_) => {});
  2223. return;
  2224. }
  2225. }
  2226. this.examSubmit();
  2227. },
  2228. /**
  2229. * @param {Object} second倒计时过滤器
  2230. */
  2231. countdown(second) {
  2232. if (second) {
  2233. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  2234. let m = parseInt((second / 60) % 60); // 计算分数
  2235. let s = parseInt(second % 60); // 计算当前秒数
  2236. if (h < 10) h = "0" + h;
  2237. if (m < 10) m = "0" + m;
  2238. if (s < 10) s = "0" + s;
  2239. return h + ":" + m + ":" + s;
  2240. } else {
  2241. return "";
  2242. }
  2243. },
  2244. examSubmit() {
  2245. if (this.needPhoto && !this.hasTake) {
  2246. this.$confirm("未拍照成功不能交卷", "提示", {
  2247. closeOnClickModal: false,
  2248. showCancelButton: false,
  2249. closeOnPressEscape: false,
  2250. distinguishCancelAndClose: false,
  2251. showClose: false,
  2252. });
  2253. return;
  2254. }
  2255. let score = 0; //计算总分
  2256. let reportStatus = 0;
  2257. let number = 0; //做对的题目数量
  2258. let doQuestionNum = 0; //做过的题目数量
  2259. let allScore = 0; //总分
  2260. let passScore = 0;
  2261. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  2262. let doQuestionIds = []; //做过的题目id
  2263. let rightQuestionIds = []; //做对的题目id
  2264. let lessQuestionNum = 0;
  2265. this.questionList.forEach((item, index) => {
  2266. passScore = item.passScore;
  2267. if (item.type == 1) {
  2268. //正确
  2269. if (item.ques == item.ans) {
  2270. item.scoreResult = item.score;
  2271. score += item.score;
  2272. number++;
  2273. rightQuestionIds.push(item.questionId);
  2274. } else {
  2275. //错误
  2276. item.scoreResult = 0;
  2277. if (item.ques) {
  2278. doWrongQuestionIds.push(item.questionId);
  2279. }
  2280. }
  2281. allScore += item.score;
  2282. if (item.ques) {
  2283. doQuestionNum++;
  2284. doQuestionIds.push(item.questionId);
  2285. }
  2286. } else if (item.type == 2) {
  2287. let isRight =
  2288. item.ans &&
  2289. item.ans.every((quesItem, quesIndex) => {
  2290. if (item.ques) {
  2291. return item.ques[quesIndex] == item.ans[quesIndex];
  2292. } else {
  2293. return false;
  2294. }
  2295. });
  2296. if (isRight) {
  2297. score += item.score;
  2298. number++;
  2299. item.scoreResult = item.score;
  2300. rightQuestionIds.push(item.questionId);
  2301. } else {
  2302. let hasPart = false;
  2303. let checkboxScore = 1; //获取单题总分数
  2304. item.ques &&
  2305. item.ques.forEach((ques, quesIndex) => {
  2306. //选错一个全扣
  2307. if (item.ques) {
  2308. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  2309. checkboxScore = 0;
  2310. }
  2311. } else {
  2312. checkboxScore = 0;
  2313. }
  2314. });
  2315. //没选错
  2316. if (checkboxScore) {
  2317. checkboxScore = 0;
  2318. item.ans.forEach((ans, quesIndex) => {
  2319. //漏选扣一部分,对n题给n X partScore 分
  2320. if (item.ques) {
  2321. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  2322. checkboxScore += item.partScore;
  2323. hasPart = true;
  2324. }
  2325. } else {
  2326. checkboxScore = 0;
  2327. }
  2328. });
  2329. }
  2330. if (!hasPart) {
  2331. //0分
  2332. item.scoreResult = 0;
  2333. if (item.ques) {
  2334. doWrongQuestionIds.push(item.questionId);
  2335. }
  2336. } else {
  2337. //部分分
  2338. // number++;
  2339. lessQuestionNum++;
  2340. // doWrongQuestionIds.push(item.questionId);
  2341. item.scoreResult = checkboxScore;
  2342. score += checkboxScore;
  2343. // rightQuestionIds.push(item.questionId)
  2344. }
  2345. }
  2346. allScore += item.score;
  2347. if (item.ques && item.ques.length) {
  2348. doQuestionNum++;
  2349. doQuestionIds.push(item.questionId);
  2350. }
  2351. } else if (item.type == 3) {
  2352. if (item.ques == item.ans) {
  2353. item.scoreResult = item.score;
  2354. score += item.score;
  2355. number++;
  2356. rightQuestionIds.push(item.questionId);
  2357. } else {
  2358. item.scoreResult = 0;
  2359. if (item.ques) {
  2360. doWrongQuestionIds.push(item.questionId);
  2361. }
  2362. }
  2363. allScore += item.score;
  2364. if (item.ques) {
  2365. doQuestionNum++;
  2366. doQuestionIds.push(item.questionId);
  2367. }
  2368. } else if (item.type == 4) {
  2369. allScore += item.score;
  2370. if (item.ques && item.ques.length) {
  2371. doQuestionNum++;
  2372. doQuestionIds.push(item.questionId);
  2373. }
  2374. } else if (item.type == 5) {
  2375. allScore += item.score;
  2376. if (item.ques && (item.ques.imageList || item.ques.text)) {
  2377. doQuestionNum++;
  2378. doQuestionIds.push(item.questionId);
  2379. }
  2380. }
  2381. });
  2382. //大于分及格
  2383. if (score >= passScore) {
  2384. reportStatus = 1;
  2385. } else {
  2386. reportStatus = 0;
  2387. }
  2388. clearInterval(this.timer);
  2389. //交卷 /bank/record/edit
  2390. this.$request
  2391. .bankRecordEdit({
  2392. moduleId: this.moduleId || 0,
  2393. chapterId: this.chapterId || 0,
  2394. sectionId: this.sectionId || 0,
  2395. gradeId: this.gradeId,
  2396. courseId: this.courseId,
  2397. orderGoodsId: this.orderGoodsId,
  2398. type: this.type, //题卷类型 1章卷 2节卷 3模块卷
  2399. examId: this.examId,
  2400. goodsId: this.goodsId,
  2401. reportStatus: reportStatus,
  2402. recordId: this.recordId,
  2403. rightQuestionNum: number,
  2404. lessQuestionNum: lessQuestionNum,
  2405. status: 1,
  2406. doQuestionIds: doQuestionIds.join(","),
  2407. rightQuestionIds: rightQuestionIds.join(","),
  2408. doQuestionNum: doQuestionNum,
  2409. performance: score,
  2410. totalScore: allScore,
  2411. examTime: parseInt(this.allTimes),
  2412. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2413. historyExamJson: JSON.stringify(this.questionList),
  2414. })
  2415. .then((res) => {
  2416. this.isSubmit = true;
  2417. clearInterval(this.timer);
  2418. this.$message({
  2419. type: "success",
  2420. message: "交卷成功",
  2421. });
  2422. setTimeout(() => {
  2423. let result = {
  2424. rightQuestionNum: number,
  2425. doWrongQuestionNum: doWrongQuestionIds.length,
  2426. score: score,
  2427. totalScore: allScore,
  2428. reportStatus: reportStatus,
  2429. lessQuestionNum: lessQuestionNum,
  2430. };
  2431. this.setExamResult(result);
  2432. this.$router.replace({
  2433. path: "/course-report",
  2434. query: {
  2435. // orderGoodsId: this.orderGoodsId,
  2436. // chapterId: this.chapterId,
  2437. // moduleId: this.moduleId,
  2438. examId: this.examId,
  2439. recordId: this.recordId,
  2440. type: this.type, //type:1章卷,2节卷,3模块卷
  2441. },
  2442. });
  2443. }, 1000);
  2444. })
  2445. .catch((err) => {
  2446. console.log(err, "err");
  2447. });
  2448. //错题集id提交(客观题)/exam/wwrong/record
  2449. this.$request
  2450. .examWrongRecord({
  2451. moduleId: this.moduleId || 0,
  2452. chapterId: this.chapterId || 0,
  2453. sectionId: this.sectionId || 0,
  2454. gradeId: this.gradeId,
  2455. courseId: this.courseId,
  2456. orderGoodsId: this.orderGoodsId,
  2457. examId: this.examId,
  2458. goodsId: this.goodsId,
  2459. questionIds: doWrongQuestionIds,
  2460. recordId: this.recordId,
  2461. type: 2, // 视频课程的传2
  2462. })
  2463. .then((res) => {})
  2464. .catch((err) => {});
  2465. },
  2466. },
  2467. computed: {
  2468. param() {
  2469. return {
  2470. examId: this.examId,
  2471. questionId: this.questionList[this.current]
  2472. ? this.questionList[this.current].questionId
  2473. : undefined,
  2474. goodsId: this.goodsId,
  2475. orderGoodsId: this.orderGoodsId,
  2476. collectQuestionId: this.collectList[this.current]
  2477. ? this.collectList[this.current].collectQuestionId
  2478. : undefined,
  2479. };
  2480. },
  2481. },
  2482. };
  2483. </script>
  2484. <!-- Add "scoped" attribute to limit CSS to this component only -->
  2485. <style scoped lang="scss">
  2486. .course-exam {
  2487. .section {
  2488. overflow: hidden;
  2489. &__header {
  2490. height: 20px;
  2491. margin-top: 20px;
  2492. }
  2493. &__body {
  2494. .explain-record {
  2495. &__header {
  2496. }
  2497. &__body {
  2498. border: 1px solid #eee;
  2499. .left-box {
  2500. position: relative;
  2501. float: left;
  2502. width: 970px;
  2503. min-height: 630px;
  2504. border: 1px solid #eee;
  2505. &__header {
  2506. height: 40px;
  2507. padding-left: 12px;
  2508. border-bottom: 1px solid #eeeeee;
  2509. display: flex;
  2510. align-items: center;
  2511. .progress {
  2512. width: 636px;
  2513. }
  2514. .text {
  2515. margin-left: 15px;
  2516. font-size: 16px;
  2517. span {
  2518. font-family: Microsoft YaHei;
  2519. font-weight: bold;
  2520. color: #3f8dfd;
  2521. line-height: 24px;
  2522. }
  2523. }
  2524. }
  2525. &__body {
  2526. border-bottom: 1px solid #eee;
  2527. .question {
  2528. padding: 12px 0 0 12px;
  2529. display: flex;
  2530. flex-direction: column;
  2531. height: 100%;
  2532. &__title {
  2533. padding-left: 12px;
  2534. font-size: 16px;
  2535. font-family: Microsoft YaHei;
  2536. font-weight: bold;
  2537. color: #333333;
  2538. line-height: 24px;
  2539. }
  2540. &__desc {
  2541. padding-left: 12px;
  2542. margin-top: 20px;
  2543. font-size: 16px;
  2544. font-family: Microsoft YaHei;
  2545. font-weight: 400;
  2546. color: #666666;
  2547. line-height: 24px;
  2548. text-align: justify;
  2549. /deep/ img {
  2550. max-width: 100% !important;
  2551. }
  2552. }
  2553. &__content {
  2554. /deep/ .el-tabs__item {
  2555. padding: 0 20px !important;
  2556. height: 40px;
  2557. line-height: 40px;
  2558. }
  2559. .question__content {
  2560. height: auto;
  2561. overflow: auto;
  2562. }
  2563. .question-list {
  2564. padding: 24px 0 24px 24px;
  2565. border-bottom: 1px solid #eee;
  2566. .checkbox,
  2567. .radio {
  2568. cursor: pointer;
  2569. margin-right: 24px;
  2570. padding: 0 24px;
  2571. display: flex;
  2572. align-items: center;
  2573. margin-top: 2px;
  2574. min-height: 40px;
  2575. padding-top: 10px;
  2576. padding-bottom: 10px;
  2577. background: #f5f9ff;
  2578. border-radius: 8px;
  2579. box-sizing: border-box;
  2580. &.right {
  2581. background: #37c65b;
  2582. }
  2583. &.wrong {
  2584. background: #ff3a30;
  2585. }
  2586. &.user_choose {
  2587. background: #007aff;
  2588. }
  2589. }
  2590. &.textarea {
  2591. margin-right: 12px;
  2592. .upload {
  2593. margin-top: 10px;
  2594. &__imgs {
  2595. margin-right: 10px;
  2596. width: 80px;
  2597. height: 80px;
  2598. background: #ffffff;
  2599. border: 1px solid #eeeeee;
  2600. border-radius: 4px;
  2601. position: relative;
  2602. display: flex;
  2603. float: left;
  2604. align-items: center;
  2605. justify-content: center;
  2606. img {
  2607. max-width: 100%;
  2608. max-height: 100%;
  2609. }
  2610. }
  2611. &__btn {
  2612. margin-right: 10px;
  2613. width: 80px;
  2614. height: 80px;
  2615. background: #ffffff;
  2616. border: 1px solid #eeeeee;
  2617. border-radius: 4px;
  2618. position: relative;
  2619. display: flex;
  2620. float: left;
  2621. align-items: center;
  2622. justify-content: center;
  2623. flex-direction: column;
  2624. .icon {
  2625. font-size: 20px;
  2626. color: #3f8dfd;
  2627. }
  2628. p {
  2629. font-size: 12px;
  2630. font-family: Microsoft YaHei;
  2631. font-weight: 400;
  2632. color: #999999;
  2633. line-height: 24px;
  2634. }
  2635. input {
  2636. position: absolute;
  2637. left: 0;
  2638. top: 0;
  2639. display: block;
  2640. width: 100%;
  2641. height: 100%;
  2642. opacity: 0;
  2643. }
  2644. }
  2645. }
  2646. }
  2647. /deep/
  2648. .el-checkbox__input.is-checked
  2649. + .el-checkbox__label {
  2650. color: #000 !important;
  2651. }
  2652. /deep/
  2653. .el-checkbox__input.is-disabled
  2654. + span.el-checkbox__label {
  2655. color: #000;
  2656. }
  2657. /deep/ .el-checkbox {
  2658. white-space: normal;
  2659. }
  2660. }
  2661. .answer-list {
  2662. height: 40px;
  2663. // border-top: 1px solid #eee;
  2664. border-bottom: 1px solid #eee;
  2665. // margin-top: 24px;
  2666. display: flex;
  2667. align-items: center;
  2668. justify-content: space-between;
  2669. padding: 0 24px;
  2670. &__left {
  2671. font-size: 16px;
  2672. font-family: Microsoft YaHei;
  2673. font-weight: 400;
  2674. color: #333333;
  2675. line-height: 24px;
  2676. }
  2677. &__right {
  2678. font-size: 16px;
  2679. font-family: Microsoft YaHei;
  2680. font-weight: 400;
  2681. color: #333333;
  2682. line-height: 24px;
  2683. }
  2684. }
  2685. .explain-list {
  2686. padding: 12px 24px;
  2687. &__header {
  2688. font-size: 16px;
  2689. font-family: Microsoft YaHei;
  2690. font-weight: bold;
  2691. color: #666666;
  2692. line-height: 24px;
  2693. }
  2694. &__body {
  2695. margin-top: 12px;
  2696. font-size: 16px;
  2697. font-family: Microsoft YaHei;
  2698. font-weight: 400;
  2699. color: #666666;
  2700. line-height: 24px;
  2701. }
  2702. .upload {
  2703. margin-top: 10px;
  2704. &__imgs {
  2705. margin-right: 10px;
  2706. width: 80px;
  2707. height: 80px;
  2708. background: #ffffff;
  2709. border: 1px solid #eeeeee;
  2710. border-radius: 4px;
  2711. position: relative;
  2712. display: flex;
  2713. float: left;
  2714. align-items: center;
  2715. justify-content: center;
  2716. img {
  2717. max-width: 100%;
  2718. max-height: 100%;
  2719. }
  2720. }
  2721. }
  2722. }
  2723. .question {
  2724. padding-bottom: 58px;
  2725. }
  2726. }
  2727. &__btns {
  2728. position: relative;
  2729. height: 32px;
  2730. .submit {
  2731. cursor: pointer;
  2732. margin: 0 auto;
  2733. width: 140px;
  2734. height: 32px;
  2735. background: #3f8dfd;
  2736. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  2737. border-radius: 16px;
  2738. text-align: center;
  2739. line-height: 32px;
  2740. color: #fff;
  2741. font-size: 16px;
  2742. }
  2743. .collect {
  2744. cursor: pointer;
  2745. position: absolute;
  2746. right: 0;
  2747. top: 5px;
  2748. font-size: 12px;
  2749. font-family: Microsoft YaHei;
  2750. font-weight: 400;
  2751. color: #3f8dfd;
  2752. line-height: 24px;
  2753. }
  2754. }
  2755. }
  2756. }
  2757. &__footer {
  2758. height: 40px;
  2759. display: flex;
  2760. justify-content: space-around;
  2761. align-items: center;
  2762. .btn {
  2763. cursor: pointer;
  2764. width: 140px;
  2765. height: 32px;
  2766. background: #ffffff;
  2767. border: 1px solid #3f8dfd;
  2768. border-radius: 16px;
  2769. line-height: 32px;
  2770. text-align: center;
  2771. color: #3f8dfd;
  2772. }
  2773. }
  2774. }
  2775. .right-box {
  2776. float: right;
  2777. width: 299px;
  2778. border-right: 1px solid #eee;
  2779. &__header {
  2780. height: 40px;
  2781. line-height: 40px;
  2782. border-bottom: 1px solid #eeeeee;
  2783. padding: 0 10px;
  2784. .back-btn {
  2785. display: block;
  2786. margin: 0 auto;
  2787. width: 160px;
  2788. }
  2789. .title {
  2790. float: left;
  2791. font-size: 16px;
  2792. font-family: Microsoft YaHei;
  2793. font-weight: bold;
  2794. color: #333333;
  2795. float: left;
  2796. }
  2797. .time {
  2798. font-size: 16px;
  2799. font-family: Microsoft YaHei;
  2800. font-weight: 400;
  2801. color: #666666;
  2802. float: right;
  2803. }
  2804. }
  2805. &__body {
  2806. border-bottom: 1px solid #eee;
  2807. height: 510px;
  2808. .card {
  2809. &__note {
  2810. display: flex;
  2811. height: 64px;
  2812. align-items: center;
  2813. border-bottom: 1px solid #eee;
  2814. flex-wrap: wrap;
  2815. .item {
  2816. display: flex;
  2817. align-items: center;
  2818. margin-left: 10px;
  2819. width: 84px;
  2820. font-size: 12px;
  2821. .box {
  2822. margin-right: 5px;
  2823. width: 16px;
  2824. height: 16px;
  2825. border-radius: 4px;
  2826. &.white {
  2827. background: #ffffff;
  2828. border: 1px solid #eeeeee;
  2829. }
  2830. &.green {
  2831. background: #37c65b;
  2832. }
  2833. &.red {
  2834. background: #ff3a30;
  2835. }
  2836. &.yellow {
  2837. background: #ffc53d;
  2838. }
  2839. &.blue,
  2840. &.check_ans {
  2841. background: #3f8dfd;
  2842. }
  2843. }
  2844. }
  2845. }
  2846. &__content {
  2847. height: 440px;
  2848. overflow-y: scroll;
  2849. &::-webkit-scrollbar {
  2850. width: 6px;
  2851. }
  2852. &::-webkit-scrollbar-track {
  2853. background-color: #fff;
  2854. -webkit-border-radius: 2em;
  2855. -moz-border-radius: 2em;
  2856. border-radius: 2em;
  2857. }
  2858. &::-webkit-scrollbar-thumb {
  2859. background-color: #eeeeee;
  2860. -webkit-border-radius: 2em;
  2861. -moz-border-radius: 2em;
  2862. border-radius: 2em;
  2863. }
  2864. .list {
  2865. display: flex;
  2866. flex-wrap: wrap;
  2867. .item {
  2868. width: 40px;
  2869. height: 40px;
  2870. border-radius: 10px;
  2871. text-align: center;
  2872. line-height: 40px;
  2873. margin-left: 16px;
  2874. margin-top: 16px;
  2875. cursor: pointer;
  2876. &.white {
  2877. line-height: 38px;
  2878. color: #333333;
  2879. background: #ffffff;
  2880. border: 1px solid #eeeeee;
  2881. }
  2882. &.green {
  2883. color: #fff;
  2884. background: #37c65b;
  2885. }
  2886. &.red {
  2887. color: #fff;
  2888. background: #ff3a30;
  2889. }
  2890. &.blue,
  2891. &.check_ans {
  2892. color: #fff;
  2893. background: #3f8dfd;
  2894. }
  2895. &.yellow {
  2896. background: #ffc53d;
  2897. }
  2898. &.disabled {
  2899. cursor: not-allowed;
  2900. line-height: 38px;
  2901. color: #eeeeee;
  2902. background: #ffffff;
  2903. border: 1px solid #eeeeee;
  2904. }
  2905. }
  2906. }
  2907. }
  2908. }
  2909. }
  2910. &__footer {
  2911. border-bottom: 1px solid #eee;
  2912. height: 40px;
  2913. display: flex;
  2914. align-items: center;
  2915. justify-content: center;
  2916. .submit {
  2917. cursor: pointer;
  2918. width: 140px;
  2919. height: 32px;
  2920. background: #3f8dfd;
  2921. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  2922. border-radius: 16px;
  2923. line-height: 32px;
  2924. text-align: center;
  2925. color: #fff;
  2926. font-size: 16px;
  2927. }
  2928. }
  2929. }
  2930. }
  2931. }
  2932. }
  2933. }
  2934. .take-photo {
  2935. /deep/ .el-dialog__header {
  2936. display: none;
  2937. }
  2938. /deep/ .el-dialog__body {
  2939. padding: 0;
  2940. overflow: unset;
  2941. }
  2942. &__close {
  2943. cursor: pointer;
  2944. position: absolute;
  2945. right: 0;
  2946. top: -28px;
  2947. width: 24px;
  2948. height: 24px;
  2949. line-height: 24px;
  2950. text-align: center;
  2951. color: #eee;
  2952. border: 1px solid #eee;
  2953. border-radius: 50%;
  2954. }
  2955. &__header {
  2956. height: 40px;
  2957. border-bottom: 1px solid #eee;
  2958. line-height: 40px;
  2959. font-size: 16px;
  2960. font-family: Microsoft YaHei;
  2961. font-weight: bold;
  2962. color: #333333;
  2963. padding-left: 24px;
  2964. }
  2965. &__body {
  2966. // height: 400px;
  2967. padding: 40px 24px;
  2968. .left-box {
  2969. width: 336px;
  2970. float: left;
  2971. .title {
  2972. font-size: 16px;
  2973. font-family: Microsoft YaHei;
  2974. font-weight: bold;
  2975. color: #ff3b30;
  2976. line-height: 24px;
  2977. }
  2978. .content {
  2979. font-size: 14px;
  2980. font-family: Microsoft YaHei;
  2981. font-weight: 400;
  2982. color: #333333;
  2983. line-height: 28px;
  2984. margin-top: 32px;
  2985. }
  2986. }
  2987. .right-box {
  2988. float: right;
  2989. width: 400px;
  2990. height: 400px;
  2991. position: relative;
  2992. overflow: hidden;
  2993. video {
  2994. width: 100%;
  2995. height: 100%;
  2996. }
  2997. .mask {
  2998. width: 55%;
  2999. height: 200px;
  3000. position: absolute;
  3001. top: 0;
  3002. left: 0;
  3003. right: 0;
  3004. bottom: 0;
  3005. margin: 30px auto 0;
  3006. box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
  3007. }
  3008. }
  3009. }
  3010. &__footer {
  3011. height: 90px;
  3012. border-top: 1px solid #eee;
  3013. text-align: center;
  3014. .take {
  3015. display: inline-block;
  3016. width: 200px;
  3017. height: 40px;
  3018. padding: 0;
  3019. border-radius: 20px;
  3020. text-align: center;
  3021. line-height: 40px;
  3022. margin: 24px auto;
  3023. }
  3024. }
  3025. }
  3026. }
  3027. </style>