questionBank.vue 66 KB

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