questionBank.vue 63 KB

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