questionBank.vue 92 KB

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