questionBank.vue 64 KB

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