questionBank.vue 44 KB

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