questionBank.vue 109 KB

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