questionBankExplainDetail.vue 45 KB

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