questionBank.vue 44 KB

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