questionBank.vue 94 KB

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