index.vue 119 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492
  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="question.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. export default {
  1086. name: "BankExplain",
  1087. components: {
  1088. Footer,
  1089. Header,
  1090. ToolBar,
  1091. CollectionBox,
  1092. HeaderTabBox
  1093. },
  1094. data() {
  1095. return {
  1096. recordId: 0,
  1097. tabIndex: "1",
  1098. textarea: "",
  1099. questionIndex: 0,
  1100. checked: false,
  1101. activeName: "1",
  1102. questionList: [],
  1103. goodsExamConfig: [],
  1104. goodsDetail: {},
  1105. bankList: [],
  1106. judge: ["正确", "错误"],
  1107. ast: [
  1108. "A",
  1109. "B",
  1110. "C",
  1111. "D",
  1112. "E",
  1113. "F",
  1114. "G",
  1115. "H",
  1116. "I",
  1117. "J",
  1118. "K",
  1119. "L",
  1120. "M",
  1121. "N",
  1122. "O",
  1123. "P",
  1124. "Q",
  1125. "R",
  1126. "S",
  1127. "T",
  1128. "U",
  1129. "V",
  1130. "W",
  1131. "X",
  1132. "Y",
  1133. "Z"
  1134. ],
  1135. mustBack: false,
  1136. loading: false,
  1137. needPhoto: false,
  1138. lastTime: 0, //剩余考试时长
  1139. allTimes: 0, //总考试时长
  1140. lastCount: 0,
  1141. examId: 0,
  1142. goodsId: 0,
  1143. moduleId: 0,
  1144. chapterId: 0,
  1145. current: 0,
  1146. bankType: 0,
  1147. timer: null,
  1148. orderGoodsId: "",
  1149. collectList: [],
  1150. isSubmit: false,
  1151. postTimer: null,
  1152. number: "",
  1153. simulateExamId: ""
  1154. };
  1155. },
  1156. async mounted() {
  1157. this.orderGoodsId = this.$route.query.orderGoodsId || "";
  1158. this.current = +this.$route.query.current || 0;
  1159. this.goodsId = this.$route.params.goodsId;
  1160. this.number = this.$route.query.number;
  1161. this.examId = this.$route.query.examId;
  1162. this.moduleId = this.$route.query.moduleId;
  1163. this.chapterId = this.$route.query.chapterId;
  1164. (this.simulateStatus = parseInt(this.$route.query.simulateStatus)),
  1165. await this.bankExam();
  1166. if (!this.number) {
  1167. this.goodsQuestionList();
  1168. } else {
  1169. // 随机练习
  1170. this.goodsExamRandomList();
  1171. }
  1172. },
  1173. beforeDestroy() {
  1174. clearInterval(this.postTimer);
  1175. clearInterval(this.timer);
  1176. try {
  1177. this.$msgbox.close();
  1178. } catch (err) {}
  1179. },
  1180. beforeRouteLeave(to, from, next) {
  1181. if (this.mustBack) {
  1182. next();
  1183. } else {
  1184. if (this.isSubmit) {
  1185. //交卷
  1186. next();
  1187. } else {
  1188. //离开
  1189. if (this.bankType == 1) {
  1190. console.log(1);
  1191. let ansCount = this.questionOverNum(true); //已答题数
  1192. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1193. //所有题目答完
  1194. if (this.lastCount == 0) {
  1195. // this.testOver = true;
  1196. this.$nextTick(() => {
  1197. this.$confirm("您还未交卷,确定结束做题吗?", "温馨提示", {
  1198. confirmButtonText: "结束做题",
  1199. cancelButtonText: "下次继续",
  1200. type: "warning"
  1201. })
  1202. .then(() => {
  1203. this.examSubmit();
  1204. })
  1205. .catch(() => {
  1206. this.examRecordEdit();
  1207. next();
  1208. });
  1209. });
  1210. //未答完
  1211. } else {
  1212. this.$nextTick(() => {
  1213. this.$confirm(
  1214. `您还有${this.lastCount}道题未作答, 现在继续作答,还是下次继续?`,
  1215. "温馨提示",
  1216. {
  1217. confirmButtonText: "继续作答",
  1218. cancelButtonText: "下次继续",
  1219. type: "warning"
  1220. }
  1221. )
  1222. .then(() => {
  1223. // confirmButton回调
  1224. })
  1225. .catch(() => {
  1226. this.examRecordEdit();
  1227. next();
  1228. });
  1229. });
  1230. // this.isLastCount = true;
  1231. }
  1232. } else if (this.bankType == 2) {
  1233. console.log(2);
  1234. let ansCount = this.questionOverNum(true); //已答题数
  1235. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1236. //所有题目答完
  1237. if (this.lastCount == 0) {
  1238. this.$nextTick(() => {
  1239. this.$confirm(`您已完成所有题目,快去交卷吧!`, "温馨提示", {
  1240. confirmButtonText: "立即交卷",
  1241. cancelButtonText: "暂不交卷",
  1242. type: "warning"
  1243. })
  1244. .then(() => {
  1245. // confirmButton回调
  1246. this.examSubmit();
  1247. next();
  1248. })
  1249. .catch(() => {});
  1250. });
  1251. //未答完
  1252. } else {
  1253. this.$nextTick(() => {
  1254. this.$confirm(
  1255. `您当前正在测试,还剩${this.lastCount}道题未完成,离开视为交卷`,
  1256. "温馨提示",
  1257. {
  1258. confirmButtonText: "继续离开",
  1259. cancelButtonText: "暂不离开",
  1260. type: "warning"
  1261. }
  1262. )
  1263. .then(() => {
  1264. this.examSubmit();
  1265. })
  1266. .catch(() => {});
  1267. });
  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 = res.data[0].answerTime * 60;
  1353. this.lastTime = res.data[0].answerTime && res.data[0].answerTime * 60;
  1354. //考试时间到了自动交卷
  1355. if (this.lastTime) {
  1356. this.timer = setInterval(() => {
  1357. if (this.lastTime <= 0) {
  1358. clearInterval(this.timer);
  1359. this.$confirm(`考试时间已到,系统将自动交卷`, "提示", {
  1360. confirmButtonText: "立即交卷",
  1361. closeOnClickModal: false,
  1362. showCancelButton: false,
  1363. closeOnPressEscape: false,
  1364. distinguishCancelAndClose: false,
  1365. showClose: false
  1366. });
  1367. setTimeout(() => {
  1368. try {
  1369. this.$msgbox.close();
  1370. } catch (err) {}
  1371. this.examSubmit();
  1372. }, 3000);
  1373. return;
  1374. }
  1375. this.lastTime--;
  1376. }, 1000);
  1377. } else {
  1378. }
  1379. res.data.forEach((item, index) => {
  1380. item.jsonStr = JSON.parse(item.jsonStr);
  1381. if (item.type == 2) {
  1382. //多选
  1383. item.jsonStr.forEach(str => {
  1384. str.optionsId = "" + str.optionsId;
  1385. });
  1386. let arr = item.answerQuestion.split(",");
  1387. arr.forEach((a, i) => {
  1388. arr[i] = "" + a;
  1389. });
  1390. item.ans = arr;
  1391. item.quesSelect = [];
  1392. item.analysisContent &&
  1393. (item.analysisContent = item.analysisContent.replace(
  1394. /<img/gi,
  1395. '<img style="max-width:100%;"'
  1396. ));
  1397. item.content &&
  1398. (item.content = item.content.replace(
  1399. /<img/gi,
  1400. '<img style="max-width:100%;"'
  1401. ));
  1402. return;
  1403. } else if (item.type == 5) {
  1404. //简答题
  1405. item.ansText = {
  1406. text: "",
  1407. imageList: []
  1408. };
  1409. item.ques = {
  1410. text: "",
  1411. imageList: []
  1412. };
  1413. item.analysisContent &&
  1414. (item.analysisContent = item.analysisContent.replace(
  1415. /<img/gi,
  1416. '<img style="max-width:100%;"'
  1417. ));
  1418. item.content &&
  1419. (item.content = item.content.replace(
  1420. /<img/gi,
  1421. '<img style="max-width:100%;"'
  1422. ));
  1423. return;
  1424. } else if (item.type == 4) {
  1425. //案例题
  1426. console.log(item.jsonStr);
  1427. item.ques = [];
  1428. item.tabIndex = "0";
  1429. let ansArr = [];
  1430. item.jsonStr.forEach((json, index) => {
  1431. if (json.type == 1) {
  1432. ansArr[index] = json.answerQuestion;
  1433. json.content &&
  1434. (json.content = json.content.replace(
  1435. /<img/gi,
  1436. '<img style="max-width:100%;"'
  1437. ));
  1438. } else if (json.type == 2) {
  1439. json.optionsList.forEach(str => {
  1440. str.optionsId = "" + str.optionsId;
  1441. });
  1442. let arr = json.answerQuestion.split(",");
  1443. arr.forEach((a, i) => {
  1444. arr[i] = "" + a;
  1445. });
  1446. ansArr[index] = arr;
  1447. json.content &&
  1448. (json.content = json.content.replace(
  1449. /<img/gi,
  1450. '<img style="max-width:100%;"'
  1451. ));
  1452. } else if (json.type == 3) {
  1453. ansArr[index] = json.answerQuestion;
  1454. json.content &&
  1455. (json.content = json.content.replace(
  1456. /<img/gi,
  1457. '<img style="max-width:100%;"'
  1458. ));
  1459. } else if (json.type == 5) {
  1460. ansArr[index] = {
  1461. text: "",
  1462. imageList: []
  1463. };
  1464. json.ansText = {
  1465. text: "",
  1466. imageList: []
  1467. };
  1468. json.ques = {
  1469. text: "",
  1470. imageList: []
  1471. };
  1472. json.content &&
  1473. (json.content = json.content.replace(
  1474. /<img/gi,
  1475. '<img style="max-width:100%;"'
  1476. ));
  1477. }
  1478. });
  1479. item.ans = ansArr;
  1480. return;
  1481. }
  1482. item.analysisContent &&
  1483. (item.analysisContent = item.analysisContent.replace(
  1484. /<img/gi,
  1485. '<img style="max-width:100%;"'
  1486. ));
  1487. item.content &&
  1488. (item.content = item.content.replace(
  1489. /<img/gi,
  1490. '<img style="max-width:100%;"'
  1491. ));
  1492. item.ques = "";
  1493. item.ans = item.answerQuestion;
  1494. });
  1495. this.questionList = res.data;
  1496. this.lastCount = this.questionList.length;
  1497. this.getCollectInfo(this.current);
  1498. await this.examRecord();
  1499. })
  1500. .catch(err => {
  1501. if (this.doMode == 3) {
  1502. this.$alert("你已做完所有题目", "提示", {
  1503. confirmButtonText: "确定,并且返回上一页",
  1504. showClose: false,
  1505. callback: action => {
  1506. this.mustBack = true;
  1507. this.$router.go(-1);
  1508. return;
  1509. }
  1510. });
  1511. }
  1512. });
  1513. },
  1514. // 随机练习题目
  1515. goodsExamRandomList() {
  1516. this.$request
  1517. .goodsExamRandomList({
  1518. goodsId: this.goodsId,
  1519. number: this.number,
  1520. orderGoodsId: this.orderGoodsId
  1521. })
  1522. .then(async res => {
  1523. if (!res.data.questionList.length) {
  1524. this.$message({
  1525. type: "warning",
  1526. message: "该试卷暂无题目"
  1527. });
  1528. return;
  1529. }
  1530. this.examId = res.data.examId;
  1531. this.bankType = 1;
  1532. res.data.questionList.forEach((item, index) => {
  1533. item.jsonStr = JSON.parse(item.jsonStr);
  1534. console.log(item.type, "item");
  1535. if (item.type == 2) {
  1536. //多选
  1537. item.jsonStr.forEach(str => {
  1538. str.optionsId = "" + str.optionsId;
  1539. });
  1540. let arr = item.answerQuestion.split(",");
  1541. arr.forEach((a, i) => {
  1542. arr[i] = "" + a;
  1543. });
  1544. item.ans = arr;
  1545. item.quesSelect = [];
  1546. item.analysisContent &&
  1547. (item.analysisContent = item.analysisContent.replace(
  1548. /<img/gi,
  1549. '<img style="max-width:100%;"'
  1550. ));
  1551. item.content &&
  1552. (item.content = item.content.replace(
  1553. /<img/gi,
  1554. '<img style="max-width:100%;"'
  1555. ));
  1556. return;
  1557. } else if (item.type == 5) {
  1558. //简答题
  1559. item.ansText = {
  1560. text: "",
  1561. imageList: []
  1562. };
  1563. item.ques = {
  1564. text: "",
  1565. imageList: []
  1566. };
  1567. item.analysisContent &&
  1568. (item.analysisContent = item.analysisContent.replace(
  1569. /<img/gi,
  1570. '<img style="max-width:100%;"'
  1571. ));
  1572. item.content &&
  1573. (item.content = item.content.replace(
  1574. /<img/gi,
  1575. '<img style="max-width:100%;"'
  1576. ));
  1577. return;
  1578. } else if (item.type == 4) {
  1579. //案例题
  1580. console.log(item.jsonStr);
  1581. item.ques = [];
  1582. item.tabIndex = "0";
  1583. let ansArr = [];
  1584. item.jsonStr.forEach((json, index) => {
  1585. if (json.type == 1) {
  1586. ansArr[index] = json.answerQuestion;
  1587. json.content &&
  1588. (json.content = json.content.replace(
  1589. /<img/gi,
  1590. '<img style="max-width:100%;"'
  1591. ));
  1592. } else if (json.type == 2) {
  1593. json.optionsList.forEach(str => {
  1594. str.optionsId = "" + str.optionsId;
  1595. });
  1596. let arr = json.answerQuestion.split(",");
  1597. arr.forEach((a, i) => {
  1598. arr[i] = "" + a;
  1599. });
  1600. ansArr[index] = arr;
  1601. json.content &&
  1602. (json.content = json.content.replace(
  1603. /<img/gi,
  1604. '<img style="max-width:100%;"'
  1605. ));
  1606. } else if (json.type == 3) {
  1607. ansArr[index] = json.answerQuestion;
  1608. json.content &&
  1609. (json.content = json.content.replace(
  1610. /<img/gi,
  1611. '<img style="max-width:100%;"'
  1612. ));
  1613. } else if (json.type == 5) {
  1614. ansArr[index] = {
  1615. text: "",
  1616. imageList: []
  1617. };
  1618. json.ansText = {
  1619. text: "",
  1620. imageList: []
  1621. };
  1622. json.ques = {
  1623. text: "",
  1624. imageList: []
  1625. };
  1626. json.content &&
  1627. (json.content = json.content.replace(
  1628. /<img/gi,
  1629. '<img style="max-width:100%;"'
  1630. ));
  1631. }
  1632. });
  1633. item.ans = ansArr;
  1634. return;
  1635. }
  1636. item.analysisContent &&
  1637. (item.analysisContent = item.analysisContent.replace(
  1638. /<img/gi,
  1639. '<img style="max-width:100%;"'
  1640. ));
  1641. item.content &&
  1642. (item.content = item.content.replace(
  1643. /<img/gi,
  1644. '<img style="max-width:100%;"'
  1645. ));
  1646. item.ques = "";
  1647. item.ans = item.answerQuestion;
  1648. });
  1649. this.questionList = res.data.questionList;
  1650. this.lastCount = this.questionList.length;
  1651. this.getCollectInfo(this.current);
  1652. await this.examRecord();
  1653. });
  1654. },
  1655. /**
  1656. * 记录总题数,获取recordId
  1657. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1658. */
  1659. examRecord(hasSpecial) {
  1660. return new Promise(resolve => {
  1661. let self = this;
  1662. let questionList = 0;
  1663. // if(!hasSpecial) {
  1664. this.questionList.forEach((item, index) => {
  1665. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1666. questionList++;
  1667. }
  1668. });
  1669. // } else {
  1670. // questionList = this.questionList.length;
  1671. // }
  1672. this.$request
  1673. .examRecord({
  1674. chapterExamId: this.chapterId || 0,
  1675. moduleExamId: this.moduleId || 0,
  1676. examId: this.examId,
  1677. goodsId: this.goodsId,
  1678. orderGoodsId: this.orderGoodsId,
  1679. totalQuestionNum: questionList,
  1680. allQuestionNum: this.questionList.length,
  1681. doMode: this.doMode,
  1682. simulateExamId: this.simulateExamId
  1683. })
  1684. .then(res => {
  1685. this.recordId = res.data;
  1686. if (this.bankType == 1) {
  1687. this.examRecordEdit();
  1688. clearInterval(this.postTimer);
  1689. this.postTimer = setInterval(() => {
  1690. this.examRecordEdit();
  1691. }, 5000);
  1692. }
  1693. });
  1694. });
  1695. },
  1696. /**
  1697. * 离开页面统计回答正确题数
  1698. */
  1699. examRecordEdit() {
  1700. clearInterval(this.postTimer);
  1701. clearInterval(this.timer);
  1702. let number = 0;
  1703. let score = 0;
  1704. let doQuestionNum = 0;
  1705. let doQuestionIds = []; //做过的题目id
  1706. let lessQuestionNum = 0;
  1707. this.questionList.forEach((item, index) => {
  1708. if (item.type == 1) {
  1709. if (item.ques == item.ans) {
  1710. score += item.score;
  1711. number++;
  1712. }
  1713. if (item.ques) {
  1714. doQuestionNum++;
  1715. doQuestionIds.push(item.questionId);
  1716. }
  1717. } else if (item.type == 2) {
  1718. let isRight =
  1719. item.ans &&
  1720. item.ans.every((quesItem, quesIndex) => {
  1721. if (item.ques) {
  1722. return item.ques[quesIndex] == item.ans[quesIndex];
  1723. } else {
  1724. return false;
  1725. }
  1726. });
  1727. if (isRight) {
  1728. score += item.score;
  1729. number++;
  1730. } else {
  1731. let hasPart = false;
  1732. let checkboxScore = 1; //获取单题总分数
  1733. item.ques &&
  1734. item.ques.forEach((ques, quesIndex) => {
  1735. //选错一个全扣
  1736. if (item.ques) {
  1737. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1738. checkboxScore = 0;
  1739. }
  1740. } else {
  1741. checkboxScore = 0;
  1742. }
  1743. });
  1744. console.log(checkboxScore);
  1745. //没选错
  1746. if (checkboxScore) {
  1747. checkboxScore = 0;
  1748. item.ans.forEach((ans, quesIndex) => {
  1749. //漏选扣一部分,对n题给n X partScore 分
  1750. if (item.ques) {
  1751. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  1752. checkboxScore += item.partScore;
  1753. hasPart = true;
  1754. }
  1755. } else {
  1756. checkboxScore = 0;
  1757. }
  1758. });
  1759. }
  1760. if (!hasPart) {
  1761. //0分
  1762. } else {
  1763. //部分分
  1764. // number++;
  1765. lessQuestionNum++;
  1766. score += checkboxScore;
  1767. }
  1768. }
  1769. if (item.ques && item.ques.length) {
  1770. doQuestionNum++;
  1771. doQuestionIds.push(item.questionId);
  1772. }
  1773. } else if (item.type == 3) {
  1774. if (item.ques == item.ans) {
  1775. score += item.score;
  1776. number++;
  1777. }
  1778. if (item.ques) {
  1779. doQuestionNum++;
  1780. doQuestionIds.push(item.questionId);
  1781. }
  1782. } else if (item == 4) {
  1783. if (item.ques.length) {
  1784. doQuestionNum++;
  1785. doQuestionIds.push(item.questionId);
  1786. }
  1787. } else if (item.type == 5) {
  1788. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  1789. doQuestionNum++;
  1790. doQuestionIds.push(item.questionId);
  1791. }
  1792. }
  1793. });
  1794. this.$request
  1795. .examRecordEdit({
  1796. examId: this.examId,
  1797. goodsId: this.goodsId,
  1798. recordId: this.recordId,
  1799. orderGoodsId: this.orderGoodsId,
  1800. doQuestionIds: doQuestionIds.join(","),
  1801. rightQuestionNum: number,
  1802. moduleExamId: this.moduleId || 0,
  1803. chapterExamId: this.chapterId || 0,
  1804. lessQuestionNum: lessQuestionNum,
  1805. status: 0,
  1806. doQuestionNum: doQuestionNum,
  1807. historyExamJson: JSON.stringify(this.questionList)
  1808. })
  1809. .then(res => {
  1810. this.punchClock();
  1811. });
  1812. },
  1813. /**
  1814. * 获取试卷类型2考试,1练习
  1815. */
  1816. bankExam() {
  1817. return new Promise(resolve => {
  1818. if (this.examType) {
  1819. this.bankType = 1;
  1820. resolve();
  1821. return;
  1822. }
  1823. this.$request.bankExam(this.examId).then(res => {
  1824. this.bankType = res.data.doType;
  1825. if (this.bankType == 2) {
  1826. this.needBack = true;
  1827. }
  1828. resolve();
  1829. });
  1830. });
  1831. },
  1832. /**
  1833. * @param {Object}
  1834. * 单选点击确认
  1835. */
  1836. radioSelect(question, questionIndex, optionsId) {
  1837. // if (this.questionList[questionIndex].ques) return;
  1838. if (this.questionList[questionIndex].ques && this.bankType == 1) {
  1839. return;
  1840. }
  1841. this.$set(this.questionList[questionIndex], "ques", optionsId);
  1842. this.isDoOver();
  1843. // if (
  1844. // this.questionList[questionIndex].ques !=
  1845. // this.questionList[questionIndex].ans
  1846. // ) {
  1847. // this.$request
  1848. // .examWrongRecord({
  1849. // orderGoodsId: this.orderGoodsId,
  1850. // examId: this.examId,
  1851. // goodsId: this.goodsId,
  1852. // moduleExamId: this.moduleId || 0,
  1853. // chapterExamId: this.chapterId || 0,
  1854. // questionIds: [this.questionList[questionIndex].questionId],
  1855. // recordId: this.recordId,
  1856. // type 1,
  1857. // })
  1858. // .then((res) => {});
  1859. // }
  1860. },
  1861. /**
  1862. * @param {Object}
  1863. * 案例单选点击
  1864. */
  1865. radioSelectChild(questionIndex, jsonIndex, optionsId) {
  1866. // if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1867. if (
  1868. this.questionList[questionIndex].ques[jsonIndex] &&
  1869. this.bankType == 1
  1870. ) {
  1871. return;
  1872. }
  1873. this.$set(this.questionList[questionIndex].ques, jsonIndex, optionsId);
  1874. this.isDoOver();
  1875. },
  1876. /**
  1877. * 多选点击确认
  1878. */
  1879. checkboxSubmit(question, questionIndex) {
  1880. // if (this.questionList[questionIndex].ques) return;
  1881. if (this.questionList[questionIndex].ques && this.bankType == 1) {
  1882. return;
  1883. }
  1884. let arr = [];
  1885. this.questionList[questionIndex].jsonStr.forEach(item => {
  1886. if (item.checked) {
  1887. arr.push(item.optionsId);
  1888. }
  1889. });
  1890. if (!arr.length) {
  1891. delete this.questionList[questionIndex].ques;
  1892. this.$message({
  1893. type: "warning",
  1894. message: "请选择答案"
  1895. });
  1896. return;
  1897. }
  1898. this.$set(this.questionList[questionIndex], "ques", arr);
  1899. this.isDoOver();
  1900. // let isWrong = this.questionList[questionIndex].ques.some((item, i) => {
  1901. // return this.questionList[questionIndex].ans.indexOf(item) == -1;
  1902. // })
  1903. // // 回答错误
  1904. // if (isWrong) {
  1905. // this.$request
  1906. // .examWrongRecord({
  1907. // orderGoodsId: this.orderGoodsId,
  1908. // examId: this.examId,
  1909. // goodsId: this.goodsId,
  1910. // moduleExamId: this.moduleId || 0,
  1911. // chapterExamId: this.chapterId || 0,
  1912. // questionIds: [this.questionList[questionIndex].questionId],
  1913. // recordId: this.recordId,
  1914. // type 1,
  1915. // })
  1916. // .then((res) => {});
  1917. // }
  1918. },
  1919. /**
  1920. * @param {Object}
  1921. * 案例多选确认
  1922. */
  1923. checkboxSubmitChild(questionIndex, ansIndex) {
  1924. // if (this.questionList[questionIndex].ques[ansIndex]) return;
  1925. if (
  1926. this.questionList[questionIndex].ques[ansIndex] &&
  1927. this.bankType == 1
  1928. ) {
  1929. return;
  1930. }
  1931. let arr = [];
  1932. this.questionList[questionIndex].jsonStr[ansIndex].optionsList.forEach(
  1933. item => {
  1934. if (item.checked) {
  1935. arr.push(item.optionsId);
  1936. }
  1937. }
  1938. );
  1939. if (!arr.length) {
  1940. delete this.questionList[questionIndex].ques[ansIndex];
  1941. this.$message({
  1942. type: "warning",
  1943. message: "请选择答案"
  1944. });
  1945. return;
  1946. }
  1947. this.$set(this.questionList[questionIndex].ques, ansIndex, arr);
  1948. this.isDoOver();
  1949. },
  1950. /**
  1951. * 判断点击确认
  1952. */
  1953. judgeSelect(question, questionIndex, index) {
  1954. console.log(this.bankType);
  1955. // if (question.ques) return;
  1956. if (question.ques && this.bankType == 1) {
  1957. return;
  1958. }
  1959. this.$set(
  1960. this.questionList[questionIndex],
  1961. "ques",
  1962. index == 0 ? "1" : "0"
  1963. );
  1964. this.isDoOver();
  1965. // if (
  1966. // this.questionList[questionIndex].ques !=
  1967. // this.questionList[questionIndex].ans
  1968. // ) {
  1969. // this.$request
  1970. // .examWrongRecord({
  1971. // orderGoodsId: this.orderGoodsId,
  1972. // examId: this.examId,
  1973. // goodsId: this.goodsId,
  1974. // moduleExamId: this.moduleId || 0,
  1975. // chapterExamId: this.chapterId || 0,
  1976. // questionIds: [this.questionList[questionIndex].questionId],
  1977. // recordId: this.recordId,
  1978. // type 1,
  1979. // })
  1980. // .then((res) => {});
  1981. // }
  1982. },
  1983. judgeSelectChild(questionIndex, jsonIndex, index) {
  1984. console.log(this.questionList[questionIndex].ques[jsonIndex]);
  1985. // if (this.questionList[questionIndex].ques[jsonIndex]) return;
  1986. if (
  1987. this.questionList[questionIndex].ques[jsonIndex] &&
  1988. this.bankType == 1
  1989. ) {
  1990. return;
  1991. }
  1992. this.$set(
  1993. this.questionList[questionIndex].ques,
  1994. jsonIndex,
  1995. index == 0 ? "1" : "0"
  1996. );
  1997. this.isDoOver();
  1998. },
  1999. /**
  2000. * 上传图片
  2001. */
  2002. uploadImg(e, question, questionIndex) {
  2003. var file = e.target.files[0];
  2004. if (file.size > 2 * 1024 * 1024) {
  2005. this.$message.warn("图片不得大于2000kb");
  2006. return;
  2007. }
  2008. var type = e.target.value
  2009. .toLowerCase()
  2010. .split(".")
  2011. .splice(-1);
  2012. if (
  2013. type[0] != "jpg" &&
  2014. type[0] != "png" &&
  2015. type[0] != "jpeg" &&
  2016. type[0] != "gif"
  2017. ) {
  2018. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  2019. e.target.value = "";
  2020. return;
  2021. }
  2022. this.$upload.upload(file, 0).then(res => {
  2023. question.ansText.imageList.push(res);
  2024. });
  2025. },
  2026. /**
  2027. * 案例上传图片
  2028. */
  2029. uploadImgChild(e, questionIndex, jsonIndex) {
  2030. var file = e.target.files[0];
  2031. if (file.size > 2 * 1024 * 1024) {
  2032. this.$message.warn("图片不得大于2000kb");
  2033. return;
  2034. }
  2035. var type = e.target.value
  2036. .toLowerCase()
  2037. .split(".")
  2038. .splice(-1);
  2039. if (
  2040. type[0] != "jpg" &&
  2041. type[0] != "png" &&
  2042. type[0] != "jpeg" &&
  2043. type[0] != "gif"
  2044. ) {
  2045. this.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  2046. e.target.value = "";
  2047. return;
  2048. }
  2049. this.$upload.upload(file, 0).then(res => {
  2050. this.questionList[questionIndex].jsonStr[
  2051. jsonIndex
  2052. ].ansText.imageList.push(res);
  2053. });
  2054. },
  2055. isOver(item, index) {
  2056. if (this.questionList[index].ques) {
  2057. if (item.type == 4) {
  2058. //案例题
  2059. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  2060. if (
  2061. jsonItem.type == 1 ||
  2062. jsonItem.type == 2 ||
  2063. jsonItem.type == 3
  2064. ) {
  2065. if (item.ques[indexs]) {
  2066. return true;
  2067. } else {
  2068. return false;
  2069. }
  2070. } else if (jsonItem.type == 5) {
  2071. if (
  2072. item.ques[indexs] &&
  2073. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  2074. ) {
  2075. console.log("chil");
  2076. return true;
  2077. } else {
  2078. return false;
  2079. }
  2080. }
  2081. });
  2082. if (isOver) {
  2083. return true;
  2084. } else {
  2085. return false;
  2086. }
  2087. } else if (item.type == 5) {
  2088. //简答题
  2089. //每一项都相等
  2090. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2091. return true;
  2092. }
  2093. //判断
  2094. } else {
  2095. return false;
  2096. }
  2097. } else {
  2098. return false;
  2099. }
  2100. },
  2101. ansSubmit(question, questionIndex) {
  2102. if (!question.ansText.text && !question.ansText.imageList.length) {
  2103. this.$message({
  2104. type: "warning",
  2105. message: "请输入内容或上传图片"
  2106. });
  2107. return;
  2108. }
  2109. question.ques.imageList = question.ansText.imageList;
  2110. question.ques.text = question.ansText.text;
  2111. this.isDoOver();
  2112. console.log(question.ques);
  2113. },
  2114. ansSubmitChild(question, questionIndex, jsonIndex) {
  2115. if (
  2116. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text &&
  2117. !this.questionList[questionIndex].jsonStr[jsonIndex].ansText.imageList
  2118. .length
  2119. ) {
  2120. this.$message({
  2121. type: "warning",
  2122. message: "请输入内容或上传图片"
  2123. });
  2124. return;
  2125. }
  2126. this.$set(this.questionList[questionIndex].ques, jsonIndex, {
  2127. imageList:
  2128. this.questionList[questionIndex].jsonStr[jsonIndex].ansText
  2129. .imageList || [],
  2130. text:
  2131. this.questionList[questionIndex].jsonStr[jsonIndex].ansText.text || ""
  2132. });
  2133. this.isDoOver();
  2134. },
  2135. changeIndex(index) {
  2136. this.current = index;
  2137. this.getCollectInfo(this.current);
  2138. },
  2139. nextQuestion() {
  2140. if (this.current >= this.questionList.length - 1) {
  2141. this.$message({
  2142. type: "warning",
  2143. message: "已经是最后一题了!"
  2144. });
  2145. return;
  2146. }
  2147. this.current++;
  2148. this.getCollectInfo(this.current);
  2149. },
  2150. prevQuestion() {
  2151. if (this.current == 0) {
  2152. this.$message({
  2153. type: "warning",
  2154. message: "已经是第一题了!"
  2155. });
  2156. return;
  2157. } else {
  2158. this.current--;
  2159. this.getCollectInfo(this.current);
  2160. }
  2161. },
  2162. isCheck(item, index) {
  2163. if (item.type === 4) {
  2164. if (
  2165. this.questionList[index].ques &&
  2166. this.questionList[index].ques.length
  2167. ) {
  2168. return true;
  2169. }
  2170. } else {
  2171. if (this.questionList[index].ques) {
  2172. return true;
  2173. }
  2174. }
  2175. },
  2176. isRight(item, index) {
  2177. //单选
  2178. if (this.questionList[index].ques) {
  2179. if (item.type == 1) {
  2180. console.log(
  2181. this.questionList[index].ques == this.questionList[index].ans
  2182. );
  2183. return this.questionList[index].ques == this.questionList[index].ans;
  2184. //多选
  2185. } else if (item.type == 2) {
  2186. //每一项都相等
  2187. return this.questionList[index].ans.every((item, i) => {
  2188. return item == this.questionList[index].ques[i];
  2189. });
  2190. //判断
  2191. } else if (item.type == 3) {
  2192. return this.questionList[index].ques == this.questionList[index].ans;
  2193. } else {
  2194. return false;
  2195. }
  2196. } else {
  2197. return false;
  2198. }
  2199. },
  2200. isWrong(item, index) {
  2201. if (this.questionList[index].ques) {
  2202. //单选
  2203. if (item.type == 1) {
  2204. return this.questionList[index].ques != this.questionList[index].ans;
  2205. //多选
  2206. } else if (item.type == 2) {
  2207. //每一项都相等
  2208. return this.questionList[index].ques.some((item, i) => {
  2209. return this.questionList[index].ans.indexOf(item) == -1;
  2210. });
  2211. //判断
  2212. } else if (item.type == 3) {
  2213. return this.questionList[index].ques != this.questionList[index].ans;
  2214. } else {
  2215. return false;
  2216. }
  2217. } else {
  2218. return false;
  2219. }
  2220. },
  2221. isPart(item, index) {
  2222. if (this.questionList[index].ques) {
  2223. if (item.type == 2) {
  2224. let isWrong = this.questionList[index].ques.some((item, i) => {
  2225. return this.questionList[index].ans.indexOf(item) == -1;
  2226. });
  2227. let isRight = this.questionList[index].ans.every((item, i) => {
  2228. return item == this.questionList[index].ques[i];
  2229. });
  2230. if (!isRight && !isWrong) {
  2231. return true;
  2232. }
  2233. }
  2234. } else {
  2235. return false;
  2236. }
  2237. },
  2238. right(bankIndex, ansIndex, option) {
  2239. if (
  2240. this.questionList[bankIndex].ques[ansIndex] &&
  2241. this.questionList[bankIndex].ans[ansIndex]
  2242. ) {
  2243. if (
  2244. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2245. option.optionsId
  2246. ) != -1 ||
  2247. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2248. option.optionsId
  2249. ) != -1
  2250. ) {
  2251. return true;
  2252. } else {
  2253. return false;
  2254. }
  2255. } else {
  2256. return false;
  2257. }
  2258. },
  2259. wrong(bankIndex, ansIndex, option) {
  2260. if (
  2261. this.questionList[bankIndex].ques[ansIndex] &&
  2262. this.questionList[bankIndex].ans[ansIndex]
  2263. ) {
  2264. if (
  2265. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2266. option.optionsId
  2267. ) != -1 &&
  2268. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2269. option.optionsId
  2270. ) == -1
  2271. ) {
  2272. return true;
  2273. } else {
  2274. return false;
  2275. }
  2276. } else {
  2277. return false;
  2278. }
  2279. },
  2280. /**
  2281. * 获取已经回答的题目数
  2282. * hasSpecail (是否包含简答和案例)
  2283. */
  2284. questionOverNum(hasSpecail) {
  2285. let count = 0;
  2286. this.questionList.forEach(item => {
  2287. if (item.type == 1 || item.type == 2 || item.type == 3) {
  2288. if (item.ques) {
  2289. count++;
  2290. }
  2291. } else if (item.type == 4) {
  2292. //案例题
  2293. if (hasSpecail) {
  2294. let isOver = item.jsonStr.every((jsonItem, index) => {
  2295. if (
  2296. jsonItem.type == 1 ||
  2297. jsonItem.type == 2 ||
  2298. jsonItem.type == 3
  2299. ) {
  2300. if (item.ques[index]) {
  2301. return true;
  2302. } else {
  2303. return false;
  2304. }
  2305. } else if (jsonItem.type == 5) {
  2306. if (
  2307. item.ques[index] &&
  2308. (item.ques[index].text || item.ques[index].imageList.length)
  2309. ) {
  2310. return true;
  2311. } else {
  2312. return false;
  2313. }
  2314. }
  2315. });
  2316. if (isOver) {
  2317. count++;
  2318. console.log(item, 4441);
  2319. }
  2320. }
  2321. } else if (item.type == 5) {
  2322. //简答题
  2323. if (hasSpecail) {
  2324. if (item.ques && (item.ques.text || item.ques.imageList.length)) {
  2325. console.log(5, item);
  2326. count++;
  2327. }
  2328. }
  2329. }
  2330. });
  2331. return count;
  2332. },
  2333. submit() {
  2334. let ansCount = this.questionOverNum(true); //已答题数
  2335. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  2336. //没有答完
  2337. if (this.lastCount > 0) {
  2338. this.$confirm(
  2339. `您还有${this.lastCount}道题未作答, 现在继续作答,还是下次继续?`,
  2340. "提示",
  2341. {
  2342. confirmButtonText: "立即交卷",
  2343. cancelButtonText: "继续做题",
  2344. closeOnClickModal: false,
  2345. closeOnPressEscape: false,
  2346. distinguishCancelAndClose: false,
  2347. showClose: false
  2348. }
  2349. )
  2350. .then(_ => {
  2351. this.examSubmit();
  2352. })
  2353. .catch(_ => {});
  2354. return;
  2355. }
  2356. if (this.bankType == 2) {
  2357. if (this.lastTime > 0) {
  2358. let lastTime = this.countdown(this.lastTime);
  2359. this.$confirm(`时间还剩余${lastTime},确定交卷吗?`, "提示", {
  2360. confirmButtonText: "交卷",
  2361. cancelButtonText: "继续答题",
  2362. closeOnClickModal: false,
  2363. closeOnPressEscape: false,
  2364. distinguishCancelAndClose: false,
  2365. showClose: false
  2366. })
  2367. .then(_ => {
  2368. this.examSubmit();
  2369. })
  2370. .catch(_ => {});
  2371. return;
  2372. }
  2373. }
  2374. this.examSubmit();
  2375. },
  2376. /**
  2377. * @param {Object} second倒计时过滤器
  2378. */
  2379. countdown(second) {
  2380. if (second) {
  2381. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  2382. let m = parseInt((second / 60) % 60); // 计算分数
  2383. let s = parseInt(second % 60); // 计算当前秒数
  2384. if (h < 10) h = "0" + h;
  2385. if (m < 10) m = "0" + m;
  2386. if (s < 10) s = "0" + s;
  2387. return h + ":" + m + ":" + s;
  2388. } else {
  2389. return "";
  2390. }
  2391. },
  2392. /**
  2393. * 交卷,跳转报告页
  2394. */
  2395. examSubmit() {
  2396. this.loading = true;
  2397. clearInterval(this.timer);
  2398. clearInterval(this.postTimer);
  2399. let score = 0; //计算总分
  2400. let reportStatus = 0;
  2401. let number = 0; //做对的题目数量
  2402. let doQuestionNum = 0; //做过的题目数量
  2403. let allScore = 0; //总分
  2404. let passScore = 0;
  2405. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  2406. let doQuestionIds = []; //做过的题目id
  2407. let rightQuestionIds = []; //做对的题目id
  2408. let lessQuestionNum = 0;
  2409. this.questionList.forEach((item, index) => {
  2410. passScore = item.passScore;
  2411. if (item.type == 1) {
  2412. //正确
  2413. if (item.ques == item.ans) {
  2414. item.scoreResult = item.score;
  2415. score += item.score;
  2416. number++;
  2417. rightQuestionIds.push(item.questionId);
  2418. } else {
  2419. //错误
  2420. item.scoreResult = 0;
  2421. if (item.ques) {
  2422. doWrongQuestionIds.push(item.questionId);
  2423. }
  2424. }
  2425. allScore += item.score;
  2426. if (item.ques) {
  2427. doQuestionNum++;
  2428. doQuestionIds.push(item.questionId);
  2429. }
  2430. } else if (item.type == 2) {
  2431. let isRight =
  2432. item.ans &&
  2433. item.ans.every((quesItem, quesIndex) => {
  2434. if (item.ques) {
  2435. console.log(
  2436. "ques:",
  2437. item.ques,
  2438. item.ans,
  2439. item.ques[quesIndex],
  2440. item.ans[quesIndex],
  2441. quesIndex
  2442. );
  2443. return item.ques[quesIndex] == item.ans[quesIndex];
  2444. } else {
  2445. return false;
  2446. }
  2447. });
  2448. if (isRight) {
  2449. score += item.score;
  2450. number++;
  2451. item.scoreResult = item.score;
  2452. rightQuestionIds.push(item.questionId);
  2453. } else {
  2454. let hasPart = false;
  2455. let checkboxScore = 1; //获取单题总分数
  2456. item.ques &&
  2457. item.ques.forEach((ques, quesIndex) => {
  2458. //选错一个全扣
  2459. if (item.ques) {
  2460. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  2461. checkboxScore = 0;
  2462. }
  2463. } else {
  2464. checkboxScore = 0;
  2465. }
  2466. });
  2467. console.log(checkboxScore, "checkboxScore1");
  2468. //没选错
  2469. if (checkboxScore) {
  2470. checkboxScore = 0;
  2471. item.ans.forEach((ans, quesIndex) => {
  2472. //漏选扣一部分,对n题给n X partScore 分
  2473. if (item.ques) {
  2474. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  2475. checkboxScore += item.partScore;
  2476. hasPart = true;
  2477. }
  2478. } else {
  2479. checkboxScore = 0;
  2480. }
  2481. });
  2482. }
  2483. console.log(checkboxScore, "checkboxScore2");
  2484. if (!hasPart) {
  2485. //0分
  2486. item.scoreResult = 0;
  2487. if (item.ques) {
  2488. doWrongQuestionIds.push(item.questionId);
  2489. }
  2490. } else {
  2491. //部分分
  2492. // number++;
  2493. lessQuestionNum++;
  2494. // doWrongQuestionIds.push(item.questionId);
  2495. item.scoreResult = checkboxScore;
  2496. score += checkboxScore;
  2497. // rightQuestionIds.push(item.questionId)
  2498. }
  2499. }
  2500. allScore += item.score;
  2501. if (item.ques && item.ques.length) {
  2502. doQuestionNum++;
  2503. doQuestionIds.push(item.questionId);
  2504. }
  2505. } else if (item.type == 3) {
  2506. if (item.ques == item.ans) {
  2507. item.scoreResult = item.score;
  2508. score += item.score;
  2509. number++;
  2510. rightQuestionIds.push(item.questionId);
  2511. } else {
  2512. item.scoreResult = 0;
  2513. if (item.ques) {
  2514. doWrongQuestionIds.push(item.questionId);
  2515. }
  2516. }
  2517. allScore += item.score;
  2518. if (item.ques) {
  2519. doQuestionNum++;
  2520. doQuestionIds.push(item.questionId);
  2521. }
  2522. } else if (item.type == 4) {
  2523. allScore += item.score;
  2524. if (item.ques && item.ques.length) {
  2525. doQuestionNum++;
  2526. doQuestionIds.push(item.questionId);
  2527. }
  2528. } else if (item.type == 5) {
  2529. allScore += item.score;
  2530. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2531. doQuestionNum++;
  2532. doQuestionIds.push(item.questionId);
  2533. }
  2534. }
  2535. });
  2536. //大于及格
  2537. if (score >= passScore) {
  2538. reportStatus = 1;
  2539. } else {
  2540. reportStatus = 0;
  2541. }
  2542. // setTimeout(() => {
  2543. // let result = {
  2544. // chapterId: this.chapterId,
  2545. // moduleId: this.moduleId,
  2546. // examId: this.examId,
  2547. // recordId: this.recordId,
  2548. // };
  2549. // this.setExamResult(result);
  2550. // this.$router.push({
  2551. // path: "/bank-report/" + this.goodsId,
  2552. // });
  2553. // }, 1000);
  2554. // return;
  2555. //交卷 /exam/record/edit
  2556. this.$request
  2557. .examRecordEdit({
  2558. examId: this.examId,
  2559. goodsId: this.goodsId,
  2560. orderGoodsId: this.orderGoodsId,
  2561. reportStatus: reportStatus,
  2562. recordId: this.recordId,
  2563. lessQuestionNum: lessQuestionNum,
  2564. rightQuestionNum: number,
  2565. status: 1,
  2566. moduleExamId: this.moduleId || 0,
  2567. chapterExamId: this.chapterId || 0,
  2568. doQuestionIds: doQuestionIds.join(","),
  2569. rightQuestionIds: rightQuestionIds.join(","),
  2570. doQuestionNum: doQuestionNum,
  2571. performance: score,
  2572. totalScore: allScore,
  2573. examTime: parseInt(this.allTimes),
  2574. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2575. historyExamJson: JSON.stringify(this.questionList)
  2576. })
  2577. .then(res => {
  2578. this.isSubmit = true;
  2579. this.loading = false;
  2580. this.$message({
  2581. type: "success",
  2582. message: "交卷成功"
  2583. });
  2584. this.punchClock();
  2585. setTimeout(() => {
  2586. this.$router.replace({
  2587. path: "/bank-report/" + this.goodsId,
  2588. query: {
  2589. orderGoodsId: this.orderGoodsId,
  2590. chapterId: this.chapterId,
  2591. moduleId: this.moduleId,
  2592. examId: this.examId,
  2593. recordId: this.recordId,
  2594. examType: this.examType
  2595. }
  2596. });
  2597. }, 1000);
  2598. })
  2599. .catch(err => {
  2600. this.loading = false;
  2601. });
  2602. //错题集id提交(客观题)/exam/wwrong/record
  2603. this.$request
  2604. .examWrongRecord({
  2605. orderGoodsId: this.orderGoodsId,
  2606. examId: this.examId,
  2607. goodsId: this.goodsId,
  2608. questionIds: doWrongQuestionIds,
  2609. recordId: this.recordId,
  2610. type: 1,
  2611. doMode: this.doMode,
  2612. courseType: 1
  2613. })
  2614. .then(res => {})
  2615. .catch(err => {});
  2616. },
  2617. // 打卡
  2618. punchClock() {
  2619. if (this.examType != 1) {
  2620. return;
  2621. }
  2622. this.$request.punchClock({
  2623. chapterExamId: this.chapterId,
  2624. examId: this.examId,
  2625. goodsId: this.goodsId,
  2626. moduleExamId: this.moduleId,
  2627. recordTime: new Date(new Date().setHours(0, 0, 0, 0)) / 1000
  2628. });
  2629. },
  2630. /**
  2631. * 交卷,不用跳转
  2632. */
  2633. leaveNow() {
  2634. clearInterval(this.timer);
  2635. clearInterval(this.postTimer);
  2636. let score = 0; //计算总分
  2637. let reportStatus = 0;
  2638. let number = 0; //做对的题目数量
  2639. let doQuestionNum = 0; //做过的题目数量
  2640. let allScore = 0; //总分
  2641. let passScore = 0;
  2642. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  2643. let doQuestionIds = []; //做过的题目id
  2644. let rightQuestionIds = []; //做对的题目id
  2645. let lessQuestionNum = 0;
  2646. console.log(111);
  2647. this.questionList.forEach((item, index) => {
  2648. passScore = item.passScore;
  2649. if (item.type == 1) {
  2650. //正确
  2651. if (item.ques == item.ans) {
  2652. item.scoreResult = item.score;
  2653. score += item.score;
  2654. number++;
  2655. rightQuestionIds.push(item.questionId);
  2656. } else {
  2657. //错误
  2658. item.scoreResult = 0;
  2659. if (item.ques) {
  2660. doWrongQuestionIds.push(item.questionId);
  2661. }
  2662. }
  2663. allScore += item.score;
  2664. if (item.ques) {
  2665. doQuestionNum++;
  2666. doQuestionIds.push(item.questionId);
  2667. }
  2668. } else if (item.type == 2) {
  2669. let isRight =
  2670. item.ans &&
  2671. item.ans.every((quesItem, quesIndex) => {
  2672. if (item.ques) {
  2673. return item.ques[quesIndex] == item.ans[quesIndex];
  2674. } else {
  2675. return false;
  2676. }
  2677. });
  2678. if (isRight) {
  2679. score += item.score;
  2680. number++;
  2681. item.scoreResult = item.score;
  2682. rightQuestionIds.push(item.questionId);
  2683. } else {
  2684. let hasPart = false;
  2685. let checkboxScore = 1; //获取单题总分数
  2686. item.ques &&
  2687. item.ques.forEach((ques, quesIndex) => {
  2688. //选错一个全扣
  2689. if (item.ques) {
  2690. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  2691. checkboxScore = 0;
  2692. }
  2693. } else {
  2694. checkboxScore = 0;
  2695. }
  2696. });
  2697. console.log(checkboxScore, "checkboxScore1");
  2698. //没选错
  2699. if (checkboxScore) {
  2700. checkboxScore = 0;
  2701. item.ans.forEach((ans, quesIndex) => {
  2702. //漏选扣一部分,对n题给n X partScore 分
  2703. if (item.ques) {
  2704. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  2705. checkboxScore += item.partScore;
  2706. hasPart = true;
  2707. }
  2708. } else {
  2709. checkboxScore = 0;
  2710. }
  2711. });
  2712. }
  2713. console.log(checkboxScore, "checkboxScore2");
  2714. if (!hasPart) {
  2715. //0分
  2716. item.scoreResult = 0;
  2717. if (item.ques) {
  2718. doWrongQuestionIds.push(item.questionId);
  2719. }
  2720. } else {
  2721. //部分分
  2722. // number++;
  2723. lessQuestionNum++;
  2724. // doWrongQuestionIds.push(item.questionId);
  2725. item.scoreResult = checkboxScore;
  2726. score += checkboxScore;
  2727. // rightQuestionIds.push(item.questionId)
  2728. }
  2729. }
  2730. allScore += item.score;
  2731. if (item.ques && item.ques.length) {
  2732. doQuestionNum++;
  2733. doQuestionIds.push(item.questionId);
  2734. }
  2735. } else if (item.type == 3) {
  2736. if (item.ques == item.ans) {
  2737. item.scoreResult = item.score;
  2738. score += item.score;
  2739. number++;
  2740. rightQuestionIds.push(item.questionId);
  2741. } else {
  2742. item.scoreResult = 0;
  2743. if (item.ques) {
  2744. doWrongQuestionIds.push(item.questionId);
  2745. }
  2746. }
  2747. allScore += item.score;
  2748. if (item.ques) {
  2749. doQuestionNum++;
  2750. doQuestionIds.push(item.questionId);
  2751. }
  2752. } else if (item.type == 4) {
  2753. allScore += item.score;
  2754. if (item.ques && item.ques.length) {
  2755. doQuestionNum++;
  2756. doQuestionIds.push(item.questionId);
  2757. }
  2758. } else if (item.type == 5) {
  2759. allScore += item.score;
  2760. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2761. doQuestionNum++;
  2762. doQuestionIds.push(item.questionId);
  2763. }
  2764. }
  2765. });
  2766. //大于及格
  2767. if (score >= passScore) {
  2768. reportStatus = 1;
  2769. } else {
  2770. reportStatus = 0;
  2771. }
  2772. console.log(333);
  2773. //交卷
  2774. this.$request
  2775. .examRecordEdit({
  2776. examId: this.examId,
  2777. goodsId: this.goodsId,
  2778. orderGoodsId: this.orderGoodsId,
  2779. reportStatus: reportStatus,
  2780. recordId: this.recordId,
  2781. rightQuestionNum: number,
  2782. lessQuestionNum: lessQuestionNum,
  2783. status: 1,
  2784. moduleExamId: this.moduleId || 0,
  2785. chapterExamId: this.chapterId || 0,
  2786. doQuestionIds: doQuestionIds.join(","),
  2787. rightQuestionIds: rightQuestionIds.join(","),
  2788. doQuestionNum: doQuestionNum,
  2789. performance: score,
  2790. totalScore: allScore,
  2791. examTime: parseInt(this.allTimes),
  2792. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2793. historyExamJson: JSON.stringify(this.questionList)
  2794. })
  2795. .then(res => {
  2796. this.punchClock();
  2797. });
  2798. console.log(222);
  2799. //错题集id提交(客观题)
  2800. this.$request
  2801. .examWrongRecord({
  2802. orderGoodsId: this.orderGoodsId,
  2803. examId: this.examId,
  2804. goodsId: this.goodsId,
  2805. questionIds: doWrongQuestionIds,
  2806. recordId: this.recordId,
  2807. type: 1,
  2808. doMode: this.doMode,
  2809. courseType: 1
  2810. })
  2811. .then(res => {
  2812. this.loading = false;
  2813. })
  2814. .catch(err => {
  2815. this.loading = false;
  2816. });
  2817. }
  2818. },
  2819. computed: {
  2820. param() {
  2821. return {
  2822. examId: this.examId,
  2823. questionId: this.questionList[this.current]
  2824. ? this.questionList[this.current].questionId
  2825. : undefined,
  2826. goodsId: this.goodsId,
  2827. orderGoodsId: this.orderGoodsId,
  2828. collectQuestionId: this.collectList[this.current]
  2829. ? this.collectList[this.current].collectQuestionId
  2830. : undefined,
  2831. doMode: this.doMode
  2832. };
  2833. },
  2834. doMode() {
  2835. return this.simulateStatus ? 3 : this.number ? 2 : 1;
  2836. },
  2837. examType() {
  2838. return this.$route.query.examType || (this.number ? 2 : 0);
  2839. }
  2840. }
  2841. };
  2842. </script>
  2843. <!-- Add "scoped" attribute to limit CSS to this component only -->
  2844. <style scoped lang="scss">
  2845. .course-exam {
  2846. .section {
  2847. overflow: hidden;
  2848. &__header {
  2849. height: 20px;
  2850. margin-top: 20px;
  2851. }
  2852. &__body {
  2853. .explain-record {
  2854. &__body {
  2855. margin-bottom: 20px;
  2856. border: 1px solid #eee;
  2857. .left-box {
  2858. position: relative;
  2859. float: left;
  2860. width: 970px;
  2861. min-height: 630px;
  2862. border: 1px solid #eee;
  2863. &__body {
  2864. .question {
  2865. padding: 12px 0 0 12px;
  2866. display: flex;
  2867. flex-direction: column;
  2868. height: 100%;
  2869. &__title {
  2870. padding-left: 12px;
  2871. font-size: 16px;
  2872. font-family: Microsoft YaHei;
  2873. font-weight: bold;
  2874. color: #333333;
  2875. line-height: 24px;
  2876. }
  2877. &__desc {
  2878. padding-left: 12px;
  2879. margin-top: 20px;
  2880. font-size: 16px;
  2881. font-family: Microsoft YaHei;
  2882. font-weight: 400;
  2883. color: #666666;
  2884. line-height: 24px;
  2885. text-align: justify;
  2886. /deep/ img {
  2887. max-width: 100% !important;
  2888. }
  2889. }
  2890. &__content {
  2891. /deep/ .el-tabs__item {
  2892. height: 40px;
  2893. line-height: 40px;
  2894. }
  2895. .question__content {
  2896. height: auto;
  2897. overflow: auto;
  2898. }
  2899. .question-list {
  2900. padding: 24px 0 24px 24px;
  2901. border-bottom: 1px solid #eee;
  2902. .checkbox,
  2903. .radio {
  2904. cursor: pointer;
  2905. margin-right: 24px;
  2906. padding: 0 24px;
  2907. display: flex;
  2908. align-items: center;
  2909. margin-top: 2px;
  2910. min-height: 40px;
  2911. padding-top: 10px;
  2912. padding-bottom: 10px;
  2913. background: #f5f9ff;
  2914. border-radius: 8px;
  2915. box-sizing: border-box;
  2916. &.right {
  2917. background: #37c65b;
  2918. }
  2919. &.wrong {
  2920. background: #ff3a30;
  2921. }
  2922. &.user_choose {
  2923. background: #007aff;
  2924. }
  2925. }
  2926. &.textarea {
  2927. margin-right: 12px;
  2928. .upload {
  2929. margin-top: 10px;
  2930. &__imgs {
  2931. margin-right: 10px;
  2932. width: 80px;
  2933. height: 80px;
  2934. background: #ffffff;
  2935. border: 1px solid #eeeeee;
  2936. border-radius: 4px;
  2937. position: relative;
  2938. display: flex;
  2939. float: left;
  2940. align-items: center;
  2941. justify-content: center;
  2942. img {
  2943. max-width: 100%;
  2944. max-height: 100%;
  2945. }
  2946. }
  2947. &__btn {
  2948. margin-right: 10px;
  2949. width: 80px;
  2950. height: 80px;
  2951. background: #ffffff;
  2952. border: 1px solid #eeeeee;
  2953. border-radius: 4px;
  2954. position: relative;
  2955. display: flex;
  2956. float: left;
  2957. align-items: center;
  2958. justify-content: center;
  2959. flex-direction: column;
  2960. .icon {
  2961. font-size: 20px;
  2962. color: #3f8dfd;
  2963. }
  2964. p {
  2965. font-size: 12px;
  2966. font-family: Microsoft YaHei;
  2967. font-weight: 400;
  2968. color: #999999;
  2969. line-height: 24px;
  2970. }
  2971. input {
  2972. position: absolute;
  2973. left: 0;
  2974. top: 0;
  2975. display: block;
  2976. width: 100%;
  2977. height: 100%;
  2978. opacity: 0;
  2979. }
  2980. }
  2981. }
  2982. }
  2983. /deep/
  2984. .el-checkbox__input.is-checked
  2985. + .el-checkbox__label {
  2986. color: #000 !important;
  2987. }
  2988. .el-checkbox__input.is-disabled + span.el-checkbox__label {
  2989. color: #000;
  2990. }
  2991. /deep/ .el-checkbox {
  2992. white-space: normal;
  2993. }
  2994. }
  2995. .answer-list {
  2996. height: 40px;
  2997. // border-top: 1px solid #eee;
  2998. border-bottom: 1px solid #eee;
  2999. // margin-top: 24px;
  3000. display: flex;
  3001. align-items: center;
  3002. justify-content: space-between;
  3003. padding: 0 24px;
  3004. &__left {
  3005. font-size: 16px;
  3006. font-family: Microsoft YaHei;
  3007. font-weight: 400;
  3008. color: #333333;
  3009. line-height: 24px;
  3010. }
  3011. &__right {
  3012. font-size: 16px;
  3013. font-family: Microsoft YaHei;
  3014. font-weight: 400;
  3015. color: #333333;
  3016. line-height: 24px;
  3017. }
  3018. }
  3019. .explain-list {
  3020. padding: 12px 24px;
  3021. &__header {
  3022. font-size: 16px;
  3023. font-family: Microsoft YaHei;
  3024. font-weight: bold;
  3025. color: #666666;
  3026. line-height: 24px;
  3027. }
  3028. &__body {
  3029. margin-top: 12px;
  3030. font-size: 16px;
  3031. font-family: Microsoft YaHei;
  3032. font-weight: 400;
  3033. color: #666666;
  3034. line-height: 24px;
  3035. }
  3036. .upload {
  3037. margin-top: 10px;
  3038. &__imgs {
  3039. margin-right: 10px;
  3040. width: 80px;
  3041. height: 80px;
  3042. background: #ffffff;
  3043. border: 1px solid #eeeeee;
  3044. border-radius: 4px;
  3045. position: relative;
  3046. display: flex;
  3047. float: left;
  3048. align-items: center;
  3049. justify-content: center;
  3050. img {
  3051. max-width: 100%;
  3052. max-height: 100%;
  3053. }
  3054. }
  3055. }
  3056. }
  3057. .question {
  3058. padding-bottom: 58px;
  3059. }
  3060. }
  3061. &__btns {
  3062. position: relative;
  3063. height: 32px;
  3064. .submit {
  3065. cursor: pointer;
  3066. margin: 0 auto;
  3067. width: 140px;
  3068. height: 32px;
  3069. padding: 0;
  3070. color: #fff;
  3071. background: #3f8dfd;
  3072. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  3073. border-radius: 16px;
  3074. text-align: center;
  3075. line-height: 32px;
  3076. font-size: 16px;
  3077. }
  3078. }
  3079. }
  3080. }
  3081. &__footer {
  3082. height: 40px;
  3083. display: flex;
  3084. justify-content: space-around;
  3085. align-items: center;
  3086. .btn {
  3087. cursor: pointer;
  3088. width: 140px;
  3089. height: 32px;
  3090. background: #ffffff;
  3091. border: 1px solid #3f8dfd;
  3092. border-radius: 16px;
  3093. line-height: 32px;
  3094. text-align: center;
  3095. color: #3f8dfd;
  3096. }
  3097. }
  3098. }
  3099. .right-box {
  3100. float: right;
  3101. width: 299px;
  3102. border-right: 1px solid #eee;
  3103. &__header {
  3104. height: 40px;
  3105. line-height: 40px;
  3106. border-bottom: 1px solid #eeeeee;
  3107. .back-btn {
  3108. display: block;
  3109. margin: 0 auto;
  3110. width: 160px;
  3111. }
  3112. .title {
  3113. float: left;
  3114. font-size: 16px;
  3115. font-family: Microsoft YaHei;
  3116. font-weight: bold;
  3117. color: #333333;
  3118. }
  3119. .time {
  3120. font-size: 16px;
  3121. font-family: Microsoft YaHei;
  3122. font-weight: 400;
  3123. color: #666666;
  3124. float: right;
  3125. }
  3126. }
  3127. &__body {
  3128. height: 510px;
  3129. border-bottom: 1px solid #eee;
  3130. .card {
  3131. &__note {
  3132. display: flex;
  3133. height: 64px;
  3134. align-items: center;
  3135. border-bottom: 1px solid #eee;
  3136. flex-wrap: wrap;
  3137. .item {
  3138. display: flex;
  3139. align-items: center;
  3140. margin-left: 10px;
  3141. width: 84px;
  3142. font-size: 12px;
  3143. .box {
  3144. margin-right: 5px;
  3145. width: 16px;
  3146. height: 16px;
  3147. border-radius: 4px;
  3148. &.white {
  3149. background: #ffffff;
  3150. border: 1px solid #eeeeee;
  3151. }
  3152. &.green {
  3153. background: #37c65b;
  3154. }
  3155. &.red {
  3156. background: #ff3a30;
  3157. }
  3158. &.yellow {
  3159. background: #ffc53d;
  3160. }
  3161. &.blue,
  3162. &.check_ans {
  3163. background: #3f8dfd;
  3164. }
  3165. }
  3166. }
  3167. }
  3168. &__content {
  3169. height: 440px;
  3170. overflow-y: scroll;
  3171. &::-webkit-scrollbar {
  3172. width: 6px;
  3173. }
  3174. &::-webkit-scrollbar-track {
  3175. background-color: #fff;
  3176. -webkit-border-radius: 2em;
  3177. -moz-border-radius: 2em;
  3178. border-radius: 2em;
  3179. }
  3180. &::-webkit-scrollbar-thumb {
  3181. background-color: #eeeeee;
  3182. -webkit-border-radius: 2em;
  3183. -moz-border-radius: 2em;
  3184. border-radius: 2em;
  3185. }
  3186. .list {
  3187. display: flex;
  3188. flex-wrap: wrap;
  3189. .item {
  3190. width: 40px;
  3191. height: 40px;
  3192. border-radius: 10px;
  3193. text-align: center;
  3194. line-height: 40px;
  3195. margin-left: 16px;
  3196. margin-top: 16px;
  3197. cursor: pointer;
  3198. &.white {
  3199. line-height: 38px;
  3200. color: #333333;
  3201. background: #ffffff;
  3202. border: 1px solid #eeeeee;
  3203. }
  3204. &.green {
  3205. color: #fff;
  3206. background: #37c65b;
  3207. }
  3208. &.red {
  3209. color: #fff;
  3210. background: #ff3a30;
  3211. }
  3212. &.blue,
  3213. &.check_ans {
  3214. color: #fff;
  3215. background: #3f8dfd;
  3216. }
  3217. &.yellow {
  3218. background: #ffc53d;
  3219. }
  3220. &.disabled {
  3221. cursor: not-allowed;
  3222. line-height: 38px;
  3223. color: #eeeeee;
  3224. background: #ffffff;
  3225. border: 1px solid #eeeeee;
  3226. }
  3227. }
  3228. }
  3229. }
  3230. }
  3231. }
  3232. &__footer {
  3233. border-bottom: 1px solid #eee;
  3234. height: 40px;
  3235. display: flex;
  3236. align-items: center;
  3237. justify-content: center;
  3238. .submit {
  3239. cursor: pointer;
  3240. width: 140px;
  3241. height: 32px;
  3242. padding: 0;
  3243. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
  3244. border-radius: 16px;
  3245. line-height: 32px;
  3246. text-align: center;
  3247. font-size: 16px;
  3248. }
  3249. }
  3250. }
  3251. }
  3252. }
  3253. }
  3254. }
  3255. .take-photo {
  3256. /deep/ .el-dialog__header {
  3257. display: none;
  3258. }
  3259. /deep/ .el-dialog__body {
  3260. padding: 0;
  3261. overflow: unset;
  3262. }
  3263. &__close {
  3264. cursor: pointer;
  3265. position: absolute;
  3266. right: 0;
  3267. top: -28px;
  3268. width: 24px;
  3269. height: 24px;
  3270. line-height: 24px;
  3271. text-align: center;
  3272. color: #eee;
  3273. border: 1px solid #eee;
  3274. border-radius: 50%;
  3275. }
  3276. &__header {
  3277. height: 40px;
  3278. border-bottom: 1px solid #eee;
  3279. line-height: 40px;
  3280. font-size: 16px;
  3281. font-family: Microsoft YaHei;
  3282. font-weight: bold;
  3283. color: #333333;
  3284. padding-left: 24px;
  3285. }
  3286. &__body {
  3287. height: 400px;
  3288. padding: 40px 24px;
  3289. .left-box {
  3290. width: 336px;
  3291. float: left;
  3292. .title {
  3293. font-size: 16px;
  3294. font-family: Microsoft YaHei;
  3295. font-weight: bold;
  3296. color: #ff3b30;
  3297. line-height: 24px;
  3298. }
  3299. .content {
  3300. font-size: 14px;
  3301. font-family: Microsoft YaHei;
  3302. font-weight: 400;
  3303. color: #333333;
  3304. line-height: 28px;
  3305. margin-top: 32px;
  3306. }
  3307. }
  3308. .right-box {
  3309. float: right;
  3310. width: 400px;
  3311. height: 300px;
  3312. video {
  3313. width: 100%;
  3314. height: 100%;
  3315. }
  3316. }
  3317. }
  3318. &__footer {
  3319. height: 90px;
  3320. border-top: 1px solid #eee;
  3321. text-align: center;
  3322. .take {
  3323. display: inline-block;
  3324. width: 200px;
  3325. height: 40px;
  3326. padding: 0;
  3327. border-radius: 20px;
  3328. text-align: center;
  3329. line-height: 40px;
  3330. margin: 24px auto;
  3331. }
  3332. }
  3333. }
  3334. }
  3335. </style>