questionBank.vue 93 KB

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