questionBank.vue 44 KB

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