questionBank.vue 97 KB

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