questionBank.vue 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532
  1. <template>
  2. <view class="questionBank">
  3. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" ref="navbar" :statusBar="true" title="试卷"></uni-nav-bar>
  4. <swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
  5. <swiper-item v-for="(bank, bankIndex) in questionList" :key="bankIndex">
  6. <view class="pageContent">
  7. <view class="pad_8 titBox">
  8. <view class="firstLetter">
  9. <view class="leftLetters">
  10. <view class="btnType">
  11. <text v-if="bank.type == 1">单选</text>
  12. <text v-if="bank.type == 2">多选</text>
  13. <text v-if="bank.type == 3">判断</text>
  14. <text v-if="bank.type == 4">案例</text>
  15. <text v-if="bank.type == 5">简答</text>
  16. </view>
  17. <text>{{ bankIndex + 1 }}/{{ questionList.length }}</text>
  18. </view>
  19. <view style="color: #666;font-size: 28rpx;">{{ countdown(lastTime) }}</view>
  20. </view>
  21. <view class="titles"><rich-text :nodes="bank.content"></rich-text></view>
  22. </view>
  23. <template v-if="bank.type == 1">
  24. <view class="pad_8 titBox no-margin">
  25. <view v-if="!bank.ques">
  26. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="radioSelect(item.optionsId, bankIndex)">
  27. <view class="activeTI">{{ ast[index] }}</view>
  28. <view class="flex_auto">{{ item.content }}</view>
  29. </view>
  30. </view>
  31. <view v-if="bank.ques">
  32. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  33. <text
  34. :class="{ right: item.optionsId == bank.ques || item.optionsId == bank.ans, wrong: item.optionsId == bank.ques && bank.ques != bank.ans }"
  35. class="activeTI"
  36. >
  37. {{ ast[index] }}
  38. </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>我的答案:{{ ast[bank.ques - 1] }}</view>
  47. </view>
  48. <view class="pad_8 answerInfos">
  49. <view class="answerTitle">答案解析</view>
  50. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  51. </view>
  52. </view>
  53. </template>
  54. <template v-if="bank.type == 2">
  55. <view class="pad_8 titBox no-margin">
  56. <view v-if="!bank.ques">
  57. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="checkboxSelect(item.optionsId, bankIndex, index)">
  58. <view :class="{ checked: item.checked }" class="activeTI">{{ ast[index] }}</view>
  59. <view class="flex_auto">{{ item.content }}</view>
  60. </view>
  61. </view>
  62. <view v-if="bank.ques">
  63. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  64. <text
  65. :class="{
  66. right: bank.ques.indexOf(item.optionsId) != -1 || bank.ans.indexOf(item.optionsId) != -1,
  67. wrong: bank.ques.indexOf(item.optionsId) != -1 && bank.ans.indexOf(item.optionsId) == -1
  68. }"
  69. class="activeTI"
  70. >
  71. {{ ast[index] }}
  72. </text>
  73. <view class="flex_auto">{{ item.content }}</view>
  74. </view>
  75. </view>
  76. <view v-if="!bank.ques" class="submit_checkbox" :class="{disabled:!isCheckboxChecked(bank.jsonStr)}" @click="checkboxSubmit(bankIndex)">确认答案</view>
  77. </view>
  78. <view v-if="bank.ques">
  79. <view class="pad_8 answer">
  80. <view>
  81. 正确答案:
  82. <text v-for="(ansItem,ansIndex) in bank.ans" :key="ansIndex">{{ ast[ansItem - 1] }}</text>
  83. </view>
  84. <view>
  85. 我的答案:
  86. <text v-for="(quesItem,quesIndex) in bank.ques" :key="quesIndex">{{ ast[quesItem - 1] }}</text>
  87. </view>
  88. </view>
  89. <view class="pad_8 answerInfos">
  90. <view class="answerTitle">答案解析</view>
  91. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  92. </view>
  93. </view>
  94. </template>
  95. <template v-if="bank.type == 3">
  96. <view class="pad_8 titBox no-margin">
  97. <view v-if="!bank.ques">
  98. <view v-for="(item, index) in judge" :key="index" class="lisSty" @click="judgeSelect(index, bankIndex)">
  99. <view class="activeTI">{{ ast[index] }}</view>
  100. <view class="flex_auto">
  101. {{ item }}
  102. </view>
  103. </view>
  104. </view>
  105. <view v-if="bank.ques">
  106. <view v-for="(item, index) in judge" :key="index" class="lisSty">
  107. <text :class="{ right: index == bank.ques || index == bank.ans, wrong: index == bank.ques && bank.ques != bank.ans }" class="activeTI">
  108. {{ ast[index] }}
  109. </text>
  110. <view class="flex_auto">
  111. {{ item }}
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. <view v-if="bank.ques">
  117. <view class="pad_8 answer">
  118. <view>正确答案:{{ ast[bank.ans] }}</view>
  119. <view>我的答案:{{ ast[bank.ques] }}</view>
  120. </view>
  121. <view class="pad_8 answerInfos">
  122. <view class="answerTitle">答案解析</view>
  123. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  124. </view>
  125. </view>
  126. </template>
  127. <!-- 简答题 -->
  128. <template v-if="bank.type == 5">
  129. <view class="pad_8 titBox">
  130. <view class="ans">
  131. <view class="ans_input" v-if="!bank.ques || (!bank.ques.imageList.length && !bank.ques.text)">
  132. <view class="top flex">
  133. <image :data-index="bankIndex" class="icon" @click="chooseImg(bankIndex)" src="/static/camera.png" mode=""></image>
  134. <view class="progress">{{bank.ansText.imageList.length || '0'}}/4</view>
  135. <view class="submit" :class="{disabled:!bank.ansText.text && hasImgs(bank)}" @click="submitAns(bankIndex)">确认答案</view>
  136. </view>
  137. <view class="textarea"><textarea v-model="bank.ansText.text" placeholder="在此输入答案"></textarea></view>
  138. <view class="imgs">
  139. <view class="img" v-for="(img, imgIndex) in bank.ansText.imageList" :key="imgIndex">
  140. <text @click="deleteImg(imgIndex, bankIndex)">x</text>
  141. <image :src="$method.splitImgHost(img, true)"></image>
  142. </view>
  143. </view>
  144. </view>
  145. <view class="ans_submit answerInfos" v-if="bank.ques.imageList.length || bank.ques.text">
  146. <view class="answerTitle">我的答案:</view>
  147. {{ bank.ques.text }}
  148. <view class="imgs"><image class="img" :key="quesIndex" v-for="(ques,quesIndex) in bank.ques.imageList" :src="$method.splitImgHost(ques, true)"></image></view>
  149. </view>
  150. </view>
  151. </view>
  152. <view v-if="bank.ques.imageList.length || bank.ques.text">
  153. <view class="pad_8 answerInfos">
  154. <view class="answerTitle">答案解析:</view>
  155. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  156. </view>
  157. </view>
  158. </template>
  159. <!-- 案例题 -->
  160. <template v-if="bank.type == 4">
  161. <view class="tabs">
  162. <view
  163. class="tab"
  164. :class="{ current: tabIndex == bank.current }"
  165. :key="tabIndex"
  166. v-for="(tab, tabIndex) in bank.jsonStr"
  167. @click="tabSelect(tabIndex, bankIndex)"
  168. >
  169. 问题{{ tabIndex+1 }}
  170. </view>
  171. </view>
  172. <view v-for="(ansItem, ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
  173. <template v-if="ansItem.type == 1">
  174. <view class="pad_8 titBox">
  175. <view class="leftLetters">
  176. <view class="btnType">
  177. <text>单选</text>
  178. </view>
  179. </view>
  180. <view class="titles"><rich-text :nodes="ansItem.content"></rich-text></view>
  181. <view v-if="!bank.ques[ansIndex]">
  182. <view
  183. v-for="(option, childIndex) in ansItem.optionsList"
  184. :key="childIndex"
  185. class="lisSty"
  186. @click="radioSelectChild(option.optionsId, ansIndex, bankIndex)"
  187. >
  188. <view class="activeTI">{{ ast[childIndex] }}</view>
  189. <view class="flex_auto">
  190. <rich-text class="textChild" :nodes="option.content"></rich-text>
  191. </view>
  192. </view>
  193. </view>
  194. <view v-if="bank.ques[ansIndex]">
  195. <view v-for="(option, childIndex) in ansItem.optionsList" :key="childIndex" class="lisSty">
  196. <text
  197. :class="{
  198. right: option.optionsId == bank.ques[ansIndex] || option.optionsId == bank.ans[ansIndex],
  199. wrong: option.optionsId == bank.ques[ansIndex] && bank.ques[ansIndex] != bank.ans[ansIndex]
  200. }"
  201. class="activeTI"
  202. >
  203. {{ ast[childIndex] }}
  204. </text>
  205. <view class="flex_auto">
  206. <rich-text :nodes="option.content"></rich-text>
  207. </view>
  208. </view>
  209. </view>
  210. </view>
  211. <view v-if="bank.ques[ansIndex]">
  212. <view class="pad_8 answer">
  213. <view>正确答案:{{ ast[bank.ans[ansIndex] - 1] }}</view>
  214. <view>我的答案:{{ ast[bank.ques[ansIndex] - 1] }}</view>
  215. </view>
  216. <view class="pad_8 answerInfos">
  217. <view class="answerTitle">答案解析</view>
  218. <view class="answerContent"><rich-text :nodes="option.analysisContent"></rich-text></view>
  219. </view>
  220. </view>
  221. </template>
  222. <template v-if="ansItem.type == 2">
  223. <view class="pad_8 titBox">
  224. <view class="leftLetters">
  225. <view class="btnType">
  226. <text>多选</text>
  227. </view>
  228. </view>
  229. <view class="titles"><rich-text :nodes="ansItem.content"></rich-text></view>
  230. <view v-if="!bank.ques[ansIndex]">
  231. <view
  232. v-for="(option, childindex) in ansItem.optionsList"
  233. :key="childindex"
  234. class="lisSty"
  235. @click="checkboxSelectChild(bankIndex, ansIndex, childindex)"
  236. >
  237. <view :class="{ checked: option.checked }" class="activeTI">{{ ast[childindex] }}</view>
  238. <view class="flex_auto">
  239. <rich-text :nodes="option.content"></rich-text>
  240. </view>
  241. </view>
  242. </view>
  243. <view v-if="!bank.ques[ansIndex]" class="submit_checkbox" :class="{disabled:!isCheckboxChecked(ansItem.optionsList)}" @click="checkboxSubmitChild(bankIndex, ansIndex)">确认答案</view>
  244. <view v-if="bank.ques && bank.ques[ansIndex]">
  245. <view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty">
  246. <text :class="{ right: right(bankIndex, ansIndex, option), wrong: wrong(bankIndex, ansIndex, option) }" class="activeTI">
  247. {{ ast[childindex] }}
  248. </text>
  249. <view class="flex_auto">
  250. <rich-text :nodes="option.content"></rich-text>
  251. </view>
  252. </view>
  253. </view>
  254. </view>
  255. <view v-if="bank.ques[ansIndex]">
  256. <view class="pad_8 answer">
  257. <view>
  258. 正确答案:
  259. <text :key="ansItemIndex1" v-for="(ansItem1,ansItemIndex1) in bank.ans[ansIndex]">{{ ast[ansItem1 - 1] }}</text>
  260. </view>
  261. <view>
  262. 我的答案:
  263. <text :key="quesItemIndex" v-for="(quesItem,quesItemIndex) in bank.ques[ansIndex]">{{ ast[quesItem - 1] }}</text>
  264. </view>
  265. </view>
  266. <view class="pad_8 answerInfos">
  267. <view class="answerTitle">答案解析</view>
  268. <view class="answerContent"><rich-text :nodes="ansItem.analysisContent"></rich-text></view>
  269. </view>
  270. </view>
  271. </template>
  272. <template v-if="ansItem.type == 3">
  273. <view class="pad_8 titBox">
  274. <view class="leftLetters">
  275. <view class="btnType">
  276. <text>判断</text>
  277. </view>
  278. </view>
  279. <view class="titles"><rich-text :nodes="ansItem.content"></rich-text></view>
  280. <view v-if="!bank.ques[ansIndex]">
  281. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty" @click="judgeSelectChild(ansIndex, childindex, bankIndex)">
  282. <view class="activeTI">{{ ast[childindex] }}</view>
  283. <view class="flex_auto">
  284. {{ option }}
  285. </view>
  286. </view>
  287. </view>
  288. <view v-if="bank.ques[ansIndex]">
  289. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty">
  290. <text
  291. :class="{
  292. right: childindex == bank.ques[ansIndex] || childindex == bank.ans[ansIndex],
  293. wrong: childindex == bank.ques[ansIndex] && bank.ques[ansIndex] != bank.ans[ansIndex]
  294. }"
  295. class="activeTI"
  296. >
  297. {{ ast[childindex] }}
  298. </text>
  299. <view class="flex_auto">
  300. {{ option }}
  301. </view>
  302. </view>
  303. </view>
  304. </view>
  305. <view v-if="bank.ques[ansIndex]">
  306. <view class="pad_8 answer">
  307. <view>正确答案:{{ ast[bank.ans[ansIndex]] }}</view>
  308. <view>我的答案:{{ ast[bank.ques[ansIndex]] }}</view>
  309. </view>
  310. <view class="pad_8 answerInfos">
  311. <view class="answerTitle">答案解析</view>
  312. <view class="answerContent"><rich-text :nodes="ansItem.analysisContent"></rich-text></view>
  313. </view>
  314. </view>
  315. </template>
  316. <!-- 简答题 -->
  317. <template v-if="ansItem.type == 5">
  318. <view class="pad_8 titBox_title">
  319. <view class="leftLetters">
  320. <view class="btnType">
  321. <text>简答</text>
  322. </view>
  323. </view>
  324. <view><rich-text :nodes="ansItem.content"></rich-text></view>
  325. </view>
  326. <view class="pad_8 titBox_title">
  327. <view class="ans">
  328. <view class="ans_input" v-if="!bank.ques[ansIndex] || (!bank.ques[ansIndex].text && !bank.ques[ansIndex].imageList.length)">
  329. <view class="top flex">
  330. <image class="icon" @click="chooseImgChild(bankIndex, ansIndex)" src="/static/camera.png" mode=""></image>
  331. <view class="progress">{{ansItem.ansText.imageList.length || '0'}}/4</view>
  332. <view class="submit" :class="{disabled:!ansItem.ansText.text && hasImgs(ansItem)}" @click="submitAnsChild(bankIndex, ansIndex)">确认答案</view>
  333. </view>
  334. <view class="textarea"><textarea v-model="ansItem.ansText.text" placeholder="在此输入答案"></textarea></view>
  335. <view class="imgs">
  336. <view class="img" v-for="(img, imgIndex) in ansItem.ansText.imageList" :key="imgIndex">
  337. <text @click="deleteImgChild(imgIndex, bankIndex, ansIndex)">x</text>
  338. <image :src="$method.splitImgHost(img, true)"></image>
  339. </view>
  340. </view>
  341. </view>
  342. <view class="ans_submit answerInfos" v-if="bank.ques[ansIndex] && (bank.ques[ansIndex].imageList.length || bank.ques[ansIndex].text)">
  343. <view class="answerTitle">我的答案</view>
  344. {{ bank.ques[ansIndex].text || ''}}
  345. <view class="imgs">
  346. <image class="img" v-for="(ques,quesIndex) in bank.ques[ansIndex].imageList" :key="quesIndex" :src="$method.splitImgHost(ques, true)"></image>
  347. </view>
  348. </view>
  349. </view>
  350. </view>
  351. <view v-if="bank.ques[ansIndex].imageList.length || bank.ques[ansIndex].text">
  352. <view class="pad_8 answerInfos">
  353. <view class="answerTitle">答案解析</view>
  354. <view class="answerContent"><rich-text :nodes="ansItem.analysisContent"></rich-text></view>
  355. </view>
  356. </view>
  357. </template>
  358. </view>
  359. </template>
  360. <view class="footer_btn">
  361. <view class="collect" :class="{ show: goodsId && !isFromVideo ? true : false }" @click="collect(collectList[bankIndex], bankIndex)">
  362. <view v-if="collectList[bankIndex]">
  363. <image src="/static/icon/collected.png" mode=""></image>
  364. <view>取消收藏</view>
  365. </view>
  366. <view v-if="!collectList[bankIndex]">
  367. <image src="/static/icon/collect.png" mode=""></image>
  368. <view>收藏</view>
  369. </view>
  370. </view>
  371. <view class="flex_center" @click="openFooterTab">
  372. <view class="up-icon">
  373. <image src="/static/up.png"></image>
  374. </view>
  375. 答题卡
  376. </view>
  377. <view class="collect show" @click="pdsubmit">
  378. <view>
  379. <image src="/static/jj.png" mode=""></image>
  380. <view>交卷</view>
  381. </view>
  382. </view>
  383. </view>
  384. </view>
  385. </swiper-item>
  386. </swiper>
  387. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  388. <view class="popupView">
  389. <view class="popupTops">
  390. <view class="topIcon"></view>
  391. 点击编号即可跳转至对应题目
  392. </view>
  393. <view class="popupContent">
  394. <scroll-view scroll-y="true" style="height: 506rpx;">
  395. <view class="boxSty">
  396. <view
  397. v-for="(item, index) in questionList"
  398. :key="index"
  399. @click="changeIndex(index)"
  400. :class="{ isRight: isRight(item, index), isWrong: isWrong(item, index) }"
  401. class="liListSty"
  402. >
  403. {{ index + 1 }}
  404. </view>
  405. </view>
  406. </scroll-view>
  407. </view>
  408. </view>
  409. </u-popup>
  410. <view class="dialog" v-if="showDialog">
  411. <image class="pointer" src="/static/pointer.png" mode=""></image>
  412. <view class="text">左右滑动切换上下题</view>
  413. <view class="btn" @click="showDialog = false">我知道了</view>
  414. </view>
  415. <view class="dialog-arrow" v-if="showArrow">
  416. <image class="pointer" src="/static/arrow-left.png" mode=""></image>
  417. <view class="text">您当前正在测试, 若想退出请点击左上角返回按钮。</view>
  418. <view class="btn" @click="showArrow = false">我知道了</view>
  419. </view>
  420. <view class="dialog_wrap" v-if="testOver">
  421. <view class="bg"></view>
  422. <view class="dialog">
  423. <view class="title">温馨提示</view>
  424. <view class="content">
  425. <view>您已完成所有题目,</view>
  426. <view>快去交卷吧!</view>
  427. </view>
  428. <view class="btns">
  429. <view class="btn" @click="noSubmit()">暂不交卷</view>
  430. <view class="btn active" @click="submitNow()">立即交卷</view>
  431. </view>
  432. </view>
  433. </view>
  434. <view class="dialog_wrap" v-if="isLastCount">
  435. <view class="bg"></view>
  436. <view class="dialog">
  437. <view class="title">温馨提示</view>
  438. <view class="content">
  439. <view>您当前正在测试,还剩{{ lastCount }}道题未完成,离开视为交卷</view>
  440. </view>
  441. <view class="btns">
  442. <view class="btn" @click="noLeave()">暂不离开</view>
  443. <view class="btn active" @click="leaveNow()">继续离开</view>
  444. </view>
  445. </view>
  446. </view>
  447. <u-popup v-model="showpopups" mode="center" border-radius="24" height="439rpx" width="640rpx" :mask-close-able="false">
  448. <view class="popboxs">
  449. <view class="classTops">温馨提示</view>
  450. <view class="textStys">
  451. {{
  452. cgType === 7
  453. ? '您还未交卷,确定结束做题吗?'
  454. : cgType === 8
  455. ? `您还有${lastCount}道题未作答, 现在继续作答,还是下次继续?`
  456. : cgType === 6
  457. ? `您还有${lastCount}道题未作答, 您确定要交卷吗?`
  458. : cgType == 9
  459. ? `您已完成所有题目,快去交卷吧!`
  460. : ''
  461. }}
  462. </view>
  463. <view class="classFootsty" v-if="cgType === 6">
  464. <view class="btnsty btns1" @click="submit">立即交卷</view>
  465. <view class="btnsty btns2" @click="showpopups = false">继续做题</view>
  466. </view>
  467. <view class="classFootsty" v-if="cgType === 7">
  468. <view class="btnsty btns1" @click="backPages">下次继续</view>
  469. <view class="btnsty btns2" @click="submit">结束做题</view>
  470. </view>
  471. <view class="classFootsty" v-if="cgType === 8">
  472. <view class="btnsty btns1" @click="backPages()">下次继续</view>
  473. <view class="btnsty btns2" @click="showpopups = false">继续作答</view>
  474. </view>
  475. <view class="classFootsty" v-if="cgType === 9">
  476. <view class="btnsty btns1" @click="showpopups = false">暂不交卷</view>
  477. <view class="btnsty btns2" @click="submit">立即交卷</view>
  478. </view>
  479. </view>
  480. </u-popup>
  481. </view>
  482. </template>
  483. <script>
  484. export default {
  485. data() {
  486. return {
  487. showpopups: false,
  488. id: '',
  489. current: 0,
  490. questionList: [],
  491. ast: ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
  492. judge: ['错误', '正确'],
  493. ans: [],
  494. ques: [],
  495. show: false,
  496. showDialog: false,
  497. bankList: [],
  498. collectList: [],
  499. goodsId: '',
  500. recordId: '',
  501. isSubmit: false,
  502. lastTime: 0, //剩余考试时长
  503. allTimes: 0, //总考试时长
  504. timer: null,
  505. wrongList: [],
  506. bankType: 0, //试卷类型
  507. needBack: false, //是否是考试
  508. testOver: false,
  509. isLastCount: false, //是否有未答题目
  510. lastCount: 0, //剩余没有回答的题目数
  511. chapterId: 0,
  512. moduleId: 0,
  513. showArrow:false, //退出提示
  514. isFromVideo:'',
  515. gradeId:'',
  516. cgType: 0 //对应设计稿弹窗编码
  517. };
  518. },
  519. async onLoad(option) {
  520. this.current = +option.current || 0
  521. this.id = option.id;
  522. this.goodsId = option.goodsid;
  523. this.chapterId = option.chapterId || 0;
  524. this.moduleId = option.moduleId || 0;
  525. this.isFromVideo = option.isFromVideo||'';
  526. this.gradeId = option.gradeId || '';
  527. let isBack = option.isback;
  528. let showDialog = uni.getStorageSync('showDialog');
  529. if(showDialog) {
  530. this.showDialog = false;
  531. } else {
  532. this.showDialog = true;
  533. uni.setStorageSync('showDialog','1');
  534. }
  535. //考试被迫返回
  536. if (isBack) {
  537. let app = getApp();
  538. let globalData = app.globalData;
  539. for (var k in globalData.bankData) {
  540. this[k] = globalData.bankData[k];
  541. }
  542. this.showArrow = true;
  543. this.timer = setInterval(() => {
  544. if (this.lastTime <= 0) {
  545. clearInterval(this.timer);
  546. uni.showToast({
  547. icon:'none',
  548. mask:true,
  549. title:'考试时间已到,系统将自动交卷',
  550. duration:10000
  551. })
  552. this.submit();
  553. return;
  554. }
  555. this.lastTime--;
  556. }, 1000);
  557. } else {
  558. //进入页面
  559. await this.bankExam();
  560. this.goodsQuestionList();
  561. }
  562. },
  563. onUnload() {
  564. if (this.isSubmit) {
  565. clearInterval(this.timer)
  566. return;
  567. }
  568. //考试试卷 阻止ios手势返回,自动跳回答题页
  569. if (this.needBack) {
  570. let app = getApp();
  571. app.globalData.bankData = this.$data;
  572. clearInterval(this.timer);
  573. uni.navigateTo({
  574. url: '/pages2/bank/questionBank?id=' + this.id + '&goodsid=' + this.goodsId + '&isback=true'
  575. });
  576. } else {
  577. //点击返回按钮确认允许退出,记录答题记录
  578. clearInterval(this.timer)
  579. this.examRecordEdit();
  580. }
  581. },
  582. methods: {
  583. /**
  584. * 是否有上传图片
  585. */
  586. hasImgs(bank) {
  587. return bank.ansText.imageList.length == 0;
  588. },
  589. /**
  590. * 获取试卷类型2考试,1练习
  591. */
  592. bankExam() {
  593. return new Promise(resolve => {
  594. this.$api.bankExam(this.id).then(res => {
  595. this.bankType = res.data.data.doType;
  596. if (this.bankType == 2) {
  597. this.needBack = true;
  598. }
  599. resolve()
  600. });
  601. })
  602. },
  603. /**
  604. * 点击后退按钮
  605. */
  606. clickLeft() {
  607. if (this.bankType == 1) {
  608. let ansCount = this.questionOverNum(true); //已答题数
  609. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  610. //所有题目答完
  611. if (this.lastCount == 0) {
  612. // this.testOver = true;
  613. this.cgType = 7;
  614. //未答完
  615. } else {
  616. this.cgType = 8;
  617. // this.isLastCount = true;
  618. }
  619. this.showpopups = true;
  620. } else if (this.bankType == 2) {
  621. let ansCount = this.questionOverNum(true); //已答题数
  622. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  623. //所有题目答完
  624. if (this.lastCount == 0) {
  625. this.testOver = true;
  626. //未答完
  627. } else {
  628. this.isLastCount = true;
  629. }
  630. }
  631. },
  632. /**
  633. * 返回上一页
  634. */
  635. backPages() {
  636. this.needBack = false;
  637. uni.navigateBack({
  638. delta: 1
  639. });
  640. },
  641. /**
  642. * 获取已经回答的题目数
  643. * hasSpecail (是否包含简答和案例)
  644. */
  645. questionOverNum(hasSpecail) {
  646. let count = 0;
  647. this.questionList.forEach(item => {
  648. if (item.type == 1 || item.type == 2 || item.type == 3) {
  649. if (item.ques) {
  650. count++;
  651. }
  652. } else if (item.type == 4) {
  653. //案例题
  654. if(hasSpecail) {
  655. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  656. if (jsonItem.type == 1 || jsonItem.type == 2 || jsonItem.type == 3) {
  657. if (item.ques[indexs]) {
  658. return true;
  659. } else {
  660. return false;
  661. }
  662. } else if (jsonItem.type == 5) {
  663. if (item.ques[indexs] && (item.ques[indexs].text || item.ques[indexs].imageList.length)) {
  664. console.log('chil')
  665. return true;
  666. } else {
  667. return false;
  668. }
  669. }
  670. });
  671. if (isOver) {
  672. count++;
  673. console.log(item, 444);
  674. }
  675. }
  676. } else if (item.type == 5) {
  677. //简答题
  678. if(hasSpecail) {
  679. if (item.ques && (item.ques.text || item.ques.imageList.length)) {
  680. console.log(5,item)
  681. count++;
  682. }
  683. }
  684. }
  685. });
  686. return count;
  687. },
  688. /**
  689. * 是否做完所有题目
  690. */
  691. isDoOver() {
  692. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  693. if(this.questionList.length == questionOverNum) { //全部做完弹窗
  694. this.cgType = 9;
  695. this.showpopups = true;
  696. }
  697. },
  698. /**
  699. * 暂不交卷
  700. */
  701. noSubmit() {
  702. //设为允许退出页面
  703. this.needBack = false;
  704. uni.navigateBack({
  705. delta: 1
  706. });
  707. },
  708. /**
  709. * 不离开
  710. */
  711. noLeave() {
  712. this.isLastCount = false;
  713. },
  714. /**
  715. * 立即离开并交卷
  716. */
  717. leaveNow() {
  718. this.needBack = false;
  719. this.isSubmit = true;
  720. uni.navigateBack({
  721. delta: 1
  722. });
  723. let score = 0; //计算总分
  724. let reportStatus = 0;
  725. let number = 0; //做对的题目数量
  726. let doQuestionNum = 0; //做过的题目数量
  727. let allScore = 0; //总分
  728. let passScore = 0;
  729. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  730. let doQuestionIds = []; //做过的题目id
  731. let rightQuestionIds = []; //做对的题目id
  732. this.questionList.forEach((item, index) => {
  733. // passScore = item.passScore
  734. if (item.type == 1) {
  735. //正确
  736. if (item.ques == item.ans) {
  737. item.scoreResult = item.score;
  738. score += item.score;
  739. number++;
  740. rightQuestionIds.push(item.questionId)
  741. } else { //错误
  742. item.scoreResult = 0;
  743. doWrongQuestionIds.push(item.questionId)
  744. }
  745. allScore += item.score;
  746. if (item.ques) {
  747. doQuestionNum++;
  748. doQuestionIds.push(item.questionId)
  749. }
  750. } else if (item.type == 2) {
  751. let isRight =
  752. item.ans &&
  753. item.ans.every((quesItem, quesIndex) => {
  754. if(item.ques) {
  755. return item.ques[quesIndex] == item.ans[quesIndex];
  756. } else {
  757. return false;
  758. }
  759. });
  760. if (isRight) {
  761. score += item.score;
  762. number++;
  763. item.scoreResult = item.score;
  764. rightQuestionIds.push(item.questionId)
  765. } else {
  766. let checkboxScore = item.score; //获取单题总分数
  767. item.ques && item.ques.forEach((ques,quesIndex) => {
  768. //选错一个全扣
  769. if(item.ques) {
  770. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  771. checkboxScore = 0;
  772. }
  773. } else {
  774. checkboxScore = 0;
  775. }
  776. })
  777. console.log(checkboxScore)
  778. //没选错
  779. if(checkboxScore) {
  780. item.ans.forEach((ans,quesIndex) => {
  781. //漏选只能得部分分数
  782. if(item.ques) {
  783. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  784. checkboxScore = item.partScore;
  785. }
  786. } else {
  787. checkboxScore = 0;
  788. }
  789. })
  790. }
  791. if(checkboxScore <= 0) { //0分
  792. item.scoreResult = 0;
  793. doWrongQuestionIds.push(item.questionId)
  794. } else { //部分分
  795. number++;
  796. item.scoreResult = checkboxScore;
  797. score += checkboxScore;
  798. rightQuestionIds.push(item.questionId)
  799. }
  800. }
  801. allScore += item.score;
  802. if (item.ques && item.ques.length) {
  803. doQuestionNum++;
  804. doQuestionIds.push(item.questionId)
  805. }
  806. } else if (item.type == 3) {
  807. if (item.ques == item.ans) {
  808. item.scoreResult = item.score;
  809. score += item.score;
  810. number++;
  811. rightQuestionIds.push(item.questionId)
  812. } else {
  813. item.scoreResult = 0;
  814. doWrongQuestionIds.push(item.questionId)
  815. }
  816. allScore += item.score;
  817. if (item.ques) {
  818. doQuestionNum++;
  819. doQuestionIds.push(item.questionId)
  820. }
  821. } else if (item.type == 4) {
  822. allScore += item.score;
  823. if (item.ques && item.ques.length) {
  824. doQuestionNum++;
  825. }
  826. } else if (item.type == 5) {
  827. allScore += item.score;
  828. if (item.ques) {
  829. doQuestionNum++;
  830. }
  831. }
  832. });
  833. //大于60分及格
  834. if(score >= 60) {
  835. reportStatus = 1
  836. } else {
  837. reportStatus = 0
  838. }
  839. //交卷
  840. this.$api
  841. .examRecordEdit({
  842. examId: this.id,
  843. goodsId: this.goodsId,
  844. reportStatus:reportStatus,
  845. recordId: this.recordId,
  846. rightQuestionNum: number,
  847. status: 1,
  848. moduleExamId:this.moduleId || 0,
  849. chapterExamId:this.chapterId || 0,
  850. doQuestionIds:doQuestionIds.join(','),
  851. rightQuestionIds:rightQuestionIds.join(','),
  852. doQuestionNum: doQuestionNum,
  853. performance: score,
  854. totalScore: allScore,
  855. examTime: parseInt(this.allTimes),
  856. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  857. historyExamJson: JSON.stringify(this.questionList)
  858. })
  859. .then(res => {
  860. this.isSubmit = true;
  861. if (res.data.code == 200) {
  862. }
  863. });
  864. //错题集id提交(客观题)
  865. this.$api.examWrongRecord({
  866. moduleExamId:this.moduleId || 0,
  867. chapterExamId:this.chapterId || 0,
  868. examId: this.id,
  869. goodsId: this.goodsId,
  870. questionIds: doWrongQuestionIds,
  871. recordId: this.recordId
  872. }).then(res => {
  873. });
  874. },
  875. /**
  876. * 立即交卷
  877. */
  878. submitNow() {
  879. this.showpopups = false;
  880. this.needBack = false;
  881. this.submit();
  882. },
  883. /**
  884. * 离开页面统计回答正确题数
  885. */
  886. examRecordEdit() {
  887. if (!this.isSubmit) {
  888. let number = 0;
  889. let score = 0;
  890. let doQuestionNum = 0;
  891. this.questionList.forEach((item, index) => {
  892. if (item.type == 1) {
  893. if (item.ques == item.ans) {
  894. score += item.score;
  895. number++;
  896. }
  897. if (item.ques) {
  898. doQuestionNum++;
  899. }
  900. } else if (item.type == 2) {
  901. let isRight =
  902. item.ans &&
  903. item.ans.every((quesItem, quesIndex) => {
  904. if(item.ques) {
  905. return item.ques[quesIndex] == item.ans[quesIndex];
  906. } else {
  907. return false;
  908. }
  909. });
  910. if (isRight) {
  911. score += item.score;
  912. number++;
  913. } else {
  914. let checkboxScore = item.score; //获取单题总分数
  915. item.ques && item.ques.forEach((ques,quesIndex) => {
  916. //选错一个全扣
  917. if(item.ques) {
  918. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  919. checkboxScore = 0;
  920. }
  921. } else {
  922. checkboxScore = 0;
  923. }
  924. })
  925. console.log(checkboxScore)
  926. //没选错
  927. if(checkboxScore) {
  928. item.ans.forEach((ans,quesIndex) => {
  929. //漏选扣一部分
  930. if(item.ques) {
  931. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  932. checkboxScore = item.partScore;
  933. }
  934. } else {
  935. checkboxScore = 0;
  936. }
  937. })
  938. }
  939. if(checkboxScore <= 0) { //0分
  940. } else { //部分分
  941. number++;
  942. score += checkboxScore;
  943. }
  944. }
  945. if (item.ques && item.ques.length) {
  946. doQuestionNum++;
  947. }
  948. } else if (item.type == 3) {
  949. if (item.ques == item.ans) {
  950. score += item.score;
  951. number++;
  952. }
  953. if (item.ques) {
  954. doQuestionNum++;
  955. }
  956. } else if (item == 4) {
  957. if (item.ques.length) {
  958. doQuestionNum++;
  959. }
  960. } else if (item.type == 5) {
  961. if (item.ques) {
  962. doQuestionNum++;
  963. }
  964. }
  965. });
  966. this.$api
  967. .examRecordEdit({
  968. examId: this.id,
  969. goodsId: this.goodsId,
  970. recordId: this.recordId,
  971. rightQuestionNum: number,
  972. moduleExamId:this.moduleId || 0,
  973. chapterExamId:this.chapterId || 0,
  974. status: 0,
  975. doQuestionNum: doQuestionNum,
  976. historyExamJson: JSON.stringify(this.questionList)
  977. })
  978. .then(res => {});
  979. }
  980. },
  981. /**
  982. * 记录总题数
  983. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  984. */
  985. examRecord(hasSpecial) {
  986. let questionList = 0;
  987. if(!hasSpecial) {
  988. this.questionList.forEach((item, index) => {
  989. if(item.type == 1 || item.type == 2 || item.type == 3) {
  990. questionList++;
  991. }
  992. })
  993. } else {
  994. questionList = this.questionList.length;
  995. }
  996. this.$api
  997. .examRecord({
  998. chapterExamId: this.chapterId || 0,
  999. moduleExamId: this.moduleId || 0,
  1000. examId: this.id,
  1001. goodsId: this.goodsId,
  1002. totalQuestionNum: questionList
  1003. })
  1004. .then(res => {
  1005. this.recordId = res.data.data;
  1006. //获取recordId 初始化先提交题目 以防突然下次继续做题退出报错
  1007. if(this.bankType == 1) {
  1008. this.examRecordEdit();
  1009. }
  1010. });
  1011. },
  1012. /**
  1013. * @param {Object} second倒计时过滤器
  1014. */
  1015. countdown(second) {
  1016. if (second) {
  1017. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1018. let m = parseInt((second / 60) % 60); // 计算分数
  1019. let s = parseInt(second % 60); // 计算当前秒数
  1020. if (h < 10) h = '0' + h;
  1021. if (m < 10) m = '0' + m;
  1022. if (s < 10) s = '0' + s;
  1023. return h + ':' + m + ':' + s;
  1024. } else {
  1025. return '';
  1026. }
  1027. },
  1028. /**
  1029. * 请求题目列表
  1030. */
  1031. goodsQuestionList() {
  1032. this.$api
  1033. .goodsQuestionList({
  1034. examId: this.id
  1035. })
  1036. .then(res => {
  1037. if (!res.data.data.length) {
  1038. this.hideDialog();
  1039. uni.showModal({
  1040. showCancel: false,
  1041. content: '该试卷暂无题目',
  1042. success: function(k) {
  1043. if (k.confirm) {
  1044. uni.navigateBack();
  1045. }
  1046. }
  1047. });
  1048. return;
  1049. }
  1050. this.allTimes = res.data.data[0].answerTime * 60;
  1051. this.lastTime = res.data.data[0].answerTime && res.data.data[0].answerTime * 60;
  1052. //考试时间到了自动交卷
  1053. if (this.lastTime) {
  1054. this.timer = setInterval(() => {
  1055. if (this.lastTime <= 0) {
  1056. clearInterval(this.timer);
  1057. uni.showToast({
  1058. icon:'none',
  1059. mask:true,
  1060. title:'考试时间已到,系统将自动交卷',
  1061. duration:10000
  1062. })
  1063. this.submit();
  1064. return;
  1065. }
  1066. this.lastTime--;
  1067. }, 1000);
  1068. } else {
  1069. }
  1070. res.data.data.forEach((item, index) => {
  1071. if (typeof item.jsonStr == 'string') {
  1072. item.jsonStr = JSON.parse(item.jsonStr);
  1073. if (item.type == 2) {
  1074. //多选
  1075. item.jsonStr.forEach(str => {
  1076. str.optionsId = '' + str.optionsId;
  1077. });
  1078. let arr = item.answerQuestion.split(',');
  1079. arr.forEach((a, i) => {
  1080. arr[i] = '' + a;
  1081. });
  1082. item.ans = arr;
  1083. return;
  1084. } else if (item.type == 5) {
  1085. //简答题
  1086. item.ansText = {
  1087. text: '',
  1088. imageList: []
  1089. };
  1090. item.ques = {
  1091. text: '',
  1092. imageList: []
  1093. }
  1094. } else if (item.type == 4) {
  1095. //案例题
  1096. console.log(item.jsonStr);
  1097. item.ques = [];
  1098. item.current = 0;
  1099. let ansArr = [];
  1100. item.jsonStr.forEach((json, index) => {
  1101. if (json.type == 1) {
  1102. ansArr[index] = json.answerQuestion;
  1103. } else if (json.type == 2) {
  1104. json.optionsList.forEach(str => {
  1105. str.optionsId = '' + str.optionsId;
  1106. });
  1107. let arr = json.answerQuestion.split(',');
  1108. arr.forEach((a, i) => {
  1109. arr[i] = '' + a;
  1110. });
  1111. ansArr[index] = arr;
  1112. } else if (json.type == 3) {
  1113. ansArr[index] = json.answerQuestion;
  1114. } else if (json.type == 5) {
  1115. ansArr[index] = {
  1116. text: json.answerQuestion,
  1117. imageList: []
  1118. };
  1119. json.ansText = {
  1120. text: '',
  1121. imageList: []
  1122. };
  1123. }
  1124. });
  1125. item.ans = ansArr;
  1126. return;
  1127. }
  1128. item.ans = item.answerQuestion;
  1129. }
  1130. });
  1131. this.questionList = res.data.data;
  1132. this.lastCount = this.questionList.length;
  1133. this.examRecord();
  1134. this.getCollectInfo(this.current);
  1135. });
  1136. },
  1137. /**
  1138. * @param {Object} e单选点击
  1139. */
  1140. radioSelect(optionsId, bindex) {
  1141. if (this.questionList[bindex].ques) return;
  1142. this.$set(this.questionList[bindex], 'ques', optionsId);
  1143. this.isDoOver();
  1144. // 回答错误
  1145. if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
  1146. this.$api
  1147. .examWrongRecord({
  1148. examId: this.id,
  1149. goodsId: this.goodsId,
  1150. moduleExamId:this.moduleId || 0,
  1151. chapterExamId:this.chapterId || 0,
  1152. questionIds: [this.questionList[bindex].questionId],
  1153. recordId: this.recordId
  1154. })
  1155. .then(res => {});
  1156. } else {
  1157. // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  1158. // if(question) {
  1159. // this.$api.wrongRecordDelete({
  1160. // "examId": +this.id,
  1161. // "goodsId": +this.goodsId,
  1162. // "questionId": this.questionList[bindex].questionId,
  1163. // }).then(res => {
  1164. // })
  1165. // }
  1166. }
  1167. },
  1168. /**
  1169. * @param {Object} e案例单选点击
  1170. */
  1171. radioSelectChild(optionsId, ansIndex, bindex) {
  1172. if (this.questionList[bindex].ques[ansIndex]) return;
  1173. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  1174. this.isDoOver();
  1175. },
  1176. /**
  1177. * @param {Object} 多选点击
  1178. */
  1179. checkboxSelect(optionsId, bindex, index) {
  1180. this.$set(this.questionList[bindex].jsonStr[index], 'checked', !this.questionList[bindex].jsonStr[index].checked);
  1181. },
  1182. /**
  1183. * @param {Object} 案例多选点击
  1184. */
  1185. checkboxSelectChild(bindex, ansIndex, childIndex) {
  1186. this.$set(this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex], 'checked', !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex].checked);
  1187. },
  1188. isCheckboxChecked(arr) {
  1189. return arr.some(item => {
  1190. if (item.checked) {
  1191. return true;
  1192. }
  1193. });
  1194. },
  1195. /**
  1196. * @param {Object} 多选确认
  1197. */
  1198. checkboxSubmit(bindex) {
  1199. if (this.questionList[bindex].ques) return;
  1200. let arr = [];
  1201. this.questionList[bindex].jsonStr.forEach(item => {
  1202. if (item.checked) {
  1203. arr.push(item.optionsId);
  1204. }
  1205. });
  1206. if(!arr.length) {
  1207. uni.showToast({
  1208. title:'请选择答案',
  1209. icon:'none'
  1210. })
  1211. return;
  1212. }
  1213. this.$set(this.questionList[bindex], 'ques', arr);
  1214. this.isDoOver();
  1215. let isWrong = this.questionList[bindex].ques.some((quesItem, quesIndex) => {
  1216. return this.questionList[bindex].ques[quesIndex] != this.questionList[bindex].ans[quesIndex];
  1217. });
  1218. // 回答错误
  1219. if (isWrong) {
  1220. this.$api
  1221. .examWrongRecord({
  1222. examId: this.id,
  1223. goodsId: this.goodsId,
  1224. moduleExamId:this.moduleId || 0,
  1225. chapterExamId:this.chapterId || 0,
  1226. questionIds: [this.questionList[bindex].questionId],
  1227. recordId: this.recordId
  1228. })
  1229. .then(res => {});
  1230. } else {
  1231. // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  1232. // if(question) {
  1233. // this.$api.wrongRecordDelete({
  1234. // "examId": +this.id,
  1235. // "goodsId": +this.goodsId,
  1236. // "questionId": this.questionList[bindex].questionId,
  1237. // }).then(res => {
  1238. // })
  1239. // }
  1240. }
  1241. },
  1242. /**
  1243. * @param {Object} 案例多选确认
  1244. */
  1245. checkboxSubmitChild(bindex, ansIndex) {
  1246. if (this.questionList[bindex].ques[ansIndex]) return;
  1247. let arr = [];
  1248. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(item => {
  1249. if (item.checked) {
  1250. arr.push(item.optionsId);
  1251. }
  1252. });
  1253. if(!arr.length) {
  1254. uni.showToast({
  1255. title:'请选择答案',
  1256. icon:'none'
  1257. })
  1258. return;
  1259. }
  1260. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  1261. this.isDoOver();
  1262. },
  1263. /**
  1264. * @param {Object} index
  1265. * @param {Object} bindex
  1266. * 判断题
  1267. */
  1268. judgeSelect(index, bindex) {
  1269. if (this.questionList[bindex].ques) return;
  1270. this.$set(this.questionList[bindex], 'ques', index + '');
  1271. this.isDoOver();
  1272. // 回答错误
  1273. if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
  1274. this.$api
  1275. .examWrongRecord({
  1276. examId: this.id,
  1277. goodsId: this.goodsId,
  1278. moduleExamId:this.moduleId || 0,
  1279. chapterExamId:this.chapterId || 0,
  1280. questionIds:[this.questionList[bindex].questionId],
  1281. recordId: this.recordId
  1282. })
  1283. .then(res => {});
  1284. } else {
  1285. // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  1286. // if(question) {
  1287. // this.$api.wrongRecordDelete({
  1288. // "examId": +this.id,
  1289. // "goodsId": +this.goodsId,
  1290. // "questionId": this.questionList[bindex].questionId,
  1291. // }).then(res => {
  1292. // })
  1293. // }
  1294. }
  1295. },
  1296. /**
  1297. * @param {Object} ansindex
  1298. * @param {Object} childindex
  1299. * @param {Object} bindex
  1300. * 案例判断题
  1301. */
  1302. judgeSelectChild(ansindex, childindex, bindex) {
  1303. if (this.questionList[bindex].ques[ansindex]) return;
  1304. this.$set(this.questionList[bindex].ques, ansindex, childindex + '');
  1305. this.isDoOver();
  1306. },
  1307. openFooterTab() {
  1308. this.show = true;
  1309. },
  1310. changeIndex(index) {
  1311. this.current = index;
  1312. },
  1313. swiperChange(e) {
  1314. this.current = e.detail.current;
  1315. this.getCollectInfo(this.current);
  1316. },
  1317. /**
  1318. * @param {Object} current
  1319. * 获取收藏信息
  1320. */
  1321. getCollectInfo(current) {
  1322. this.$api
  1323. .getCollectInfo({
  1324. examId: this.id,
  1325. questionId: this.questionList[current].questionId,
  1326. goodsId: this.goodsId
  1327. })
  1328. .then(res => {
  1329. if (res.data.code == 500) {
  1330. this.$set(this.collectList, current, false);
  1331. } else if (res.data.code == 200) {
  1332. this.$set(this.collectList, current, res.data.data);
  1333. }
  1334. });
  1335. },
  1336. pdsubmit() {
  1337. // if (this.bankType == 1) {
  1338. let ansCount = this.questionOverNum(true); //已答题数
  1339. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1340. //没有答完
  1341. if (this.lastCount !== 0) {
  1342. this.cgType = 6;
  1343. this.showpopups = true;
  1344. return;
  1345. }
  1346. // }
  1347. if(this.bankType == 2) {
  1348. if(this.lastTime > 0) {
  1349. let lastTime = this.countdown(this.lastTime)
  1350. uni.showModal({
  1351. title:'提示',
  1352. content:`时间还剩余${lastTime},确定交卷吗?`,
  1353. confirmText:'交卷',
  1354. cancelText:'继续答题',
  1355. success:(res) => {
  1356. if(res.confirm) { //确定
  1357. this.submit();
  1358. } else { //取消
  1359. }
  1360. }
  1361. })
  1362. return;
  1363. }
  1364. }
  1365. this.submit();
  1366. },
  1367. /**
  1368. * 交卷
  1369. */
  1370. submit() {
  1371. let score = 0; //计算总分
  1372. let reportStatus = 0;
  1373. let number = 0; //做对的题目数量
  1374. let doQuestionNum = 0; //做过的题目数量
  1375. let allScore = 0; //总分
  1376. let passScore = 0;
  1377. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  1378. let doQuestionIds = []; //做过的题目id
  1379. let rightQuestionIds = []; //做对的题目id
  1380. this.questionList.forEach((item, index) => {
  1381. passScore = item.passScore
  1382. if (item.type == 1) {
  1383. //正确
  1384. if (item.ques == item.ans) {
  1385. item.scoreResult = item.score;
  1386. score += item.score;
  1387. number++;
  1388. rightQuestionIds.push(item.questionId)
  1389. } else { //错误
  1390. item.scoreResult = 0;
  1391. doWrongQuestionIds.push(item.questionId)
  1392. }
  1393. allScore += item.score;
  1394. if (item.ques) {
  1395. doQuestionNum++;
  1396. doQuestionIds.push(item.questionId)
  1397. }
  1398. } else if (item.type == 2) {
  1399. let isRight =
  1400. item.ans &&
  1401. item.ans.every((quesItem, quesIndex) => {
  1402. if(item.ques) {
  1403. return item.ques[quesIndex] == item.ans[quesIndex];
  1404. } else {
  1405. return false;
  1406. }
  1407. });
  1408. if (isRight) {
  1409. score += item.score;
  1410. number++;
  1411. item.scoreResult = item.score;
  1412. rightQuestionIds.push(item.questionId)
  1413. } else {
  1414. let checkboxScore = item.score; //获取单题总分数
  1415. item.ques && item.ques.forEach((ques,quesIndex) => {
  1416. //选错一个全扣
  1417. if(item.ques) {
  1418. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1419. checkboxScore = 0;
  1420. }
  1421. } else {
  1422. checkboxScore = 0;
  1423. }
  1424. })
  1425. console.log(checkboxScore)
  1426. //没选错
  1427. if(checkboxScore) {
  1428. item.ans.forEach((ans,quesIndex) => {
  1429. //漏选扣一部分
  1430. if(item.ques) {
  1431. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  1432. checkboxScore = item.partScore;
  1433. }
  1434. } else {
  1435. checkboxScore = 0;
  1436. }
  1437. })
  1438. }
  1439. if(checkboxScore <= 0) { //0分
  1440. item.scoreResult = 0;
  1441. doWrongQuestionIds.push(item.questionId)
  1442. } else { //部分分
  1443. number++;
  1444. item.scoreResult = checkboxScore;
  1445. score += checkboxScore;
  1446. rightQuestionIds.push(item.questionId)
  1447. }
  1448. }
  1449. allScore += item.score;
  1450. if (item.ques && item.ques.length) {
  1451. doQuestionNum++;
  1452. doQuestionIds.push(item.questionId)
  1453. }
  1454. } else if (item.type == 3) {
  1455. if (item.ques == item.ans) {
  1456. item.scoreResult = item.score;
  1457. score += item.score;
  1458. number++;
  1459. rightQuestionIds.push(item.questionId)
  1460. } else {
  1461. item.scoreResult = 0;
  1462. doWrongQuestionIds.push(item.questionId)
  1463. }
  1464. allScore += item.score;
  1465. if (item.ques) {
  1466. doQuestionNum++;
  1467. doQuestionIds.push(item.questionId)
  1468. }
  1469. } else if (item.type == 4) {
  1470. allScore += item.score;
  1471. if (item.ques && item.ques.length) {
  1472. doQuestionNum++;
  1473. }
  1474. } else if (item.type == 5) {
  1475. allScore += item.score;
  1476. if (item.ques) {
  1477. doQuestionNum++;
  1478. }
  1479. }
  1480. });
  1481. //大于及格
  1482. if(score >= passScore) {
  1483. reportStatus = 1
  1484. } else {
  1485. reportStatus = 0
  1486. }
  1487. //交卷
  1488. this.$api
  1489. .examRecordEdit({
  1490. examId: this.id,
  1491. goodsId: this.goodsId,
  1492. reportStatus:reportStatus,
  1493. recordId: this.recordId,
  1494. rightQuestionNum: number,
  1495. status: 1,
  1496. moduleExamId:this.moduleId || 0,
  1497. chapterExamId:this.chapterId || 0,
  1498. doQuestionIds:doQuestionIds.join(','),
  1499. rightQuestionIds:rightQuestionIds.join(','),
  1500. doQuestionNum: doQuestionNum,
  1501. performance: score,
  1502. totalScore: allScore,
  1503. examTime: parseInt(this.allTimes),
  1504. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1505. historyExamJson: JSON.stringify(this.questionList)
  1506. })
  1507. .then(res => {
  1508. this.isSubmit = true;
  1509. if (res.data.code == 200) {
  1510. uni.showToast({
  1511. title: '交卷成功',
  1512. duration: 1000,
  1513. icon: 'none'
  1514. });
  1515. setTimeout(() => {
  1516. uni.redirectTo({
  1517. url: '/pages2/bank/question_report?goodsId='+this.goodsId+'&chapterId='+this.chapterId+'&moduleId='+this.moduleId+'&examId='+this.id+'&id=' + this.recordId
  1518. });
  1519. }, 1000);
  1520. }
  1521. });
  1522. //错题集id提交(客观题)
  1523. this.$api.examWrongRecord({
  1524. examId: this.id,
  1525. goodsId: this.goodsId,
  1526. questionIds: doWrongQuestionIds,
  1527. recordId: this.recordId
  1528. }).then(res => {
  1529. });
  1530. },
  1531. /**
  1532. * @param {Object} state
  1533. * @param {Object} index
  1534. * 收藏
  1535. */
  1536. collect(state, index) {
  1537. if (!state) {
  1538. this.$api
  1539. .collectQuestion({
  1540. examId: this.id,
  1541. questionId: this.questionList[index].questionId,
  1542. goodsId: this.goodsId || ''
  1543. })
  1544. .then(res => {
  1545. if (res.data.code == 200) {
  1546. this.$set(this.collectList, index, true);
  1547. uni.showToast({
  1548. title: '收藏成功',
  1549. duration: 2000,
  1550. icon: 'none'
  1551. });
  1552. this.getCollectInfo(index)
  1553. }
  1554. });
  1555. } else {
  1556. this.$api.deleteCollectQuestion(this.collectList[index].collectQuestionId).then(res => {
  1557. if (res.data.code == 200) {
  1558. this.$set(this.collectList, index, false);
  1559. uni.showToast({
  1560. title: '取消收藏成功',
  1561. duration: 2000,
  1562. icon: 'none'
  1563. });
  1564. }
  1565. });
  1566. }
  1567. return;
  1568. },
  1569. /**
  1570. * @param {Object} imgIndex
  1571. * @param {Object} bankIndex
  1572. * 删除简答图片
  1573. */
  1574. deleteImg(imgIndex, bankIndex) {
  1575. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  1576. },
  1577. /**
  1578. * @param {Object} imgIndex
  1579. * @param {Object} bankIndex
  1580. * @param {Object} ansIndex
  1581. * 删除案例题简答图片
  1582. */
  1583. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  1584. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(imgIndex, 1);
  1585. },
  1586. /**
  1587. * @param {Object} bankindex
  1588. * 选择上传图片
  1589. */
  1590. chooseImg(bankindex) {
  1591. if(this.questionList[bankindex] && this.questionList[bankindex].ansText && this.questionList[bankindex].ansText.imageList.length >= 4) {
  1592. uni.showToast({
  1593. icon:'none',
  1594. title:'最多选择4张'
  1595. })
  1596. return;
  1597. }
  1598. uni.chooseImage({
  1599. count: 1, //默认9
  1600. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  1601. sourceType: ['album', 'camera'], //从相册选择
  1602. success: res => {
  1603. let self = this;
  1604. // console.log(JSON.stringify(res.tempFilePaths));
  1605. let img = res.tempFilePaths[0];
  1606. uni.getImageInfo({
  1607. src: img,
  1608. success: async res => {
  1609. let canvasWidth = res.width; //图片原始长宽
  1610. let canvasHeight = res.height;
  1611. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1612. uni.compressImage({
  1613. src: img,
  1614. quality: 75,
  1615. width: '50%',
  1616. height: '50%',
  1617. success: async rest => {
  1618. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1619. this.questionList[bankindex].ansText.imageList.push(dir);
  1620. }
  1621. });
  1622. } else {
  1623. const dir = await self.uploadFile(img, 0);
  1624. this.questionList[bankindex].ansText.imageList.push(dir);
  1625. }
  1626. }
  1627. });
  1628. }
  1629. });
  1630. },
  1631. /**
  1632. * @param {Object} bankindex
  1633. * @param {Object} ansindex
  1634. * 案例题选择上传图片
  1635. */
  1636. chooseImgChild(bankindex, ansindex) {
  1637. if(this.questionList[bankindex].jsonStr[ansindex] && this.questionList[bankindex].jsonStr[ansindex].ansText && this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length >= 4) {
  1638. uni.showToast({
  1639. icon:'none',
  1640. title:'最多选择4张'
  1641. })
  1642. return;
  1643. }
  1644. uni.chooseImage({
  1645. count: 1, //默认9
  1646. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  1647. sourceType: ['album', 'camera'], //从相册选择
  1648. success: res => {
  1649. let self = this;
  1650. // console.log(JSON.stringify(res.tempFilePaths));
  1651. let img = res.tempFilePaths[0];
  1652. uni.getImageInfo({
  1653. src: img,
  1654. success: async res => {
  1655. let canvasWidth = res.width; //图片原始长宽
  1656. let canvasHeight = res.height;
  1657. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1658. uni.compressImage({
  1659. src: img,
  1660. quality: 75,
  1661. width: '50%',
  1662. height: '50%',
  1663. success: async rest => {
  1664. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1665. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir);
  1666. }
  1667. });
  1668. } else {
  1669. const dir = await self.uploadFile(img, 0);
  1670. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir);
  1671. }
  1672. }
  1673. });
  1674. }
  1675. });
  1676. },
  1677. uploadFile(options, int) {
  1678. var self = this;
  1679. return new Promise((resolve, reject) => {
  1680. var data = {
  1681. imageStatus: int
  1682. };
  1683. self.$api.aliyunpolicy(data).then(res => {
  1684. console.log(res.data, 6);
  1685. if (res.data.code != 200) {
  1686. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  1687. return;
  1688. }
  1689. var ossToken = res.data.data.resultContent;
  1690. if (ossToken.host == null || ossToken.host == undefined) {
  1691. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  1692. return;
  1693. }
  1694. uni.uploadFile({
  1695. url: ossToken.host,
  1696. name: 'file',
  1697. filePath: options,
  1698. fileType: 'image',
  1699. header: {
  1700. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  1701. },
  1702. formData: {
  1703. key: ossToken.dir,
  1704. OSSAccessKeyId: ossToken.accessid,
  1705. policy: ossToken.policy,
  1706. Signature: ossToken.signature,
  1707. callback: ossToken.callback,
  1708. success_action_status: 200
  1709. },
  1710. success: result => {
  1711. if (result.statusCode === 200) {
  1712. resolve(ossToken.dir);
  1713. } else {
  1714. uni.showToast({
  1715. title: '上传失败',
  1716. icon: 'none'
  1717. });
  1718. return;
  1719. }
  1720. },
  1721. fail: error => {
  1722. uni.showToast({
  1723. title: '上传接口报错' + error,
  1724. icon: 'none'
  1725. });
  1726. return;
  1727. }
  1728. });
  1729. });
  1730. });
  1731. },
  1732. /**
  1733. * @param {Object} type
  1734. * @param {Object} bankindex
  1735. * 简答题答案确认
  1736. */
  1737. submitAns(bankindex) {
  1738. console.log(this.questionList[bankindex]);
  1739. if (!this.questionList[bankindex].ansText.text && !this.questionList[bankindex].ansText.imageList.length) {
  1740. uni.showToast({
  1741. title: '请输入内容或上传图片',
  1742. duration: 2000,
  1743. icon: 'none'
  1744. });
  1745. return;
  1746. }
  1747. this.$set(this.questionList[bankindex], 'ques', {
  1748. imageList: this.questionList[bankindex].ansText.imageList || [],
  1749. text: this.questionList[bankindex].ansText.text || ''
  1750. });
  1751. this.isDoOver()
  1752. },
  1753. /**
  1754. * @param {Object} bankindex
  1755. * @param {Object} ansindex
  1756. * 案例题简答答案确认
  1757. */
  1758. submitAnsChild(bankindex, ansindex) {
  1759. if (!this.questionList[bankindex].jsonStr[ansindex].ansText.text && !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length) {
  1760. uni.showToast({
  1761. title: '请输入内容或上传图片',
  1762. duration: 2000,
  1763. icon: 'none'
  1764. });
  1765. return;
  1766. }
  1767. this.$set(this.questionList[bankindex].ques, ansindex, {
  1768. imageList: this.questionList[bankindex].jsonStr[ansindex].ansText.imageList || [],
  1769. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text || ''
  1770. });
  1771. this.isDoOver()
  1772. },
  1773. isRight(item, index) {
  1774. //单选
  1775. if (this.questionList[index].ques) {
  1776. if (item.type == 1) {
  1777. return this.questionList[index].ques == this.questionList[index].ans;
  1778. //多选
  1779. } else if (item.type == 2) {
  1780. //每一项都相等
  1781. return this.questionList[index].ques.every((item, i) => {
  1782. return item == this.questionList[index].ans[i];
  1783. });
  1784. //判断
  1785. } else if (item.type == 3) {
  1786. return this.questionList[index].ques == this.questionList[index].ans;
  1787. // } else if (item.type == 5) {
  1788. // if(this.questionList[index].ques.text){
  1789. // return true
  1790. // }else{
  1791. // return false
  1792. // }
  1793. } else {
  1794. return false;
  1795. }
  1796. } else {
  1797. return false;
  1798. }
  1799. },
  1800. right(bankIndex, ansIndex, option) {
  1801. if (this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1802. if (this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 || this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) != -1) {
  1803. return true;
  1804. } else {
  1805. return false;
  1806. }
  1807. } else {
  1808. return false;
  1809. }
  1810. },
  1811. wrong(bankIndex, ansIndex, option) {
  1812. if (this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1813. if (this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 && this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) == -1) {
  1814. return true;
  1815. } else {
  1816. return false;
  1817. }
  1818. } else {
  1819. return false;
  1820. }
  1821. },
  1822. isWrong(item, index) {
  1823. if (this.questionList[index].ques) {
  1824. //单选
  1825. if (item.type == 1) {
  1826. return this.questionList[index].ques != this.questionList[index].ans;
  1827. //多选
  1828. } else if (item.type == 2) {
  1829. //每一项都相等
  1830. return this.questionList[index].ques.some((item, index) => {
  1831. return item != this.questionList[index].ans;
  1832. });
  1833. //判断
  1834. } else if (item.type == 3) {
  1835. return this.questionList[index].ques != this.questionList[index].ans;
  1836. } else {
  1837. return false;
  1838. }
  1839. } else {
  1840. return false;
  1841. }
  1842. },
  1843. tabSelect(index, bankindex) {
  1844. this.$set(this.questionList[bankindex], 'current', index);
  1845. }
  1846. }
  1847. };
  1848. </script>
  1849. <style lang="scss" scoped>
  1850. .questionBank {
  1851. width:100%;
  1852. height:100vh;
  1853. display: flex;
  1854. flex-direction: column;
  1855. }
  1856. .swiper {
  1857. width: 100%;
  1858. flex:1;
  1859. }
  1860. .lisSty {
  1861. margin-bottom: 16rpx;
  1862. display: flex;
  1863. align-items: center;
  1864. .flex_auto {
  1865. flex: 1;
  1866. }
  1867. }
  1868. .activeTI {
  1869. vertical-align: middle;
  1870. display: inline-block;
  1871. border: 1rpx solid #eee;
  1872. border-radius: 50rpx;
  1873. height: 48rpx;
  1874. line-height: 46rpx;
  1875. text-align: center;
  1876. width: 48rpx;
  1877. margin-right: 15rpx;
  1878. color: #666;
  1879. font-size: 30rpx;
  1880. &.right {
  1881. color: #fff;
  1882. background: #36C75A;
  1883. }
  1884. &.wrong {
  1885. color: #fff;
  1886. background: #FF3B30;
  1887. }
  1888. &.checked {
  1889. color: #fff;
  1890. background: #007AFF;
  1891. }
  1892. }
  1893. .submit_checkbox {
  1894. position:fixed;
  1895. left:0;
  1896. right:0;
  1897. bottom:120rpx;
  1898. margin: 20rpx auto;
  1899. width: 526rpx;
  1900. height: 80rpx;
  1901. background: rgba(0, 122, 255, 1);
  1902. color: #fff;
  1903. text-align: center;
  1904. line-height: 80rpx;
  1905. font-size: 30rpx;
  1906. border-radius: 40rpx;
  1907. &.disabled {
  1908. opacity: 0.6;
  1909. }
  1910. }
  1911. .titles {
  1912. overflow: hidden;
  1913. margin-bottom: 24rpx;
  1914. }
  1915. .titBox {
  1916. padding: 41rpx 25rpx 24rpx 25rpx;
  1917. }
  1918. .titBox_title {
  1919. padding: 21rpx;
  1920. }
  1921. .tabs {
  1922. margin: 10rpx;
  1923. display: flex;
  1924. .tab {
  1925. margin: 0 4rpx;
  1926. padding:10rpx 13rpx;
  1927. text-align: center;
  1928. color: #007aff;
  1929. font-size: 28rpx;
  1930. border-radius: 16rpx;
  1931. background:#fff;
  1932. &.current {
  1933. color: #fff;
  1934. background: #007aff;
  1935. }
  1936. }
  1937. }
  1938. .ans {
  1939. margin: 8rpx 8rpx 8rpx;
  1940. .ans_input {
  1941. border-radius: 16rpx;
  1942. background: #fff;
  1943. .top {
  1944. border-bottom: 1rpx solid #eeeeee;
  1945. padding: 16rpx;
  1946. display: flex;
  1947. align-items: center;
  1948. .icon {
  1949. margin-right: 20rpx;
  1950. width: 40rpx;
  1951. height: 38rpx;
  1952. }
  1953. .progress {
  1954. flex: 1;
  1955. }
  1956. .submit {
  1957. width: 168rpx;
  1958. height: 48rpx;
  1959. line-height: 48rpx;
  1960. text-align: center;
  1961. color: #fff;
  1962. font-size: 30rpx;
  1963. background: #007aff;
  1964. border-radius: 24rpx;
  1965. &.disabled {
  1966. opacity: 0.6;
  1967. }
  1968. }
  1969. }
  1970. .textarea {
  1971. textarea {
  1972. width: 100%;
  1973. height: 287rpx;
  1974. padding: 10rpx;
  1975. }
  1976. }
  1977. .imgs {
  1978. overflow: hidden;
  1979. display: flex;
  1980. width: 100%;
  1981. .img {
  1982. width: 104rpx;
  1983. height: 104rpx;
  1984. border-radius: 8rpx;
  1985. position: relative;
  1986. margin: 20rpx;
  1987. text {
  1988. position: absolute;
  1989. right: -15rpx;
  1990. top: -15rpx;
  1991. width: 30rpx;
  1992. height: 30rpx;
  1993. text-align: center;
  1994. line-height: 30rpx;
  1995. color: #fff;
  1996. background: #FF3B30;
  1997. border-radius: 50%;
  1998. }
  1999. image {
  2000. width: 100%;
  2001. height: 100%;
  2002. }
  2003. }
  2004. }
  2005. }
  2006. .ans_submit {
  2007. padding: 16rpx;
  2008. border-radius: 16rpx;
  2009. background: #fff;
  2010. .imgs {
  2011. overflow: hidden;
  2012. display: flex;
  2013. width: 100%;
  2014. .img {
  2015. width: 104rpx;
  2016. height: 104rpx;
  2017. border-radius: 8rpx;
  2018. position: relative;
  2019. margin: 20rpx;
  2020. image {
  2021. width: 100%;
  2022. height: 100%;
  2023. }
  2024. }
  2025. }
  2026. }
  2027. }
  2028. .leftLetters {
  2029. display: flex;
  2030. align-items: center;
  2031. width: 220rpx;
  2032. .btnType {
  2033. padding: 5rpx 10rpx;
  2034. border: 1rpx solid #007aff;
  2035. border-radius: 10rpx;
  2036. background-color: rgba(0, 122, 255, 0.1);
  2037. font-size: 28rpx;
  2038. color: #007aff;
  2039. margin-right: 15rpx;
  2040. }
  2041. }
  2042. .firstLetter {
  2043. display: flex;
  2044. justify-content: space-between;
  2045. align-items: center;
  2046. margin-bottom: 30rpx;
  2047. }
  2048. .popupView {
  2049. height: 100%;
  2050. padding-bottom: 100rpx;
  2051. .popupTops {
  2052. height: 77rpx;
  2053. border-bottom: 1rpx solid #eee;
  2054. text-align: center;
  2055. line-height: 77rpx;
  2056. font-size: 24rpx;
  2057. color: #999;
  2058. position: relative;
  2059. .topIcon {
  2060. position: absolute;
  2061. top: 10rpx;
  2062. left: 50%;
  2063. transform: translateX(-50%);
  2064. width: 80rpx;
  2065. height: 8rpx;
  2066. background-color: #999;
  2067. border-radius: 4rpx;
  2068. }
  2069. }
  2070. .popupContent {
  2071. }
  2072. }
  2073. .pageContent {
  2074. position: relative;
  2075. background-color: #eaeef1;
  2076. height: 100%;
  2077. padding-top: 8rpx;
  2078. padding-bottom: 100rpx;
  2079. overflow-y: scroll;
  2080. }
  2081. .pad_8 {
  2082. background-color: #fff;
  2083. margin: 0rpx 8rpx 8rpx;
  2084. border-radius: 16rpx;
  2085. &.no-margin {
  2086. margin-top:-16rpx;
  2087. border-radius: 0 0 16rpx 16rpx;
  2088. }
  2089. }
  2090. .answer {
  2091. height: 80rpx;
  2092. line-height: 80rpx;
  2093. padding: 0rpx 24rpx;
  2094. display: flex;
  2095. align-items: center;
  2096. justify-content: space-between;
  2097. color: #666;
  2098. font-size: 30rpx;
  2099. }
  2100. .footer_btn {
  2101. background-color: #fff;
  2102. z-index: 10078;
  2103. position: fixed;
  2104. bottom: 0rpx;
  2105. display: flex;
  2106. align-items: center;
  2107. justify-content: space-between;
  2108. width: 100%;
  2109. height: 98rpx;
  2110. padding: 0rpx 38rpx;
  2111. border-top: 1rpx solid #eee;
  2112. .flex_center {
  2113. flex:1;
  2114. display: flex;
  2115. justify-content: center;
  2116. align-items: center;
  2117. flex-direction: column;
  2118. margin:0 200rpx;
  2119. font-size: 24rpx;
  2120. color: #999999;
  2121. .up-icon {
  2122. margin-bottom:18rpx;
  2123. width:100%;
  2124. display: flex;
  2125. justify-content: center;
  2126. image {
  2127. width:58rpx;
  2128. height:21rpx;
  2129. }
  2130. }
  2131. }
  2132. .collect {
  2133. visibility: hidden;
  2134. width:100rpx;
  2135. &.show {
  2136. visibility: visible;
  2137. }
  2138. >view {
  2139. display: flex;
  2140. flex-direction: column;
  2141. align-items: center;
  2142. justify-content: center;
  2143. image {
  2144. width:32rpx;
  2145. height:32rpx;
  2146. margin-bottom:6rpx;
  2147. }
  2148. view {
  2149. font-size: 24rpx;
  2150. color: #999999;
  2151. }
  2152. }
  2153. }
  2154. }
  2155. .boxSty {
  2156. padding: 44rpx 41rpx 0rpx;
  2157. }
  2158. .liListSty {
  2159. border: 1rpx solid #eeeeee;
  2160. width: 88rpx;
  2161. height: 88rpx;
  2162. border-radius: 32rpx;
  2163. text-align: center;
  2164. line-height: 88rpx;
  2165. color: #333;
  2166. font-size: 32rpx;
  2167. float: left;
  2168. margin: 20rpx 23rpx;
  2169. &.isRight {
  2170. border: 1rpx solid #eeeeee;
  2171. color: #fff;
  2172. background: #36C75A;
  2173. }
  2174. &.isWrong {
  2175. border: 1rpx solid #eeeeee;
  2176. color: #fff;
  2177. background: #FF3B30;
  2178. }
  2179. }
  2180. .answerInfos {
  2181. padding: 25rpx 25rpx 25rpx 23rpx;
  2182. }
  2183. .answerTitle {
  2184. margin-bottom: 28rpx;
  2185. color: #666;
  2186. font-size: 30rpx;
  2187. }
  2188. .answerContent {
  2189. font-size: 30rpx;
  2190. color: #666;
  2191. }
  2192. .textChild {
  2193. display: inline-block;
  2194. vertical-align: middle;
  2195. }
  2196. .dialog {
  2197. position: fixed;
  2198. left: 0;
  2199. top: 0;
  2200. width: 100%;
  2201. height: 100%;
  2202. background-color: rgba(0, 0, 0, 0.8);
  2203. display: flex;
  2204. flex-direction: column;
  2205. align-items: center;
  2206. justify-content: center;
  2207. z-index: 20000;
  2208. .pointer {
  2209. width:338rpx;
  2210. height:240rpx;
  2211. }
  2212. .text {
  2213. font-size: 32rpx;
  2214. color: #ffffff;
  2215. text-align: center;
  2216. }
  2217. .btn {
  2218. width: 242rpx;
  2219. height: 82rpx;
  2220. border: 2rpx solid #ffffff;
  2221. border-radius: 16rpx;
  2222. text-align: center;
  2223. line-height: 82rpx;
  2224. margin: 41rpx auto;
  2225. color: #fff;
  2226. font-size: 32rpx;
  2227. }
  2228. }
  2229. .dialog-arrow {
  2230. padding-top:124rpx;
  2231. position: fixed;
  2232. left: 0;
  2233. top: 0;
  2234. width: 100%;
  2235. height: 100%;
  2236. background-color: rgba(0, 0, 0, 0.8);
  2237. z-index: 20000;
  2238. .pointer {
  2239. margin-left:87rpx;
  2240. display: block;
  2241. width:95rpx;
  2242. height:98rpx;
  2243. }
  2244. .text {
  2245. padding-left:177rpx;
  2246. font-size: 32rpx;
  2247. color: #ffffff;
  2248. }
  2249. .btn {
  2250. width: 242rpx;
  2251. height: 82rpx;
  2252. border: 2rpx solid #ffffff;
  2253. border-radius: 16rpx;
  2254. text-align: center;
  2255. line-height: 82rpx;
  2256. margin: 500rpx auto 0;
  2257. color: #fff;
  2258. font-size: 32rpx;
  2259. }
  2260. }
  2261. .dialog_wrap {
  2262. position: fixed;
  2263. left: 0;
  2264. top: 0;
  2265. width: 100%;
  2266. height: 100%;
  2267. z-index: 9999999999;
  2268. .bg {
  2269. background: rgba(0, 0, 0, 0.3);
  2270. position: absolute;
  2271. left: 0;
  2272. top: 0;
  2273. width: 100%;
  2274. height: 100%;
  2275. }
  2276. .dialog {
  2277. position: absolute;
  2278. left: 50%;
  2279. top: 50%;
  2280. transform: translate3D(-50%, -50%, 0);
  2281. width: 640rpx;
  2282. height: 439rpx;
  2283. background: #ffffff;
  2284. border-radius: 24rpx;
  2285. .title {
  2286. font-size: 30rpx;
  2287. font-weight: bold;
  2288. color: #333333;
  2289. line-height: 48rpx;
  2290. text-align: center;
  2291. margin-top: 40rpx;
  2292. }
  2293. .content {
  2294. margin: 35rpx 35rpx 0;
  2295. font-size: 30rpx;
  2296. color: #666666;
  2297. line-height: 48rpx;
  2298. }
  2299. .btns {
  2300. margin-top: 35rpx;
  2301. display: flex;
  2302. align-items: center;
  2303. justify-content: center;
  2304. .btn {
  2305. width: 200rpx;
  2306. height: 80rpx;
  2307. line-height: 80rpx;
  2308. text-align: center;
  2309. background: #f5f5f5;
  2310. border-radius: 40rpx;
  2311. font-size: 30rpx;
  2312. color: rgba(0, 122, 255, 1);
  2313. background: #f5f5f5;
  2314. margin: 0 20rpx;
  2315. &.active {
  2316. color: #f5f5f5;
  2317. background: rgba(0, 122, 255, 1);
  2318. }
  2319. }
  2320. }
  2321. }
  2322. }
  2323. .popboxs {
  2324. width: 100%;
  2325. height: 100%;
  2326. display: flex;
  2327. flex-direction: column;
  2328. align-items: center;
  2329. }
  2330. .classTops {
  2331. flex-shrink: 0;
  2332. padding: 39rpx 0rpx 4rpx;
  2333. font-weight: bold;
  2334. color: #333;
  2335. font-size: 30rpx;
  2336. }
  2337. .textStys {
  2338. width: 100%;
  2339. flex: 1;
  2340. padding: 36rpx;
  2341. }
  2342. .classFootsty {
  2343. flex-shrink: 0;
  2344. display: flex;
  2345. align-items: center;
  2346. justify-content: center;
  2347. padding: 10rpx 0rpx 40rpx;
  2348. .btnsty {
  2349. width: 200rpx;
  2350. height: 80rpx;
  2351. border-radius: 40rpx;
  2352. font-weight: bold;
  2353. font-size: 30rpx;
  2354. text-align: center;
  2355. line-height: 80rpx;
  2356. }
  2357. .btns1 {
  2358. background-color: #f5f5f5;
  2359. color: #007aff;
  2360. }
  2361. .btns2 {
  2362. margin-left: 40rpx;
  2363. background-color: #007aff;
  2364. color: #ffffff;
  2365. }
  2366. }
  2367. </style>