questionBank.vue 109 KB

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