questionBank.vue 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311
  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. };
  731. },
  732. watch: {
  733. photoPopup(n) {
  734. // 拍照弹窗和showDialog同时出现时,先展示拍照弹窗再展示showDialog弹窗
  735. if (n) {
  736. this.showDialog && (this.showDialog = false);
  737. } else {
  738. this.originShowDialog && (this.showDialog = true);
  739. }
  740. },
  741. },
  742. async onLoad(option) {
  743. await goodsExamIsCanLearn(option.goodsid);
  744. this.examType = option.type;
  745. this.id = option.id;
  746. this.goodsId = option.goodsid || "";
  747. this.chapterId = option.chapterId;
  748. this.courseId = option.courseId;
  749. this.sectionId = option.sectionId;
  750. this.moduleId = option.moduleId;
  751. this.isFromVideo = option.isFromVideo || "";
  752. this.gradeId = option.gradeId || "";
  753. this.orderGoodsId = Number(option.orderGoodsId);
  754. let isBack = option.isback;
  755. this.isBackVideo = option.isBackVideo;
  756. let showDialog = uni.getStorageSync("showDialog");
  757. if (showDialog) {
  758. this.showDialog = false;
  759. } else {
  760. this.showDialog = true;
  761. this.originShowDialog = true;
  762. uni.setStorageSync("showDialog", "1");
  763. }
  764. //考试时候用手势或者返回键 被迫返回做题
  765. if (isBack) {
  766. let app = getApp();
  767. let globalData = app.globalData;
  768. for (var k in globalData.bankData) {
  769. this[k] = globalData.bankData[k];
  770. }
  771. this.showArrow = true;
  772. //需要拍没拍过直接弹出摄像头
  773. if (this.needPhoto && !this.isTakePhoto) {
  774. if (!this.learning && this.examType != 2) {
  775. if (uni.getStorageSync("tabkePhotoShow")) {
  776. // #ifdef MP-WEIXIN
  777. this.photoPopup = true;
  778. this.isTaking = true;
  779. // #endif
  780. this.avatarUrl = "";
  781. // #ifdef H5
  782. this.isHadCamera();
  783. // #endif
  784. } else {
  785. this.popupPhotoShow = true;
  786. uni.setStorageSync("tabkePhotoShow", 1); // 本地缓存用来判断是否已经弹出过弹窗
  787. }
  788. }
  789. } else {
  790. //不需要拍照
  791. if (this.lastTime) {
  792. this.timer = setInterval(() => {
  793. if (this.lastTime <= 0) {
  794. clearInterval(this.timer);
  795. uni.showToast({
  796. icon: "none",
  797. mask: true,
  798. title: "考试时间已到,系统将自动交卷",
  799. duration: 10000,
  800. });
  801. this.submit();
  802. return;
  803. }
  804. this.lastTime--;
  805. }, 1000);
  806. }
  807. }
  808. } else {
  809. await this.getGoodsDetail();
  810. this.needPhoto && (await this.getExamLearnStatus());
  811. // 请求题目列表
  812. await this.bankExam();
  813. this.goodsQuestionList();
  814. }
  815. },
  816. mounted() {},
  817. onUnload() {
  818. if (this.isSubmit) {
  819. clearInterval(this.timer);
  820. return;
  821. }
  822. if (this.needPhoto && !this.isTakePhoto) {
  823. return;
  824. }
  825. //考试试卷 阻止ios手势返回,自动跳回答题页
  826. if (this.needBack) {
  827. let app = getApp();
  828. app.globalData.bankData = this.$data;
  829. clearInterval(this.timer);
  830. uni.navigateTo({
  831. url: "/pages2/class/questionBank?id=" +
  832. this.id +
  833. "&goodsid=" +
  834. this.goodsId +
  835. "&isback=true&orderGoodsId=" +
  836. this.orderGoodsId,
  837. });
  838. } else {
  839. //点击返回按钮确认允许退出,交卷
  840. clearInterval(this.timer);
  841. this.examRecordEdit();
  842. }
  843. },
  844. computed: {
  845. doMode() {
  846. // 做题模式 1章卷 2随机练习 3模拟组卷
  847. return this.examData.simulateStatus ? 3 : undefined;
  848. },
  849. },
  850. methods: {
  851. getExamLearnStatus() {
  852. return this.$api
  853. .getExamLearnStatus({
  854. goodsId: this.goodsId,
  855. gradeId: this.gradeId,
  856. chapterId: this.chapterId,
  857. courseId: this.courseId,
  858. moduleId: this.moduleId,
  859. type: this.examType,
  860. examId: this.id,
  861. })
  862. .then((res) => {
  863. if (res.data.data) {
  864. //之前是否拍照过,拍过则不需要再拍
  865. this.needPhoto = false;
  866. }
  867. this.learning = res.data.data;
  868. return Promise.resolve();
  869. });
  870. },
  871. getGoodsDetail() {
  872. return new Promise((resolve) => {
  873. let self = this;
  874. this.$api.goodsDetail(this.goodsId).then((res) => {
  875. self.goodsDetail = res.data.data;
  876. if (self.goodsDetail.goodsPhotoExamConfig) {
  877. let goodsPhotoExamConfig = JSON.parse(
  878. self.goodsDetail.goodsPhotoExamConfig
  879. );
  880. if (goodsPhotoExamConfig.photograph > 0) {
  881. self.needPhoto = true;
  882. }
  883. }
  884. if (res.data.data.erJianErZao) {
  885. self.needPhoto = true;
  886. }
  887. resolve();
  888. });
  889. });
  890. },
  891. reTake() {
  892. this.isTaking = true;
  893. // #ifdef H5
  894. this.faceUrl = "";
  895. this.getUserMedia({
  896. video: {
  897. width: 400,
  898. height: 300,
  899. },
  900. });
  901. // #endif
  902. },
  903. postStudyRecord() {
  904. let self = this;
  905. let data = {
  906. photo: self.ossAvatarUrl,
  907. recordId: self.recordId,
  908. };
  909. if (this.ossAvatarUrl) {
  910. data.similarity = this.compareFaceData; // 相似度
  911. }
  912. // console.log(data, "拍照提交");
  913. this.$api.studyExamPhotoRecord(data).then((res) => {
  914. // console.log(res, "拍照提交结果");
  915. if (res.data.code != 200) {
  916. uni.showToast({
  917. icon: "none",
  918. mask: true,
  919. title: res.data.msg,
  920. duration: 10000,
  921. });
  922. return;
  923. }
  924. self.ossAvatarUrl = "";
  925. self.isTakePhoto = true;
  926. if (this.isReach) {
  927. return this.submit();
  928. }
  929. //拍照
  930. if (this.lastTime) {
  931. this.timer = setInterval(() => {
  932. if (this.lastTime <= 0) {
  933. clearInterval(this.timer);
  934. uni.showToast({
  935. icon: "none",
  936. mask: true,
  937. title: "考试时间已到,系统将自动交卷",
  938. duration: 10000,
  939. });
  940. this.submit();
  941. return;
  942. }
  943. this.lastTime--;
  944. }, 1000);
  945. }
  946. });
  947. },
  948. uploadFile(options, int) {
  949. var self = this;
  950. return new Promise((resolve, reject) => {
  951. var data = {
  952. imageStatus: int,
  953. gradeId: this.gradeId,
  954. };
  955. self.$api.aliyunpolicy(data).then((res) => {
  956. if (res.data.code != 200) {
  957. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  958. return;
  959. }
  960. var ossToken = res.data.data.resultContent;
  961. if (ossToken.host == null || ossToken.host == undefined) {
  962. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  963. return;
  964. }
  965. let filePath = "";
  966. // #ifdef H5
  967. var localData = options; //dataUrl为base64位
  968. let base = atob(localData.substring(localData.indexOf(",") +
  969. 1)); // base是将base64编码解码,去掉data:image/png;base64部分
  970. let length = base.length;
  971. let url = new Uint8Array(length);
  972. while (length--) {
  973. url[length] = base.charCodeAt(length);
  974. }
  975. filePath = new File([url], "a.jpg", {
  976. type: "image/jpg",
  977. });
  978. console.log("filePath:", filePath);
  979. uni.uploadFile({
  980. url: ossToken.host,
  981. name: "file",
  982. file: filePath,
  983. fileType: "image",
  984. header: {
  985. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  986. },
  987. formData: {
  988. key: ossToken.dir,
  989. OSSAccessKeyId: ossToken.accessid,
  990. policy: ossToken.policy,
  991. Signature: ossToken.signature,
  992. callback: ossToken.callback,
  993. success_action_status: 200,
  994. },
  995. success: (result) => {
  996. this.$u.toast("上传成功");
  997. this.ossAvatarUrl = ossToken.dir;
  998. console.log("h5上传成功--:", this.ossAvatarUrl);
  999. resolve(this.ossAvatarUrl);
  1000. },
  1001. fail: (error) => {
  1002. console.log("h5上传失败:", error);
  1003. uni.showToast({
  1004. title: "上传接口报错,请重新拍照上传" + error,
  1005. icon: "none",
  1006. });
  1007. this.openPhoto();
  1008. return;
  1009. },
  1010. });
  1011. // #endif
  1012. // #ifdef MP-WEIXIN
  1013. uni.uploadFile({
  1014. url: ossToken.host,
  1015. name: "file",
  1016. filePath: options,
  1017. fileType: "image",
  1018. header: {
  1019. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1020. },
  1021. formData: {
  1022. key: ossToken.dir,
  1023. OSSAccessKeyId: ossToken.accessid,
  1024. policy: ossToken.policy,
  1025. Signature: ossToken.signature,
  1026. callback: ossToken.callback,
  1027. success_action_status: 200,
  1028. },
  1029. success: (result) => {
  1030. // if (result.statusCode === 200) {
  1031. self.ossAvatarUrl = ossToken.dir;
  1032. resolve(ossToken.dir);
  1033. // } else {
  1034. // uni.showToast({
  1035. // title: "上传失败",
  1036. // icon: "none",
  1037. // });
  1038. // return;
  1039. // }
  1040. },
  1041. fail: (error) => {
  1042. uni.showToast({
  1043. title: "上传接口报错" + error,
  1044. icon: "none",
  1045. });
  1046. this.uploadLock = false;
  1047. this.openPhoto();
  1048. return;
  1049. },
  1050. });
  1051. // #endif
  1052. });
  1053. });
  1054. },
  1055. imageInfos() {
  1056. var self = this;
  1057. return new Promise(async (resolve, reject) => {
  1058. // #ifdef MP-WEIXIN
  1059. uni.getImageInfo({
  1060. src: self.avatarUrl,
  1061. success: async (res) => {
  1062. let canvasWidth = res.width; //图片原始长宽
  1063. let canvasHeight = res.height;
  1064. if (canvasWidth > 2000 || canvasHeight > 2000) {
  1065. uni.compressImage({
  1066. src: self.avatarUrl,
  1067. quality: 75,
  1068. width: "35%",
  1069. height: "35%",
  1070. success: async (rest) => {
  1071. const waitUpload = await self.uploadFile(
  1072. rest.tempFilePath,
  1073. 0
  1074. );
  1075. resolve(waitUpload);
  1076. },
  1077. });
  1078. } else if (canvasWidth > 1000 || canvasHeight > 1000) {
  1079. uni.compressImage({
  1080. src: self.avatarUrl,
  1081. quality: 75,
  1082. width: "50%",
  1083. height: "50%",
  1084. success: async (rest) => {
  1085. const waitUpload = await self.uploadFile(
  1086. rest.tempFilePath,
  1087. 0
  1088. );
  1089. resolve(waitUpload);
  1090. },
  1091. });
  1092. } else {
  1093. console.log("无需压缩");
  1094. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  1095. resolve(waitUpload);
  1096. }
  1097. },
  1098. });
  1099. // #endif
  1100. // #ifdef H5
  1101. const waitUpload = await this.uploadFile(this.faceUrl, 0);
  1102. resolve(waitUpload);
  1103. // #endif
  1104. });
  1105. },
  1106. /**
  1107. * 人脸匹配
  1108. */
  1109. faceRecognition(url) {
  1110. return new Promise((resolve) => {
  1111. // // #ifdef MP-WEIXIN
  1112. // let fileSystem = uni.getFileSystemManager();
  1113. // fileSystem.readFile({
  1114. // filePath: `${this.avatarUrl}`,
  1115. // encoding: "base64",
  1116. // position: 0,
  1117. // success: (res) => {
  1118. // let base64 = "data:image/jpg;base64," + res.data;
  1119. // console.log("试卷-base64Data人脸识别参数:", {
  1120. // imageA: base64,
  1121. // orderGoodsId: this.orderGoodsId,
  1122. // gradeId: this.gradeId,
  1123. // });
  1124. // this.CompareFace(base64, resolve);
  1125. // },
  1126. // fail(err) {
  1127. // console.error(err, "err");
  1128. // },
  1129. // });
  1130. // // #endif
  1131. // // #ifdef H5
  1132. // this.CompareFace(this.faceUrl, resolve);
  1133. // // #endif
  1134. this.CompareFace(url, resolve);
  1135. });
  1136. },
  1137. CompareFace(url, resolve) {
  1138. let timer = setTimeout(() => {
  1139. uni.showToast({
  1140. icon: "none",
  1141. title: "拍照超时,请重新拍照",
  1142. duration: 2000,
  1143. success: () => {
  1144. setTimeout(() => {
  1145. uni.navigateBack();
  1146. }, 1000);
  1147. },
  1148. });
  1149. }, 10 * 1000);
  1150. this.$api
  1151. .faceCertificationCompareFace({
  1152. urlA: url,
  1153. // imageA: url,
  1154. orderGoodsId: this.orderGoodsId,
  1155. gradeId: this.gradeId,
  1156. })
  1157. .then((res) => {
  1158. clearTimeout(timer);
  1159. console.log(res, "人脸识别成功res");
  1160. resolve(res.data.data);
  1161. })
  1162. .catch((err) => {
  1163. clearTimeout(timer);
  1164. // 当前网络延迟,
  1165. console.log("人脸识别错误:", err);
  1166. uni.showModal({
  1167. content: "当前网络延迟",
  1168. showCancel: false,
  1169. success: (resultst) => {
  1170. if (resultst.confirm) {
  1171. uni.navigateBack();
  1172. }
  1173. },
  1174. });
  1175. });
  1176. },
  1177. toTakePhoto() {
  1178. this.popupPhotoShow = false;
  1179. this.openPhoto();
  1180. },
  1181. takePhTips() {
  1182. this.popupPhotoShow = true;
  1183. this.isTaking = false;
  1184. this.photoPopup = false;
  1185. },
  1186. // 确认拍照
  1187. async submitPhoto() {
  1188. if (this.uploadLock) {
  1189. return;
  1190. }
  1191. this.uploadLock = true;
  1192. const waitYS = await this.imageInfos();
  1193. let compareFaceData = await this.faceRecognition(waitYS);
  1194. this.compareFaceData = compareFaceData;
  1195. if (compareFaceData >= 80) {
  1196. this.postStudyRecord(); //提交记录
  1197. this.photoPopup = false;
  1198. } else {
  1199. uni.showToast({
  1200. title: "人脸匹配不通过,请重新拍照上传",
  1201. icon: "none",
  1202. duration: 2000,
  1203. });
  1204. setTimeout(() => {
  1205. this.uploadLock = false;
  1206. this.openPhoto();
  1207. }, 2000);
  1208. }
  1209. },
  1210. //拍照
  1211. openPhoto() {
  1212. console.log("开始拍照");
  1213. // this.enableAutoRotation = false;
  1214. // #ifdef MP-WEIXIN
  1215. this.photoPopup = true;
  1216. this.isTaking = true;
  1217. uni.setKeepScreenOn({
  1218. keepScreenOn: true,
  1219. });
  1220. uni.authorize({
  1221. scope: "scope.camera",
  1222. success() {},
  1223. });
  1224. // #endif
  1225. // #ifdef H5
  1226. this.isHadCamera();
  1227. // #endif
  1228. },
  1229. isHadCamera() {
  1230. if (
  1231. (window.navigator.mediaDevices &&
  1232. window.navigator.mediaDevices.getUserMedia) ||
  1233. window.navigator.getUserMedia ||
  1234. window.navigator.webkitGetUserMedia ||
  1235. window.navigator.mozGetUserMedia
  1236. ) {
  1237. console.log("getUserMedia----");
  1238. // 调用用户媒体设备, 访问摄像头
  1239. this.getUserMedia({
  1240. video: {
  1241. width: 400,
  1242. height: 300,
  1243. },
  1244. },
  1245. this.photographSuccess,
  1246. this.photographError
  1247. );
  1248. } else {
  1249. console.log("1111没有摄像");
  1250. this.photographError();
  1251. }
  1252. },
  1253. //确认拍照
  1254. takePhoto() {
  1255. // #ifdef MP-WEIXIN
  1256. const ctx = uni.createCameraContext();
  1257. ctx.takePhoto({
  1258. quality: "high",
  1259. success: (res) => {
  1260. console.log(res.tempImagePath);
  1261. this.avatarUrl = res.tempImagePath;
  1262. // self.submitPhoto();
  1263. this.isTaking = false;
  1264. },
  1265. fail: (err) => {
  1266. console.log(err);
  1267. },
  1268. });
  1269. // #endif
  1270. // #ifdef H5
  1271. const canvas = document.createElement("canvas");
  1272. canvas.width = 400;
  1273. canvas.height = 400;
  1274. const context = canvas.getContext("2d");
  1275. const video = document.querySelector("video");
  1276. context.drawImage(video, 0, 0, 400, 400);
  1277. this.faceUrl = canvas.toDataURL("image/png");
  1278. this.isTaking = false;
  1279. // #endif
  1280. },
  1281. /**
  1282. * 是否有上传图片
  1283. */
  1284. hasImgs(bank) {
  1285. return bank.ansText.imageList.length == 0;
  1286. },
  1287. /**
  1288. * 获取试卷类型2考试,1练习
  1289. */
  1290. bankExam() {
  1291. return this.$api.bankExam(this.id).then((res) => {
  1292. const {
  1293. examLimitClient,
  1294. doType
  1295. } = res.data.data;
  1296. if (!examClientCanLearn(examLimitClient)) {
  1297. return;
  1298. }
  1299. this.bankType = doType;
  1300. this.examData = res.data.data;
  1301. this.allTimes = this.examData.answerTime * 60;
  1302. this.lastTime =
  1303. this.examData.answerTime && this.examData.answerTime * 60;
  1304. if (this.bankType == 2) {
  1305. this.needBack = true;
  1306. }
  1307. return Promise.resolve();
  1308. });
  1309. },
  1310. /**
  1311. * 点击后退按钮
  1312. */
  1313. clickLeft() {
  1314. //需要拍照没有拍直接返回
  1315. if (this.needPhoto && !this.isTakePhoto) {
  1316. this.isSubmit = true;
  1317. uni.navigateBack({
  1318. delta: 1,
  1319. });
  1320. return;
  1321. }
  1322. if (this.bankType == 1) {
  1323. let ansCount = this.questionOverNum(); //已答题数
  1324. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1325. //所有题目答完
  1326. if (this.lastCount == 0) {
  1327. // this.testOver = true;
  1328. this.cgType = 7;
  1329. //未答完
  1330. } else {
  1331. this.cgType = 8;
  1332. // this.isLastCount = true;
  1333. }
  1334. this.showpopups = true;
  1335. } else if (this.bankType == 2) {
  1336. let ansCount = this.questionOverNum(); //已答题数
  1337. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1338. //所有题目答完
  1339. if (this.lastCount == 0) {
  1340. this.testOver = true;
  1341. //未答完
  1342. } else {
  1343. this.isLastCount = true;
  1344. }
  1345. }
  1346. },
  1347. /**
  1348. * 返回上一页
  1349. */
  1350. backPages() {
  1351. this.needBack = false;
  1352. uni.navigateBack({
  1353. delta: 1,
  1354. });
  1355. },
  1356. /**
  1357. * 获取已经回答的题目数
  1358. * hasSpecail (是否包含简答和案例)
  1359. */
  1360. questionOverNum(hasSpecail) {
  1361. let count = 0;
  1362. this.questionList.forEach((item) => {
  1363. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1364. if (item.ques) {
  1365. count++;
  1366. }
  1367. } else if (item.type == 4) {
  1368. //案例题
  1369. if (hasSpecail) {
  1370. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1371. if (
  1372. jsonItem.type == 1 ||
  1373. jsonItem.type == 2 ||
  1374. jsonItem.type == 3
  1375. ) {
  1376. if (item.ques[indexs]) {
  1377. return true;
  1378. } else {
  1379. return false;
  1380. }
  1381. } else if (jsonItem.type == 5) {
  1382. console.log(jsonItem, 111);
  1383. if (
  1384. item.ques[indexs] &&
  1385. (item.ques[indexs].text.length ||
  1386. item.ques[indexs].imageList.length)
  1387. ) {
  1388. return true;
  1389. } else {
  1390. return false;
  1391. }
  1392. }
  1393. });
  1394. if (isOver) {
  1395. count++;
  1396. console.log(item, 444);
  1397. }
  1398. }
  1399. } else if (item.type == 5) {
  1400. //简答题
  1401. if (hasSpecail) {
  1402. if (
  1403. item.ques &&
  1404. (item.ques.text.length || item.ques.imageList.length)
  1405. ) {
  1406. count++;
  1407. }
  1408. }
  1409. }
  1410. });
  1411. return count;
  1412. },
  1413. /**
  1414. * 是否做完所有题目
  1415. */
  1416. isDoOver() {
  1417. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  1418. if (this.questionList.length == questionOverNum) {
  1419. //全部做完弹窗
  1420. this.cgType = 9;
  1421. this.showpopups = true;
  1422. }
  1423. },
  1424. /**
  1425. * 暂不交卷
  1426. */
  1427. noSubmit() {
  1428. //设为允许退出页面
  1429. this.needBack = false;
  1430. uni.navigateBack({
  1431. delta: 1,
  1432. });
  1433. },
  1434. /**
  1435. * 不离开
  1436. */
  1437. noLeave() {
  1438. this.isLastCount = false;
  1439. },
  1440. /**
  1441. * 立即离开并交卷
  1442. */
  1443. leaveNow() {
  1444. this.isSubmit = true;
  1445. uni.navigateBack({
  1446. delta: 1,
  1447. });
  1448. //需要拍照没有拍,返回不扣次数
  1449. if (this.needPhoto && !this.isTakePhoto) {
  1450. return;
  1451. }
  1452. this.submit("leaveNow");
  1453. },
  1454. /**
  1455. * 立即交卷
  1456. */
  1457. submitNow() {
  1458. this.showpopups = false;
  1459. this.needBack = false;
  1460. this.submit();
  1461. },
  1462. /**
  1463. * 离开页面统计回答正确题数
  1464. */
  1465. examRecordEdit() {
  1466. if (!this.isSubmit) {
  1467. this.submit("leave");
  1468. }
  1469. },
  1470. /**
  1471. * @param {Object} second倒计时过滤器
  1472. */
  1473. countdown(second) {
  1474. if (second) {
  1475. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1476. let m = parseInt((second / 60) % 60); // 计算分数
  1477. let s = parseInt(second % 60); // 计算当前秒数
  1478. if (h < 10) h = "0" + h;
  1479. if (m < 10) m = "0" + m;
  1480. if (s < 10) s = "0" + s;
  1481. return h + ":" + m + ":" + s;
  1482. } else {
  1483. return "";
  1484. }
  1485. },
  1486. noListTip(content = "该试卷暂无题目") {
  1487. this.hideDialog();
  1488. uni.showModal({
  1489. showCancel: false,
  1490. content,
  1491. success: (k) => {
  1492. if (k.confirm) {
  1493. this.isSubmit = true;
  1494. uni.navigateBack();
  1495. }
  1496. },
  1497. });
  1498. },
  1499. /**
  1500. * 请求题目列表
  1501. */
  1502. goodsQuestionList() {
  1503. this.$api[
  1504. this.doMode == 3 ? "goodsRandomQuestionList" : "goodsQuestionList"
  1505. ]({
  1506. examId: this.id,
  1507. goodsId: this.goodsId,
  1508. orderGoodsId: this.orderGoodsId,
  1509. from: 2,
  1510. }).then(async (res) => {
  1511. if (res.data.code == 500) {
  1512. return this.noListTip("你已完成所有题目");
  1513. }
  1514. let data = res.data.data;
  1515. if (this.doMode == 3) {
  1516. this.simulateExamId = data.simulateExamId;
  1517. data = data.questionList;
  1518. }
  1519. if (!data.length) {
  1520. return this.noListTip();
  1521. }
  1522. data.forEach((item, index) => {
  1523. if (typeof item.jsonStr == "string") {
  1524. item.jsonStr = JSON.parse(item.jsonStr) || [];
  1525. if (item.type == 2) {
  1526. //多选
  1527. item.jsonStr.forEach((str) => {
  1528. str.optionsId = "" + str.optionsId;
  1529. });
  1530. let arr = item.answerQuestion.split(",");
  1531. arr.forEach((a, i) => {
  1532. arr[i] = "" + a;
  1533. });
  1534. item.ans = arr;
  1535. item.analysisContent &&
  1536. (item.analysisContent = item.analysisContent.replace(
  1537. /<img/gi,
  1538. '<img style="max-width:100%;"'
  1539. ));
  1540. item.content &&
  1541. (item.content = item.content.replace(
  1542. /<img/gi,
  1543. '<img style="max-width:100%;"'
  1544. ));
  1545. return;
  1546. } else if (item.type == 5) {
  1547. //简答题
  1548. item.ansText = {
  1549. text: "",
  1550. imageList: [],
  1551. };
  1552. item.ques = {
  1553. text: "",
  1554. imageList: [],
  1555. };
  1556. item.analysisContent &&
  1557. (item.analysisContent = item.analysisContent.replace(
  1558. /<img/gi,
  1559. '<img style="max-width:100%;"'
  1560. ));
  1561. item.content &&
  1562. (item.content = item.content.replace(
  1563. /<img/gi,
  1564. '<img style="max-width:100%;"'
  1565. ));
  1566. } else if (item.type == 4) {
  1567. //案例题
  1568. console.log(item.jsonStr);
  1569. item.ques = [];
  1570. item.current = 0;
  1571. let ansArr = [];
  1572. item.jsonStr.forEach((json, index) => {
  1573. if (json.type == 1) {
  1574. ansArr[index] = json.answerQuestion;
  1575. json.content &&
  1576. (json.content = json.content.replace(
  1577. /<img/gi,
  1578. '<img style="max-width:100%;"'
  1579. ));
  1580. } else if (json.type == 2) {
  1581. json.optionsList.forEach((str) => {
  1582. str.optionsId = "" + str.optionsId;
  1583. });
  1584. let arr = json.answerQuestion.split(",");
  1585. arr.forEach((a, i) => {
  1586. arr[i] = "" + a;
  1587. });
  1588. ansArr[index] = arr;
  1589. json.content &&
  1590. (json.content = json.content.replace(
  1591. /<img/gi,
  1592. '<img style="max-width:100%;"'
  1593. ));
  1594. } else if (json.type == 3) {
  1595. ansArr[index] = json.answerQuestion;
  1596. json.content &&
  1597. (json.content = json.content.replace(
  1598. /<img/gi,
  1599. '<img style="max-width:100%;"'
  1600. ));
  1601. } else if (json.type == 5) {
  1602. ansArr[index] = {
  1603. text: "",
  1604. imageList: [],
  1605. };
  1606. json.ansText = {
  1607. text: "",
  1608. imageList: [],
  1609. };
  1610. json.content &&
  1611. (json.content = json.content.replace(
  1612. /<img/gi,
  1613. '<img style="max-width:100%;"'
  1614. ));
  1615. }
  1616. });
  1617. item.analysisContent &&
  1618. (item.analysisContent = item.analysisContent.replace(
  1619. /<img/gi,
  1620. '<img style="max-width:100%;"'
  1621. ));
  1622. item.content &&
  1623. (item.content = item.content.replace(
  1624. /<img/gi,
  1625. '<img style="max-width:100%;"'
  1626. ));
  1627. item.ans = ansArr;
  1628. return;
  1629. }
  1630. item.content &&
  1631. (item.content = item.content.replace(
  1632. /<img/gi,
  1633. '<img style="max-width:100%;"'
  1634. ));
  1635. item.ans = item.answerQuestion;
  1636. }
  1637. });
  1638. this.questionList = data;
  1639. this.lastCount = this.questionList.length;
  1640. this.getCollectInfo(this.current);
  1641. await this.examRecord();
  1642. });
  1643. },
  1644. /**
  1645. * 记录总题数,获取recordId
  1646. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1647. */
  1648. examRecord(hasSpecial) {
  1649. return new Promise((resolve) => {
  1650. let questionList = 0;
  1651. // if(!hasSpecial) {
  1652. this.questionList.forEach((item, index) => {
  1653. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1654. questionList++;
  1655. }
  1656. });
  1657. // } else {
  1658. // questionList = this.questionList.length;
  1659. // }
  1660. // #ifdef MP-WEIXIN
  1661. let fromPlat = 1
  1662. // #endif
  1663. // #ifdef H5
  1664. let fromPlat = 3
  1665. // #endif
  1666. this.$api
  1667. .bankRecord({
  1668. fromPlat: fromPlat, //"来源平台 1小程序 2PC网站 3h5"
  1669. courseId: this.courseId,
  1670. // chapterExamId: this.chapterId || 0,
  1671. // moduleExamId: this.moduleId || 0,
  1672. chapterId: this.chapterId || 0,
  1673. moduleId: this.moduleId || 0,
  1674. sectionId: this.sectionId || 0,
  1675. examId: this.id,
  1676. goodsId: this.goodsId,
  1677. orderGoodsId: this.orderGoodsId,
  1678. gradeId: this.gradeId,
  1679. totalQuestionNum: questionList,
  1680. allQuestionNum: this.questionList.length,
  1681. type: this.examType,
  1682. simulateExamId: this.simulateExamId,
  1683. doMode: this.doMode,
  1684. })
  1685. .then((res) => {
  1686. this.recordId = res.data.data;
  1687. if (this.needPhoto) {
  1688. if (!this.learning && this.examType != 2) {
  1689. if (uni.getStorageSync("tabkePhotoShow")) {
  1690. // #ifdef MP-WEIXIN
  1691. this.photoPopup = true; //拍照
  1692. this.isTaking = true;
  1693. // #endif
  1694. // #ifdef H5
  1695. this.isHadCamera();
  1696. // #endif
  1697. } else {
  1698. this.popupPhotoShow = true;
  1699. uni.setStorageSync("tabkePhotoShow", 1); // 本地缓存用来判断是否已经弹出过弹窗
  1700. }
  1701. }
  1702. } else {
  1703. if (this.lastTime) {
  1704. this.timer = setInterval(() => {
  1705. if (this.lastTime <= 0) {
  1706. clearInterval(this.timer);
  1707. uni.showToast({
  1708. icon: "none",
  1709. mask: true,
  1710. title: "考试时间已到,系统将自动交卷",
  1711. duration: 10000,
  1712. });
  1713. this.submit();
  1714. return;
  1715. }
  1716. this.lastTime--;
  1717. }, 1000);
  1718. }
  1719. resolve();
  1720. }
  1721. });
  1722. });
  1723. },
  1724. /**
  1725. * @param {Object} e单选点击
  1726. */
  1727. radioSelect(optionsId, bindex) {
  1728. // if (this.questionList[bindex].ques) return;
  1729. if (this.questionList[bindex].ques && this.bankType == 1) {
  1730. return;
  1731. }
  1732. this.$set(this.questionList[bindex], "ques", optionsId);
  1733. // if ((bindex + 1) < this.questionList.length) {
  1734. // this.current = bindex + 1
  1735. // }
  1736. this.isDoOver();
  1737. },
  1738. /**
  1739. * @param {Object} e案例单选点击
  1740. */
  1741. radioSelectChild(optionsId, ansIndex, bindex) {
  1742. // if (this.questionList[bindex].ques[ansIndex]) return;
  1743. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1744. return;
  1745. }
  1746. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  1747. this.isDoOver();
  1748. },
  1749. /**
  1750. * @param {Object} 多选点击
  1751. */
  1752. checkboxSelect(optionsId, bindex, index) {
  1753. if (this.questionList[bindex].ques && this.bankType == 1) {
  1754. return;
  1755. }
  1756. this.$set(
  1757. this.questionList[bindex].jsonStr[index],
  1758. "checked",
  1759. !this.questionList[bindex].jsonStr[index].checked
  1760. );
  1761. },
  1762. /**
  1763. * @param {Object} 案例多选点击
  1764. */
  1765. checkboxSelectChild(bindex, ansIndex, childIndex) {
  1766. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1767. return;
  1768. }
  1769. this.$set(
  1770. this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
  1771. "checked",
  1772. !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex]
  1773. .checked
  1774. );
  1775. },
  1776. isCheckboxChecked(arr) {
  1777. return arr.some((item) => {
  1778. if (item.checked) {
  1779. return true;
  1780. }
  1781. });
  1782. },
  1783. /**
  1784. * @param {Object} 多选确认
  1785. */
  1786. checkboxSubmit(bindex) {
  1787. // if (this.questionList[bindex].ques) return;
  1788. if (this.questionList[bindex].ques && this.bankType == 1) {
  1789. return;
  1790. }
  1791. let arr = [];
  1792. this.questionList[bindex].jsonStr.forEach((item) => {
  1793. if (item.checked) {
  1794. arr.push(item.optionsId);
  1795. }
  1796. });
  1797. if (!arr.length) {
  1798. delete this.questionList[bindex].ques;
  1799. uni.showToast({
  1800. title: "请选择答案",
  1801. icon: "none",
  1802. });
  1803. return;
  1804. }
  1805. this.$set(this.questionList[bindex], "ques", arr);
  1806. this.$u.toast("已确认答案");
  1807. this.isDoOver();
  1808. // 切换下一题
  1809. if (
  1810. this.bankType != 1 &&
  1811. this.cgType != 9 &&
  1812. bindex != this.questionList.length - 1
  1813. ) {
  1814. this.current = bindex + 1;
  1815. this.getCollectInfo(this.current);
  1816. }
  1817. },
  1818. /**
  1819. * @param {Object} 案例多选确认
  1820. */
  1821. checkboxSubmitChild(bindex, ansIndex) {
  1822. // if (this.questionList[bindex].ques[ansIndex]) return;
  1823. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1824. return;
  1825. }
  1826. let arr = [];
  1827. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
  1828. (item) => {
  1829. if (item.checked) {
  1830. arr.push(item.optionsId);
  1831. }
  1832. }
  1833. );
  1834. if (!arr.length) {
  1835. delete this.questionList[bindex].ques[ansIndex];
  1836. uni.showToast({
  1837. title: "请选择答案",
  1838. icon: "none",
  1839. });
  1840. return;
  1841. }
  1842. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  1843. this.$u.toast("已确认答案");
  1844. this.isDoOver();
  1845. // 切换下一题
  1846. if (
  1847. this.bankType != 1 &&
  1848. this.cgType != 9 &&
  1849. ansIndex != this.questionList[bindex].ques.length - 1
  1850. ) {
  1851. this.questionList[bindex].current += 1;
  1852. }
  1853. },
  1854. /**
  1855. * @param {Object} index
  1856. * @param {Object} bindex
  1857. * 判断题
  1858. */
  1859. judgeSelect(index, bindex) {
  1860. // if (this.questionList[bindex].ques) return;
  1861. if (this.questionList[bindex].ques && this.bankType == 1) {
  1862. return;
  1863. }
  1864. this.$set(this.questionList[bindex], "ques", index == 0 ? "1" : "0");
  1865. this.isDoOver();
  1866. },
  1867. /**
  1868. * @param {Object} ansindex
  1869. * @param {Object} childindex
  1870. * @param {Object} bindex
  1871. * 案例判断题
  1872. */
  1873. judgeSelectChild(ansindex, childindex, bindex) {
  1874. // if (this.questionList[bindex].ques[ansindex]) return;
  1875. if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
  1876. return;
  1877. }
  1878. this.$set(
  1879. this.questionList[bindex].ques,
  1880. ansindex,
  1881. childindex == 0 ? "1" : "0"
  1882. );
  1883. this.isDoOver();
  1884. },
  1885. openFooterTab() {
  1886. this.show = true;
  1887. },
  1888. hideDialog() {
  1889. this.showDialog = false;
  1890. },
  1891. changeIndex(index) {
  1892. this.current = index;
  1893. },
  1894. swiperChange(e) {
  1895. this.current = e.detail.current;
  1896. this.getCollectInfo(this.current);
  1897. },
  1898. /**
  1899. * @param {Object} current
  1900. * 获取收藏信息
  1901. */
  1902. getCollectInfo(current) {
  1903. this.$api
  1904. .getCollectInfo({
  1905. examId: this.id,
  1906. questionId: this.questionList[current].questionId,
  1907. goodsId: this.goodsId,
  1908. orderGoodsId: this.orderGoodsId,
  1909. })
  1910. .then((res) => {
  1911. if (res.data.code == 500) {
  1912. this.$set(this.collectList, current, false);
  1913. } else if (res.data.code == 200) {
  1914. this.$set(this.collectList, current, res.data.data);
  1915. }
  1916. });
  1917. },
  1918. /**
  1919. * @param {Object} state
  1920. * @param {Object} index
  1921. * 收藏
  1922. */
  1923. collect(state, index) {
  1924. if (!state) {
  1925. this.$api
  1926. .collectQuestion({
  1927. examId: this.id,
  1928. questionId: this.questionList[index].questionId,
  1929. goodsId: this.goodsId || "",
  1930. orderGoodsId: this.orderGoodsId,
  1931. doMode: this.doMode,
  1932. })
  1933. .then((res) => {
  1934. if (res.data.code == 200) {
  1935. this.$set(this.collectList, index, true);
  1936. uni.showToast({
  1937. title: "收藏成功",
  1938. duration: 2000,
  1939. icon: "none",
  1940. });
  1941. this.getCollectInfo(index);
  1942. }
  1943. });
  1944. } else {
  1945. this.$api
  1946. .deleteCollectQuestion(this.collectList[index].collectQuestionId)
  1947. .then((res) => {
  1948. if (res.data.code == 200) {
  1949. this.$set(this.collectList, index, false);
  1950. uni.showToast({
  1951. title: "取消收藏成功",
  1952. duration: 2000,
  1953. icon: "none",
  1954. });
  1955. }
  1956. });
  1957. }
  1958. return;
  1959. },
  1960. pdsubmit() {
  1961. let ansCount = this.questionOverNum(true); //已答题数
  1962. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1963. //没有答完
  1964. if (this.lastCount !== 0) {
  1965. this.cgType = 6;
  1966. this.showpopups = true;
  1967. return;
  1968. }
  1969. if (this.bankType == 2) {
  1970. if (this.lastTime > 0) {
  1971. let lastTime = this.countdown(this.lastTime);
  1972. uni.showModal({
  1973. title: "提示",
  1974. content: `时间还剩余${lastTime},确定交卷吗?`,
  1975. confirmText: "交卷",
  1976. cancelText: "继续答题",
  1977. success: (res) => {
  1978. if (res.confirm) {
  1979. //确定
  1980. this.submit();
  1981. } else {
  1982. //取消
  1983. }
  1984. },
  1985. });
  1986. return;
  1987. }
  1988. }
  1989. this.submit();
  1990. },
  1991. /**
  1992. * 交卷
  1993. */
  1994. submit(typesubmit) {
  1995. let form = this.$method.calculateScore(this.questionList);
  1996. clearInterval(this.timer);
  1997. //交卷
  1998. this.$api
  1999. .bankRecordEdit({
  2000. moduleId: this.moduleId || 0,
  2001. chapterId: this.chapterId || 0,
  2002. sectionId: this.sectionId || 0,
  2003. gradeId: this.gradeId,
  2004. examId: this.id,
  2005. goodsId: this.goodsId,
  2006. orderGoodsId: this.orderGoodsId,
  2007. recordId: this.recordId,
  2008. courseId: this.courseId,
  2009. status: 1,
  2010. type: this.examType,
  2011. examTime: parseInt(this.allTimes),
  2012. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2013. ...form,
  2014. })
  2015. .then((res) => {
  2016. this.isSubmit = true;
  2017. this.isReach = false;
  2018. if (res.data.code == 200) {
  2019. uni.showToast({
  2020. title: "交卷成功",
  2021. duration: 1000,
  2022. mask: true,
  2023. icon: "none",
  2024. });
  2025. if (!typesubmit) {
  2026. console.log("跳转----");
  2027. setTimeout(() => {
  2028. uni.redirectTo({
  2029. url: "/pages2/class/question_report?recordId=" +
  2030. this.recordId +
  2031. "&type=" +
  2032. this.examType +
  2033. "&orderGoodsId=" +
  2034. this.orderGoodsId +
  2035. "&isBackVideo=" +
  2036. this.isBackVideo +
  2037. "&bankType=" +
  2038. this.bankType,
  2039. });
  2040. }, 1000);
  2041. }
  2042. } else if (res.data.code == 559) {
  2043. this.isReach = true;
  2044. this.uploadLock = false;
  2045. this.openPhoto();
  2046. }
  2047. });
  2048. //错题集id提交(客观题)
  2049. this.$api
  2050. .examWrongRecord({
  2051. moduleId: this.moduleId || 0,
  2052. chapterId: this.chapterId || 0,
  2053. sectionId: this.sectionId || 0,
  2054. gradeId: this.gradeId,
  2055. courseId: this.courseId,
  2056. examId: this.id,
  2057. goodsId: this.goodsId,
  2058. orderGoodsId: this.orderGoodsId,
  2059. questionIds: form.questionIds,
  2060. recordId: this.recordId,
  2061. type: 2, // 视频课程的传2
  2062. doMode: this.doMode,
  2063. })
  2064. .then((res) => {})
  2065. .catch((err) => {});
  2066. },
  2067. /**
  2068. * @param {Object} imgIndex
  2069. * @param {Object} bankIndex
  2070. * 删除简答图片
  2071. */
  2072. deleteImg(imgIndex, bankIndex) {
  2073. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  2074. },
  2075. /**
  2076. * @param {Object} imgIndex
  2077. * @param {Object} bankIndex
  2078. * @param {Object} ansIndex
  2079. * 删除案例题简答图片
  2080. */
  2081. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  2082. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(
  2083. imgIndex,
  2084. 1
  2085. );
  2086. },
  2087. /**
  2088. * @param {Object} bankindex
  2089. * 选择上传图片
  2090. */
  2091. chooseImg(bankindex) {
  2092. if (
  2093. this.questionList[bankindex] &&
  2094. this.questionList[bankindex].ansText &&
  2095. this.questionList[bankindex].ansText.imageList.length >= 4
  2096. ) {
  2097. uni.showToast({
  2098. icon: "none",
  2099. title: "最多选择4张",
  2100. });
  2101. return;
  2102. }
  2103. uni.chooseImage({
  2104. count: 1, //默认9
  2105. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2106. sourceType: ["album", "camera"], //从相册选择
  2107. success: (res) => {
  2108. let self = this;
  2109. // console.log(JSON.stringify(res.tempFilePaths));
  2110. let img = res.tempFilePaths[0];
  2111. uni.getImageInfo({
  2112. src: img,
  2113. success: async (res) => {
  2114. let canvasWidth = res.width; //图片原始长宽
  2115. let canvasHeight = res.height;
  2116. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2117. uni.compressImage({
  2118. src: img,
  2119. quality: 75,
  2120. width: "50%",
  2121. height: "50%",
  2122. success: async (rest) => {
  2123. const dir = await self.uploadFile(rest
  2124. .tempFilePath, 0);
  2125. this.questionList[bankindex].ansText
  2126. .imageList.push(dir);
  2127. },
  2128. });
  2129. } else {
  2130. const dir = await self.uploadFile(img, 0);
  2131. this.questionList[bankindex].ansText.imageList.push(dir);
  2132. }
  2133. },
  2134. });
  2135. },
  2136. });
  2137. },
  2138. /**
  2139. * @param {Object} bankindex
  2140. * @param {Object} ansindex
  2141. * 案例题选择上传图片
  2142. */
  2143. chooseImgChild(bankindex, ansindex) {
  2144. uni.chooseImage({
  2145. count: 1, //默认9
  2146. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2147. sourceType: ["album", "camera"], //从相册选择
  2148. success: (res) => {
  2149. let self = this;
  2150. // console.log(JSON.stringify(res.tempFilePaths));
  2151. let img = res.tempFilePaths[0];
  2152. uni.getImageInfo({
  2153. src: img,
  2154. success: async (res) => {
  2155. let canvasWidth = res.width; //图片原始长宽
  2156. let canvasHeight = res.height;
  2157. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2158. uni.compressImage({
  2159. src: img,
  2160. quality: 75,
  2161. width: "50%",
  2162. height: "50%",
  2163. success: async (rest) => {
  2164. const dir = await self.uploadFile(rest
  2165. .tempFilePath, 0);
  2166. this.questionList[bankindex].jsonStr[
  2167. ansindex
  2168. ].ansText.imageList.push(dir);
  2169. },
  2170. });
  2171. } else {
  2172. const dir = await self.uploadFile(img, 0);
  2173. this.questionList[bankindex].jsonStr[
  2174. ansindex
  2175. ].ansText.imageList.push(dir);
  2176. }
  2177. },
  2178. });
  2179. },
  2180. });
  2181. },
  2182. /**
  2183. * @param {Object} type
  2184. * @param {Object} bankindex
  2185. * 简答题答案确认
  2186. */
  2187. submitAns(bankindex) {
  2188. console.log(this.questionList[bankindex]);
  2189. if (
  2190. !this.questionList[bankindex].ansText.text &&
  2191. !this.questionList[bankindex].ansText.imageList.length
  2192. ) {
  2193. uni.showToast({
  2194. title: "请输入内容或上传图片",
  2195. duration: 2000,
  2196. icon: "none",
  2197. });
  2198. return;
  2199. }
  2200. this.$set(this.questionList[bankindex], "ques", {
  2201. imageList: this.questionList[bankindex].ansText.imageList,
  2202. text: this.questionList[bankindex].ansText.text,
  2203. });
  2204. this.$u.toast("已确认答案");
  2205. this.isDoOver();
  2206. },
  2207. /**
  2208. * @param {Object} bankindex
  2209. * @param {Object} ansindex
  2210. * 案例题简答答案确认
  2211. */
  2212. submitAnsChild(bankindex, ansindex) {
  2213. if (
  2214. !this.questionList[bankindex].jsonStr[ansindex].ansText.text &&
  2215. !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length
  2216. ) {
  2217. uni.showToast({
  2218. title: "请输入内容或上传图片",
  2219. duration: 2000,
  2220. icon: "none",
  2221. });
  2222. return;
  2223. }
  2224. this.$set(this.questionList[bankindex].ques, ansindex, {
  2225. imageList: this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  2226. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text,
  2227. });
  2228. this.$u.toast("已确认答案");
  2229. this.isDoOver();
  2230. },
  2231. isCheck(item, index) {
  2232. // 案例题处理
  2233. let {
  2234. ques,
  2235. type,
  2236. ans
  2237. } = item;
  2238. if (type == 4) {
  2239. return ans.length == ques.length;
  2240. }
  2241. if (ques) {
  2242. return true;
  2243. }
  2244. },
  2245. isRight(item, index) {
  2246. //单选
  2247. if (this.questionList[index].ques) {
  2248. if (item.type == 1) {
  2249. return this.questionList[index].ques == this.questionList[index].ans;
  2250. //多选
  2251. } else if (item.type == 2) {
  2252. //每一项都相等
  2253. return this.questionList[index].ans.every((item, i) => {
  2254. return item == this.questionList[index].ques[i];
  2255. });
  2256. //判断
  2257. } else if (item.type == 3) {
  2258. return this.questionList[index].ques == this.questionList[index].ans;
  2259. // } else if (item.type == 5) {
  2260. // if(this.questionList[index].ques.text){
  2261. // return true
  2262. // }else{
  2263. // return false
  2264. // }
  2265. } else {
  2266. return false;
  2267. }
  2268. } else {
  2269. return false;
  2270. }
  2271. },
  2272. right(bankIndex, ansIndex, option) {
  2273. if (
  2274. this.questionList[bankIndex].ques[ansIndex] &&
  2275. this.questionList[bankIndex].ans[ansIndex]
  2276. ) {
  2277. if (
  2278. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2279. option.optionsId
  2280. ) != -1 ||
  2281. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2282. option.optionsId
  2283. ) != -1
  2284. ) {
  2285. return true;
  2286. } else {
  2287. return false;
  2288. }
  2289. } else {
  2290. return false;
  2291. }
  2292. },
  2293. wrong(bankIndex, ansIndex, option) {
  2294. if (
  2295. this.questionList[bankIndex].ques[ansIndex] &&
  2296. this.questionList[bankIndex].ans[ansIndex]
  2297. ) {
  2298. if (
  2299. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2300. option.optionsId
  2301. ) != -1 &&
  2302. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2303. option.optionsId
  2304. ) == -1
  2305. ) {
  2306. return true;
  2307. } else {
  2308. return false;
  2309. }
  2310. } else {
  2311. return false;
  2312. }
  2313. },
  2314. isWrong(item, index) {
  2315. if (this.questionList[index].ques) {
  2316. //单选
  2317. if (item.type == 1) {
  2318. return this.questionList[index].ques != this.questionList[index].ans;
  2319. //多选
  2320. } else if (item.type == 2) {
  2321. //每一项都相等
  2322. return this.questionList[index].ques.some((item, i) => {
  2323. return this.questionList[index].ans.indexOf(item) == -1;
  2324. });
  2325. //判断
  2326. } else if (item.type == 3) {
  2327. return this.questionList[index].ques != this.questionList[index].ans;
  2328. } else {
  2329. return false;
  2330. }
  2331. } else {
  2332. return false;
  2333. }
  2334. },
  2335. isPart(item, index) {
  2336. if (this.questionList[index].ques) {
  2337. if (item.type == 2) {
  2338. let isWrong = this.questionList[index].ques.some((item, i) => {
  2339. return this.questionList[index].ans.indexOf(item) == -1;
  2340. });
  2341. let isRight = this.questionList[index].ans.every((item, i) => {
  2342. return item == this.questionList[index].ques[i];
  2343. });
  2344. if (!isRight && !isWrong) {
  2345. return true;
  2346. }
  2347. }
  2348. } else {
  2349. return false;
  2350. }
  2351. },
  2352. isOver(item, index) {
  2353. if (this.questionList[index].ques) {
  2354. if (item.type == 4) {
  2355. //案例题
  2356. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  2357. if (
  2358. jsonItem.type == 1 ||
  2359. jsonItem.type == 2 ||
  2360. jsonItem.type == 3
  2361. ) {
  2362. if (item.ques[indexs]) {
  2363. return true;
  2364. } else {
  2365. return false;
  2366. }
  2367. } else if (jsonItem.type == 5) {
  2368. if (
  2369. item.ques[indexs] &&
  2370. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  2371. ) {
  2372. console.log("chil");
  2373. return true;
  2374. } else {
  2375. return false;
  2376. }
  2377. }
  2378. });
  2379. if (isOver) {
  2380. return true;
  2381. } else {
  2382. return false;
  2383. }
  2384. } else if (item.type == 5) {
  2385. //简答题
  2386. //每一项都相等
  2387. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2388. return true;
  2389. }
  2390. //判断
  2391. } else {
  2392. return false;
  2393. }
  2394. } else {
  2395. return false;
  2396. }
  2397. },
  2398. tabSelect(index, bankindex) {
  2399. this.$set(this.questionList[bankindex], "current", index);
  2400. },
  2401. /**
  2402. * 退出全屏
  2403. */
  2404. exitFullscreen() {
  2405. try {
  2406. var de = document;
  2407. // console.log(de);
  2408. if (de.exitFullscreen) {
  2409. de.exitFullscreen();
  2410. } else if (de.mozCancelFullScreen) {
  2411. de.mozCancelFullScreen();
  2412. } else if (de.webkitCancelFullScreen) {
  2413. de.webkitCancelFullScreen();
  2414. }
  2415. } catch (err) {}
  2416. },
  2417. fullele() {
  2418. return (
  2419. document.fullscreenElement ||
  2420. document.webkitFullscreenElement ||
  2421. document.msFullscreenElement ||
  2422. document.mozFullScreenElement ||
  2423. null
  2424. );
  2425. },
  2426. //判断是否全屏
  2427. isFullScreen() {
  2428. return !!(document.webkitIsFullScreen || this.fullele());
  2429. },
  2430. getUserMedia(constraints, success, error) {
  2431. console.log("getUserMedia===", constraints, "success:", success);
  2432. if (window.navigator.mediaDevices.getUserMedia) {
  2433. // 最新的标准API
  2434. window.navigator.mediaDevices
  2435. .getUserMedia(constraints)
  2436. .then(success)
  2437. .catch(error);
  2438. } else if (window.navigator.webkitGetUserMedia) {
  2439. // webkit核心浏览器
  2440. window.navigator.webkitGetUserMedia(constraints, success, error);
  2441. } else if (window.navigator.mozGetUserMedia) {
  2442. // firfox浏览器
  2443. window.navigator.mozGetUserMedia(constraints, success, error);
  2444. } else if (window.navigator.getUserMedia) {
  2445. // 旧版API
  2446. window.navigator.getUserMedia(constraints, success, error);
  2447. }
  2448. },
  2449. photographSuccess(stream) {
  2450. console.log("有摄像头---", stream);
  2451. this.photoPopup = true;
  2452. this.isTaking = true;
  2453. this.$nextTick(() => {
  2454. const video = document.querySelector("video");
  2455. console.log("video:", video);
  2456. video.srcObject = stream;
  2457. video.play();
  2458. });
  2459. },
  2460. photographError(err) {
  2461. console.log("没有摄像头:", err);
  2462. uni.showModal({
  2463. title: "提示",
  2464. content: "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
  2465. cancelText: "取消",
  2466. showCancel: false,
  2467. confirmText: "确定",
  2468. success: (res) => {
  2469. if (res.confirm) {
  2470. uni.navigateBack();
  2471. } else if (res.cancel) {}
  2472. },
  2473. });
  2474. },
  2475. },
  2476. };
  2477. </script>
  2478. <style lang="scss" scoped>
  2479. .photoBox {
  2480. width: 100%;
  2481. // background-color: #ffffff;
  2482. // border-radius: 24px 24px 0px 0px;
  2483. .photoTop {
  2484. width: 100%;
  2485. height: 74rpx;
  2486. border-radius: 20px 20px 0px 0px;
  2487. background-color: #ffffff;
  2488. display: flex;
  2489. align-items: center;
  2490. justify-content: center;
  2491. padding: 0rpx 38rpx;
  2492. .sqzz {
  2493. width: 28rpx;
  2494. height: 28rpx;
  2495. display: flex;
  2496. align-items: center;
  2497. justify-content: center;
  2498. }
  2499. .centersq {
  2500. color: #333;
  2501. font-size: 30rpx;
  2502. font-weight: 500;
  2503. }
  2504. }
  2505. .photoCenter {
  2506. width: 750rpx;
  2507. height: 75vh;
  2508. position: relative;
  2509. .center_camera {
  2510. width: 100%;
  2511. height: 75vh;
  2512. position: fixed;
  2513. .head_take {
  2514. width: 100%;
  2515. height: 75vh;
  2516. display: flex;
  2517. flex-direction: column;
  2518. }
  2519. .headTake_up {
  2520. width: 100%;
  2521. height: 100rpx;
  2522. }
  2523. .headTake_minddle {
  2524. display: flex;
  2525. .min_img {
  2526. width: 500rpx;
  2527. height: 550rpx;
  2528. }
  2529. .min_left,
  2530. .min_right {
  2531. flex: 1;
  2532. height: 550rpx;
  2533. }
  2534. }
  2535. .headTake_down {
  2536. width: 100%;
  2537. flex: 1;
  2538. }
  2539. .color {
  2540. background-color: #333;
  2541. opacity: 0.5;
  2542. }
  2543. .photo_v {
  2544. width: 100%;
  2545. height: 100%;
  2546. }
  2547. .mask {
  2548. width: 500rpx;
  2549. height: 550rpx;
  2550. position: absolute;
  2551. top: 100rpx;
  2552. left: 0;
  2553. right: 0;
  2554. bottom: 0;
  2555. margin: 0 auto;
  2556. box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
  2557. }
  2558. }
  2559. .custom {
  2560. width: 750rpx;
  2561. height: 75vh;
  2562. position: absolute;
  2563. z-index: 1000;
  2564. top: 0;
  2565. left: 0;
  2566. image {
  2567. width: 100%;
  2568. height: 100%;
  2569. }
  2570. }
  2571. }
  2572. .photoBoxbtns {
  2573. display: flex;
  2574. .takePhoto_btn {
  2575. width: 100%;
  2576. display: flex;
  2577. align-items: center;
  2578. justify-content: space-between;
  2579. background: #a9a7a9;
  2580. padding: 40rpx 26rpx;
  2581. .middle_btn {
  2582. width: 120rpx;
  2583. height: 120rpx;
  2584. border-radius: 40rpx;
  2585. border: 4rpx solid #ffffff;
  2586. display: flex;
  2587. align-items: center;
  2588. justify-content: center;
  2589. }
  2590. .square {
  2591. width: 96rpx;
  2592. height: 96rpx;
  2593. background: #ffffff;
  2594. border-radius: 28rpx;
  2595. }
  2596. .rights {
  2597. font-size: 32rpx;
  2598. font-weight: 500;
  2599. color: #ffffff;
  2600. }
  2601. }
  2602. .btnResult {
  2603. height: 100rpx;
  2604. width: 100%;
  2605. background-color: #07c160;
  2606. text-align: center;
  2607. line-height: 100rpx;
  2608. color: #fff;
  2609. font-size: 32rpx;
  2610. font-weight: bold;
  2611. }
  2612. }
  2613. }
  2614. .navbar {
  2615. position: relative;
  2616. z-index: 20000;
  2617. }
  2618. .questionBank {
  2619. width: 100%;
  2620. height: 100vh;
  2621. display: flex;
  2622. flex-direction: column;
  2623. }
  2624. .swiper {
  2625. width: 100%;
  2626. flex: 1;
  2627. }
  2628. .lisSty {
  2629. margin-bottom: 16rpx;
  2630. display: flex;
  2631. .flex_auto {
  2632. flex: 1;
  2633. word-break: break-all;
  2634. }
  2635. }
  2636. .activeTI {
  2637. vertical-align: middle;
  2638. display: inline-block;
  2639. border: 1rpx solid #eee;
  2640. border-radius: 50rpx;
  2641. height: 48rpx;
  2642. line-height: 46rpx;
  2643. text-align: center;
  2644. width: 48rpx;
  2645. margin-right: 15rpx;
  2646. color: #666;
  2647. font-size: 30rpx;
  2648. &.right {
  2649. color: #fff;
  2650. background: #36c75a;
  2651. }
  2652. &.wrong {
  2653. color: #fff;
  2654. background: #ff3b30;
  2655. }
  2656. &.checked,
  2657. &.user_choose {
  2658. color: #fff;
  2659. background: #007aff;
  2660. }
  2661. }
  2662. .submit_checkbox {
  2663. position: fixed;
  2664. left: 0;
  2665. right: 0;
  2666. bottom: 120rpx;
  2667. margin: 20rpx auto;
  2668. width: 526rpx;
  2669. height: 80rpx;
  2670. background: rgba(0, 122, 255, 1);
  2671. color: #fff;
  2672. text-align: center;
  2673. line-height: 80rpx;
  2674. font-size: 30rpx;
  2675. border-radius: 40rpx;
  2676. &.disabled {
  2677. opacity: 0.6;
  2678. }
  2679. }
  2680. .titles {
  2681. overflow: hidden;
  2682. margin-bottom: 24rpx;
  2683. }
  2684. .titBox {
  2685. padding: 41rpx 25rpx 24rpx 25rpx;
  2686. }
  2687. .titBox_title {
  2688. padding: 21rpx;
  2689. }
  2690. .tabs {
  2691. margin: 10rpx;
  2692. display: flex;
  2693. .tab {
  2694. margin: 0 4rpx;
  2695. padding: 10rpx 13rpx;
  2696. text-align: center;
  2697. color: #007aff;
  2698. font-size: 28rpx;
  2699. border-radius: 16rpx;
  2700. background: #fff;
  2701. &.current {
  2702. color: #fff;
  2703. background: #007aff;
  2704. }
  2705. }
  2706. }
  2707. .ans {
  2708. margin: 8rpx 8rpx 8rpx;
  2709. .ans_input {
  2710. border-radius: 16rpx;
  2711. background: #fff;
  2712. .top {
  2713. border-bottom: 1rpx solid #eeeeee;
  2714. padding: 16rpx;
  2715. display: flex;
  2716. align-items: center;
  2717. .icon {
  2718. margin-right: 20rpx;
  2719. width: 40rpx;
  2720. height: 38rpx;
  2721. }
  2722. .progress {
  2723. flex: 1;
  2724. }
  2725. .submit {
  2726. width: 168rpx;
  2727. height: 48rpx;
  2728. line-height: 48rpx;
  2729. text-align: center;
  2730. color: #fff;
  2731. font-size: 30rpx;
  2732. background: #007aff;
  2733. border-radius: 24rpx;
  2734. &.disabled {
  2735. opacity: 0.6;
  2736. }
  2737. }
  2738. }
  2739. .textarea {
  2740. textarea {
  2741. width: 100%;
  2742. height: 287rpx;
  2743. padding: 10rpx;
  2744. }
  2745. }
  2746. .imgs {
  2747. overflow: hidden;
  2748. display: flex;
  2749. width: 100%;
  2750. .img {
  2751. width: 104rpx;
  2752. height: 104rpx;
  2753. border-radius: 8rpx;
  2754. position: relative;
  2755. margin: 20rpx;
  2756. text {
  2757. position: absolute;
  2758. right: -15rpx;
  2759. top: -15rpx;
  2760. width: 30rpx;
  2761. height: 30rpx;
  2762. text-align: center;
  2763. line-height: 30rpx;
  2764. color: #fff;
  2765. background: #ff3b30;
  2766. border-radius: 50%;
  2767. }
  2768. image {
  2769. width: 100%;
  2770. height: 100%;
  2771. }
  2772. }
  2773. }
  2774. }
  2775. .ans_submit {
  2776. padding: 16rpx;
  2777. border-radius: 16rpx;
  2778. background: #fff;
  2779. .imgs {
  2780. overflow: hidden;
  2781. display: flex;
  2782. width: 100%;
  2783. .img {
  2784. width: 104rpx;
  2785. height: 104rpx;
  2786. border-radius: 8rpx;
  2787. position: relative;
  2788. margin: 20rpx;
  2789. image {
  2790. width: 100%;
  2791. height: 100%;
  2792. }
  2793. }
  2794. }
  2795. }
  2796. }
  2797. .leftLetters {
  2798. display: flex;
  2799. align-items: center;
  2800. width: 220rpx;
  2801. .btnType {
  2802. padding: 5rpx 10rpx;
  2803. border: 1rpx solid #007aff;
  2804. border-radius: 10rpx;
  2805. background-color: rgba(0, 122, 255, 0.1);
  2806. font-size: 28rpx;
  2807. color: #007aff;
  2808. margin-right: 15rpx;
  2809. }
  2810. image {
  2811. width: 40rpx;
  2812. height: 40rpx;
  2813. padding-right: 8rpx;
  2814. }
  2815. }
  2816. .firstLetter {
  2817. display: flex;
  2818. justify-content: space-between;
  2819. align-items: center;
  2820. margin-bottom: 30rpx;
  2821. }
  2822. .popupView {
  2823. height: 100%;
  2824. padding-bottom: 100rpx;
  2825. .popupTops {
  2826. height: 77rpx;
  2827. border-bottom: 1rpx solid #eee;
  2828. text-align: center;
  2829. line-height: 77rpx;
  2830. font-size: 24rpx;
  2831. color: #999;
  2832. position: relative;
  2833. .topIcon {
  2834. position: absolute;
  2835. top: 10rpx;
  2836. left: 50%;
  2837. transform: translateX(-50%);
  2838. width: 80rpx;
  2839. height: 8rpx;
  2840. background-color: #999;
  2841. border-radius: 4rpx;
  2842. }
  2843. }
  2844. .popupContent {}
  2845. }
  2846. .pageContent {
  2847. position: relative;
  2848. background-color: #eaeef1;
  2849. height: 100%;
  2850. padding-top: 8rpx;
  2851. padding-bottom: 100rpx;
  2852. overflow-y: scroll;
  2853. }
  2854. .pad_8 {
  2855. background-color: #fff;
  2856. margin: 0rpx 8rpx 8rpx;
  2857. border-radius: 16rpx;
  2858. &.no-margin {
  2859. margin-top: -16rpx;
  2860. border-radius: 0 0 16rpx 16rpx;
  2861. }
  2862. }
  2863. .answer {
  2864. height: 80rpx;
  2865. line-height: 80rpx;
  2866. padding: 0rpx 24rpx;
  2867. display: flex;
  2868. align-items: center;
  2869. justify-content: space-between;
  2870. color: #666;
  2871. font-size: 30rpx;
  2872. }
  2873. .footer_btn {
  2874. background-color: #fff;
  2875. z-index: 10078;
  2876. position: fixed;
  2877. bottom: 0rpx;
  2878. display: flex;
  2879. align-items: center;
  2880. justify-content: space-between;
  2881. width: 100%;
  2882. height: 98rpx;
  2883. padding: 0rpx 38rpx;
  2884. border-top: 1rpx solid #eee;
  2885. .flex_center {
  2886. flex: 1;
  2887. display: flex;
  2888. justify-content: center;
  2889. align-items: center;
  2890. flex-direction: column;
  2891. margin: 0 200rpx;
  2892. font-size: 24rpx;
  2893. color: #999999;
  2894. .up-icon {
  2895. margin-bottom: 18rpx;
  2896. width: 100%;
  2897. display: flex;
  2898. justify-content: center;
  2899. image {
  2900. width: 58rpx;
  2901. height: 21rpx;
  2902. }
  2903. }
  2904. }
  2905. }
  2906. .boxSty {
  2907. padding: 44rpx 41rpx 0rpx;
  2908. }
  2909. .liListSty {
  2910. border: 1rpx solid #eeeeee;
  2911. width: 88rpx;
  2912. height: 88rpx;
  2913. border-radius: 32rpx;
  2914. text-align: center;
  2915. line-height: 88rpx;
  2916. color: #333;
  2917. font-size: 32rpx;
  2918. float: left;
  2919. margin: 20rpx 23rpx;
  2920. &.isRight {
  2921. border: 1rpx solid #eeeeee;
  2922. color: #fff;
  2923. background: #36c75a;
  2924. }
  2925. &.isWrong {
  2926. border: 1rpx solid #eeeeee;
  2927. color: #fff;
  2928. background: #ff3b30;
  2929. }
  2930. &.isPart {
  2931. border: 1rpx solid #eeeeee;
  2932. color: #fff;
  2933. background: #ffc53d;
  2934. }
  2935. &.isOver {
  2936. border: 1rpx solid #eeeeee;
  2937. color: #fff;
  2938. background: blue;
  2939. }
  2940. &.check_ans {
  2941. border: 1rpx solid #eeeeee;
  2942. color: #fff;
  2943. background: #007aff;
  2944. }
  2945. }
  2946. .answerInfos {
  2947. padding: 25rpx 25rpx 25rpx 23rpx;
  2948. }
  2949. .answerTitle {
  2950. margin-bottom: 28rpx;
  2951. color: #666;
  2952. font-size: 30rpx;
  2953. }
  2954. .answerContent {
  2955. font-size: 30rpx;
  2956. color: #666;
  2957. }
  2958. .textChild {
  2959. display: inline-block;
  2960. vertical-align: middle;
  2961. }
  2962. .dialog {
  2963. position: fixed;
  2964. left: 0;
  2965. top: 0;
  2966. width: 100%;
  2967. height: 100%;
  2968. background-color: rgba(0, 0, 0, 0.8);
  2969. display: flex;
  2970. flex-direction: column;
  2971. align-items: center;
  2972. justify-content: center;
  2973. z-index: 20000;
  2974. .text {
  2975. font-size: 32rpx;
  2976. color: #ffffff;
  2977. text-align: center;
  2978. }
  2979. .btn {
  2980. width: 242rpx;
  2981. height: 82rpx;
  2982. border: 2rpx solid #ffffff;
  2983. border-radius: 16rpx;
  2984. text-align: center;
  2985. line-height: 82rpx;
  2986. margin: 41rpx auto;
  2987. color: #fff;
  2988. font-size: 32rpx;
  2989. }
  2990. }
  2991. .dialog-arrow {
  2992. padding-top: 124rpx;
  2993. position: fixed;
  2994. left: 0;
  2995. top: 0;
  2996. width: 100%;
  2997. height: 100%;
  2998. background-color: rgba(0, 0, 0, 0.8);
  2999. z-index: 20000;
  3000. .pointer {
  3001. margin-left: 87rpx;
  3002. display: block;
  3003. width: 95rpx;
  3004. height: 98rpx;
  3005. }
  3006. .text {
  3007. padding-left: 177rpx;
  3008. font-size: 32rpx;
  3009. color: #ffffff;
  3010. }
  3011. .btn {
  3012. width: 242rpx;
  3013. height: 82rpx;
  3014. border: 2rpx solid #ffffff;
  3015. border-radius: 16rpx;
  3016. text-align: center;
  3017. line-height: 82rpx;
  3018. margin: 500rpx auto 0;
  3019. color: #fff;
  3020. font-size: 32rpx;
  3021. }
  3022. }
  3023. .dialog_wrap {
  3024. position: fixed;
  3025. left: 0;
  3026. top: 0;
  3027. width: 100%;
  3028. height: 100%;
  3029. z-index: 9999999999;
  3030. .bg {
  3031. background: rgba(0, 0, 0, 0.3);
  3032. position: absolute;
  3033. left: 0;
  3034. top: 0;
  3035. width: 100%;
  3036. height: 100%;
  3037. }
  3038. .dialog {
  3039. position: absolute;
  3040. left: 50%;
  3041. top: 50%;
  3042. transform: translate3D(-50%, -50%, 0);
  3043. width: 640rpx;
  3044. height: 439rpx;
  3045. background: #ffffff;
  3046. border-radius: 24rpx;
  3047. .title {
  3048. font-size: 30rpx;
  3049. font-weight: bold;
  3050. color: #333333;
  3051. line-height: 48rpx;
  3052. text-align: center;
  3053. margin-top: 40rpx;
  3054. }
  3055. .content {
  3056. margin: 35rpx 35rpx 0;
  3057. font-size: 30rpx;
  3058. color: #666666;
  3059. line-height: 48rpx;
  3060. }
  3061. .btns {
  3062. margin-top: 35rpx;
  3063. display: flex;
  3064. align-items: center;
  3065. justify-content: center;
  3066. .btn {
  3067. width: 200rpx;
  3068. height: 80rpx;
  3069. line-height: 80rpx;
  3070. text-align: center;
  3071. background: #f5f5f5;
  3072. border-radius: 40rpx;
  3073. font-size: 30rpx;
  3074. color: rgba(0, 122, 255, 1);
  3075. background: #f5f5f5;
  3076. margin: 0 20rpx;
  3077. &.active {
  3078. color: #f5f5f5;
  3079. background: rgba(0, 122, 255, 1);
  3080. }
  3081. }
  3082. }
  3083. }
  3084. }
  3085. .popboxs {
  3086. width: 100%;
  3087. height: 100%;
  3088. display: flex;
  3089. flex-direction: column;
  3090. align-items: center;
  3091. }
  3092. .classTops {
  3093. flex-shrink: 0;
  3094. padding: 39rpx 0rpx 4rpx;
  3095. font-weight: bold;
  3096. color: #333;
  3097. font-size: 30rpx;
  3098. }
  3099. .textStys {
  3100. width: 100%;
  3101. flex: 1;
  3102. padding: 36rpx;
  3103. }
  3104. .classFootsty {
  3105. flex-shrink: 0;
  3106. display: flex;
  3107. align-items: center;
  3108. justify-content: center;
  3109. padding: 10rpx 0rpx 40rpx;
  3110. .btnsty {
  3111. width: 200rpx;
  3112. height: 80rpx;
  3113. border-radius: 40rpx;
  3114. font-weight: bold;
  3115. font-size: 30rpx;
  3116. text-align: center;
  3117. line-height: 80rpx;
  3118. }
  3119. .btns1 {
  3120. background-color: #f5f5f5;
  3121. color: #007aff;
  3122. }
  3123. .btns2 {
  3124. margin-left: 40rpx;
  3125. background-color: #007aff;
  3126. color: #ffffff;
  3127. }
  3128. }
  3129. </style>