questionBank.vue 63 KB

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