questionBank.vue 94 KB

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