questionBank.vue 85 KB

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