questionBank.vue 96 KB

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