index.vue 94 KB

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