questionBank.vue 62 KB

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