questionBankExplainDetail.vue 46 KB

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