questionBank.vue 93 KB

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