questionBankExplainDetail.vue 45 KB

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