questionBank.vue 64 KB

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