questionBank.vue 61 KB

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