questionBank.vue 94 KB

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