index.vue 111 KB

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