questionBank.vue 110 KB

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