index.vue 115 KB

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