questionBank.vue 64 KB

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