questionBank.vue 91 KB

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