index.vue 117 KB

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