questionBank.vue 63 KB

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