index.vue 92 KB

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