questionBank.vue 111 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906
  1. <template>
  2. <view class="questionBank">
  3. <uni-nav-bar
  4. class="navbar"
  5. @clickLeft="clickLeft"
  6. left-icon="back"
  7. :statusBar="true"
  8. :title="examData.examName"
  9. ></uni-nav-bar>
  10. <swiper class="swiper" :current="current" @change="swiperChange">
  11. <swiper-item v-for="(bank, bankIndex) in questionList" :key="bankIndex">
  12. <view class="pageContent">
  13. <view class="pad_8 titBox">
  14. <view class="firstLetter">
  15. <view class="leftLetters">
  16. <view class="btnType">
  17. <text v-if="bank.type == 1">单选</text>
  18. <text v-if="bank.type == 2">多选</text>
  19. <text v-if="bank.type == 3">判断</text>
  20. <text v-if="bank.type == 4">案例</text>
  21. <text v-if="bank.type == 5">简答</text>
  22. </view>
  23. <text>{{ bankIndex + 1 }}/{{ questionList.length }}</text>
  24. </view>
  25. <view style="color: #666; font-size: 28rpx">{{
  26. countdown(lastTime)
  27. }}</view>
  28. <view class="leftLetters"></view>
  29. </view>
  30. <view class="titles">
  31. <rich-text :nodes="bank.content"></rich-text>
  32. </view>
  33. </view>
  34. <template v-if="bank.type == 1">
  35. <view class="pad_8 titBox no-margin">
  36. <view v-if="!bank.ques">
  37. <view
  38. v-for="(item, index) in bank.jsonStr"
  39. :key="index"
  40. class="lisSty"
  41. @click="radioSelect(item.optionsId, bankIndex)"
  42. >
  43. <view class="activeTI">{{ ast[index] }}</view>
  44. <view class="flex_auto">{{ item.content }}</view>
  45. </view>
  46. </view>
  47. <view v-if="bank.ques">
  48. <view
  49. v-for="(item, index) in bank.jsonStr"
  50. :key="index"
  51. class="lisSty"
  52. @click="radioSelect(item.optionsId, bankIndex)"
  53. >
  54. <text
  55. :class="{
  56. right:
  57. bankType == 1 &&
  58. (item.optionsId == bank.ques ||
  59. item.optionsId == bank.ans),
  60. wrong:
  61. bankType == 1 &&
  62. item.optionsId == bank.ques &&
  63. bank.ques != bank.ans,
  64. user_choose: bankType == 2 && item.optionsId == bank.ques,
  65. }"
  66. class="activeTI"
  67. >
  68. {{ ast[index] }}
  69. </text>
  70. <view class="flex_auto">{{ item.content }}</view>
  71. </view>
  72. </view>
  73. </view>
  74. <view v-if="bankType == 1 && bank.ques">
  75. <view class="pad_8 answer">
  76. <view>题目答案:{{ ast[bank.ans - 1] }}</view>
  77. <view>我的答案:{{ ast[bank.ques - 1] }}</view>
  78. </view>
  79. <view class="pad_8 answerInfos">
  80. <view class="answerTitle">答案解析</view>
  81. <view class="answerContent">
  82. <rich-text :nodes="bank.analysisContent"></rich-text>
  83. </view>
  84. </view>
  85. </view>
  86. </template>
  87. <template v-if="bank.type == 2">
  88. <view class="pad_8 titBox no-margin">
  89. <view v-if="!bank.ques">
  90. <view
  91. v-for="(item, index) in bank.jsonStr"
  92. :key="index"
  93. class="lisSty"
  94. @click="checkboxSelect(item.optionsId, bankIndex, index)"
  95. >
  96. <view :class="{ checked: item.checked }" class="activeTI">{{
  97. ast[index]
  98. }}</view>
  99. <view class="flex_auto">{{ item.content }}</view>
  100. </view>
  101. </view>
  102. <view
  103. v-if="bankType == 2 || (bankType == 1 && !bank.ques)"
  104. class="submit_checkbox"
  105. :class="{ disabled: !isCheckboxChecked(bank.jsonStr) }"
  106. @click="checkboxSubmit(bankIndex)"
  107. >确认答案</view
  108. >
  109. <view v-if="bank.ques">
  110. <view
  111. v-for="(item, index) in bank.jsonStr"
  112. :key="index"
  113. class="lisSty"
  114. @click="checkboxSelect(item.optionsId, bankIndex, index)"
  115. >
  116. <text
  117. :class="{
  118. right:
  119. bankType == 1 &&
  120. (bank.ques.indexOf(item.optionsId) != -1 ||
  121. bank.ans.indexOf(item.optionsId) != -1),
  122. wrong:
  123. bankType == 1 &&
  124. bank.ques.indexOf(item.optionsId) != -1 &&
  125. bank.ans.indexOf(item.optionsId) == -1,
  126. user_choose: bankType == 2 && item.checked,
  127. }"
  128. class="activeTI"
  129. >
  130. {{ ast[index] }}
  131. </text>
  132. <view class="flex_auto">{{ item.content }}</view>
  133. </view>
  134. </view>
  135. </view>
  136. <view v-if="bankType == 1 && bank.ques">
  137. <view class="pad_8 answer">
  138. <view>
  139. 题目答案:
  140. <text
  141. v-for="(ansItem, ansItemIndex) in bank.ans"
  142. :key="ansItemIndex"
  143. >{{ ast[ansItem - 1] }}</text
  144. >
  145. </view>
  146. <view>
  147. 我的答案:
  148. <text
  149. v-for="(quesItem, quesItemIndex) in bank.ques"
  150. :key="quesItemIndex"
  151. >{{ ast[quesItem - 1] }}</text
  152. >
  153. </view>
  154. </view>
  155. <view class="pad_8 answerInfos">
  156. <view class="answerTitle">答案解析</view>
  157. <view class="answerContent">
  158. <rich-text :nodes="bank.analysisContent"></rich-text>
  159. </view>
  160. </view>
  161. </view>
  162. </template>
  163. <template v-if="bank.type == 3">
  164. <view class="pad_8 titBox no-margin">
  165. <view v-if="!bank.ques">
  166. <view
  167. v-for="(item, index) in judge"
  168. :key="index"
  169. class="lisSty"
  170. @click="judgeSelect(index, bankIndex)"
  171. >
  172. <view class="activeTI">{{ ast[index] }}</view>
  173. <view class="flex_auto">
  174. {{ item }}
  175. </view>
  176. </view>
  177. </view>
  178. <view v-if="bank.ques">
  179. <view
  180. v-for="(item, index) in judge"
  181. :key="index"
  182. class="lisSty"
  183. @click="judgeSelect(index, bankIndex)"
  184. >
  185. <text
  186. :class="{
  187. right:
  188. bankType == 1 &&
  189. (index == (bank.ques == 1 ? 0 : 1) ||
  190. index != bank.ans),
  191. wrong:
  192. bankType == 1 &&
  193. index == (bank.ques == 1 ? 0 : 1) &&
  194. bank.ques != bank.ans,
  195. user_choose:
  196. bankType == 2 && index == (bank.ques == 1 ? 0 : 1),
  197. }"
  198. class="activeTI"
  199. >
  200. {{ ast[index] }}
  201. </text>
  202. <view class="flex_auto">
  203. {{ item }}
  204. </view>
  205. </view>
  206. </view>
  207. </view>
  208. <view v-if="bankType == 1 && bank.ques">
  209. <view class="pad_8 answer">
  210. <view>题目答案:{{ ast[bank.ans == 1 ? 0 : 1] }}</view>
  211. <view>我的答案:{{ ast[bank.ques == 1 ? 0 : 1] }}</view>
  212. </view>
  213. <view class="pad_8 answerInfos">
  214. <view class="answerTitle">答案解析</view>
  215. <view class="answerContent">
  216. <rich-text :nodes="bank.analysisContent"></rich-text>
  217. </view>
  218. </view>
  219. </view>
  220. </template>
  221. <!-- 简答题 -->
  222. <template v-if="bank.type == 5">
  223. <view class="pad_8 titBox">
  224. <view class="ans">
  225. <view
  226. class="ans_input"
  227. v-if="
  228. bankType == 2 ||
  229. (bankType == 1 &&
  230. (!bank.ques ||
  231. (!bank.ques.imageList.length && !bank.ques.text)))
  232. "
  233. >
  234. <view class="top flex">
  235. <image
  236. :data-index="bankIndex"
  237. class="icon"
  238. @click="chooseImg(bankIndex)"
  239. src="/static/camera.png"
  240. mode=""
  241. ></image>
  242. <view class="progress"
  243. >{{ bank.ansText.imageList.length || "0" }}/4</view
  244. >
  245. <view
  246. class="submit"
  247. :class="{ disabled: !bank.ansText.text && hasImgs(bank) }"
  248. @click="submitAns(bankIndex)"
  249. >确认答案</view
  250. >
  251. </view>
  252. <view class="textarea">
  253. <textarea
  254. v-model="bank.ansText.text"
  255. placeholder="在此输入答案"
  256. ></textarea>
  257. </view>
  258. <view class="imgs">
  259. <view
  260. class="img"
  261. v-for="(img, imgIndex) in bank.ansText.imageList"
  262. :key="imgIndex"
  263. >
  264. <text @click="deleteImg(imgIndex, bankIndex)">x</text>
  265. <image :src="$method.splitImgHost(img, true)"></image>
  266. </view>
  267. </view>
  268. </view>
  269. <view
  270. class="ans_submit answerInfos"
  271. v-if="
  272. bankType == 1 &&
  273. (bank.ques.text || bank.ques.imageList.length)
  274. "
  275. >
  276. <view class="answerTitle">我的答案:</view>
  277. {{ bank.ques.text }}
  278. <view class="imgs">
  279. <image
  280. class="img"
  281. v-for="(ques, quesIndex) in bank.ques.imageList"
  282. :key="quesIndex"
  283. :src="$method.splitImgHost(ques, true)"
  284. ></image>
  285. </view>
  286. </view>
  287. </view>
  288. </view>
  289. <view
  290. v-if="
  291. bankType == 1 &&
  292. bank.ques &&
  293. (bank.ques.text || bank.ques.imageList.length)
  294. "
  295. >
  296. <view class="pad_8 answerInfos">
  297. <view class="answerTitle">答案解析:</view>
  298. <view class="answerContent">
  299. <rich-text :nodes="bank.analysisContent"></rich-text>
  300. </view>
  301. </view>
  302. </view>
  303. </template>
  304. <!-- 案例题 -->
  305. <template v-if="bank.type == 4">
  306. <view class="tabs">
  307. <view
  308. class="tab"
  309. :class="{ current: tabIndex == bank.current }"
  310. :key="tabIndex"
  311. v-for="(tab, tabIndex) in bank.jsonStr"
  312. @click="tabSelect(tabIndex, bankIndex)"
  313. >
  314. 问题{{ tabIndex + 1 }}
  315. </view>
  316. </view>
  317. <view
  318. v-for="(ansItem, ansIndex) in bank.jsonStr"
  319. v-if="bank.current == ansIndex"
  320. :key="ansIndex"
  321. >
  322. <template v-if="ansItem.type == 1">
  323. <view class="pad_8 titBox">
  324. <view class="leftLetters">
  325. <view class="btnType">
  326. <text>单选</text>
  327. </view>
  328. </view>
  329. <view class="titles">
  330. <rich-text :nodes="ansItem.content"></rich-text>
  331. </view>
  332. <view v-if="!bank.ques[ansIndex]">
  333. <view
  334. v-for="(option, childIndex) in ansItem.optionsList"
  335. :key="childIndex"
  336. class="lisSty"
  337. @click="
  338. radioSelectChild(option.optionsId, ansIndex, bankIndex)
  339. "
  340. >
  341. <view class="activeTI">{{ ast[childIndex] }}</view>
  342. <view class="flex_auto">
  343. <rich-text
  344. class="textChild"
  345. :nodes="option.content"
  346. ></rich-text>
  347. </view>
  348. </view>
  349. </view>
  350. <view v-if="bank.ques[ansIndex]">
  351. <view
  352. v-for="(option, childIndex) in ansItem.optionsList"
  353. :key="childIndex"
  354. class="lisSty"
  355. @click="
  356. radioSelectChild(option.optionsId, ansIndex, bankIndex)
  357. "
  358. >
  359. <text
  360. :class="{
  361. right:
  362. bankType == 1 &&
  363. (option.optionsId == bank.ques[ansIndex] ||
  364. option.optionsId == bank.ans[ansIndex]),
  365. wrong:
  366. bankType == 1 &&
  367. option.optionsId == bank.ques[ansIndex] &&
  368. bank.ques[ansIndex] != bank.ans[ansIndex],
  369. user_choose:
  370. bankType == 2 &&
  371. option.optionsId == bank.ques[ansIndex],
  372. }"
  373. class="activeTI"
  374. >
  375. {{ ast[childIndex] }}
  376. </text>
  377. <view class="flex_auto">
  378. <rich-text :nodes="option.content"></rich-text>
  379. </view>
  380. </view>
  381. </view>
  382. </view>
  383. <view v-if="bankType == 1 && bank.ques[ansIndex]">
  384. <view class="pad_8 answer">
  385. <view>题目答案:{{ ast[bank.ans[ansIndex] - 1] }}</view>
  386. <view>我的答案:{{ ast[bank.ques[ansIndex] - 1] }}</view>
  387. </view>
  388. <view class="pad_8 answerInfos">
  389. <view class="answerTitle">答案解析</view>
  390. <view class="answerContent">
  391. <rich-text :nodes="option.analysisContent"></rich-text>
  392. </view>
  393. </view>
  394. </view>
  395. </template>
  396. <template v-if="ansItem.type == 2">
  397. <view class="pad_8 titBox">
  398. <view class="leftLetters">
  399. <view class="btnType">
  400. <text>多选</text>
  401. </view>
  402. </view>
  403. <view class="titles">
  404. <rich-text :nodes="ansItem.content"></rich-text>
  405. </view>
  406. <view v-if="!bank.ques[ansIndex]">
  407. <view
  408. v-for="(option, childindex) in ansItem.optionsList"
  409. :key="childindex"
  410. class="lisSty"
  411. @click="
  412. checkboxSelectChild(bankIndex, ansIndex, childindex)
  413. "
  414. >
  415. <view
  416. :class="{ checked: option.checked }"
  417. class="activeTI"
  418. >
  419. {{ ast[childindex] }}
  420. </view>
  421. <view class="flex_auto">
  422. <rich-text :nodes="option.content"></rich-text>
  423. </view>
  424. </view>
  425. </view>
  426. <view
  427. v-if="
  428. bankType == 2 || (bankType == 1 && !bank.ques[ansIndex])
  429. "
  430. class="submit_checkbox"
  431. :class="{
  432. disabled: !isCheckboxChecked(ansItem.optionsList),
  433. }"
  434. @click="checkboxSubmitChild(bankIndex, ansIndex)"
  435. >确认答案</view
  436. >
  437. <view v-if="bank.ques && bank.ques[ansIndex]">
  438. <view
  439. v-for="(option, childindex) in ansItem.optionsList"
  440. :key="childindex"
  441. class="lisSty"
  442. @click="
  443. checkboxSelectChild(bankIndex, ansIndex, childindex)
  444. "
  445. >
  446. <text
  447. :class="{
  448. right:
  449. bankType == 1 && right(bankIndex, ansIndex, option),
  450. wrong:
  451. bankType == 1 && wrong(bankIndex, ansIndex, option),
  452. user_choose: bankType == 2 && option.checked,
  453. }"
  454. class="activeTI"
  455. >
  456. {{ ast[childindex] }}
  457. </text>
  458. <view class="flex_auto">
  459. <rich-text :nodes="option.content"></rich-text>
  460. </view>
  461. </view>
  462. </view>
  463. </view>
  464. <view v-if="bankType == 1 && bank.ques[ansIndex]">
  465. <view class="pad_8 answer">
  466. <view>
  467. 题目答案:
  468. <text
  469. :key="ansItemIndex1"
  470. v-for="(ansItem1, ansItemIndex1) in bank.ans[ansIndex]"
  471. >{{ ast[ansItem1 - 1] }}</text
  472. >
  473. </view>
  474. <view>
  475. 我的答案:
  476. <text
  477. :key="quesItemIndex"
  478. v-for="(quesItem, quesItemIndex) in bank.ques[ansIndex]"
  479. >{{ ast[quesItem - 1] }}</text
  480. >
  481. </view>
  482. </view>
  483. <view class="pad_8 answerInfos">
  484. <view class="answerTitle">答案解析</view>
  485. <view class="answerContent">
  486. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  487. </view>
  488. </view>
  489. </view>
  490. </template>
  491. <template v-if="ansItem.type == 3">
  492. <view class="pad_8 titBox">
  493. <view class="leftLetters">
  494. <view class="btnType">
  495. <text>判断</text>
  496. </view>
  497. </view>
  498. <view class="titles">
  499. <rich-text :nodes="ansItem.content"></rich-text>
  500. </view>
  501. <view v-if="!bank.ques[ansIndex]">
  502. <view
  503. v-for="(option, childindex) in judge"
  504. :key="childindex"
  505. class="lisSty"
  506. @click="judgeSelectChild(ansIndex, childindex, bankIndex)"
  507. >
  508. <view class="activeTI">{{ ast[childindex] }}</view>
  509. <view class="flex_auto">
  510. {{ option }}
  511. </view>
  512. </view>
  513. </view>
  514. <view v-if="bank.ques[ansIndex]">
  515. <view
  516. v-for="(option, childindex) in judge"
  517. :key="childindex"
  518. class="lisSty"
  519. @click="judgeSelectChild(ansIndex, childindex, bankIndex)"
  520. >
  521. <text
  522. :class="{
  523. right:
  524. bankType == 1 &&
  525. (childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) ||
  526. childindex != bank.ans[ansIndex]),
  527. wrong:
  528. bankType == 1 &&
  529. childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) &&
  530. bank.ques[ansIndex] != bank.ans[ansIndex],
  531. user_choose:
  532. bankType == 2 &&
  533. childindex == (bank.ques[ansIndex] == 1 ? 0 : 1),
  534. }"
  535. class="activeTI"
  536. >
  537. {{ ast[childindex] }}
  538. </text>
  539. <view class="flex_auto">
  540. {{ option }}
  541. </view>
  542. </view>
  543. </view>
  544. </view>
  545. <view v-if="bankType == 1 && bank.ques[ansIndex]">
  546. <view class="pad_8 answer">
  547. <view
  548. >题目答案:{{
  549. ast[bank.ans[ansIndex] == 1 ? 0 : 1]
  550. }}</view
  551. >
  552. <view
  553. >我的答案:{{
  554. ast[bank.ques[ansIndex] == 1 ? 0 : 1]
  555. }}</view
  556. >
  557. </view>
  558. <view class="pad_8 answerInfos">
  559. <view class="answerTitle">答案解析</view>
  560. <view class="answerContent">
  561. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  562. </view>
  563. </view>
  564. </view>
  565. </template>
  566. <!-- 简答题 -->
  567. <template v-if="ansItem.type == 5">
  568. <view class="pad_8 titBox_title">
  569. <view class="leftLetters">
  570. <view class="btnType">
  571. <text>简答</text>
  572. </view>
  573. </view>
  574. <view class="titles">
  575. <rich-text :nodes="ansItem.content"></rich-text>
  576. </view>
  577. </view>
  578. <view class="pad_8 titBox_title">
  579. <view class="ans">
  580. <view
  581. class="ans_input"
  582. v-if="
  583. bankType == 2 ||
  584. (bankType == 1 &&
  585. (!bank.ques[ansIndex] ||
  586. (!bank.ques[ansIndex].text &&
  587. !bank.ques[ansIndex].imageList.length)))
  588. "
  589. >
  590. <view class="top flex">
  591. <image
  592. class="icon"
  593. @click="chooseImgChild(bankIndex, ansIndex)"
  594. src="/static/08-10_032.jpg"
  595. mode=""
  596. ></image>
  597. <view class="progress"
  598. >{{ ansItem.ansText.imageList.length || "0" }}/4
  599. </view>
  600. <view
  601. class="submit"
  602. @click="submitAnsChild(bankIndex, ansIndex)"
  603. >确认答案
  604. </view>
  605. </view>
  606. <view class="textarea">
  607. <textarea
  608. v-model="ansItem.ansText.text"
  609. placeholder="在此输入答案"
  610. ></textarea>
  611. </view>
  612. <view class="imgs">
  613. <view
  614. class="img"
  615. :key="imgIndex"
  616. v-for="(img, imgIndex) in ansItem.ansText.imageList"
  617. >
  618. <text
  619. @click="
  620. deleteImgChild(imgIndex, bankIndex, ansIndex)
  621. "
  622. >x</text
  623. >
  624. <image :src="$method.splitImgHost(img, true)"></image>
  625. </view>
  626. </view>
  627. </view>
  628. <view
  629. class="ans_submit answerInfos"
  630. v-if="bankType == 1 && bank.ques[ansIndex]"
  631. >
  632. <view class="answerTitle">我的答案</view>
  633. {{ bank.ques[ansIndex].text }}
  634. <view class="imgs">
  635. <image
  636. class="img"
  637. :key="quesIndex"
  638. v-for="(ques, quesIndex) in bank.ques[ansIndex]
  639. .imageList"
  640. :src="$method.splitImgHost(ques, true)"
  641. ></image>
  642. </view>
  643. </view>
  644. </view>
  645. </view>
  646. <view v-if="bankType == 1 && bank.ques[ansIndex]">
  647. <view class="pad_8 answerInfos">
  648. <view class="answerTitle">答案解析</view>
  649. <view class="answerContent">
  650. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  651. </view>
  652. </view>
  653. </view>
  654. </template>
  655. </view>
  656. </template>
  657. <view class="footer_btn">
  658. <!-- <view class="collect">
  659. <view v-if="collectList[bankIndex]">
  660. <image src="/static/icon/collected.png" mode=""></image>
  661. <view>取消收藏</view>
  662. </view>
  663. </view> -->
  664. <view
  665. class="collect show"
  666. @click="collect(collectList[bankIndex], bankIndex)"
  667. >
  668. <view v-if="collectList[bankIndex]">
  669. <image src="/static/icon/collected.png" mode=""></image>
  670. <view>取消收藏</view>
  671. </view>
  672. <view v-if="!collectList[bankIndex]">
  673. <image src="/static/icon/collect.png" mode=""></image>
  674. <view>收藏</view>
  675. </view>
  676. </view>
  677. <view class="flex_center" @click="openFooterTab">
  678. <view class="up-icon">
  679. <image src="/static/up.png"></image>
  680. </view>
  681. 答题卡
  682. </view>
  683. <view class="collect show" @click="pdsubmit">
  684. <view>
  685. <image src="/static/jj.png" mode=""></image>
  686. <view>交卷</view>
  687. </view>
  688. </view>
  689. </view>
  690. </view>
  691. </swiper-item>
  692. </swiper>
  693. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  694. <view class="popupView">
  695. <view class="popupTops">
  696. <view class="topIcon"></view>
  697. 点击编号即可跳转至对应题目
  698. </view>
  699. <view class="popupContent">
  700. <scroll-view scroll-y="true" style="height: 506rpx">
  701. <view class="boxSty">
  702. <view
  703. v-for="(item, index) in questionList"
  704. :key="index"
  705. @click="changeIndex(index)"
  706. :class="{
  707. isRight: bankType == 1 && isRight(item, index),
  708. isWrong: bankType == 1 && isWrong(item, index),
  709. isPart: bankType == 1 && isPart(item, index),
  710. isOver: bankType == 1 && isOver(item, index),
  711. check_ans: bankType == 2 && isCheck(item, index),
  712. }"
  713. class="liListSty"
  714. >
  715. {{ index + 1 }}
  716. </view>
  717. </view>
  718. </scroll-view>
  719. </view>
  720. </view>
  721. </u-popup>
  722. <view class="dialog" v-if="showDialog">
  723. <view class="text">左右滑动切换上下题</view>
  724. <view class="btn" @click="hideDialog">我知道了</view>
  725. </view>
  726. <view class="dialog-arrow" v-if="showArrow">
  727. <image class="pointer" src="/static/arrow-left.png" mode=""></image>
  728. <view class="text">您当前正在测试, 若想退出请点击左上角返回按钮。</view>
  729. <view class="btn" @click="showArrow = false">我知道了</view>
  730. </view>
  731. <view class="dialog_wrap" v-if="testOver">
  732. <view class="bg"></view>
  733. <view class="dialog">
  734. <view class="title">温馨提示</view>
  735. <view class="content">
  736. <view>您已完成所有题目,</view>
  737. <view>快去交卷吧!</view>
  738. </view>
  739. <view class="btns">
  740. <view class="btn" @click="noSubmit()">暂不交卷</view>
  741. <view class="btn active" @click="submitNow()">立即交卷</view>
  742. </view>
  743. </view>
  744. </view>
  745. <view class="dialog_wrap" v-if="isLastCount">
  746. <view class="bg"></view>
  747. <view class="dialog">
  748. <view class="title">温馨提示</view>
  749. <view class="content">
  750. <view
  751. >您当前正在测试,还剩{{ lastCount }}道题未完成,离开视为交卷</view
  752. >
  753. </view>
  754. <view class="btns">
  755. <view class="btn" @click="noLeave()">暂不离开</view>
  756. <view class="btn active" @click="leaveNow()">继续离开</view>
  757. </view>
  758. </view>
  759. </view>
  760. <u-popup
  761. v-model="showpopups"
  762. mode="center"
  763. border-radius="24"
  764. height="439rpx"
  765. width="640rpx"
  766. :mask-close-able="false"
  767. >
  768. <view class="popboxs">
  769. <view class="classTops">温馨提示</view>
  770. <view class="textStys">
  771. {{
  772. cgType === 7
  773. ? "您还未交卷,确定结束做题吗?"
  774. : cgType === 8
  775. ? `您还有${lastCount}道题未作答, 现在继续作答,还是下次继续?`
  776. : cgType === 6
  777. ? `您还有${lastCount}道题未作答, 您确定要交卷吗?`
  778. : cgType == 9
  779. ? `您已完成所有题目,快去交卷吧!`
  780. : ""
  781. }}
  782. </view>
  783. <view class="classFootsty" v-if="cgType === 6">
  784. <view class="btnsty btns1" @click="submit()">立即交卷</view>
  785. <view class="btnsty btns2" @click="showpopups = false">继续做题</view>
  786. </view>
  787. <view class="classFootsty" v-if="cgType === 7">
  788. <view class="btnsty btns1" @click="showpopups = false">下次继续</view>
  789. <view class="btnsty btns2" @click="backPages">结束做题</view>
  790. </view>
  791. <view class="classFootsty" v-if="cgType === 8">
  792. <view class="btnsty btns1" @click="leaveNow()">下次继续</view>
  793. <view class="btnsty btns2" @click="showpopups = false">继续作答</view>
  794. </view>
  795. <view class="classFootsty" v-if="cgType === 9">
  796. <view class="btnsty btns1" @click="showpopups = false">暂不交卷</view>
  797. <view class="btnsty btns2" @click="submit()">立即交卷</view>
  798. </view>
  799. </view>
  800. </u-popup>
  801. <!-- 节卷不需要拍照 -->
  802. <!-- :show="examType != 2 && photoPopup" -->
  803. <u-popup
  804. v-model="photoPopup"
  805. mode="bottom"
  806. border-radius="40"
  807. :mask-close-able="false"
  808. >
  809. <!-- 播放前拍照start -->
  810. <!-- :mask-close-able="false" -->
  811. <!-- style="bottom: 0; position: fixed; width: 100%; z-index: 999" -->
  812. <view v-if="examType != 2 && photoPopup">
  813. <view class="photoBox">
  814. <view class="photoTop">
  815. <view class="sqzz" v-if="false">
  816. <u-icon
  817. name="close"
  818. color="#333333"
  819. size="30"
  820. @click="closePhoto"
  821. ></u-icon>
  822. </view>
  823. <view class="centersq">请正视手机屏幕</view>
  824. <view class="sqzz"></view>
  825. </view>
  826. <view class="photoCenter">
  827. <view class="center_camera" v-if="photoPopup && isTaking">
  828. <!-- #ifdef MP-WEIXIN -->
  829. <camera
  830. device-position="front"
  831. flash="off"
  832. @error="error"
  833. style="width: 100%; height: 100%"
  834. >
  835. <!-- 加人脸框 -->
  836. <cover-view class="head_take">
  837. <cover-view class="headTake_up color"></cover-view>
  838. <cover-view class="headTake_minddle">
  839. <cover-view class="min_left color"></cover-view>
  840. <cover-view class="min_img"></cover-view>
  841. <cover-view class="min_right color"></cover-view>
  842. </cover-view>
  843. <cover-view class="headTake_down color"></cover-view>
  844. </cover-view>
  845. </camera>
  846. <!-- #endif -->
  847. <!-- #ifdef H5 -->
  848. <video
  849. :controls="false"
  850. id="video"
  851. width="400"
  852. height="300"
  853. class="photo_v"
  854. ></video>
  855. <view class="mask"></view>
  856. <!-- #endif -->
  857. </view>
  858. <view class="custom" v-if="!isTaking">
  859. <!-- #ifdef MP-WEIXIN -->
  860. <image :src="avatarUrl" mode=""></image>
  861. <!-- #endif -->
  862. <!-- #ifdef H5 -->
  863. <image :src="faceUrl" mode=""></image>
  864. <!-- #endif -->
  865. </view>
  866. </view>
  867. <view class="photoBoxbtns">
  868. <!-- <view class="btnResult" v-if="isTaking" @click="takePhoto"
  869. >拍照</view
  870. > -->
  871. <view v-if="isTaking" class="takePhoto_btn">
  872. <view style="width: 100rpx; height: 2rpx"></view>
  873. <view class="middle_btn" @click="takePhoto">
  874. <view class="square"></view>
  875. </view>
  876. <view class="rights" @click="takePhTips()">
  877. <text>拍照提示</text>
  878. <u-icon name="arrow-right" color="#FFFFFF" size="30"></u-icon>
  879. </view>
  880. </view>
  881. <view class="btnResult" v-if="!isTaking" @click="reTake">重拍</view>
  882. <view class="btnResult" v-if="!isTaking" @click="submitPhoto"
  883. >确认</view
  884. >
  885. </view>
  886. </view>
  887. </view>
  888. </u-popup>
  889. <!-- 拍照提示 -->
  890. <popup-photo
  891. :popupPhotoShow.sync="popupPhotoShow"
  892. @takePhoto="toTakePhoto()"
  893. ></popup-photo>
  894. </view>
  895. </template>
  896. <script>
  897. import PopupPhoto from "@/components/popup/index.vue";
  898. export default {
  899. components: {
  900. PopupPhoto,
  901. },
  902. data() {
  903. return {
  904. photoPopup: false,
  905. showpopups: false,
  906. id: "",
  907. current: 0,
  908. questionList: [],
  909. ast: ["A", "B", "C", "D", "E", "F", "G"],
  910. judge: ["正确", "错误"],
  911. ans: [],
  912. ques: [],
  913. show: false,
  914. showDialog: false,
  915. bankList: [],
  916. collectList: [],
  917. goodsId: "",
  918. recordId: "",
  919. isSubmit: false,
  920. lastTime: 0, //剩余考试时长
  921. allTimes: 0, //总考试时长
  922. timer: null,
  923. wrongList: [],
  924. bankType: 0, //试卷类型
  925. needBack: false, //是否是考试
  926. testOver: false,
  927. isLastCount: false, //是否有未答题目
  928. lastCount: 0, //剩余没有回答的题目数
  929. chapterId: 0,
  930. moduleId: 0,
  931. sectionId: 0,
  932. showArrow: false, //退出提示
  933. isFromVideo: "",
  934. gradeId: "",
  935. courseId: 0,
  936. cgType: 0, //对应设计稿弹窗编码,
  937. avatarUrl: "",
  938. ossAvatarUrl: "",
  939. goodsDetail: {},
  940. isTakePhoto: false,
  941. orderGoodsId: 0,
  942. isTaking: true, //是否正在拍照
  943. needPhoto: false, //是否需要拍照
  944. examType: 0, // 3-模块,1-章,2-节
  945. compareFaceData: 0, // 拍照匹配相似度
  946. learning: false, // 1合格,0不合格
  947. originShowDialog: false,
  948. uploadLock: false, //上传图片
  949. examData: {},
  950. popupPhotoShow: false,
  951. // h5
  952. faceUrl: "",
  953. simulateExamId: undefined,
  954. };
  955. },
  956. watch: {
  957. photoPopup(n) {
  958. // 拍照弹窗和showDialog同时出现时,先展示拍照弹窗再展示showDialog弹窗
  959. if (n) {
  960. this.showDialog && (this.showDialog = false);
  961. } else {
  962. this.originShowDialog && (this.showDialog = true);
  963. }
  964. },
  965. },
  966. async onLoad(option) {
  967. this.examType = option.type;
  968. this.id = option.id;
  969. this.goodsId = option.goodsid;
  970. this.chapterId = option.chapterId;
  971. this.courseId = option.courseId;
  972. this.sectionId = option.sectionId;
  973. this.moduleId = option.moduleId;
  974. this.isFromVideo = option.isFromVideo || "";
  975. this.gradeId = option.gradeId || "";
  976. this.orderGoodsId = Number(option.orderGoodsId);
  977. let isBack = option.isback;
  978. let showDialog = uni.getStorageSync("showDialog");
  979. if (showDialog) {
  980. this.showDialog = false;
  981. } else {
  982. this.showDialog = true;
  983. this.originShowDialog = true;
  984. uni.setStorageSync("showDialog", "1");
  985. }
  986. //考试时候用手势或者返回键 被迫返回做题
  987. if (isBack) {
  988. let app = getApp();
  989. let globalData = app.globalData;
  990. for (var k in globalData.bankData) {
  991. this[k] = globalData.bankData[k];
  992. }
  993. this.showArrow = true;
  994. //需要拍没拍过直接弹出摄像头
  995. if (this.needPhoto && !this.isTakePhoto) {
  996. if (!this.learning && this.examType != 2) {
  997. if (uni.getStorageSync("tabkePhotoShow")) {
  998. // #ifdef MP-WEIXIN
  999. this.photoPopup = true;
  1000. this.isTaking = true;
  1001. // #endif
  1002. this.avatarUrl = "";
  1003. // #ifdef H5
  1004. this.isHadCamera();
  1005. // #endif
  1006. } else {
  1007. this.popupPhotoShow = true;
  1008. uni.setStorageSync("tabkePhotoShow", 1); // 本地缓存用来判断是否已经弹出过弹窗
  1009. }
  1010. }
  1011. } else {
  1012. //不需要拍照
  1013. if (this.lastTime) {
  1014. this.timer = setInterval(() => {
  1015. if (this.lastTime <= 0) {
  1016. clearInterval(this.timer);
  1017. uni.showToast({
  1018. icon: "none",
  1019. mask: true,
  1020. title: "考试时间已到,系统将自动交卷",
  1021. duration: 10000,
  1022. });
  1023. this.submit();
  1024. return;
  1025. }
  1026. this.lastTime--;
  1027. }, 1000);
  1028. }
  1029. }
  1030. } else {
  1031. await this.getGoodsDetail();
  1032. this.needPhoto && (await this.getExamLearnStatus());
  1033. // 请求题目列表
  1034. await this.bankExam();
  1035. this.goodsQuestionList();
  1036. }
  1037. },
  1038. mounted() {},
  1039. onUnload() {
  1040. if (this.isSubmit) {
  1041. clearInterval(this.timer);
  1042. return;
  1043. }
  1044. if (this.needPhoto && !this.isTakePhoto) {
  1045. return;
  1046. }
  1047. //考试试卷 阻止ios手势返回,自动跳回答题页
  1048. if (this.needBack) {
  1049. let app = getApp();
  1050. app.globalData.bankData = this.$data;
  1051. clearInterval(this.timer);
  1052. uni.navigateTo({
  1053. url:
  1054. "/pages2/class/questionBank?id=" +
  1055. this.id +
  1056. "&goodsid=" +
  1057. this.goodsId +
  1058. "&isback=true&orderGoodsId=" +
  1059. this.orderGoodsId,
  1060. });
  1061. } else {
  1062. //点击返回按钮确认允许退出,交卷
  1063. clearInterval(this.timer);
  1064. this.examRecordEdit();
  1065. }
  1066. },
  1067. computed: {
  1068. doMode() {
  1069. // 做题模式 1章卷 2随机练习 3模拟组卷
  1070. return this.examData.simulateStatus ? 3 : undefined;
  1071. },
  1072. },
  1073. methods: {
  1074. getExamLearnStatus() {
  1075. return this.$api
  1076. .getExamLearnStatus({
  1077. goodsId: this.goodsId,
  1078. gradeId: this.gradeId,
  1079. chapterId: this.chapterId,
  1080. courseId: this.courseId,
  1081. moduleId: this.moduleId,
  1082. type: this.examType,
  1083. examId: this.id,
  1084. })
  1085. .then((res) => {
  1086. this.learning = res.data.data;
  1087. return Promise.resolve();
  1088. });
  1089. },
  1090. getGoodsDetail() {
  1091. return new Promise((resolve) => {
  1092. let self = this;
  1093. this.$api.goodsDetail(this.goodsId).then((res) => {
  1094. self.goodsDetail = res.data.data;
  1095. if (self.goodsDetail.goodsPhotoExamConfig) {
  1096. let goodsPhotoExamConfig = JSON.parse(
  1097. self.goodsDetail.goodsPhotoExamConfig
  1098. );
  1099. if (goodsPhotoExamConfig.photograph > 0) {
  1100. self.needPhoto = true;
  1101. }
  1102. }
  1103. resolve();
  1104. });
  1105. });
  1106. },
  1107. reTake() {
  1108. this.isTaking = true;
  1109. // #ifdef H5
  1110. this.faceUrl = "";
  1111. this.getUserMedia({
  1112. video: {
  1113. width: 400,
  1114. height: 300,
  1115. },
  1116. });
  1117. // #endif
  1118. },
  1119. postStudyRecord() {
  1120. let self = this;
  1121. let data = {
  1122. photo: self.ossAvatarUrl,
  1123. recordId: self.recordId,
  1124. };
  1125. if (this.ossAvatarUrl) {
  1126. data.similarity = this.compareFaceData; // 相似度
  1127. }
  1128. // console.log(data, "拍照提交");
  1129. this.$api.studyExamPhotoRecord(data).then((res) => {
  1130. // console.log(res, "拍照提交结果");
  1131. if (res.data.code != 200) {
  1132. uni.showToast({
  1133. icon: "none",
  1134. mask: true,
  1135. title: res.data.msg,
  1136. duration: 10000,
  1137. });
  1138. return;
  1139. }
  1140. self.ossAvatarUrl = "";
  1141. self.isTakePhoto = true;
  1142. //拍照
  1143. if (this.lastTime) {
  1144. this.timer = setInterval(() => {
  1145. if (this.lastTime <= 0) {
  1146. clearInterval(this.timer);
  1147. uni.showToast({
  1148. icon: "none",
  1149. mask: true,
  1150. title: "考试时间已到,系统将自动交卷",
  1151. duration: 10000,
  1152. });
  1153. this.submit();
  1154. return;
  1155. }
  1156. this.lastTime--;
  1157. }, 1000);
  1158. }
  1159. });
  1160. },
  1161. uploadFile(options, int) {
  1162. var self = this;
  1163. return new Promise((resolve, reject) => {
  1164. var data = {
  1165. imageStatus: int,
  1166. gradeId: this.gradeId,
  1167. };
  1168. self.$api.aliyunpolicy(data).then((res) => {
  1169. if (res.data.code != 200) {
  1170. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  1171. return;
  1172. }
  1173. var ossToken = res.data.data.resultContent;
  1174. if (ossToken.host == null || ossToken.host == undefined) {
  1175. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  1176. return;
  1177. }
  1178. let filePath = "";
  1179. // #ifdef H5
  1180. var localData = options; //dataUrl为base64位
  1181. let base = atob(localData.substring(localData.indexOf(",") + 1)); // base是将base64编码解码,去掉data:image/png;base64部分
  1182. let length = base.length;
  1183. let url = new Uint8Array(length);
  1184. while (length--) {
  1185. url[length] = base.charCodeAt(length);
  1186. }
  1187. filePath = new File([url], "a.jpg", {
  1188. type: "image/jpg",
  1189. });
  1190. console.log("filePath:", filePath);
  1191. uni.uploadFile({
  1192. url: ossToken.host,
  1193. name: "file",
  1194. file: filePath,
  1195. fileType: "image",
  1196. header: {
  1197. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1198. },
  1199. formData: {
  1200. key: ossToken.dir,
  1201. OSSAccessKeyId: ossToken.accessid,
  1202. policy: ossToken.policy,
  1203. Signature: ossToken.signature,
  1204. callback: ossToken.callback,
  1205. success_action_status: 200,
  1206. },
  1207. success: (result) => {
  1208. this.$u.toast("上传成功");
  1209. this.ossAvatarUrl = ossToken.dir;
  1210. console.log("h5上传成功--:", this.ossAvatarUrl);
  1211. resolve();
  1212. },
  1213. fail: (error) => {
  1214. console.log("h5上传失败:", error);
  1215. uni.showToast({
  1216. title: "上传接口报错,请重新拍照上传" + error,
  1217. icon: "none",
  1218. });
  1219. this.openPhoto();
  1220. return;
  1221. },
  1222. });
  1223. // #endif
  1224. // #ifdef MP-WEIXIN
  1225. uni.uploadFile({
  1226. url: ossToken.host,
  1227. name: "file",
  1228. filePath: options,
  1229. fileType: "image",
  1230. header: {
  1231. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1232. },
  1233. formData: {
  1234. key: ossToken.dir,
  1235. OSSAccessKeyId: ossToken.accessid,
  1236. policy: ossToken.policy,
  1237. Signature: ossToken.signature,
  1238. callback: ossToken.callback,
  1239. success_action_status: 200,
  1240. },
  1241. success: (result) => {
  1242. // if (result.statusCode === 200) {
  1243. self.ossAvatarUrl = ossToken.dir;
  1244. resolve(ossToken.dir);
  1245. // } else {
  1246. // uni.showToast({
  1247. // title: "上传失败",
  1248. // icon: "none",
  1249. // });
  1250. // return;
  1251. // }
  1252. },
  1253. fail: (error) => {
  1254. uni.showToast({
  1255. title: "上传接口报错" + error,
  1256. icon: "none",
  1257. });
  1258. this.uploadLock = false;
  1259. this.openPhoto();
  1260. return;
  1261. },
  1262. });
  1263. // #endif
  1264. });
  1265. });
  1266. },
  1267. imageInfos() {
  1268. var self = this;
  1269. return new Promise(async (resolve, reject) => {
  1270. // #ifdef MP-WEIXIN
  1271. uni.getImageInfo({
  1272. src: self.avatarUrl,
  1273. success: async (res) => {
  1274. let canvasWidth = res.width; //图片原始长宽
  1275. let canvasHeight = res.height;
  1276. if (canvasWidth > 2000 || canvasHeight > 2000) {
  1277. uni.compressImage({
  1278. src: self.avatarUrl,
  1279. quality: 75,
  1280. width: "35%",
  1281. height: "35%",
  1282. success: async (rest) => {
  1283. const waitUpload = await self.uploadFile(
  1284. rest.tempFilePath,
  1285. 0
  1286. );
  1287. resolve(waitUpload);
  1288. },
  1289. });
  1290. } else if (canvasWidth > 1000 || canvasHeight > 1000) {
  1291. uni.compressImage({
  1292. src: self.avatarUrl,
  1293. quality: 75,
  1294. width: "50%",
  1295. height: "50%",
  1296. success: async (rest) => {
  1297. const waitUpload = await self.uploadFile(
  1298. rest.tempFilePath,
  1299. 0
  1300. );
  1301. resolve(waitUpload);
  1302. },
  1303. });
  1304. } else {
  1305. console.log("无需压缩");
  1306. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  1307. resolve(waitUpload);
  1308. }
  1309. },
  1310. });
  1311. // #endif
  1312. // #ifdef H5
  1313. const waitUpload = await this.uploadFile(this.faceUrl, 0);
  1314. resolve(waitUpload);
  1315. // #endif
  1316. });
  1317. },
  1318. /**
  1319. * 人脸匹配
  1320. */
  1321. faceRecognition() {
  1322. return new Promise((resolve) => {
  1323. // #ifdef MP-WEIXIN
  1324. let fileSystem = uni.getFileSystemManager();
  1325. fileSystem.readFile({
  1326. filePath: `${this.avatarUrl}`,
  1327. encoding: "base64",
  1328. position: 0,
  1329. success: (res) => {
  1330. let base64 = "data:image/jpg;base64," + res.data;
  1331. console.log("试卷-base64Data人脸识别参数:", {
  1332. imageA: base64,
  1333. orderGoodsId: this.orderGoodsId,
  1334. gradeId: this.gradeId,
  1335. });
  1336. this.CompareFace(base64, resolve);
  1337. },
  1338. fail(err) {
  1339. console.error(err, "err");
  1340. },
  1341. });
  1342. // #endif
  1343. // #ifdef H5
  1344. this.CompareFace(this.faceUrl, resolve);
  1345. // #endif
  1346. });
  1347. },
  1348. CompareFace(url, resolve) {
  1349. let timer = setTimeout(() => {
  1350. uni.showToast({
  1351. icon: "none",
  1352. title: "拍照超时,请重新拍照",
  1353. duration: 2000,
  1354. success: () => {
  1355. setTimeout(() => {
  1356. uni.navigateBack();
  1357. }, 1000);
  1358. },
  1359. });
  1360. }, 10 * 1000);
  1361. this.$api
  1362. .faceCertificationCompareFace({
  1363. imageA: url,
  1364. orderGoodsId: this.orderGoodsId,
  1365. gradeId: this.gradeId,
  1366. })
  1367. .then((res) => {
  1368. clearTimeout(timer);
  1369. console.log(res, "人脸识别成功res");
  1370. resolve(res.data.data);
  1371. })
  1372. .catch((err) => {
  1373. clearTimeout(timer);
  1374. // 当前网络延迟,
  1375. console.log("人脸识别错误:", err);
  1376. uni.showModal({
  1377. content: "当前网络延迟",
  1378. showCancel: false,
  1379. success: (resultst) => {
  1380. if (resultst.confirm) {
  1381. uni.navigateBack();
  1382. }
  1383. },
  1384. });
  1385. });
  1386. },
  1387. toTakePhoto() {
  1388. this.popupPhotoShow = false;
  1389. this.openPhoto();
  1390. },
  1391. takePhTips() {
  1392. this.popupPhotoShow = true;
  1393. this.isTaking = false;
  1394. this.photoPopup = false;
  1395. },
  1396. // 确认拍照
  1397. async submitPhoto() {
  1398. if (this.uploadLock) {
  1399. return;
  1400. }
  1401. this.uploadLock = true;
  1402. let compareFaceData = await this.faceRecognition();
  1403. this.compareFaceData = compareFaceData;
  1404. if (compareFaceData >= 80) {
  1405. const waitYS = await this.imageInfos();
  1406. this.postStudyRecord(); //提交记录
  1407. this.photoPopup = false;
  1408. } else {
  1409. uni.showToast({
  1410. title: "人脸匹配不通过,请重新拍照上传",
  1411. icon: "none",
  1412. duration: 2000,
  1413. });
  1414. setTimeout(() => {
  1415. this.uploadLock = false;
  1416. this.openPhoto();
  1417. }, 2000);
  1418. }
  1419. },
  1420. //拍照
  1421. openPhoto() {
  1422. console.log("开始拍照");
  1423. // this.enableAutoRotation = false;
  1424. // #ifdef MP-WEIXIN
  1425. this.photoPopup = true;
  1426. this.isTaking = true;
  1427. uni.setKeepScreenOn({
  1428. keepScreenOn: true,
  1429. });
  1430. uni.authorize({
  1431. scope: "scope.camera",
  1432. success() {},
  1433. });
  1434. // #endif
  1435. // #ifdef H5
  1436. this.isHadCamera();
  1437. // #endif
  1438. },
  1439. isHadCamera() {
  1440. if (
  1441. (window.navigator.mediaDevices &&
  1442. window.navigator.mediaDevices.getUserMedia) ||
  1443. window.navigator.getUserMedia ||
  1444. window.navigator.webkitGetUserMedia ||
  1445. window.navigator.mozGetUserMedia
  1446. ) {
  1447. console.log("getUserMedia----");
  1448. // 调用用户媒体设备, 访问摄像头
  1449. this.getUserMedia(
  1450. {
  1451. video: {
  1452. width: 400,
  1453. height: 300,
  1454. },
  1455. },
  1456. this.photographSuccess,
  1457. this.photographError
  1458. );
  1459. } else {
  1460. console.log("1111没有摄像");
  1461. this.photographError();
  1462. }
  1463. },
  1464. //确认拍照
  1465. takePhoto() {
  1466. // #ifdef MP-WEIXIN
  1467. const ctx = uni.createCameraContext();
  1468. ctx.takePhoto({
  1469. quality: "high",
  1470. success: (res) => {
  1471. console.log(res.tempImagePath);
  1472. this.avatarUrl = res.tempImagePath;
  1473. // self.submitPhoto();
  1474. this.isTaking = false;
  1475. },
  1476. fail: (err) => {
  1477. console.log(err);
  1478. },
  1479. });
  1480. // #endif
  1481. // #ifdef H5
  1482. const canvas = document.createElement("canvas");
  1483. canvas.width = 400;
  1484. canvas.height = 400;
  1485. const context = canvas.getContext("2d");
  1486. const video = document.querySelector("video");
  1487. context.drawImage(video, 0, 0, 400, 400);
  1488. this.faceUrl = canvas.toDataURL("image/png");
  1489. this.isTaking = false;
  1490. // #endif
  1491. },
  1492. /**
  1493. * 是否有上传图片
  1494. */
  1495. hasImgs(bank) {
  1496. return bank.ansText.imageList.length == 0;
  1497. },
  1498. /**
  1499. * 获取试卷类型2考试,1练习
  1500. */
  1501. bankExam() {
  1502. return this.$api.bankExam(this.id).then((res) => {
  1503. this.bankType = res.data.data.doType;
  1504. this.examData = res.data.data;
  1505. if (this.bankType == 2) {
  1506. this.needBack = true;
  1507. }
  1508. return Promise.resolve();
  1509. });
  1510. },
  1511. /**
  1512. * 点击后退按钮
  1513. */
  1514. clickLeft() {
  1515. //需要拍照没有拍直接返回
  1516. if (this.needPhoto && !this.isTakePhoto) {
  1517. this.isSubmit = true;
  1518. uni.navigateBack({
  1519. delta: 1,
  1520. });
  1521. return;
  1522. }
  1523. if (this.bankType == 1) {
  1524. let ansCount = this.questionOverNum(); //已答题数
  1525. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1526. //所有题目答完
  1527. if (this.lastCount == 0) {
  1528. // this.testOver = true;
  1529. this.cgType = 7;
  1530. //未答完
  1531. } else {
  1532. this.cgType = 8;
  1533. // this.isLastCount = true;
  1534. }
  1535. this.showpopups = true;
  1536. } else if (this.bankType == 2) {
  1537. let ansCount = this.questionOverNum(); //已答题数
  1538. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1539. //所有题目答完
  1540. if (this.lastCount == 0) {
  1541. this.testOver = true;
  1542. //未答完
  1543. } else {
  1544. this.isLastCount = true;
  1545. }
  1546. }
  1547. },
  1548. /**
  1549. * 返回上一页
  1550. */
  1551. backPages() {
  1552. this.needBack = false;
  1553. uni.navigateBack({
  1554. delta: 1,
  1555. });
  1556. },
  1557. /**
  1558. * 获取已经回答的题目数
  1559. * hasSpecail (是否包含简答和案例)
  1560. */
  1561. questionOverNum(hasSpecail) {
  1562. let count = 0;
  1563. this.questionList.forEach((item) => {
  1564. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1565. if (item.ques) {
  1566. count++;
  1567. }
  1568. } else if (item.type == 4) {
  1569. //案例题
  1570. if (hasSpecail) {
  1571. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1572. if (
  1573. jsonItem.type == 1 ||
  1574. jsonItem.type == 2 ||
  1575. jsonItem.type == 3
  1576. ) {
  1577. if (item.ques[indexs]) {
  1578. return true;
  1579. } else {
  1580. return false;
  1581. }
  1582. } else if (jsonItem.type == 5) {
  1583. console.log(jsonItem, 111);
  1584. if (
  1585. item.ques[indexs] &&
  1586. (item.ques[indexs].text.length ||
  1587. item.ques[indexs].imageList.length)
  1588. ) {
  1589. return true;
  1590. } else {
  1591. return false;
  1592. }
  1593. }
  1594. });
  1595. if (isOver) {
  1596. count++;
  1597. console.log(item, 444);
  1598. }
  1599. }
  1600. } else if (item.type == 5) {
  1601. //简答题
  1602. if (hasSpecail) {
  1603. if (
  1604. item.ques &&
  1605. (item.ques.text.length || item.ques.imageList.length)
  1606. ) {
  1607. count++;
  1608. }
  1609. }
  1610. }
  1611. });
  1612. return count;
  1613. },
  1614. /**
  1615. * 是否做完所有题目
  1616. */
  1617. isDoOver() {
  1618. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  1619. if (this.questionList.length == questionOverNum) {
  1620. //全部做完弹窗
  1621. this.cgType = 9;
  1622. this.showpopups = true;
  1623. }
  1624. },
  1625. /**
  1626. * 暂不交卷
  1627. */
  1628. noSubmit() {
  1629. //设为允许退出页面
  1630. this.needBack = false;
  1631. uni.navigateBack({
  1632. delta: 1,
  1633. });
  1634. },
  1635. /**
  1636. * 不离开
  1637. */
  1638. noLeave() {
  1639. this.isLastCount = false;
  1640. },
  1641. /**
  1642. * 立即离开并交卷
  1643. */
  1644. leaveNow() {
  1645. this.isSubmit = true;
  1646. uni.navigateBack({
  1647. delta: 1,
  1648. });
  1649. //需要拍照没有拍,返回不扣次数
  1650. if (this.needPhoto && !this.isTakePhoto) {
  1651. return;
  1652. }
  1653. this.submit("leaveNow");
  1654. return;
  1655. let score = 0; //计算总分
  1656. let reportStatus = 0;
  1657. let number = 0;
  1658. let doQuestionIds = []; //做过的题目id
  1659. let doQuestionNum = 0; //做过的题目数量
  1660. let passScore = 0;
  1661. let allScore = 0; //总分
  1662. this.questionList.forEach((item, index) => {
  1663. passScore = item.passScore;
  1664. if (item.type == 1) {
  1665. if (item.ques == item.ans) {
  1666. item.scoreResult = item.score;
  1667. score += item.score;
  1668. number++;
  1669. } else {
  1670. item.scoreResult = 0;
  1671. }
  1672. if (item.ques) {
  1673. doQuestionNum++;
  1674. doQuestionIds.push(item.questionId);
  1675. }
  1676. allScore += item.score;
  1677. } else if (item.type == 2) {
  1678. let isRight =
  1679. item.ques &&
  1680. item.ques.every((quesItem, quesIndex) => {
  1681. return item.ques[quesIndex] == item.ans[quesIndex];
  1682. });
  1683. if (isRight) {
  1684. //全对
  1685. item.scoreResult = item.score;
  1686. score += item.score;
  1687. number++;
  1688. } else {
  1689. let hasPart = false;
  1690. let checkboxScore = 1; //获取单题总分数
  1691. item.ques &&
  1692. item.ques.forEach((ques, quesIndex) => {
  1693. //选错一个全扣
  1694. if (item.ques) {
  1695. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1696. checkboxScore = 0;
  1697. }
  1698. } else {
  1699. checkboxScore = 0;
  1700. }
  1701. });
  1702. //没选错
  1703. if (checkboxScore) {
  1704. checkboxScore = 0;
  1705. item.ans.forEach((ans, quesIndex) => {
  1706. //漏选扣一部分,对n题给n X partScore 分
  1707. if (item.ques) {
  1708. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  1709. checkboxScore += item.partScore;
  1710. hasPart = true;
  1711. }
  1712. } else {
  1713. checkboxScore = 0;
  1714. }
  1715. });
  1716. }
  1717. if (!hasPart) {
  1718. item.scoreResult = 0;
  1719. } else {
  1720. item.scoreResult = checkboxScore;
  1721. }
  1722. score += checkboxScore;
  1723. }
  1724. if (item.ques && item.ques.length) {
  1725. doQuestionNum++;
  1726. doQuestionIds.push(item.questionId);
  1727. }
  1728. allScore += item.score;
  1729. } else if (item.type == 3) {
  1730. if (item.ques == item.ans) {
  1731. item.scoreResult = item.score;
  1732. score += item.score;
  1733. number++;
  1734. } else {
  1735. item.scoreResult = 0;
  1736. }
  1737. if (item.ques) {
  1738. doQuestionNum++;
  1739. doQuestionIds.push(item.questionId);
  1740. }
  1741. allScore += item.score;
  1742. } else {
  1743. allScore += item.score;
  1744. }
  1745. });
  1746. if (score >= passScore) {
  1747. reportStatus = 1;
  1748. } else {
  1749. reportStatus = 0;
  1750. }
  1751. this.$api
  1752. .bankRecordEdit({
  1753. moduleId: this.moduleId || 0,
  1754. chapterId: this.chapterId || 0,
  1755. sectionId: this.sectionId || 0,
  1756. gradeId: this.gradeId,
  1757. courseId: this.courseId,
  1758. orderGoodsId: this.orderGoodsId,
  1759. goodsId: this.goodsId,
  1760. examId: this.id,
  1761. recordId: this.recordId,
  1762. reportStatus: reportStatus,
  1763. rightQuestionNum: number,
  1764. doQuestionNum: doQuestionNum,
  1765. status: 1,
  1766. doQuestionIds: doQuestionIds.join(","),
  1767. performance: score,
  1768. totalScore: allScore,
  1769. type: this.examType,
  1770. // examTime: parseInt(this.allTimes),
  1771. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1772. // historyExamJson: JSON.stringify(this.questionList)
  1773. })
  1774. .then((res) => {});
  1775. },
  1776. /**
  1777. * 立即交卷
  1778. */
  1779. submitNow() {
  1780. this.showpopups = false;
  1781. this.needBack = false;
  1782. this.submit();
  1783. },
  1784. /**
  1785. * 离开页面统计回答正确题数
  1786. */
  1787. examRecordEdit() {
  1788. if (!this.isSubmit) {
  1789. this.submit("leave");
  1790. return;
  1791. let number = 0;
  1792. let score = 0;
  1793. let doQuestionNum = 0;
  1794. let reportStatus = 0;
  1795. let lessQuestionNum = 0;
  1796. this.questionList.forEach((item, index) => {
  1797. if (item.type == 1) {
  1798. if (item.ques == item.ans) {
  1799. score += item.score;
  1800. number++;
  1801. }
  1802. if (item.ques) {
  1803. doQuestionNum++;
  1804. }
  1805. } else if (item.type == 2) {
  1806. let isRight =
  1807. item.ques &&
  1808. item.ques.every((quesItem, quesIndex) => {
  1809. return item.ques[quesIndex] == item.ans[quesIndex];
  1810. });
  1811. if (isRight) {
  1812. score += item.score;
  1813. number++;
  1814. } else {
  1815. let hasPart = false;
  1816. let checkboxScore = 1; //获取单题总分数
  1817. item.ques.forEach((ques, quesIndex) => {
  1818. //选错一个全扣
  1819. if (item.ques) {
  1820. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1821. checkboxScore = 0;
  1822. }
  1823. } else {
  1824. checkboxScore = 0;
  1825. }
  1826. });
  1827. //没选错
  1828. if (checkboxScore) {
  1829. checkboxScore = 0;
  1830. item.ans.forEach((ans, quesIndex) => {
  1831. //漏选扣一部分
  1832. if (item.ques) {
  1833. if (item.ques.indexOf(item.ans[quesIndex]) == -1) {
  1834. checkboxScore += item.partScore;
  1835. hasPart = true;
  1836. }
  1837. } else {
  1838. checkboxScore = 0;
  1839. }
  1840. });
  1841. }
  1842. if (!hasPart) {
  1843. item.scoreResult = 0;
  1844. } else {
  1845. lessQuestionNum++;
  1846. item.scoreResult = checkboxScore;
  1847. score += checkboxScore;
  1848. // number++;
  1849. }
  1850. }
  1851. if (item.ques && item.ques.length) {
  1852. doQuestionNum++;
  1853. }
  1854. } else if (item.type == 3) {
  1855. if (item.ques == item.ans) {
  1856. score += item.score;
  1857. number++;
  1858. }
  1859. if (item.ques) {
  1860. doQuestionNum++;
  1861. }
  1862. } else if (item == 4) {
  1863. if (item.ques.length) {
  1864. doQuestionNum++;
  1865. }
  1866. } else if (item.type == 5) {
  1867. if (item.ques) {
  1868. doQuestionNum++;
  1869. }
  1870. }
  1871. });
  1872. if (score >= 60) {
  1873. reportStatus = 1;
  1874. }
  1875. this.$api
  1876. .bankRecordEdit({
  1877. moduleId: this.moduleId || 0,
  1878. chapterId: this.chapterId || 0,
  1879. sectionId: this.sectionId || 0,
  1880. gradeId: this.gradeId,
  1881. courseId: this.courseId,
  1882. orderGoodsId: this.orderGoodsId,
  1883. goodsId: this.goodsId,
  1884. examId: this.id,
  1885. recordId: this.recordId,
  1886. lessQuestionNum: lessQuestionNum,
  1887. performance: score,
  1888. reportStatus: reportStatus,
  1889. status: 1,
  1890. type: this.examType,
  1891. // historyExamJson: JSON.stringify(this.questionList)
  1892. })
  1893. .then((res) => {});
  1894. }
  1895. },
  1896. /**
  1897. * @param {Object} second倒计时过滤器
  1898. */
  1899. countdown(second) {
  1900. if (second) {
  1901. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1902. let m = parseInt((second / 60) % 60); // 计算分数
  1903. let s = parseInt(second % 60); // 计算当前秒数
  1904. if (h < 10) h = "0" + h;
  1905. if (m < 10) m = "0" + m;
  1906. if (s < 10) s = "0" + s;
  1907. return h + ":" + m + ":" + s;
  1908. } else {
  1909. return "";
  1910. }
  1911. },
  1912. /**
  1913. * 请求题目列表
  1914. */
  1915. goodsQuestionList() {
  1916. this.$api[
  1917. this.doMode == 3 ? "goodsRandomQuestionList" : "goodsQuestionList"
  1918. ]({
  1919. examId: this.id,
  1920. goodsId: this.goodsId,
  1921. orderGoodsId: this.orderGoodsId,
  1922. from: 2,
  1923. }).then(async (res) => {
  1924. let data = res.data.data;
  1925. if (this.doMode == 3) {
  1926. this.simulateExamId = data.simulateExamId;
  1927. data = data.questionList;
  1928. }
  1929. if (!data.length) {
  1930. this.hideDialog();
  1931. uni.showModal({
  1932. showCancel: false,
  1933. content: this.simulateExamId ? "您已经毕业了" : "该试卷暂无题目",
  1934. success: function (k) {
  1935. if (k.confirm) {
  1936. uni.navigateBack();
  1937. }
  1938. },
  1939. });
  1940. return;
  1941. }
  1942. this.allTimes = data[0].answerTime * 60;
  1943. this.lastTime = data[0].answerTime && data[0].answerTime * 60;
  1944. data.forEach((item, index) => {
  1945. if (typeof item.jsonStr == "string") {
  1946. item.jsonStr = JSON.parse(item.jsonStr);
  1947. if (item.type == 2) {
  1948. //多选
  1949. item.jsonStr.forEach((str) => {
  1950. str.optionsId = "" + str.optionsId;
  1951. });
  1952. let arr = item.answerQuestion.split(",");
  1953. arr.forEach((a, i) => {
  1954. arr[i] = "" + a;
  1955. });
  1956. item.ans = arr;
  1957. item.analysisContent &&
  1958. (item.analysisContent = item.analysisContent.replace(
  1959. /<img/gi,
  1960. '<img style="max-width:100%;"'
  1961. ));
  1962. item.content &&
  1963. (item.content = item.content.replace(
  1964. /<img/gi,
  1965. '<img style="max-width:100%;"'
  1966. ));
  1967. return;
  1968. } else if (item.type == 5) {
  1969. //简答题
  1970. item.ansText = {
  1971. text: "",
  1972. imageList: [],
  1973. };
  1974. item.ques = {
  1975. text: "",
  1976. imageList: [],
  1977. };
  1978. item.analysisContent &&
  1979. (item.analysisContent = item.analysisContent.replace(
  1980. /<img/gi,
  1981. '<img style="max-width:100%;"'
  1982. ));
  1983. item.content &&
  1984. (item.content = item.content.replace(
  1985. /<img/gi,
  1986. '<img style="max-width:100%;"'
  1987. ));
  1988. } else if (item.type == 4) {
  1989. //案例题
  1990. console.log(item.jsonStr);
  1991. item.ques = [];
  1992. item.current = 0;
  1993. let ansArr = [];
  1994. item.jsonStr.forEach((json, index) => {
  1995. if (json.type == 1) {
  1996. ansArr[index] = json.answerQuestion;
  1997. json.content &&
  1998. (json.content = json.content.replace(
  1999. /<img/gi,
  2000. '<img style="max-width:100%;"'
  2001. ));
  2002. } else if (json.type == 2) {
  2003. json.optionsList.forEach((str) => {
  2004. str.optionsId = "" + str.optionsId;
  2005. });
  2006. let arr = json.answerQuestion.split(",");
  2007. arr.forEach((a, i) => {
  2008. arr[i] = "" + a;
  2009. });
  2010. ansArr[index] = arr;
  2011. json.content &&
  2012. (json.content = json.content.replace(
  2013. /<img/gi,
  2014. '<img style="max-width:100%;"'
  2015. ));
  2016. } else if (json.type == 3) {
  2017. ansArr[index] = json.answerQuestion;
  2018. json.content &&
  2019. (json.content = json.content.replace(
  2020. /<img/gi,
  2021. '<img style="max-width:100%;"'
  2022. ));
  2023. } else if (json.type == 5) {
  2024. ansArr[index] = {
  2025. text: "",
  2026. imageList: [],
  2027. };
  2028. json.ansText = {
  2029. text: "",
  2030. imageList: [],
  2031. };
  2032. json.content &&
  2033. (json.content = json.content.replace(
  2034. /<img/gi,
  2035. '<img style="max-width:100%;"'
  2036. ));
  2037. }
  2038. });
  2039. item.analysisContent &&
  2040. (item.analysisContent = item.analysisContent.replace(
  2041. /<img/gi,
  2042. '<img style="max-width:100%;"'
  2043. ));
  2044. item.content &&
  2045. (item.content = item.content.replace(
  2046. /<img/gi,
  2047. '<img style="max-width:100%;"'
  2048. ));
  2049. item.ans = ansArr;
  2050. return;
  2051. }
  2052. item.content &&
  2053. (item.content = item.content.replace(
  2054. /<img/gi,
  2055. '<img style="max-width:100%;"'
  2056. ));
  2057. item.ans = item.answerQuestion;
  2058. }
  2059. });
  2060. this.questionList = data;
  2061. this.lastCount = this.questionList.length;
  2062. this.getCollectInfo(this.current);
  2063. await this.examRecord();
  2064. });
  2065. },
  2066. /**
  2067. * 记录总题数,获取recordId
  2068. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  2069. */
  2070. examRecord(hasSpecial) {
  2071. return new Promise((resolve) => {
  2072. let questionList = 0;
  2073. // if(!hasSpecial) {
  2074. this.questionList.forEach((item, index) => {
  2075. if (item.type == 1 || item.type == 2 || item.type == 3) {
  2076. questionList++;
  2077. }
  2078. });
  2079. // } else {
  2080. // questionList = this.questionList.length;
  2081. // }
  2082. this.$api
  2083. .bankRecord({
  2084. courseId: this.courseId,
  2085. // chapterExamId: this.chapterId || 0,
  2086. // moduleExamId: this.moduleId || 0,
  2087. chapterId: this.chapterId || 0,
  2088. moduleId: this.moduleId || 0,
  2089. sectionId: this.sectionId || 0,
  2090. examId: this.id,
  2091. goodsId: this.goodsId,
  2092. orderGoodsId: this.orderGoodsId,
  2093. gradeId: this.gradeId,
  2094. totalQuestionNum: questionList,
  2095. allQuestionNum: this.questionList.length,
  2096. type: this.examType,
  2097. simulateExamId: this.simulateExamId,
  2098. doMode: this.doMode,
  2099. })
  2100. .then((res) => {
  2101. this.recordId = res.data.data;
  2102. if (this.needPhoto) {
  2103. if (!this.learning && this.examType != 2) {
  2104. if (uni.getStorageSync("tabkePhotoShow")) {
  2105. // #ifdef MP-WEIXIN
  2106. this.photoPopup = true; //拍照
  2107. this.isTaking = true;
  2108. // #endif
  2109. // #ifdef H5
  2110. this.isHadCamera();
  2111. // #endif
  2112. } else {
  2113. this.popupPhotoShow = true;
  2114. uni.setStorageSync("tabkePhotoShow", 1); // 本地缓存用来判断是否已经弹出过弹窗
  2115. }
  2116. }
  2117. } else {
  2118. if (this.lastTime) {
  2119. this.timer = setInterval(() => {
  2120. if (this.lastTime <= 0) {
  2121. clearInterval(this.timer);
  2122. uni.showToast({
  2123. icon: "none",
  2124. mask: true,
  2125. title: "考试时间已到,系统将自动交卷",
  2126. duration: 10000,
  2127. });
  2128. this.submit();
  2129. return;
  2130. }
  2131. this.lastTime--;
  2132. }, 1000);
  2133. }
  2134. resolve();
  2135. }
  2136. });
  2137. });
  2138. },
  2139. /**
  2140. * @param {Object} e单选点击
  2141. */
  2142. radioSelect(optionsId, bindex) {
  2143. // if (this.questionList[bindex].ques) return;
  2144. if (this.questionList[bindex].ques && this.bankType == 1) {
  2145. return;
  2146. }
  2147. this.$set(this.questionList[bindex], "ques", optionsId);
  2148. // if ((bindex + 1) < this.questionList.length) {
  2149. // this.current = bindex + 1
  2150. // }
  2151. this.isDoOver();
  2152. },
  2153. /**
  2154. * @param {Object} e案例单选点击
  2155. */
  2156. radioSelectChild(optionsId, ansIndex, bindex) {
  2157. // if (this.questionList[bindex].ques[ansIndex]) return;
  2158. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  2159. return;
  2160. }
  2161. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  2162. this.isDoOver();
  2163. },
  2164. /**
  2165. * @param {Object} 多选点击
  2166. */
  2167. checkboxSelect(optionsId, bindex, index) {
  2168. if (this.questionList[bindex].ques && this.bankType == 1) {
  2169. return;
  2170. }
  2171. this.$set(
  2172. this.questionList[bindex].jsonStr[index],
  2173. "checked",
  2174. !this.questionList[bindex].jsonStr[index].checked
  2175. );
  2176. },
  2177. /**
  2178. * @param {Object} 案例多选点击
  2179. */
  2180. checkboxSelectChild(bindex, ansIndex, childIndex) {
  2181. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  2182. return;
  2183. }
  2184. this.$set(
  2185. this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
  2186. "checked",
  2187. !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex]
  2188. .checked
  2189. );
  2190. },
  2191. isCheckboxChecked(arr) {
  2192. return arr.some((item) => {
  2193. if (item.checked) {
  2194. return true;
  2195. }
  2196. });
  2197. },
  2198. /**
  2199. * @param {Object} 多选确认
  2200. */
  2201. checkboxSubmit(bindex) {
  2202. // if (this.questionList[bindex].ques) return;
  2203. if (this.questionList[bindex].ques && this.bankType == 1) {
  2204. return;
  2205. }
  2206. let arr = [];
  2207. this.questionList[bindex].jsonStr.forEach((item) => {
  2208. if (item.checked) {
  2209. arr.push(item.optionsId);
  2210. }
  2211. });
  2212. if (!arr.length) {
  2213. delete this.questionList[bindex].ques;
  2214. uni.showToast({
  2215. title: "请选择答案",
  2216. icon: "none",
  2217. });
  2218. return;
  2219. }
  2220. this.$set(this.questionList[bindex], "ques", arr);
  2221. this.$u.toast("已确认答案");
  2222. this.isDoOver();
  2223. // let isWrong = this.questionList[bindex].ques.some(
  2224. // (quesItem, quesIndex) => {
  2225. // return (
  2226. // this.questionList[bindex].ques[quesIndex] !=
  2227. // this.questionList[bindex].ans[quesIndex]
  2228. // );
  2229. // }
  2230. // );
  2231. // let isWrong = this.questionList[bindex].ques.some((item, i) => {
  2232. // return this.questionList[bindex].ans.indexOf(item) == -1;
  2233. // })
  2234. },
  2235. /**
  2236. * @param {Object} 案例多选确认
  2237. */
  2238. checkboxSubmitChild(bindex, ansIndex) {
  2239. // if (this.questionList[bindex].ques[ansIndex]) return;
  2240. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  2241. return;
  2242. }
  2243. let arr = [];
  2244. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
  2245. (item) => {
  2246. if (item.checked) {
  2247. arr.push(item.optionsId);
  2248. }
  2249. }
  2250. );
  2251. if (!arr.length) {
  2252. delete this.questionList[bindex].ques[ansIndex];
  2253. uni.showToast({
  2254. title: "请选择答案",
  2255. icon: "none",
  2256. });
  2257. return;
  2258. }
  2259. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  2260. this.$u.toast("已确认答案");
  2261. this.isDoOver();
  2262. },
  2263. /**
  2264. * @param {Object} index
  2265. * @param {Object} bindex
  2266. * 判断题
  2267. */
  2268. judgeSelect(index, bindex) {
  2269. // if (this.questionList[bindex].ques) return;
  2270. if (this.questionList[bindex].ques && this.bankType == 1) {
  2271. return;
  2272. }
  2273. this.$set(this.questionList[bindex], "ques", index == 0 ? "1" : "0");
  2274. this.isDoOver();
  2275. },
  2276. /**
  2277. * @param {Object} ansindex
  2278. * @param {Object} childindex
  2279. * @param {Object} bindex
  2280. * 案例判断题
  2281. */
  2282. judgeSelectChild(ansindex, childindex, bindex) {
  2283. // if (this.questionList[bindex].ques[ansindex]) return;
  2284. if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
  2285. return;
  2286. }
  2287. this.$set(
  2288. this.questionList[bindex].ques,
  2289. ansindex,
  2290. childindex == 0 ? "1" : "0"
  2291. );
  2292. this.isDoOver();
  2293. },
  2294. openFooterTab() {
  2295. this.show = true;
  2296. },
  2297. hideDialog() {
  2298. this.showDialog = false;
  2299. },
  2300. changeIndex(index) {
  2301. this.current = index;
  2302. },
  2303. swiperChange(e) {
  2304. this.current = e.detail.current;
  2305. this.getCollectInfo(this.current);
  2306. },
  2307. /**
  2308. * @param {Object} current
  2309. * 获取收藏信息
  2310. */
  2311. getCollectInfo(current) {
  2312. this.$api
  2313. .getCollectInfo({
  2314. examId: this.id,
  2315. questionId: this.questionList[current].questionId,
  2316. goodsId: this.goodsId,
  2317. orderGoodsId: this.orderGoodsId,
  2318. })
  2319. .then((res) => {
  2320. if (res.data.code == 500) {
  2321. this.$set(this.collectList, current, false);
  2322. } else if (res.data.code == 200) {
  2323. this.$set(this.collectList, current, res.data.data);
  2324. }
  2325. });
  2326. },
  2327. /**
  2328. * @param {Object} state
  2329. * @param {Object} index
  2330. * 收藏
  2331. */
  2332. collect(state, index) {
  2333. if (!state) {
  2334. this.$api
  2335. .collectQuestion({
  2336. examId: this.id,
  2337. questionId: this.questionList[index].questionId,
  2338. goodsId: this.goodsId || "",
  2339. orderGoodsId: this.orderGoodsId,
  2340. doMode: this.doMode,
  2341. })
  2342. .then((res) => {
  2343. if (res.data.code == 200) {
  2344. this.$set(this.collectList, index, true);
  2345. uni.showToast({
  2346. title: "收藏成功",
  2347. duration: 2000,
  2348. icon: "none",
  2349. });
  2350. this.getCollectInfo(index);
  2351. }
  2352. });
  2353. } else {
  2354. this.$api
  2355. .deleteCollectQuestion(this.collectList[index].collectQuestionId)
  2356. .then((res) => {
  2357. if (res.data.code == 200) {
  2358. this.$set(this.collectList, index, false);
  2359. uni.showToast({
  2360. title: "取消收藏成功",
  2361. duration: 2000,
  2362. icon: "none",
  2363. });
  2364. }
  2365. });
  2366. }
  2367. return;
  2368. },
  2369. pdsubmit() {
  2370. let ansCount = this.questionOverNum(true); //已答题数
  2371. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  2372. //没有答完
  2373. if (this.lastCount !== 0) {
  2374. this.cgType = 6;
  2375. this.showpopups = true;
  2376. return;
  2377. }
  2378. if (this.bankType == 2) {
  2379. if (this.lastTime > 0) {
  2380. let lastTime = this.countdown(this.lastTime);
  2381. uni.showModal({
  2382. title: "提示",
  2383. content: `时间还剩余${lastTime},确定交卷吗?`,
  2384. confirmText: "交卷",
  2385. cancelText: "继续答题",
  2386. success: (res) => {
  2387. if (res.confirm) {
  2388. //确定
  2389. this.submit();
  2390. } else {
  2391. //取消
  2392. }
  2393. },
  2394. });
  2395. return;
  2396. }
  2397. }
  2398. this.submit();
  2399. },
  2400. /**
  2401. * 交卷
  2402. */
  2403. submit(typesubmit) {
  2404. console.log("交卷", typesubmit);
  2405. let score = 0; //计算总分
  2406. let reportStatus = 0;
  2407. let number = 0; //做对的题目数量
  2408. let doQuestionNum = 0; //做过的题目数量
  2409. let allScore = 0; //总分
  2410. let passScore = 0;
  2411. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  2412. let doQuestionIds = []; //做过的题目id
  2413. let rightQuestionIds = []; //做对的题目id
  2414. let lessQuestionNum = 0;
  2415. this.questionList.forEach((item, index) => {
  2416. passScore = item.passScore;
  2417. if (item.type == 1) {
  2418. //正确
  2419. if (item.ques == item.ans) {
  2420. item.scoreResult = item.score;
  2421. score += item.score;
  2422. number++;
  2423. rightQuestionIds.push(item.questionId);
  2424. } else {
  2425. //错误
  2426. item.scoreResult = 0;
  2427. if (item.ques) {
  2428. doWrongQuestionIds.push(item.questionId);
  2429. }
  2430. }
  2431. allScore += item.score;
  2432. if (item.ques) {
  2433. doQuestionNum++;
  2434. doQuestionIds.push(item.questionId);
  2435. }
  2436. } else if (item.type == 2) {
  2437. let isRight =
  2438. item.ans &&
  2439. item.ans.every((quesItem, quesIndex) => {
  2440. if (item.ques) {
  2441. return item.ques[quesIndex] == item.ans[quesIndex];
  2442. } else {
  2443. return false;
  2444. }
  2445. });
  2446. if (isRight) {
  2447. score += item.score;
  2448. number++;
  2449. item.scoreResult = item.score;
  2450. rightQuestionIds.push(item.questionId);
  2451. } else {
  2452. let hasPart = false;
  2453. let checkboxScore = 1; //获取单题总分数
  2454. item.ques &&
  2455. item.ques.forEach((ques, quesIndex) => {
  2456. //选错一个全扣
  2457. if (item.ques) {
  2458. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  2459. checkboxScore = 0;
  2460. }
  2461. } else {
  2462. checkboxScore = 0;
  2463. }
  2464. });
  2465. console.log(checkboxScore);
  2466. //没选错
  2467. if (checkboxScore) {
  2468. checkboxScore = 0;
  2469. item.ans.forEach((ans, quesIndex) => {
  2470. //漏选扣一部分,对n题给n X partScore 分
  2471. if (item.ques) {
  2472. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  2473. checkboxScore += item.partScore;
  2474. hasPart = true;
  2475. }
  2476. } else {
  2477. checkboxScore = 0;
  2478. }
  2479. });
  2480. }
  2481. if (!hasPart) {
  2482. //0分
  2483. item.scoreResult = 0;
  2484. if (item.ques) {
  2485. doWrongQuestionIds.push(item.questionId);
  2486. }
  2487. } else {
  2488. //部分分
  2489. // number++;
  2490. // doWrongQuestionIds.push(item.questionId);
  2491. lessQuestionNum++;
  2492. item.scoreResult = checkboxScore;
  2493. score += checkboxScore;
  2494. // rightQuestionIds.push(item.questionId)
  2495. }
  2496. }
  2497. allScore += item.score;
  2498. if (item.ques && item.ques.length) {
  2499. doQuestionNum++;
  2500. doQuestionIds.push(item.questionId);
  2501. }
  2502. } else if (item.type == 3) {
  2503. if (item.ques == item.ans) {
  2504. item.scoreResult = item.score;
  2505. score += item.score;
  2506. number++;
  2507. rightQuestionIds.push(item.questionId);
  2508. } else {
  2509. item.scoreResult = 0;
  2510. if (item.ques) {
  2511. doWrongQuestionIds.push(item.questionId);
  2512. }
  2513. }
  2514. allScore += item.score;
  2515. if (item.ques) {
  2516. doQuestionNum++;
  2517. doQuestionIds.push(item.questionId);
  2518. }
  2519. } else if (item.type == 4) {
  2520. allScore += item.score;
  2521. if (item.ques && item.ques.length) {
  2522. doQuestionNum++;
  2523. doQuestionIds.push(item.questionId);
  2524. }
  2525. } else if (item.type == 5) {
  2526. allScore += item.score;
  2527. if (item.ques && (item.ques.imageList || item.ques.text)) {
  2528. doQuestionNum++;
  2529. doQuestionIds.push(item.questionId);
  2530. }
  2531. }
  2532. });
  2533. //大于分及格
  2534. if (score >= passScore) {
  2535. reportStatus = 1;
  2536. } else {
  2537. reportStatus = 0;
  2538. }
  2539. clearInterval(this.timer);
  2540. //交卷
  2541. this.$api
  2542. .bankRecordEdit({
  2543. moduleId: this.moduleId || 0,
  2544. chapterId: this.chapterId || 0,
  2545. sectionId: this.sectionId || 0,
  2546. gradeId: this.gradeId,
  2547. examId: this.id,
  2548. goodsId: this.goodsId,
  2549. orderGoodsId: this.orderGoodsId,
  2550. reportStatus: reportStatus,
  2551. recordId: this.recordId,
  2552. courseId: this.courseId,
  2553. rightQuestionNum: number,
  2554. lessQuestionNum: lessQuestionNum,
  2555. status: 1,
  2556. doQuestionIds: doQuestionIds.join(","),
  2557. rightQuestionIds: rightQuestionIds.join(","),
  2558. doQuestionNum: doQuestionNum,
  2559. performance: score,
  2560. totalScore: allScore,
  2561. type: this.examType,
  2562. examTime: parseInt(this.allTimes),
  2563. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2564. historyExamJson: JSON.stringify(this.questionList),
  2565. })
  2566. .then((res) => {
  2567. this.isSubmit = true;
  2568. if (res.data.code == 200) {
  2569. uni.showToast({
  2570. title: "交卷成功",
  2571. duration: 1000,
  2572. mask: true,
  2573. icon: "none",
  2574. });
  2575. if (!typesubmit) {
  2576. console.log("跳转----");
  2577. setTimeout(() => {
  2578. uni.redirectTo({
  2579. url:
  2580. "/pages2/class/question_report?rightQuestionNum=" +
  2581. number +
  2582. "&doWrongQuestionNum=" +
  2583. doWrongQuestionIds.length +
  2584. "&score=" +
  2585. score +
  2586. "&totalScore=" +
  2587. allScore +
  2588. "&reportStatus=" +
  2589. reportStatus +
  2590. "&lessQuestionNum=" +
  2591. lessQuestionNum +
  2592. "&examId=" +
  2593. this.id +
  2594. "&recordId=" +
  2595. this.recordId +
  2596. "&type=" +
  2597. this.examType +
  2598. "&orderGoodsId=" +
  2599. this.orderGoodsId,
  2600. });
  2601. }, 1000);
  2602. }
  2603. }
  2604. });
  2605. //错题集id提交(客观题)
  2606. this.$api
  2607. .examWrongRecord({
  2608. moduleId: this.moduleId || 0,
  2609. chapterId: this.chapterId || 0,
  2610. sectionId: this.sectionId || 0,
  2611. gradeId: this.gradeId,
  2612. courseId: this.courseId,
  2613. examId: this.id,
  2614. goodsId: this.goodsId,
  2615. orderGoodsId: this.orderGoodsId,
  2616. questionIds: doWrongQuestionIds,
  2617. recordId: this.recordId,
  2618. type: 2, // 视频课程的传2
  2619. doMode: this.doMode,
  2620. })
  2621. .then((res) => {})
  2622. .catch((err) => {});
  2623. },
  2624. /**
  2625. * @param {Object} imgIndex
  2626. * @param {Object} bankIndex
  2627. * 删除简答图片
  2628. */
  2629. deleteImg(imgIndex, bankIndex) {
  2630. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  2631. },
  2632. /**
  2633. * @param {Object} imgIndex
  2634. * @param {Object} bankIndex
  2635. * @param {Object} ansIndex
  2636. * 删除案例题简答图片
  2637. */
  2638. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  2639. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(
  2640. imgIndex,
  2641. 1
  2642. );
  2643. },
  2644. /**
  2645. * @param {Object} bankindex
  2646. * 选择上传图片
  2647. */
  2648. chooseImg(bankindex) {
  2649. if (
  2650. this.questionList[bankindex] &&
  2651. this.questionList[bankindex].ansText &&
  2652. this.questionList[bankindex].ansText.imageList.length >= 4
  2653. ) {
  2654. uni.showToast({
  2655. icon: "none",
  2656. title: "最多选择4张",
  2657. });
  2658. return;
  2659. }
  2660. uni.chooseImage({
  2661. count: 1, //默认9
  2662. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2663. sourceType: ["album", "camera"], //从相册选择
  2664. success: (res) => {
  2665. let self = this;
  2666. // console.log(JSON.stringify(res.tempFilePaths));
  2667. let img = res.tempFilePaths[0];
  2668. uni.getImageInfo({
  2669. src: img,
  2670. success: async (res) => {
  2671. let canvasWidth = res.width; //图片原始长宽
  2672. let canvasHeight = res.height;
  2673. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2674. uni.compressImage({
  2675. src: img,
  2676. quality: 75,
  2677. width: "50%",
  2678. height: "50%",
  2679. success: async (rest) => {
  2680. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2681. this.questionList[bankindex].ansText.imageList.push(dir);
  2682. },
  2683. });
  2684. } else {
  2685. const dir = await self.uploadFile(img, 0);
  2686. this.questionList[bankindex].ansText.imageList.push(dir);
  2687. }
  2688. },
  2689. });
  2690. },
  2691. });
  2692. },
  2693. /**
  2694. * @param {Object} bankindex
  2695. * @param {Object} ansindex
  2696. * 案例题选择上传图片
  2697. */
  2698. chooseImgChild(bankindex, ansindex) {
  2699. uni.chooseImage({
  2700. count: 1, //默认9
  2701. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2702. sourceType: ["album", "camera"], //从相册选择
  2703. success: (res) => {
  2704. let self = this;
  2705. // console.log(JSON.stringify(res.tempFilePaths));
  2706. let img = res.tempFilePaths[0];
  2707. uni.getImageInfo({
  2708. src: img,
  2709. success: async (res) => {
  2710. let canvasWidth = res.width; //图片原始长宽
  2711. let canvasHeight = res.height;
  2712. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2713. uni.compressImage({
  2714. src: img,
  2715. quality: 75,
  2716. width: "50%",
  2717. height: "50%",
  2718. success: async (rest) => {
  2719. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2720. this.questionList[bankindex].jsonStr[
  2721. ansindex
  2722. ].ansText.imageList.push(dir);
  2723. },
  2724. });
  2725. } else {
  2726. const dir = await self.uploadFile(img, 0);
  2727. this.questionList[bankindex].jsonStr[
  2728. ansindex
  2729. ].ansText.imageList.push(dir);
  2730. }
  2731. },
  2732. });
  2733. },
  2734. });
  2735. },
  2736. /**
  2737. * @param {Object} type
  2738. * @param {Object} bankindex
  2739. * 简答题答案确认
  2740. */
  2741. submitAns(bankindex) {
  2742. console.log(this.questionList[bankindex]);
  2743. if (
  2744. !this.questionList[bankindex].ansText.text &&
  2745. !this.questionList[bankindex].ansText.imageList.length
  2746. ) {
  2747. uni.showToast({
  2748. title: "请输入内容或上传图片",
  2749. duration: 2000,
  2750. icon: "none",
  2751. });
  2752. return;
  2753. }
  2754. this.$set(this.questionList[bankindex], "ques", {
  2755. imageList: this.questionList[bankindex].ansText.imageList,
  2756. text: this.questionList[bankindex].ansText.text,
  2757. });
  2758. this.$u.toast("已确认答案");
  2759. this.isDoOver();
  2760. },
  2761. /**
  2762. * @param {Object} bankindex
  2763. * @param {Object} ansindex
  2764. * 案例题简答答案确认
  2765. */
  2766. submitAnsChild(bankindex, ansindex) {
  2767. if (
  2768. !this.questionList[bankindex].jsonStr[ansindex].ansText.text &&
  2769. !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length
  2770. ) {
  2771. uni.showToast({
  2772. title: "请输入内容或上传图片",
  2773. duration: 2000,
  2774. icon: "none",
  2775. });
  2776. return;
  2777. }
  2778. this.$set(this.questionList[bankindex].ques, ansindex, {
  2779. imageList:
  2780. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  2781. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text,
  2782. });
  2783. this.$u.toast("已确认答案");
  2784. this.isDoOver();
  2785. },
  2786. isCheck(item, index) {
  2787. if (this.questionList[index].ques) {
  2788. return true;
  2789. }
  2790. },
  2791. isRight(item, index) {
  2792. //单选
  2793. if (this.questionList[index].ques) {
  2794. if (item.type == 1) {
  2795. return this.questionList[index].ques == this.questionList[index].ans;
  2796. //多选
  2797. } else if (item.type == 2) {
  2798. //每一项都相等
  2799. return this.questionList[index].ans.every((item, i) => {
  2800. return item == this.questionList[index].ques[i];
  2801. });
  2802. //判断
  2803. } else if (item.type == 3) {
  2804. return this.questionList[index].ques == this.questionList[index].ans;
  2805. // } else if (item.type == 5) {
  2806. // if(this.questionList[index].ques.text){
  2807. // return true
  2808. // }else{
  2809. // return false
  2810. // }
  2811. } else {
  2812. return false;
  2813. }
  2814. } else {
  2815. return false;
  2816. }
  2817. },
  2818. right(bankIndex, ansIndex, option) {
  2819. if (
  2820. this.questionList[bankIndex].ques[ansIndex] &&
  2821. this.questionList[bankIndex].ans[ansIndex]
  2822. ) {
  2823. if (
  2824. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2825. option.optionsId
  2826. ) != -1 ||
  2827. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2828. option.optionsId
  2829. ) != -1
  2830. ) {
  2831. return true;
  2832. } else {
  2833. return false;
  2834. }
  2835. } else {
  2836. return false;
  2837. }
  2838. },
  2839. wrong(bankIndex, ansIndex, option) {
  2840. if (
  2841. this.questionList[bankIndex].ques[ansIndex] &&
  2842. this.questionList[bankIndex].ans[ansIndex]
  2843. ) {
  2844. if (
  2845. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2846. option.optionsId
  2847. ) != -1 &&
  2848. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2849. option.optionsId
  2850. ) == -1
  2851. ) {
  2852. return true;
  2853. } else {
  2854. return false;
  2855. }
  2856. } else {
  2857. return false;
  2858. }
  2859. },
  2860. isWrong(item, index) {
  2861. if (this.questionList[index].ques) {
  2862. //单选
  2863. if (item.type == 1) {
  2864. return this.questionList[index].ques != this.questionList[index].ans;
  2865. //多选
  2866. } else if (item.type == 2) {
  2867. //每一项都相等
  2868. return this.questionList[index].ques.some((item, i) => {
  2869. return this.questionList[index].ans.indexOf(item) == -1;
  2870. });
  2871. //判断
  2872. } else if (item.type == 3) {
  2873. return this.questionList[index].ques != this.questionList[index].ans;
  2874. } else {
  2875. return false;
  2876. }
  2877. } else {
  2878. return false;
  2879. }
  2880. },
  2881. isPart(item, index) {
  2882. if (this.questionList[index].ques) {
  2883. if (item.type == 2) {
  2884. let isWrong = this.questionList[index].ques.some((item, i) => {
  2885. return this.questionList[index].ans.indexOf(item) == -1;
  2886. });
  2887. let isRight = this.questionList[index].ans.every((item, i) => {
  2888. return item == this.questionList[index].ques[i];
  2889. });
  2890. if (!isRight && !isWrong) {
  2891. return true;
  2892. }
  2893. }
  2894. } else {
  2895. return false;
  2896. }
  2897. },
  2898. isOver(item, index) {
  2899. if (this.questionList[index].ques) {
  2900. if (item.type == 4) {
  2901. //案例题
  2902. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  2903. if (
  2904. jsonItem.type == 1 ||
  2905. jsonItem.type == 2 ||
  2906. jsonItem.type == 3
  2907. ) {
  2908. if (item.ques[indexs]) {
  2909. return true;
  2910. } else {
  2911. return false;
  2912. }
  2913. } else if (jsonItem.type == 5) {
  2914. if (
  2915. item.ques[indexs] &&
  2916. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  2917. ) {
  2918. console.log("chil");
  2919. return true;
  2920. } else {
  2921. return false;
  2922. }
  2923. }
  2924. });
  2925. if (isOver) {
  2926. return true;
  2927. } else {
  2928. return false;
  2929. }
  2930. } else if (item.type == 5) {
  2931. //简答题
  2932. //每一项都相等
  2933. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2934. return true;
  2935. }
  2936. //判断
  2937. } else {
  2938. return false;
  2939. }
  2940. } else {
  2941. return false;
  2942. }
  2943. },
  2944. tabSelect(index, bankindex) {
  2945. this.$set(this.questionList[bankindex], "current", index);
  2946. },
  2947. /**
  2948. * 退出全屏
  2949. */
  2950. exitFullscreen() {
  2951. try {
  2952. var de = document;
  2953. // console.log(de);
  2954. if (de.exitFullscreen) {
  2955. de.exitFullscreen();
  2956. } else if (de.mozCancelFullScreen) {
  2957. de.mozCancelFullScreen();
  2958. } else if (de.webkitCancelFullScreen) {
  2959. de.webkitCancelFullScreen();
  2960. }
  2961. } catch (err) {}
  2962. },
  2963. fullele() {
  2964. return (
  2965. document.fullscreenElement ||
  2966. document.webkitFullscreenElement ||
  2967. document.msFullscreenElement ||
  2968. document.mozFullScreenElement ||
  2969. null
  2970. );
  2971. },
  2972. //判断是否全屏
  2973. isFullScreen() {
  2974. return !!(document.webkitIsFullScreen || this.fullele());
  2975. },
  2976. getUserMedia(constraints, success, error) {
  2977. console.log("getUserMedia===", constraints, "success:", success);
  2978. if (window.navigator.mediaDevices.getUserMedia) {
  2979. // 最新的标准API
  2980. window.navigator.mediaDevices
  2981. .getUserMedia(constraints)
  2982. .then(success)
  2983. .catch(error);
  2984. } else if (window.navigator.webkitGetUserMedia) {
  2985. // webkit核心浏览器
  2986. window.navigator.webkitGetUserMedia(constraints, success, error);
  2987. } else if (window.navigator.mozGetUserMedia) {
  2988. // firfox浏览器
  2989. window.navigator.mozGetUserMedia(constraints, success, error);
  2990. } else if (window.navigator.getUserMedia) {
  2991. // 旧版API
  2992. window.navigator.getUserMedia(constraints, success, error);
  2993. }
  2994. },
  2995. photographSuccess(stream) {
  2996. console.log("有摄像头---", stream);
  2997. this.photoPopup = true;
  2998. this.isTaking = true;
  2999. this.$nextTick(() => {
  3000. const video = document.querySelector("video");
  3001. console.log("video:", video);
  3002. video.srcObject = stream;
  3003. video.play();
  3004. });
  3005. },
  3006. photographError(err) {
  3007. console.log("没有摄像头:", err);
  3008. uni.showModal({
  3009. title: "提示",
  3010. content:
  3011. "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
  3012. cancelText: "取消",
  3013. confirmText: "确定",
  3014. success: (res) => {
  3015. if (res.confirm) {
  3016. uni.navigateBack();
  3017. } else if (res.cancel) {
  3018. }
  3019. },
  3020. });
  3021. },
  3022. },
  3023. };
  3024. </script>
  3025. <style lang="scss" scoped>
  3026. .photoBox {
  3027. width: 100%;
  3028. // background-color: #ffffff;
  3029. // border-radius: 24px 24px 0px 0px;
  3030. .photoTop {
  3031. width: 100%;
  3032. height: 74rpx;
  3033. border-radius: 20px 20px 0px 0px;
  3034. background-color: #ffffff;
  3035. display: flex;
  3036. align-items: center;
  3037. justify-content: center;
  3038. padding: 0rpx 38rpx;
  3039. .sqzz {
  3040. width: 28rpx;
  3041. height: 28rpx;
  3042. display: flex;
  3043. align-items: center;
  3044. justify-content: center;
  3045. }
  3046. .centersq {
  3047. color: #333;
  3048. font-size: 30rpx;
  3049. font-weight: 500;
  3050. }
  3051. }
  3052. .photoCenter {
  3053. width: 750rpx;
  3054. height: 75vh;
  3055. position: relative;
  3056. .center_camera {
  3057. width: 100%;
  3058. height: 75vh;
  3059. position: fixed;
  3060. .head_take {
  3061. width: 100%;
  3062. height: 75vh;
  3063. display: flex;
  3064. flex-direction: column;
  3065. }
  3066. .headTake_up {
  3067. width: 100%;
  3068. height: 100rpx;
  3069. }
  3070. .headTake_minddle {
  3071. display: flex;
  3072. .min_img {
  3073. width: 500rpx;
  3074. height: 550rpx;
  3075. }
  3076. .min_left,
  3077. .min_right {
  3078. flex: 1;
  3079. height: 550rpx;
  3080. }
  3081. }
  3082. .headTake_down {
  3083. width: 100%;
  3084. flex: 1;
  3085. }
  3086. .color {
  3087. background-color: #333;
  3088. opacity: 0.5;
  3089. }
  3090. .photo_v {
  3091. width: 100%;
  3092. height: 100%;
  3093. }
  3094. .mask {
  3095. width: 500rpx;
  3096. height: 550rpx;
  3097. position: absolute;
  3098. top: 100rpx;
  3099. left: 0;
  3100. right: 0;
  3101. bottom: 0;
  3102. margin: 0 auto;
  3103. box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
  3104. }
  3105. }
  3106. .custom {
  3107. width: 750rpx;
  3108. height: 75vh;
  3109. position: absolute;
  3110. z-index: 1000;
  3111. top: 0;
  3112. left: 0;
  3113. image {
  3114. width: 100%;
  3115. height: 100%;
  3116. }
  3117. }
  3118. }
  3119. .photoBoxbtns {
  3120. display: flex;
  3121. .takePhoto_btn {
  3122. width: 100%;
  3123. display: flex;
  3124. align-items: center;
  3125. justify-content: space-between;
  3126. background: #a9a7a9;
  3127. padding: 40rpx 26rpx;
  3128. .middle_btn {
  3129. width: 120rpx;
  3130. height: 120rpx;
  3131. border-radius: 40rpx;
  3132. border: 4rpx solid #ffffff;
  3133. display: flex;
  3134. align-items: center;
  3135. justify-content: center;
  3136. }
  3137. .square {
  3138. width: 96rpx;
  3139. height: 96rpx;
  3140. background: #ffffff;
  3141. border-radius: 28rpx;
  3142. }
  3143. .rights {
  3144. font-size: 32rpx;
  3145. font-weight: 500;
  3146. color: #ffffff;
  3147. }
  3148. }
  3149. .btnResult {
  3150. height: 100rpx;
  3151. width: 100%;
  3152. background-color: #07c160;
  3153. text-align: center;
  3154. line-height: 100rpx;
  3155. color: #fff;
  3156. font-size: 32rpx;
  3157. font-weight: bold;
  3158. }
  3159. }
  3160. }
  3161. .navbar {
  3162. position: relative;
  3163. z-index: 20000;
  3164. }
  3165. .questionBank {
  3166. width: 100%;
  3167. height: 100vh;
  3168. display: flex;
  3169. flex-direction: column;
  3170. }
  3171. .swiper {
  3172. width: 100%;
  3173. flex: 1;
  3174. }
  3175. .lisSty {
  3176. margin-bottom: 16rpx;
  3177. display: flex;
  3178. .flex_auto {
  3179. flex: 1;
  3180. word-break: break-all;
  3181. }
  3182. }
  3183. .activeTI {
  3184. vertical-align: middle;
  3185. display: inline-block;
  3186. border: 1rpx solid #eee;
  3187. border-radius: 50rpx;
  3188. height: 48rpx;
  3189. line-height: 46rpx;
  3190. text-align: center;
  3191. width: 48rpx;
  3192. margin-right: 15rpx;
  3193. color: #666;
  3194. font-size: 30rpx;
  3195. &.right {
  3196. color: #fff;
  3197. background: #36c75a;
  3198. }
  3199. &.wrong {
  3200. color: #fff;
  3201. background: #ff3b30;
  3202. }
  3203. &.checked,
  3204. &.user_choose {
  3205. color: #fff;
  3206. background: #007aff;
  3207. }
  3208. }
  3209. .submit_checkbox {
  3210. position: fixed;
  3211. left: 0;
  3212. right: 0;
  3213. bottom: 120rpx;
  3214. margin: 20rpx auto;
  3215. width: 526rpx;
  3216. height: 80rpx;
  3217. background: rgba(0, 122, 255, 1);
  3218. color: #fff;
  3219. text-align: center;
  3220. line-height: 80rpx;
  3221. font-size: 30rpx;
  3222. border-radius: 40rpx;
  3223. &.disabled {
  3224. opacity: 0.6;
  3225. }
  3226. }
  3227. .titles {
  3228. overflow: hidden;
  3229. margin-bottom: 24rpx;
  3230. }
  3231. .titBox {
  3232. padding: 41rpx 25rpx 24rpx 25rpx;
  3233. }
  3234. .titBox_title {
  3235. padding: 21rpx;
  3236. }
  3237. .tabs {
  3238. margin: 10rpx;
  3239. display: flex;
  3240. .tab {
  3241. margin: 0 4rpx;
  3242. padding: 10rpx 13rpx;
  3243. text-align: center;
  3244. color: #007aff;
  3245. font-size: 28rpx;
  3246. border-radius: 16rpx;
  3247. background: #fff;
  3248. &.current {
  3249. color: #fff;
  3250. background: #007aff;
  3251. }
  3252. }
  3253. }
  3254. .ans {
  3255. margin: 8rpx 8rpx 8rpx;
  3256. .ans_input {
  3257. border-radius: 16rpx;
  3258. background: #fff;
  3259. .top {
  3260. border-bottom: 1rpx solid #eeeeee;
  3261. padding: 16rpx;
  3262. display: flex;
  3263. align-items: center;
  3264. .icon {
  3265. margin-right: 20rpx;
  3266. width: 40rpx;
  3267. height: 38rpx;
  3268. }
  3269. .progress {
  3270. flex: 1;
  3271. }
  3272. .submit {
  3273. width: 168rpx;
  3274. height: 48rpx;
  3275. line-height: 48rpx;
  3276. text-align: center;
  3277. color: #fff;
  3278. font-size: 30rpx;
  3279. background: #007aff;
  3280. border-radius: 24rpx;
  3281. &.disabled {
  3282. opacity: 0.6;
  3283. }
  3284. }
  3285. }
  3286. .textarea {
  3287. textarea {
  3288. width: 100%;
  3289. height: 287rpx;
  3290. padding: 10rpx;
  3291. }
  3292. }
  3293. .imgs {
  3294. overflow: hidden;
  3295. display: flex;
  3296. width: 100%;
  3297. .img {
  3298. width: 104rpx;
  3299. height: 104rpx;
  3300. border-radius: 8rpx;
  3301. position: relative;
  3302. margin: 20rpx;
  3303. text {
  3304. position: absolute;
  3305. right: -15rpx;
  3306. top: -15rpx;
  3307. width: 30rpx;
  3308. height: 30rpx;
  3309. text-align: center;
  3310. line-height: 30rpx;
  3311. color: #fff;
  3312. background: #ff3b30;
  3313. border-radius: 50%;
  3314. }
  3315. image {
  3316. width: 100%;
  3317. height: 100%;
  3318. }
  3319. }
  3320. }
  3321. }
  3322. .ans_submit {
  3323. padding: 16rpx;
  3324. border-radius: 16rpx;
  3325. background: #fff;
  3326. .imgs {
  3327. overflow: hidden;
  3328. display: flex;
  3329. width: 100%;
  3330. .img {
  3331. width: 104rpx;
  3332. height: 104rpx;
  3333. border-radius: 8rpx;
  3334. position: relative;
  3335. margin: 20rpx;
  3336. image {
  3337. width: 100%;
  3338. height: 100%;
  3339. }
  3340. }
  3341. }
  3342. }
  3343. }
  3344. .leftLetters {
  3345. display: flex;
  3346. align-items: center;
  3347. width: 220rpx;
  3348. .btnType {
  3349. padding: 5rpx 10rpx;
  3350. border: 1rpx solid #007aff;
  3351. border-radius: 10rpx;
  3352. background-color: rgba(0, 122, 255, 0.1);
  3353. font-size: 28rpx;
  3354. color: #007aff;
  3355. margin-right: 15rpx;
  3356. }
  3357. }
  3358. .firstLetter {
  3359. display: flex;
  3360. justify-content: space-between;
  3361. align-items: center;
  3362. margin-bottom: 30rpx;
  3363. }
  3364. .popupView {
  3365. height: 100%;
  3366. padding-bottom: 100rpx;
  3367. .popupTops {
  3368. height: 77rpx;
  3369. border-bottom: 1rpx solid #eee;
  3370. text-align: center;
  3371. line-height: 77rpx;
  3372. font-size: 24rpx;
  3373. color: #999;
  3374. position: relative;
  3375. .topIcon {
  3376. position: absolute;
  3377. top: 10rpx;
  3378. left: 50%;
  3379. transform: translateX(-50%);
  3380. width: 80rpx;
  3381. height: 8rpx;
  3382. background-color: #999;
  3383. border-radius: 4rpx;
  3384. }
  3385. }
  3386. .popupContent {
  3387. }
  3388. }
  3389. .pageContent {
  3390. position: relative;
  3391. background-color: #eaeef1;
  3392. height: 100%;
  3393. padding-top: 8rpx;
  3394. padding-bottom: 100rpx;
  3395. overflow-y: scroll;
  3396. }
  3397. .pad_8 {
  3398. background-color: #fff;
  3399. margin: 0rpx 8rpx 8rpx;
  3400. border-radius: 16rpx;
  3401. &.no-margin {
  3402. margin-top: -16rpx;
  3403. border-radius: 0 0 16rpx 16rpx;
  3404. }
  3405. }
  3406. .answer {
  3407. height: 80rpx;
  3408. line-height: 80rpx;
  3409. padding: 0rpx 24rpx;
  3410. display: flex;
  3411. align-items: center;
  3412. justify-content: space-between;
  3413. color: #666;
  3414. font-size: 30rpx;
  3415. }
  3416. .footer_btn {
  3417. background-color: #fff;
  3418. z-index: 10078;
  3419. position: fixed;
  3420. bottom: 0rpx;
  3421. display: flex;
  3422. align-items: center;
  3423. justify-content: space-between;
  3424. width: 100%;
  3425. height: 98rpx;
  3426. padding: 0rpx 38rpx;
  3427. border-top: 1rpx solid #eee;
  3428. .flex_center {
  3429. flex: 1;
  3430. display: flex;
  3431. justify-content: center;
  3432. align-items: center;
  3433. flex-direction: column;
  3434. margin: 0 200rpx;
  3435. font-size: 24rpx;
  3436. color: #999999;
  3437. .up-icon {
  3438. margin-bottom: 18rpx;
  3439. width: 100%;
  3440. display: flex;
  3441. justify-content: center;
  3442. image {
  3443. width: 58rpx;
  3444. height: 21rpx;
  3445. }
  3446. }
  3447. }
  3448. .collect {
  3449. visibility: hidden;
  3450. width: 100rpx;
  3451. &.show {
  3452. visibility: visible;
  3453. }
  3454. > view {
  3455. display: flex;
  3456. flex-direction: column;
  3457. align-items: center;
  3458. justify-content: center;
  3459. image {
  3460. width: 32rpx;
  3461. height: 32rpx;
  3462. margin-bottom: 6rpx;
  3463. }
  3464. view {
  3465. font-size: 24rpx;
  3466. color: #999999;
  3467. }
  3468. }
  3469. }
  3470. }
  3471. .boxSty {
  3472. padding: 44rpx 41rpx 0rpx;
  3473. }
  3474. .liListSty {
  3475. border: 1rpx solid #eeeeee;
  3476. width: 88rpx;
  3477. height: 88rpx;
  3478. border-radius: 32rpx;
  3479. text-align: center;
  3480. line-height: 88rpx;
  3481. color: #333;
  3482. font-size: 32rpx;
  3483. float: left;
  3484. margin: 20rpx 23rpx;
  3485. &.isRight {
  3486. border: 1rpx solid #eeeeee;
  3487. color: #fff;
  3488. background: #36c75a;
  3489. }
  3490. &.isWrong {
  3491. border: 1rpx solid #eeeeee;
  3492. color: #fff;
  3493. background: #ff3b30;
  3494. }
  3495. &.isPart {
  3496. border: 1rpx solid #eeeeee;
  3497. color: #fff;
  3498. background: #ffc53d;
  3499. }
  3500. &.isOver {
  3501. border: 1rpx solid #eeeeee;
  3502. color: #fff;
  3503. background: blue;
  3504. }
  3505. &.check_ans {
  3506. border: 1rpx solid #eeeeee;
  3507. color: #fff;
  3508. background: #007aff;
  3509. }
  3510. }
  3511. .answerInfos {
  3512. padding: 25rpx 25rpx 25rpx 23rpx;
  3513. }
  3514. .answerTitle {
  3515. margin-bottom: 28rpx;
  3516. color: #666;
  3517. font-size: 30rpx;
  3518. }
  3519. .answerContent {
  3520. font-size: 30rpx;
  3521. color: #666;
  3522. }
  3523. .textChild {
  3524. display: inline-block;
  3525. vertical-align: middle;
  3526. }
  3527. .dialog {
  3528. position: fixed;
  3529. left: 0;
  3530. top: 0;
  3531. width: 100%;
  3532. height: 100%;
  3533. background-color: rgba(0, 0, 0, 0.8);
  3534. display: flex;
  3535. flex-direction: column;
  3536. align-items: center;
  3537. justify-content: center;
  3538. z-index: 20000;
  3539. .text {
  3540. font-size: 32rpx;
  3541. color: #ffffff;
  3542. text-align: center;
  3543. }
  3544. .btn {
  3545. width: 242rpx;
  3546. height: 82rpx;
  3547. border: 2rpx solid #ffffff;
  3548. border-radius: 16rpx;
  3549. text-align: center;
  3550. line-height: 82rpx;
  3551. margin: 41rpx auto;
  3552. color: #fff;
  3553. font-size: 32rpx;
  3554. }
  3555. }
  3556. .dialog-arrow {
  3557. padding-top: 124rpx;
  3558. position: fixed;
  3559. left: 0;
  3560. top: 0;
  3561. width: 100%;
  3562. height: 100%;
  3563. background-color: rgba(0, 0, 0, 0.8);
  3564. z-index: 20000;
  3565. .pointer {
  3566. margin-left: 87rpx;
  3567. display: block;
  3568. width: 95rpx;
  3569. height: 98rpx;
  3570. }
  3571. .text {
  3572. padding-left: 177rpx;
  3573. font-size: 32rpx;
  3574. color: #ffffff;
  3575. }
  3576. .btn {
  3577. width: 242rpx;
  3578. height: 82rpx;
  3579. border: 2rpx solid #ffffff;
  3580. border-radius: 16rpx;
  3581. text-align: center;
  3582. line-height: 82rpx;
  3583. margin: 500rpx auto 0;
  3584. color: #fff;
  3585. font-size: 32rpx;
  3586. }
  3587. }
  3588. .dialog_wrap {
  3589. position: fixed;
  3590. left: 0;
  3591. top: 0;
  3592. width: 100%;
  3593. height: 100%;
  3594. z-index: 9999999999;
  3595. .bg {
  3596. background: rgba(0, 0, 0, 0.3);
  3597. position: absolute;
  3598. left: 0;
  3599. top: 0;
  3600. width: 100%;
  3601. height: 100%;
  3602. }
  3603. .dialog {
  3604. position: absolute;
  3605. left: 50%;
  3606. top: 50%;
  3607. transform: translate3D(-50%, -50%, 0);
  3608. width: 640rpx;
  3609. height: 439rpx;
  3610. background: #ffffff;
  3611. border-radius: 24rpx;
  3612. .title {
  3613. font-size: 30rpx;
  3614. font-weight: bold;
  3615. color: #333333;
  3616. line-height: 48rpx;
  3617. text-align: center;
  3618. margin-top: 40rpx;
  3619. }
  3620. .content {
  3621. margin: 35rpx 35rpx 0;
  3622. font-size: 30rpx;
  3623. color: #666666;
  3624. line-height: 48rpx;
  3625. }
  3626. .btns {
  3627. margin-top: 35rpx;
  3628. display: flex;
  3629. align-items: center;
  3630. justify-content: center;
  3631. .btn {
  3632. width: 200rpx;
  3633. height: 80rpx;
  3634. line-height: 80rpx;
  3635. text-align: center;
  3636. background: #f5f5f5;
  3637. border-radius: 40rpx;
  3638. font-size: 30rpx;
  3639. color: rgba(0, 122, 255, 1);
  3640. background: #f5f5f5;
  3641. margin: 0 20rpx;
  3642. &.active {
  3643. color: #f5f5f5;
  3644. background: rgba(0, 122, 255, 1);
  3645. }
  3646. }
  3647. }
  3648. }
  3649. }
  3650. .popboxs {
  3651. width: 100%;
  3652. height: 100%;
  3653. display: flex;
  3654. flex-direction: column;
  3655. align-items: center;
  3656. }
  3657. .classTops {
  3658. flex-shrink: 0;
  3659. padding: 39rpx 0rpx 4rpx;
  3660. font-weight: bold;
  3661. color: #333;
  3662. font-size: 30rpx;
  3663. }
  3664. .textStys {
  3665. width: 100%;
  3666. flex: 1;
  3667. padding: 36rpx;
  3668. }
  3669. .classFootsty {
  3670. flex-shrink: 0;
  3671. display: flex;
  3672. align-items: center;
  3673. justify-content: center;
  3674. padding: 10rpx 0rpx 40rpx;
  3675. .btnsty {
  3676. width: 200rpx;
  3677. height: 80rpx;
  3678. border-radius: 40rpx;
  3679. font-weight: bold;
  3680. font-size: 30rpx;
  3681. text-align: center;
  3682. line-height: 80rpx;
  3683. }
  3684. .btns1 {
  3685. background-color: #f5f5f5;
  3686. color: #007aff;
  3687. }
  3688. .btns2 {
  3689. margin-left: 40rpx;
  3690. background-color: #007aff;
  3691. color: #ffffff;
  3692. }
  3693. }
  3694. </style>