questionBank.vue 98 KB

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