questionBankExplainDetail.vue 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831
  1. <template>
  2. <view class="questionBank">
  3. <view class="tabs-top">
  4. <u-tabs :list="list" sticky :current="tabCurrent" @change="tabChange" active-color="#007AFF"></u-tabs>
  5. </view>
  6. <swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
  7. <swiper-item v-for="(bank,bankIndex) in questionList" :key="bankIndex">
  8. <view class="pageContent">
  9. <view class="pad_8 titBox" >
  10. <view class="firstLetter">
  11. <view class="leftLetters">
  12. <view class="btnType">
  13. <text v-if="bank.type==1">单选</text>
  14. <text v-if="bank.type==2">多选</text>
  15. <text v-if="bank.type==3">判断</text>
  16. <text v-if="bank.type==4">案例</text>
  17. <text v-if="bank.type==5">简答</text>
  18. </view>
  19. <text>{{bankIndex+1}}/{{questionList.length}}</text>
  20. </view>
  21. <view style="color: #666;font-size: 28rpx;"></view>
  22. <view class="leftLetters"></view>
  23. </view>
  24. <view class="titles">
  25. <rich-text :nodes="bank.content"></rich-text>
  26. </view>
  27. </view>
  28. <template v-if="bank.type == 1">
  29. <view class="pad_8 titBox no-margin">
  30. <view v-if="!bank.ques">
  31. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="radioSelect(item.optionsId,bankIndex)">
  32. <view class="activeTI">{{ ast[index] }}</view>
  33. <view class="flex_auto">{{ item.content }}</view>
  34. </view>
  35. </view>
  36. <view v-if="bank.ques">
  37. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  38. <text :class="{right:(item.optionsId == bank.ques) || (item.optionsId == bank.ans),wrong:(item.optionsId == bank.ques) && (bank.ques != bank.ans)}" class="activeTI">{{ ast[index] }}</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 v-if="!explain">我的答案:{{ast[bank.ques-1]}}</view>
  47. </view>
  48. <view class="pad_8 answerInfos">
  49. <view class="answerTitle">答案解析</view>
  50. <view class="answerContent">
  51. <rich-text :nodes="bank.analysisContent"></rich-text>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <template v-if="bank.type == 2">
  57. <view class="pad_8 titBox no-margin">
  58. <view v-if="!bank.ques">
  59. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="checkboxSelect(item.optionsId,bankIndex,index)">
  60. <view :class="{checked:item.checked}" class="activeTI">{{ ast[index] }}</view>
  61. <view class="flex_auto">{{ item.content }}</view>
  62. </view>
  63. </view>
  64. <view v-if="!bank.ques" class="submit_checkbox" @click="checkboxSubmit(bankIndex)">
  65. 确认答案
  66. </view>
  67. <view v-if="bank.ques">
  68. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  69. <text :class="{right:(bank.ques.indexOf(item.optionsId) != -1 ) || (bank.ans.indexOf(item.optionsId) != -1),wrong:(bank.ques.indexOf(item.optionsId) != -1 ) && (bank.ans.indexOf(item.optionsId) == -1)}" class="activeTI">{{ ast[index] }}</text>
  70. <view class="flex_auto">{{ item.content }}</view>
  71. </view>
  72. </view>
  73. </view>
  74. <view v-if="bank.ques">
  75. <view class="pad_8 answer">
  76. <view>正确答案:
  77. <text :key="ansItemIndex" v-for="(ansItem,ansItemIndex) in bank.ans">{{ast[ansItem-1]}}</text>
  78. </view>
  79. <view v-if="!explain">我的答案:
  80. <text :key="quesItemIndex" v-for="(quesItem,quesItemIndex) in bank.ques">{{ast[quesItem-1]}}</text>
  81. </view>
  82. </view>
  83. <view class="pad_8 answerInfos">
  84. <view class="answerTitle">答案解析</view>
  85. <view class="answerContent">
  86. <rich-text :nodes="bank.analysisContent"></rich-text>
  87. </view>
  88. </view>
  89. </view>
  90. </template>
  91. <template v-if="bank.type == 3">
  92. <view class="pad_8 titBox no-margin">
  93. <view v-if="!bank.ques">
  94. <view v-for="(item, index) in judge" :key="index" class="lisSty" @click="judgeSelect(index,bankIndex)">
  95. <view class="activeTI">{{ ast[index] }}</view>
  96. <view class="flex_auto">
  97. {{ item }}
  98. </view>
  99. </view>
  100. </view>
  101. <view v-if="bank.ques">
  102. <view v-for="(item, index) in judge" :key="index" class="lisSty">
  103. <text :class="{right:(index == bank.ques) || (index == bank.ans),wrong:(index == bank.ques) && (bank.ques != bank.ans)}" class="activeTI">{{ ast[index] }}</text>
  104. <view class="flex_auto">
  105. {{ item }}
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. <view v-if="bank.ques">
  111. <view class="pad_8 answer">
  112. <view>正确答案:{{ast[bank.ans]}}</view>
  113. <view v-if="!explain">我的答案:{{ast[bank.ques]}}</view>
  114. </view>
  115. <view class="pad_8 answerInfos">
  116. <view class="answerTitle">答案解析</view>
  117. <view class="answerContent">
  118. <rich-text :nodes="bank.analysisContent"></rich-text>
  119. </view>
  120. </view>
  121. </view>
  122. </template>
  123. <!-- 简答题 -->
  124. <template v-if="bank.type == 5">
  125. <view class="pad_8 titBox">
  126. <view class="ans">
  127. <view class="ans_input" v-if="!bank.ques || (!bank.ques.text && !bank.ques.imageList.length)">
  128. <view class="top flex">
  129. <image :data-index="bankIndex" class="icon" @click="chooseImg(bankIndex)" src="/static/camera.png" mode=""></image>
  130. <view class="progress">{{bank.ansText.imageList.length || '0'}}/4</view>
  131. <view class="submit" :class="{disabled:!bank.ansText.text && hasImgs(bank)}" @click="submitAns(bankIndex)" >确认答案</view>
  132. </view>
  133. <view class="textarea">
  134. <textarea v-model="bank.ansText.text" placeholder="在此输入答案"></textarea>
  135. </view>
  136. <view class="imgs">
  137. <view class="img" v-for="(img,imgIndex) in bank.ansText.imageList" :key="imgIndex" >
  138. <text @click="deleteImg(imgIndex,bankIndex)">x</text>
  139. <image :src="$method.splitImgHost(img, true)"></image>
  140. </view>
  141. </view>
  142. </view>
  143. <view class="ans_submit answerInfos" v-if="bank.ques && !explain">
  144. <view class="answerTitle">我的答案:</view>
  145. {{bank.ques.text}}
  146. <view class="imgs">
  147. <image class="img" :key="quesIndex" v-for="(ques,quesIndex) in bank.ques.imageList" :src="$method.splitImgHost(ques,true)"></image>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. <view v-if="bank.ques">
  153. <view class="pad_8 answerInfos">
  154. <view class="answerTitle">答案解析:</view>
  155. <view class="answerContent">
  156. <rich-text :nodes="bank.analysisContent"></rich-text>
  157. </view>
  158. </view>
  159. </view>
  160. </template>
  161. <!-- 案例题 -->
  162. <template v-if="bank.type == 4">
  163. <view class="tabs">
  164. <view class="tab"
  165. :class="{current:tabIndex == bank.current}"
  166. :key="tabIndex" 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">
  181. <rich-text :nodes="ansItem.content"></rich-text>
  182. </view>
  183. <view v-if="!bank.ques[ansIndex]">
  184. <view v-for="(option, childIndex) in ansItem.optionsList" :key="childIndex" class="lisSty" @click="radioSelectChild(option.optionsId,ansIndex,bankIndex)">
  185. <view class="activeTI">{{ ast[childIndex] }}</view>
  186. <view class="flex_auto">
  187. <rich-text class="textChild" :nodes="option.content"></rich-text>
  188. </view>
  189. </view>
  190. </view>
  191. <view v-if="bank.ques[ansIndex]">
  192. <view v-for="(option, childIndex) in ansItem.optionsList" :key="childIndex" class="lisSty">
  193. <text :class="{right:(option.optionsId == bank.ques[ansIndex]) || (option.optionsId == bank.ans[ansIndex]),wrong:(option.optionsId == bank.ques[ansIndex]) && (bank.ques[ansIndex] != bank.ans[ansIndex])}" class="activeTI">{{ ast[childIndex] }}</text>
  194. <view class="flex_auto">
  195. <rich-text :nodes="option.content"></rich-text>
  196. </view>
  197. </view>
  198. </view>
  199. </view>
  200. <view v-if="bank.ques[ansIndex]">
  201. <view class="pad_8 answer">
  202. <view>正确答案:{{ast[bank.ans[ansIndex]-1]}}</view>
  203. <view v-if="!explain">我的答案:{{ast[bank.ques[ansIndex]-1]}}</view>
  204. </view>
  205. <view class="pad_8 answerInfos">
  206. <view class="answerTitle">答案解析</view>
  207. <view class="answerContent">
  208. <rich-text :nodes="option.analysisContent"></rich-text>
  209. </view>
  210. </view>
  211. </view>
  212. </template>
  213. <template v-if="ansItem.type == 2">
  214. <view class="pad_8 titBox">
  215. <view class="leftLetters">
  216. <view class="btnType">
  217. <text>多选</text>
  218. </view>
  219. </view>
  220. <view class="titles">
  221. <rich-text :nodes="ansItem.content"></rich-text>
  222. </view>
  223. <view v-if="!bank.ques[ansIndex]">
  224. <view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty" @click="checkboxSelectChild(bankIndex,ansIndex,childindex)">
  225. <view :class="{checked:option.checked}" class="activeTI">{{ ast[childindex] }}</view>
  226. <view class="flex_auto">
  227. <rich-text :nodes="option.content"></rich-text>
  228. </view>
  229. </view>
  230. </view>
  231. <view v-if="!bank.ques[ansIndex]" class="submit_checkbox" @click="checkboxSubmitChild(bankIndex,ansIndex)">
  232. 确认答案
  233. </view>
  234. <view v-if="bank.ques && bank.ques[ansIndex]">
  235. <view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty">
  236. <text :class="{right:right(bankIndex,ansIndex,option),wrong:wrong(bankIndex,ansIndex,option)}" class="activeTI">{{ ast[childindex] }}</text>
  237. <view class="flex_auto">
  238. <rich-text :nodes="option.content"></rich-text>
  239. </view>
  240. </view>
  241. </view>
  242. </view>
  243. <view v-if="bank.ques[ansIndex]">
  244. <view class="pad_8 answer">
  245. <view>正确答案:
  246. <text :key="ansItemIndex1" v-for="(ansItem1,ansItemIndex1) in bank.ans[ansIndex]">{{ast[ansItem1-1]}}</text>
  247. </view>
  248. <view v-if="!explain">我的答案:
  249. <text :key="quesItemIndex" v-for="(quesItem,quesItemIndex) in bank.ques[ansIndex]">{{ast[quesItem-1]}}</text>
  250. </view>
  251. </view>
  252. <view class="pad_8 answerInfos">
  253. <view class="answerTitle">答案解析</view>
  254. <view class="answerContent">
  255. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  256. </view>
  257. </view>
  258. </view>
  259. </template>
  260. <template v-if="ansItem.type == 3">
  261. <view class="pad_8 titBox">
  262. <view class="leftLetters">
  263. <view class="btnType">
  264. <text>判断</text>
  265. </view>
  266. </view>
  267. <view class="titles">
  268. <rich-text :nodes="ansItem.content"></rich-text>
  269. </view>
  270. <view v-if="!bank.ques[ansIndex]">
  271. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty" @click="judgeSelectChild(ansIndex,childindex,bankIndex)">
  272. <view class="activeTI">{{ ast[childindex] }}</view>
  273. <view class="flex_auto">
  274. {{ option }}
  275. </view>
  276. </view>
  277. </view>
  278. <view v-if="bank.ques[ansIndex]">
  279. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty">
  280. <text :class="{right:(childindex == bank.ques[ansIndex]) || (childindex == bank.ans[ansIndex]),wrong:(childindex == bank.ques[ansIndex]) && (bank.ques[ansIndex] != bank.ans[ansIndex])}" class="activeTI">{{ ast[childindex] }}</text>
  281. <view class="flex_auto">
  282. {{ option }}
  283. </view>
  284. </view>
  285. </view>
  286. </view>
  287. <view v-if="bank.ques[ansIndex]">
  288. <view class="pad_8 answer">
  289. <view>正确答案:{{ast[bank.ans[ansIndex]]}}</view>
  290. <view v-if="!explain">我的答案:{{ast[bank.ques[ansIndex]]}}</view>
  291. </view>
  292. <view class="pad_8 answerInfos">
  293. <view class="answerTitle">答案解析</view>
  294. <view class="answerContent">
  295. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  296. </view>
  297. </view>
  298. </view>
  299. </template>
  300. <!-- 简答题 -->
  301. <template v-if="ansItem.type == 5">
  302. <view class="pad_8 titBox_title">
  303. <view class="leftLetters">
  304. <view class="btnType">
  305. <text>简答</text>
  306. </view>
  307. </view>
  308. <view class="titles">
  309. <rich-text :nodes="ansItem.content"></rich-text>
  310. </view>
  311. </view>
  312. <view class="pad_8 titBox_title">
  313. <view class="ans">
  314. <view class="ans_input" v-if="!bank.ques[ansIndex] || (!bank.ques[ansIndex].text && !bank.ques[ansIndex].imageList.length)">
  315. <view class="top flex">
  316. <image class="icon" @click="chooseImgChild(bankIndex,ansIndex)" src="/static/08-10_032.jpg" mode=""></image>
  317. <view class="progress">{{ansItem.ansText.imageList.length || '0'}}/4</view>
  318. <view class="submit" :class="{disabled:!ansItem.ansText.text && hasImgs(ansItem)}" @click="submitAnsChild(bankIndex,ansIndex)">确认答案</view>
  319. </view>
  320. <view class="textarea">
  321. <textarea v-model="ansItem.ansText.text" placeholder="在此输入答案"></textarea>
  322. </view>
  323. <view class="imgs">
  324. <view class="img" v-for="(img,imgIndex) in ansItem.ansText.imageList" :key="imgIndex">
  325. <text @click="deleteImgChild(imgIndex,bankIndex,ansIndex)">x</text>
  326. <image :src="$method.splitImgHost(img, true)"></image>
  327. </view>
  328. </view>
  329. </view>
  330. <view class="ans_submit answerInfos" v-if="bank.ques[ansIndex] && !explain">
  331. <view class="answerTitle">我的答案</view>
  332. {{bank.ques[ansIndex].text}}
  333. <view class="imgs">
  334. <image class="img" :key="quesIndex" v-for="(ques,quesIndex) in bank.ques[ansIndex].imageList" :src="$method.splitImgHost(ques,true)"></image>
  335. </view>
  336. </view>
  337. </view>
  338. </view>
  339. <view v-if="bank.ques[ansIndex]">
  340. <view class="pad_8 answerInfos">
  341. <view class="answerTitle">答案解析</view>
  342. <view class="answerContent">
  343. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  344. </view>
  345. </view>
  346. </view>
  347. </template>
  348. </view>
  349. </template>
  350. <view class="footer_btn">
  351. <view class="collect" @click="collect(collectList[bankIndex], bankIndex)">
  352. <view v-if="collectList[bankIndex]">
  353. <image src="/static/icon/collected.png" mode=""></image>
  354. <view>取消收藏</view>
  355. </view>
  356. <view v-if="!collectList[bankIndex]">
  357. <image src="/static/icon/collect.png" mode=""></image>
  358. <view>收藏</view>
  359. </view>
  360. </view>
  361. <view class="flex_center" @click="openFooterTab">
  362. <view class="up-icon">
  363. <image src="/static/up.png"></image>
  364. </view>
  365. 答题卡
  366. </view>
  367. <view class="collect" @click="submit">
  368. <view>
  369. <image src="/static/jj.png" mode=""></image>
  370. <view>交卷</view>
  371. </view>
  372. </view>
  373. </view>
  374. </view>
  375. </swiper-item>
  376. </swiper>
  377. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  378. <view class="popupView">
  379. <view class="popupTops">
  380. <view class="topIcon"></view>
  381. 点击编号即可跳转至对应题目
  382. </view>
  383. <view class="popupContent">
  384. <scroll-view scroll-y="true" style="height: 506rpx;">
  385. <view class="boxSty">
  386. <view v-for="(item, index) in questionList" :key="index" @click="changeIndex(index)" :class="{isRight:isRight(item,index),isWrong:isWrong(item,index)}" class="liListSty">{{ index + 1 }}</view>
  387. </view>
  388. </scroll-view>
  389. </view>
  390. </view>
  391. </u-popup>
  392. <view class="dialog" v-if="showDialog">
  393. <image class="pointer" src="/static/pointer.png"></image>
  394. <view class="text">左右滑动切换上下题</view>
  395. <view class="btn" @click="hideDialog">我知道了</view>
  396. </view>
  397. </view>
  398. </template>
  399. <script>
  400. export default {
  401. data() {
  402. return {
  403. examId:'',
  404. tabCurrent:0,
  405. current:0,
  406. questionList:[],
  407. ast: ['A', 'B', 'C', 'D','E','F','G'],
  408. judge:['错误','正确'],
  409. show: false,
  410. showDialog:false,
  411. bankList: [],
  412. collectList:[],
  413. goodsId:'',
  414. explain:'1', //是否显示答案
  415. chapterId:'',
  416. moduleId:'',
  417. list:[{
  418. name:'对题'
  419. },{
  420. name:'错题'
  421. }]
  422. };
  423. },
  424. onLoad(option){
  425. this.examId = option.examId;
  426. this.goodsId = option.goodsId;
  427. this.chapterId = option.chapterId;
  428. this.moduleId = option.moduleId;
  429. // this.goodsQuestionList();
  430. let showDialog = uni.getStorageSync('showDialog');
  431. if(showDialog) {
  432. this.showDialog = false;
  433. } else {
  434. this.showDialog = true;
  435. uni.setStorageSync('showDialog','1');
  436. }
  437. if(this.tabCurrent == 0) {
  438. this.examRecordRightList();
  439. } else {
  440. this.examRecordWrongList();
  441. }
  442. },
  443. onUnload() {
  444. },
  445. methods: {
  446. tabChange(e) {
  447. this.tabCurrent = e;
  448. if(this.tabCurrent == 0) {
  449. this.examRecordRightList();
  450. } else {
  451. this.examRecordWrongList();
  452. }
  453. },
  454. /**
  455. * 是否有上传图片
  456. */
  457. hasImgs(bank) {
  458. return bank.ansText.imageList.length == 0;
  459. },
  460. /**
  461. * 获取错题列表
  462. */
  463. examRecordWrongList() {
  464. this.$api.examRecordWrongList({
  465. examId:this.examId,
  466. goodsId:this.goodsId
  467. }).then(res => {
  468. res.data.rows.forEach((item,index) => {
  469. if(typeof item.jsonStr == 'string') {
  470. item.jsonStr = JSON.parse(item.jsonStr)
  471. if(item.type == 2) { //多选
  472. item.jsonStr.forEach(str => {
  473. str.optionsId = ''+str.optionsId;
  474. })
  475. let arr = item.answerQuestion.split(',');
  476. arr.forEach((a,i) => {
  477. arr[i] = ''+a;
  478. })
  479. item.ans = arr;
  480. if(this.explain) {
  481. item.ques = item.ans;
  482. }
  483. return;
  484. } else if(item.type == 5) {
  485. item.ansText = {
  486. text: '',
  487. imageList: []
  488. }
  489. if(this.explain) {
  490. item.ques = {
  491. text:item.analysisContent
  492. }
  493. return;
  494. }
  495. } else if(item.type == 4) {
  496. console.log(item.jsonStr)
  497. item.ques = []
  498. item.current = 0;
  499. let ansArr = [];
  500. item.jsonStr.forEach((json,index) => {
  501. if(json.type == 1) {
  502. ansArr[index] = json.answerQuestion;
  503. } else if(json.type == 2) {
  504. json.optionsList.forEach(str => {
  505. str.optionsId = ''+str.optionsId;
  506. })
  507. let arr = json.answerQuestion.split(',');
  508. arr.forEach((a,i) => {
  509. arr[i] = ''+a;
  510. })
  511. ansArr[index] = arr
  512. } else if(json.type == 3) {
  513. ansArr[index] = json.answerQuestion;
  514. } else if(json.type == 5) {
  515. ansArr[index] = {
  516. text: '',
  517. imageList: []
  518. }
  519. json.ansText = {
  520. text: '',
  521. imageList: []
  522. }
  523. }
  524. })
  525. item.ans = ansArr
  526. if(this.explain) {
  527. item.ques = item.ans;
  528. }
  529. return;
  530. }
  531. item.ans = item.answerQuestion
  532. if(this.explain) {
  533. item.ques = item.ans;
  534. }
  535. } else {
  536. if(this.explain) {
  537. item.ques = item.ans;
  538. }
  539. }
  540. })
  541. this.questionList = res.data.rows;
  542. })
  543. },
  544. /**
  545. * 获取对题列表
  546. */
  547. examRecordRightList() {
  548. this.$api.examRecordRightList({
  549. examId:this.examId,
  550. goodsId:this.goodsId
  551. }).then(res => {
  552. res.data.rows.forEach((item,index) => {
  553. if(typeof item.jsonStr == 'string') {
  554. item.jsonStr = JSON.parse(item.jsonStr)
  555. if(item.type == 2) { //多选
  556. item.jsonStr.forEach(str => {
  557. str.optionsId = ''+str.optionsId;
  558. })
  559. let arr = item.answerQuestion.split(',');
  560. arr.forEach((a,i) => {
  561. arr[i] = ''+a;
  562. })
  563. item.ans = arr;
  564. if(this.explain) {
  565. item.ques = item.ans;
  566. }
  567. return;
  568. } else if(item.type == 5) {
  569. item.ansText = {
  570. text: '',
  571. imageList: []
  572. }
  573. if(this.explain) {
  574. item.ques = {
  575. text:item.analysisContent
  576. }
  577. return;
  578. }
  579. } else if(item.type == 4) {
  580. console.log(item.jsonStr)
  581. item.ques = []
  582. item.current = 0;
  583. let ansArr = [];
  584. item.jsonStr.forEach((json,index) => {
  585. if(json.type == 1) {
  586. ansArr[index] = json.answerQuestion;
  587. } else if(json.type == 2) {
  588. json.optionsList.forEach(str => {
  589. str.optionsId = ''+str.optionsId;
  590. })
  591. let arr = json.answerQuestion.split(',');
  592. arr.forEach((a,i) => {
  593. arr[i] = ''+a;
  594. })
  595. ansArr[index] = arr
  596. } else if(json.type == 3) {
  597. ansArr[index] = json.answerQuestion;
  598. } else if(json.type == 5) {
  599. ansArr[index] = {
  600. text: '',
  601. imageList: []
  602. }
  603. json.ansText = {
  604. text: '',
  605. imageList: []
  606. }
  607. }
  608. })
  609. item.ans = ansArr
  610. if(this.explain) {
  611. item.ques = item.ans;
  612. }
  613. return;
  614. }
  615. item.ans = item.answerQuestion
  616. if(this.explain) {
  617. item.ques = item.ans;
  618. }
  619. } else {
  620. if(this.explain) {
  621. item.ques = item.ans;
  622. }
  623. }
  624. })
  625. this.questionList = res.data.rows;
  626. })
  627. },
  628. /**
  629. * @param {Object} state
  630. * @param {Object} index
  631. * 收藏
  632. */
  633. collect(state, index) {
  634. if (!state) {
  635. this.$api
  636. .collectQuestion({
  637. examId: this.id,
  638. questionId: this.questionList[index].questionId,
  639. goodsId: this.goodsId || ''
  640. })
  641. .then(res => {
  642. if (res.data.code == 200) {
  643. this.$set(this.collectList, index, true);
  644. uni.showToast({
  645. title: '收藏成功',
  646. duration: 2000,
  647. icon: 'none'
  648. });
  649. this.getCollectInfo(index)
  650. }
  651. });
  652. } else {
  653. this.$api.deleteCollectQuestion(this.collectList[index].collectQuestionId).then(res => {
  654. if (res.data.code == 200) {
  655. this.$set(this.collectList, index, false);
  656. uni.showToast({
  657. title: '取消收藏成功',
  658. duration: 2000,
  659. icon: 'none'
  660. });
  661. }
  662. });
  663. }
  664. return;
  665. },
  666. goodsQuestionList() {
  667. //继续答题
  668. if(this.isContinue || this.isHistory) {
  669. console.log(this.isHistory,"历史做题")
  670. console.log(this.isContinue,"继续做题")
  671. this.$api.examReport(this.recordId).then(res => {
  672. let json = JSON.parse(res.data.data.historyExamJson)
  673. this.questionList = json;
  674. })
  675. } else { //解析
  676. this.$api.goodsQuestionList({
  677. examId:this.id
  678. }).then(res => {
  679. res.data.data.forEach((item,index) => {
  680. if(typeof item.jsonStr == 'string') {
  681. item.jsonStr = JSON.parse(item.jsonStr)
  682. if(item.type == 2) { //多选
  683. item.jsonStr.forEach(str => {
  684. str.optionsId = ''+str.optionsId;
  685. })
  686. let arr = item.answerQuestion.split(',');
  687. arr.forEach((a,i) => {
  688. arr[i] = ''+a;
  689. })
  690. item.ans = arr;
  691. if(this.explain) {
  692. item.ques = item.ans;
  693. }
  694. return;
  695. } else if(item.type == 5) {
  696. item.ansText = {
  697. text: '',
  698. imageList: []
  699. }
  700. if(this.explain) {
  701. item.ques = {
  702. text:item.analysisContent
  703. }
  704. return;
  705. }
  706. } else if(item.type == 4) {
  707. console.log(item.jsonStr)
  708. item.ques = []
  709. item.current = 0;
  710. let ansArr = [];
  711. item.jsonStr.forEach((json,index) => {
  712. if(json.type == 1) {
  713. ansArr[index] = json.answerQuestion;
  714. } else if(json.type == 2) {
  715. json.optionsList.forEach(str => {
  716. str.optionsId = ''+str.optionsId;
  717. })
  718. let arr = json.answerQuestion.split(',');
  719. arr.forEach((a,i) => {
  720. arr[i] = ''+a;
  721. })
  722. ansArr[index] = arr
  723. } else if(json.type == 3) {
  724. ansArr[index] = json.answerQuestion;
  725. } else if(json.type == 5) {
  726. ansArr[index] = {
  727. text: '',
  728. imageList: []
  729. }
  730. json.ansText = {
  731. text: '',
  732. imageList: []
  733. }
  734. }
  735. })
  736. item.ans = ansArr
  737. if(this.explain) {
  738. item.ques = item.ans;
  739. }
  740. return;
  741. }
  742. item.ans = item.answerQuestion
  743. if(this.explain) {
  744. item.ques = item.ans;
  745. }
  746. } else {
  747. if(this.explain) {
  748. item.ques = item.ans;
  749. }
  750. }
  751. })
  752. this.questionList = res.data.data;
  753. this.getCollectInfo(this.current);
  754. console.log(this.questionList)
  755. })
  756. }
  757. },
  758. /**
  759. * @param {Object} current
  760. * 获取收藏信息
  761. */
  762. getCollectInfo(current) {
  763. this.$api
  764. .getCollectInfo({
  765. examId: this.id,
  766. questionId: this.questionList[current].questionId,
  767. goodsId: this.goodsId
  768. })
  769. .then(res => {
  770. if (res.data.code == 500) {
  771. this.$set(this.collectList, current, false);
  772. } else if (res.data.code == 200) {
  773. this.$set(this.collectList, current, res.data.data);
  774. }
  775. });
  776. },
  777. /**
  778. * @param {Object} e单选点击
  779. */
  780. radioSelect(optionsId,bindex) {
  781. if(this.questionList[bindex].ques) return;
  782. this.$set(this.questionList[bindex],'ques',optionsId)
  783. },
  784. examRecordEdit() {
  785. if(!this.isSubmit) {
  786. let number = 0;
  787. let score = 0;
  788. let doQuestionNum = 0;
  789. this.questionList.length && this.questionList.forEach((item,index) => {
  790. if(item.type == 1) {
  791. if(item.ques == item.ans) {
  792. score += item.score;
  793. number++
  794. }
  795. if (item.ques) {
  796. doQuestionNum++;
  797. }
  798. } else if(item.type == 2) {
  799. let isRight = item.ques && item.ques.every((quesItem,quesIndex) => {
  800. return item.ques[quesIndex] == item.ans[quesIndex]
  801. })
  802. if(isRight) {
  803. score += item.score;
  804. number++
  805. }
  806. if (item.ques && item.ques.length) {
  807. doQuestionNum++;
  808. }
  809. } else if(item.type == 3) {
  810. if(item.ques == item.ans) {
  811. score += item.score;
  812. number++
  813. }
  814. if (item.ques) {
  815. doQuestionNum++;
  816. }
  817. } else if (item == 4) {
  818. if (item.ques.length) {
  819. doQuestionNum++;
  820. }
  821. } else if (item.type == 5) {
  822. if (item.ques) {
  823. doQuestionNum++;
  824. }
  825. }
  826. })
  827. this.$api.examRecordEdit({
  828. examId:this.id,
  829. goodsId:this.goodsId,
  830. recordId: this.recordId,
  831. rightQuestionNum:number,
  832. status:0,
  833. moduleExamId:this.moduleId || 0,
  834. chapterExamId:this.chapterId || 0,
  835. doQuestionNum: doQuestionNum,
  836. historyExamJson:JSON.stringify(this.questionList)
  837. }).then(res => {
  838. })
  839. }
  840. },
  841. /**
  842. * @param {Object} e单选点击
  843. */
  844. radioSelectChild(optionsId,ansIndex,bindex) {
  845. if(this.questionList[bindex].ques[ansIndex]) return;
  846. this.$set(this.questionList[bindex].ques,ansIndex,optionsId)
  847. },
  848. /**
  849. * @param {Object} 多选点击
  850. */
  851. checkboxSelect(optionsId,bindex,index) {
  852. this.$set(this.questionList[bindex].jsonStr[index],'checked',!this.questionList[bindex].jsonStr[index].checked)
  853. },
  854. /**
  855. * @param {Object} 多选点击
  856. */
  857. checkboxSelectChild(bindex,ansIndex,childIndex) {
  858. this.$set(this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],'checked',!this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex].checked)
  859. },
  860. /**
  861. * 提交数据
  862. */
  863. submit() {
  864. let score = 0; //计算总分
  865. let reportStatus = 0;
  866. let number = 0;
  867. let allScore = 0;
  868. let passScore = 0;
  869. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  870. let doQuestionIds = []; //做过的题目id
  871. let rightQuestionIds = []; //做对的题目id
  872. this.questionList.forEach((item,index) => {
  873. passScore = item.passScore
  874. if(item.type == 1) {
  875. if(item.ques == item.ans) {
  876. score += item.score;
  877. number++
  878. rightQuestionIds.push(item.questionId)
  879. } else { //错误
  880. doWrongQuestionIds.push(item.questionId)
  881. }
  882. allScore += item.score
  883. if (item.ques) {
  884. doQuestionNum++;
  885. doQuestionIds.push(item.questionId)
  886. }
  887. } else if(item.type == 2) {
  888. let isRight = item.ans && item.ans.every((quesItem,quesIndex) => {
  889. if(item.ques) {
  890. return item.ques[quesIndex] == item.ans[quesIndex]
  891. } else {
  892. return false;
  893. }
  894. })
  895. if(isRight) {
  896. score += item.score;
  897. number++
  898. rightQuestionIds.push(item.questionId)
  899. } else {
  900. let checkboxScore = item.score; //获取单题总分数
  901. item.ques.forEach((ques,quesIndex) => {
  902. //选错一个全扣
  903. if(item.ques) {
  904. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  905. checkboxScore = 0;
  906. }
  907. } else {
  908. checkboxScore = 0;
  909. }
  910. })
  911. console.log(checkboxScore)
  912. //没选错
  913. if(checkboxScore) {
  914. item.ans.forEach((ans,quesIndex) => {
  915. //漏选扣一部分
  916. if(item.ques) {
  917. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  918. checkboxScore = item.partScore;
  919. }
  920. } else {
  921. checkboxScore = 0;
  922. }
  923. })
  924. }
  925. if(checkboxScore <= 0) { //0分
  926. item.scoreResult = 0;
  927. doWrongQuestionIds.push(item.questionId)
  928. } else { //部分分
  929. number++;
  930. item.scoreResult = checkboxScore;
  931. score += checkboxScore;
  932. rightQuestionIds.push(item.questionId)
  933. }
  934. }
  935. allScore += item.score;
  936. if (item.ques && item.ques.length) {
  937. doQuestionNum++;
  938. doQuestionIds.push(item.questionId)
  939. }
  940. } else if(item.type == 3) {
  941. if(item.ques == item.ans) {
  942. score += item.score;
  943. number++
  944. rightQuestionIds.push(item.questionId)
  945. } else {
  946. doWrongQuestionIds.push(item.questionId)
  947. }
  948. allScore += item.score;
  949. if (item.ques) {
  950. doQuestionNum++;
  951. doQuestionIds.push(item.questionId)
  952. }
  953. } else if (item.type == 4) {
  954. if (item.ques && item.ques.length) {
  955. doQuestionNum++;
  956. }
  957. } else if (item.type == 5) {
  958. if (item.ques) {
  959. doQuestionNum++;
  960. }
  961. }
  962. })
  963. //大于60分及格
  964. if(score >= passScore) {
  965. reportStatus = 1
  966. } else {
  967. reportStatus = 0
  968. }
  969. this.$api.examRecordEdit({
  970. examId:this.id,
  971. goodsId:this.goodsId,
  972. reportStatus:reportStatus,
  973. totalScore:allScore,
  974. recordId: this.recordId,
  975. rightQuestionNum:number,
  976. status:1,
  977. moduleExamId:this.moduleId || 0,
  978. chapterExamId:this.chapterId || 0,
  979. doQuestionIds:doQuestionIds.join(','),
  980. rightQuestionIds:rightQuestionIds.join(','),
  981. doQuestionNum: doQuestionNum,
  982. performance: score,
  983. historyExamJson:JSON.stringify(this.questionList)
  984. }).then(res => {
  985. this.isSubmit = true;
  986. if(res.data.code == 200) {
  987. uni.showToast({
  988. title: '交卷成功',
  989. duration: 2000,
  990. icon:'none'
  991. });
  992. setTimeout(() => {
  993. uni.redirectTo({
  994. url:'/pages2/bank/question_report?id='+this.recordId+'&examId='+this.id
  995. })
  996. },2000)
  997. }
  998. })
  999. },
  1000. /**
  1001. * @param {Object} 多选确认
  1002. */
  1003. checkboxSubmit(bindex) {
  1004. if(this.questionList[bindex].ques) return;
  1005. let arr = [];
  1006. this.questionList[bindex].jsonStr.forEach(item => {
  1007. if(item.checked) {
  1008. arr.push(item.optionsId)
  1009. }
  1010. })
  1011. this.$set(this.questionList[bindex],'ques',arr)
  1012. },
  1013. /**
  1014. * @param {Object} 多选确认
  1015. */
  1016. checkboxSubmitChild(bindex,ansIndex) {
  1017. if(this.questionList[bindex].ques[ansIndex]) return;
  1018. let arr = [];
  1019. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(item => {
  1020. if(item.checked) {
  1021. arr.push(item.optionsId)
  1022. }
  1023. })
  1024. this.$set(this.questionList[bindex].ques,ansIndex,arr)
  1025. },
  1026. judgeSelect(index,bindex) {
  1027. if(this.questionList[bindex].ques) return;
  1028. this.$set(this.questionList[bindex],'ques',index+'')
  1029. },
  1030. judgeSelectChild(ansindex,childindex,bindex) {
  1031. if(this.questionList[bindex].ques[ansindex]) return;
  1032. this.$set(this.questionList[bindex].ques,ansindex,childindex+'')
  1033. },
  1034. openFooterTab() {
  1035. this.show = true;
  1036. },
  1037. hideDialog() {
  1038. this.showDialog = false
  1039. },
  1040. changeIndex(index) {
  1041. this.current = index
  1042. },
  1043. swiperChange(e) {
  1044. this.current = e.detail.current;
  1045. },
  1046. deleteImg(imgIndex,bankIndex) {
  1047. this.questionList[bankIndex].ansText.imageList.splice(imgIndex,1)
  1048. },
  1049. deleteImgChild(imgIndex,bankIndex,ansIndex) {
  1050. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(imgIndex,1)
  1051. },
  1052. chooseImg(bankindex) {
  1053. uni.chooseImage({
  1054. count: 1, //默认9
  1055. sizeType: ['compressed', ], //可以指定是原图还是压缩图,默认二者都有
  1056. sourceType: ['album','camera'], //从相册选择
  1057. success: (res) => {
  1058. let self = this;
  1059. // console.log(JSON.stringify(res.tempFilePaths));
  1060. let img = res.tempFilePaths[0];
  1061. uni.getImageInfo({
  1062. src: img,
  1063. success: async res => {
  1064. let canvasWidth = res.width; //图片原始长宽
  1065. let canvasHeight = res.height;
  1066. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1067. uni.compressImage({
  1068. src: img,
  1069. quality: 75,
  1070. width: '50%',
  1071. height: '50%',
  1072. success: async rest => {
  1073. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1074. this.questionList[bankindex].ansText.imageList.push(dir)
  1075. }
  1076. });
  1077. } else {
  1078. const dir = await self.uploadFile(img, 0);
  1079. this.questionList[bankindex].ansText.imageList.push(dir)
  1080. }
  1081. }
  1082. });
  1083. }
  1084. })
  1085. },
  1086. chooseImgChild(bankindex,ansindex) {
  1087. uni.chooseImage({
  1088. count: 1, //默认9
  1089. sizeType: ['compressed', ], //可以指定是原图还是压缩图,默认二者都有
  1090. sourceType: ['album','camera'], //从相册选择
  1091. success: (res) => {
  1092. let self = this;
  1093. // console.log(JSON.stringify(res.tempFilePaths));
  1094. let img = res.tempFilePaths[0];
  1095. uni.getImageInfo({
  1096. src: img,
  1097. success: async res => {
  1098. let canvasWidth = res.width; //图片原始长宽
  1099. let canvasHeight = res.height;
  1100. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1101. uni.compressImage({
  1102. src: img,
  1103. quality: 75,
  1104. width: '50%',
  1105. height: '50%',
  1106. success: async rest => {
  1107. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1108. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir)
  1109. }
  1110. });
  1111. } else {
  1112. const dir = await self.uploadFile(img, 0);
  1113. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir)
  1114. }
  1115. }
  1116. });
  1117. }
  1118. })
  1119. },
  1120. uploadFile(options, int) {
  1121. var self = this;
  1122. return new Promise((resolve, reject) => {
  1123. var data = {
  1124. imageStatus: int
  1125. };
  1126. self.$api.aliyunpolicy(data).then(res => {
  1127. console.log(res.data,6)
  1128. if(res.data.code!=200){
  1129. self.$method.showToast('签名错误'+JSON.stringify(res.data))
  1130. return
  1131. }
  1132. var ossToken = res.data.data.resultContent;
  1133. if(ossToken.host==null||ossToken.host==undefined){
  1134. self.$method.showToast('上传路径报错'+JSON.stringify(res.data))
  1135. return
  1136. }
  1137. uni.uploadFile({
  1138. url: ossToken.host,
  1139. name: 'file',
  1140. filePath: options,
  1141. fileType: 'image',
  1142. header: {
  1143. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  1144. },
  1145. formData: {
  1146. key: ossToken.dir,
  1147. OSSAccessKeyId: ossToken.accessid,
  1148. policy: ossToken.policy,
  1149. Signature: ossToken.signature,
  1150. callback: ossToken.callback,
  1151. success_action_status: 200
  1152. },
  1153. success: result => {
  1154. if (result.statusCode === 200) {
  1155. resolve(ossToken.dir);
  1156. } else {
  1157. uni.showToast({
  1158. title: '上传失败',
  1159. icon: 'none'
  1160. });
  1161. return;
  1162. }
  1163. },
  1164. fail: error => {
  1165. uni.showToast({
  1166. title: '上传接口报错'+error,
  1167. icon: 'none'
  1168. });
  1169. return;
  1170. }
  1171. });
  1172. });
  1173. });
  1174. },
  1175. submitAns(bankindex) {
  1176. console.log(this.questionList[bankindex])
  1177. if(!this.questionList[bankindex].ansText.text && !this.questionList[bankindex].ansText.imageList.length) {
  1178. uni.showToast({
  1179. title: '请输入内容或上传图片',
  1180. duration: 2000,
  1181. icon:'none'
  1182. });
  1183. return
  1184. }
  1185. this.$set(this.questionList[bankindex],'ques',{
  1186. imageList:this.questionList[bankindex].ansText.imageList,
  1187. text:this.questionList[bankindex].ansText.text,
  1188. })
  1189. },
  1190. submitAnsChild(bankindex,ansindex) {
  1191. if(!this.questionList[bankindex].jsonStr[ansindex].ansText.text && !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length) {
  1192. uni.showToast({
  1193. title: '请输入内容或上传图片',
  1194. duration: 2000,
  1195. icon:'none'
  1196. });
  1197. return
  1198. }
  1199. this.$set(this.questionList[bankindex].ques,ansindex,{
  1200. imageList:this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  1201. text:this.questionList[bankindex].jsonStr[ansindex].ansText.text,
  1202. })
  1203. },
  1204. isRight(item,index) {
  1205. //单选
  1206. if(this.questionList[index].ques) {
  1207. if(item.type == 1) {
  1208. return this.questionList[index].ques == this.questionList[index].ans;
  1209. //多选
  1210. } else if(item.type == 2) {
  1211. //每一项都相等
  1212. return this.questionList[index].ans.every((item,i) => {
  1213. return item == this.questionList[index].ques[i];
  1214. })
  1215. //判断
  1216. } else if(item.type == 3) {
  1217. return this.questionList[index].ques == this.questionList[index].ans;
  1218. } else {
  1219. return false;
  1220. }
  1221. } else {
  1222. return false;
  1223. }
  1224. },
  1225. right(bankIndex,ansIndex,option) {
  1226. if(this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1227. if((this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 ) || (this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) != -1)) {
  1228. return true
  1229. } else {
  1230. return false;
  1231. }
  1232. } else {
  1233. return false;
  1234. }
  1235. },
  1236. wrong(bankIndex,ansIndex,option) {
  1237. if(this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1238. if((this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 ) && (this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) == -1)) {
  1239. return true;
  1240. } else {
  1241. return false;
  1242. }
  1243. } else {
  1244. return false;
  1245. }
  1246. },
  1247. isWrong(item,index) {
  1248. if(this.questionList[index].ques) {
  1249. //单选
  1250. if(item.type == 1) {
  1251. return this.questionList[index].ques != this.questionList[index].ans;
  1252. //多选
  1253. } else if(item.type == 2) {
  1254. //每一项都相等
  1255. return this.questionList[index].ans.some((item,i) => {
  1256. return item != this.questionList[index].ques[i];
  1257. })
  1258. //判断
  1259. } else if(item.type == 3) {
  1260. return this.questionList[index].ques != this.questionList[index].ans;
  1261. } else {
  1262. return false;
  1263. }
  1264. } else {
  1265. return false;
  1266. }
  1267. },
  1268. tabSelect(index,bankindex) {
  1269. this.$set(this.questionList[bankindex],'current',index)
  1270. },
  1271. }
  1272. };
  1273. </script>
  1274. <style lang="scss" scoped>
  1275. .questionBank {
  1276. width:100%;
  1277. height:100vh;
  1278. display: flex;
  1279. flex-direction: column;
  1280. }
  1281. .tabs-top {
  1282. display: flex;
  1283. justify-content: center;
  1284. margin-bottom:10rpx;
  1285. }
  1286. .swiper {
  1287. width:100%;
  1288. flex:1;
  1289. }
  1290. .lisSty {
  1291. margin-bottom: 16rpx;
  1292. display: flex;
  1293. align-items: center;
  1294. .flex_auto {
  1295. flex:1;
  1296. }
  1297. }
  1298. .activeTI {
  1299. vertical-align: middle;
  1300. display: inline-block;
  1301. border: 1rpx solid #eee;
  1302. border-radius: 50rpx;
  1303. height: 48rpx;
  1304. line-height: 46rpx;
  1305. text-align: center;
  1306. width: 48rpx;
  1307. margin-right: 15rpx;
  1308. color: #666;
  1309. font-size: 30rpx;
  1310. &.right {
  1311. color:#fff;
  1312. background:#36C75A;
  1313. }
  1314. &.wrong {
  1315. color:#fff;
  1316. background:#FF3B30;
  1317. }
  1318. &.checked {
  1319. color:#fff;
  1320. background:#007AFF;
  1321. }
  1322. }
  1323. .submit_checkbox {
  1324. position:fixed;
  1325. left:0;
  1326. right:0;
  1327. bottom:120rpx;
  1328. margin: 20rpx auto;
  1329. width: 526rpx;
  1330. height: 80rpx;
  1331. background: rgba(0, 122, 255, 1);
  1332. color:#fff;
  1333. text-align: center;
  1334. line-height: 80rpx;
  1335. font-size: 30rpx;
  1336. border-radius: 40rpx;
  1337. }
  1338. .titles {
  1339. overflow: hidden;
  1340. margin-bottom: 24rpx;
  1341. }
  1342. .titBox {
  1343. padding: 41rpx 25rpx 24rpx 25rpx;
  1344. }
  1345. .titBox_title {
  1346. padding: 21rpx;
  1347. }
  1348. .tabs {
  1349. margin:10rpx;
  1350. display: flex;
  1351. .tab {
  1352. margin: 0 4rpx;
  1353. padding:10rpx 13rpx;
  1354. text-align: center;
  1355. color: #007aff;
  1356. font-size: 28rpx;
  1357. border-radius: 16rpx;
  1358. background:#fff;
  1359. &.current {
  1360. color:#fff;
  1361. background: #007AFF;
  1362. }
  1363. }
  1364. }
  1365. .ans {
  1366. margin:8rpx 8rpx 8rpx;
  1367. .ans_input {
  1368. border-radius: 16rpx;
  1369. background:#fff;
  1370. .top {
  1371. border-bottom:1rpx solid #EEEEEE;
  1372. padding: 16rpx;
  1373. display: flex;
  1374. align-items: center;
  1375. .icon {
  1376. margin-right:20rpx;
  1377. width: 40rpx;
  1378. height: 38rpx;
  1379. }
  1380. .progress {
  1381. flex:1;
  1382. }
  1383. .submit {
  1384. width: 168rpx;
  1385. height: 48rpx;
  1386. line-height: 48rpx;
  1387. text-align: center;
  1388. color:#fff;
  1389. font-size: 30rpx;
  1390. background: #007AFF;
  1391. border-radius: 24rpx;
  1392. &.disabled {
  1393. opacity: 0.6;
  1394. }
  1395. }
  1396. }
  1397. .textarea {
  1398. textarea {
  1399. width:100%;
  1400. height:287rpx;
  1401. padding:10rpx;
  1402. }
  1403. }
  1404. .imgs {
  1405. overflow: hidden;
  1406. display: flex;
  1407. width:100%;
  1408. .img {
  1409. width: 104rpx;
  1410. height: 104rpx;
  1411. border-radius: 8rpx;
  1412. position:relative;
  1413. margin:20rpx;
  1414. text {
  1415. position:absolute;
  1416. right:-15rpx;
  1417. top:-15rpx;
  1418. width:30rpx;
  1419. height:30rpx;
  1420. text-align: center;
  1421. line-height: 30rpx;
  1422. color:#fff;
  1423. background:#FF3B30;
  1424. border-radius:50%;
  1425. }
  1426. image {
  1427. width:100%;
  1428. height:100%;
  1429. }
  1430. }
  1431. }
  1432. }
  1433. .ans_submit {
  1434. padding:16rpx;
  1435. border-radius: 16rpx;
  1436. background:#fff;
  1437. .imgs {
  1438. overflow: hidden;
  1439. display: flex;
  1440. width:100%;
  1441. .img {
  1442. width: 104rpx;
  1443. height: 104rpx;
  1444. border-radius: 8rpx;
  1445. position:relative;
  1446. margin:20rpx;
  1447. image {
  1448. width:100%;
  1449. height:100%;
  1450. }
  1451. }
  1452. }
  1453. }
  1454. }
  1455. .leftLetters {
  1456. display: flex;
  1457. align-items: center;
  1458. width: 220rpx;
  1459. .btnType {
  1460. padding: 5rpx 10rpx;
  1461. border: 1rpx solid #007aff;
  1462. border-radius: 10rpx;
  1463. background-color: rgba(0, 122, 255, 0.1);
  1464. font-size: 28rpx;
  1465. color: #007aff;
  1466. margin-right: 15rpx;
  1467. }
  1468. }
  1469. .firstLetter {
  1470. display: flex;
  1471. justify-content: space-between;
  1472. align-items: center;
  1473. margin-bottom: 30rpx;
  1474. }
  1475. .popupView {
  1476. height: 100%;
  1477. padding-bottom: 100rpx;
  1478. .popupTops {
  1479. height: 77rpx;
  1480. border-bottom: 1rpx solid #eee;
  1481. text-align: center;
  1482. line-height: 77rpx;
  1483. font-size: 24rpx;
  1484. color: #999;
  1485. position: relative;
  1486. .topIcon {
  1487. position: absolute;
  1488. top: 10rpx;
  1489. left: 50%;
  1490. transform: translateX(-50%);
  1491. width: 80rpx;
  1492. height: 8rpx;
  1493. background-color: #999;
  1494. border-radius: 4rpx;
  1495. }
  1496. }
  1497. .popupContent {
  1498. }
  1499. }
  1500. .pageContent {
  1501. position:relative;
  1502. background-color: #eaeef1;
  1503. height: 100%;
  1504. overflow-y: scroll;
  1505. padding-top: 8rpx;
  1506. padding-bottom: 100rpx;
  1507. }
  1508. .pad_8 {
  1509. background-color: #fff;
  1510. margin: 0rpx 8rpx 8rpx;
  1511. border-radius: 16rpx;
  1512. &.no-margin {
  1513. margin-top:-16rpx;
  1514. border-radius: 0 0 16rpx 16rpx;
  1515. }
  1516. }
  1517. .answer {
  1518. height: 80rpx;
  1519. line-height: 80rpx;
  1520. padding: 0rpx 24rpx;
  1521. display: flex;
  1522. align-items: center;
  1523. justify-content: space-between;
  1524. color: #666;
  1525. font-size: 30rpx;
  1526. }
  1527. .footer_btn {
  1528. background-color: #fff;
  1529. z-index: 10078;
  1530. position: fixed;
  1531. bottom: 0rpx;
  1532. display: flex;
  1533. align-items: center;
  1534. justify-content: space-between;
  1535. width: 100%;
  1536. height: 98rpx;
  1537. padding: 0rpx 38rpx;
  1538. border-top: 1rpx solid #eee;
  1539. .flex_center {
  1540. flex:1;
  1541. display: flex;
  1542. justify-content: center;
  1543. align-items: center;
  1544. flex-direction: column;
  1545. margin:0 200rpx;
  1546. font-size: 24rpx;
  1547. color: #999999;
  1548. .up-icon {
  1549. margin-bottom:18rpx;
  1550. width:100%;
  1551. display: flex;
  1552. justify-content: center;
  1553. image {
  1554. width:58rpx;
  1555. height:21rpx;
  1556. }
  1557. }
  1558. }
  1559. .collect {
  1560. visibility: hidden;
  1561. width:100rpx;
  1562. &.show {
  1563. visibility: visible;
  1564. }
  1565. >view {
  1566. display: flex;
  1567. flex-direction: column;
  1568. align-items: center;
  1569. justify-content: center;
  1570. image {
  1571. width:32rpx;
  1572. height:32rpx;
  1573. margin-bottom:6rpx;
  1574. }
  1575. view {
  1576. font-size: 24rpx;
  1577. color: #999999;
  1578. }
  1579. }
  1580. }
  1581. }
  1582. .boxSty {
  1583. padding: 44rpx 41rpx 0rpx;
  1584. }
  1585. .liListSty {
  1586. border:1rpx solid #EEEEEE;
  1587. width: 88rpx;
  1588. height: 88rpx;
  1589. border-radius: 32rpx;
  1590. text-align: center;
  1591. line-height: 88rpx;
  1592. color: #333;
  1593. font-size: 32rpx;
  1594. float: left;
  1595. margin: 20rpx 23rpx;
  1596. &.isRight {
  1597. border:1rpx solid #EEEEEE;
  1598. color:#fff;
  1599. background: #36C75A;
  1600. }
  1601. &.isWrong {
  1602. border:1rpx solid #EEEEEE;
  1603. color:#fff;
  1604. background: #FF3B30;
  1605. }
  1606. }
  1607. .answerInfos {
  1608. padding: 25rpx 25rpx 25rpx 23rpx;
  1609. }
  1610. .answerTitle {
  1611. margin-bottom: 28rpx;
  1612. color: #666;
  1613. font-size: 30rpx;
  1614. }
  1615. .answerContent {
  1616. font-size: 30rpx;
  1617. color: #666;
  1618. }
  1619. .textChild {
  1620. display: inline-block;
  1621. vertical-align: middle;
  1622. }
  1623. .dialog {
  1624. position: fixed;
  1625. left:0;
  1626. top:0;
  1627. width:100%;
  1628. height:100%;
  1629. background-color: rgba(0,0,0,0.8);
  1630. display: flex;
  1631. flex-direction: column;
  1632. align-items: center;
  1633. justify-content: center;
  1634. z-index: 20000;
  1635. .pointer {
  1636. width:338rpx;
  1637. height:240rpx;
  1638. }
  1639. .text {
  1640. font-size: 32rpx;
  1641. color: #FFFFFF;
  1642. text-align: center;
  1643. }
  1644. .btn {
  1645. width: 242rpx;
  1646. height: 82rpx;
  1647. border: 2rpx solid #FFFFFF;
  1648. border-radius: 16rpx;
  1649. text-align: center;
  1650. line-height: 82rpx;
  1651. margin:41rpx auto;
  1652. color:#fff;
  1653. font-size: 32rpx;
  1654. }
  1655. }
  1656. </style>