questionBank.vue 111 KB

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