questionBank.vue 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595
  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. this.examRecord();
  650. if(this.lastTime) {
  651. this.timer = setInterval(() => {
  652. if (this.lastTime <= 0) {
  653. clearInterval(this.timer);
  654. uni.showToast({
  655. icon:'none',
  656. mask:true,
  657. title:'考试时间已到,系统将自动交卷',
  658. duration:10000
  659. })
  660. this.submit();
  661. return;
  662. }
  663. this.lastTime--;
  664. }, 1000);
  665. }
  666. });
  667. },
  668. uploadFile(options, int) {
  669. var self = this;
  670. return new Promise((resolve, reject) => {
  671. var data = {
  672. imageStatus: int
  673. };
  674. self.$api.aliyunpolicy(data).then(res => {
  675. if (res.data.code != 200) {
  676. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  677. return;
  678. }
  679. var ossToken = res.data.data.resultContent;
  680. if (ossToken.host == null || ossToken.host == undefined) {
  681. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  682. return;
  683. }
  684. uni.uploadFile({
  685. url: ossToken.host,
  686. name: 'file',
  687. filePath: options,
  688. fileType: 'image',
  689. header: {
  690. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  691. },
  692. formData: {
  693. key: ossToken.dir,
  694. OSSAccessKeyId: ossToken.accessid,
  695. policy: ossToken.policy,
  696. Signature: ossToken.signature,
  697. callback: ossToken.callback,
  698. success_action_status: 200
  699. },
  700. success: result => {
  701. if (result.statusCode === 200) {
  702. self.ossAvatarUrl = ossToken.dir;
  703. resolve();
  704. } else {
  705. uni.showToast({
  706. title: '上传失败',
  707. icon: 'none'
  708. });
  709. return;
  710. }
  711. },
  712. fail: error => {
  713. uni.showToast({
  714. title: '上传接口报错' + error,
  715. icon: 'none'
  716. });
  717. return;
  718. }
  719. });
  720. });
  721. });
  722. },
  723. imageInfos() {
  724. var self = this;
  725. return new Promise((resolve, reject) => {
  726. uni.getImageInfo({
  727. src: self.avatarUrl,
  728. success: async res => {
  729. let canvasWidth = res.width; //图片原始长宽
  730. let canvasHeight = res.height;
  731. if (canvasWidth > 1000 || canvasHeight > 1000) {
  732. uni.compressImage({
  733. src: self.avatarUrl,
  734. quality: 75,
  735. width: '50%',
  736. height: '50%',
  737. success: async rest => {
  738. const waitUpload = await self.uploadFile(rest.tempFilePath, 0);
  739. resolve();
  740. }
  741. });
  742. } else {
  743. console.log('无需压缩');
  744. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  745. resolve();
  746. }
  747. }
  748. });
  749. });
  750. },
  751. async submitPhoto() {
  752. const waitYS = await this.imageInfos();
  753. this.postStudyRecord(); //提交记录
  754. },
  755. //确认拍照
  756. takePhoto() {
  757. var self = this;
  758. const ctx = uni.createCameraContext();
  759. ctx.takePhoto({
  760. quality: 'high',
  761. success: res => {
  762. console.log(res.tempImagePath);
  763. self.avatarUrl = res.tempImagePath;
  764. self.submitPhoto();
  765. self.photoPopup = false;
  766. },
  767. fail: err => {
  768. console.log(err);
  769. }
  770. });
  771. },
  772. /**
  773. * 是否有上传图片
  774. */
  775. hasImgs(bank) {
  776. return bank.ansText.imageList.length == 0;
  777. },
  778. /**
  779. * 获取试卷类型2考试,1练习
  780. */
  781. bankExam() {
  782. this.$api.bankExam(this.id).then(res => {
  783. this.bankType = res.data.data.doType;
  784. if (this.bankType == 2) {
  785. this.needBack = true;
  786. }
  787. });
  788. },
  789. /**
  790. * 点击后退按钮
  791. */
  792. clickLeft() {
  793. //需要拍照没有拍直接返回
  794. if(this.needPhoto && !this.isTakePhoto) {
  795. this.isSubmit = true;
  796. uni.navigateBack({
  797. delta:1
  798. })
  799. return;
  800. }
  801. if (this.bankType == 1) {
  802. let ansCount = this.questionOverNum(); //已答题数
  803. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  804. //所有题目答完
  805. if (this.lastCount == 0) {
  806. // this.testOver = true;
  807. this.cgType = 7;
  808. //未答完
  809. } else {
  810. this.cgType = 8;
  811. // this.isLastCount = true;
  812. }
  813. this.showpopups = true;
  814. } else if (this.bankType == 2) {
  815. let ansCount = this.questionOverNum(); //已答题数
  816. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  817. //所有题目答完
  818. if (this.lastCount == 0) {
  819. this.testOver = true;
  820. //未答完
  821. } else {
  822. this.isLastCount = true;
  823. }
  824. }
  825. },
  826. /**
  827. * 返回上一页
  828. */
  829. backPages() {
  830. this.needBack = false;
  831. uni.navigateBack({
  832. delta: 1
  833. });
  834. },
  835. /**
  836. * 获取已经回答的题目数
  837. * hasSpecail (是否包含简答和案例)
  838. */
  839. questionOverNum(hasSpecail) {
  840. let count = 0;
  841. this.questionList.forEach(item => {
  842. if (item.type == 1 || item.type == 2 || item.type == 3) {
  843. if (item.ques) {
  844. count++;
  845. }
  846. } else if (item.type == 4) {
  847. //案例题
  848. if(hasSpecail) {
  849. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  850. if (jsonItem.type == 1 || jsonItem.type == 2 || jsonItem.type == 3) {
  851. if (item.ques[indexs]) {
  852. return true;
  853. } else {
  854. return false;
  855. }
  856. } else if (jsonItem.type == 5) {
  857. console.log(jsonItem, 111);
  858. if (item.ques[indexs] && (item.ques[indexs].text.length || item.ques[indexs].imageList.length)) {
  859. return true;
  860. } else {
  861. return false;
  862. }
  863. }
  864. });
  865. if (isOver) {
  866. count++;
  867. console.log(item, 444);
  868. }
  869. }
  870. } else if (item.type == 5) {
  871. //简答题
  872. if(hasSpecail) {
  873. if (item.ques && (item.ques.text.length || item.ques.imageList.length)) {
  874. count++;
  875. }
  876. }
  877. }
  878. });
  879. return count;
  880. },
  881. /**
  882. * 是否做完所有题目
  883. */
  884. isDoOver() {
  885. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  886. if(this.questionList.length == questionOverNum) { //全部做完弹窗
  887. this.cgType = 9;
  888. this.showpopups = true;
  889. }
  890. },
  891. /**
  892. * 暂不交卷
  893. */
  894. noSubmit() {
  895. //设为允许退出页面
  896. this.needBack = false;
  897. uni.navigateBack({
  898. delta: 1
  899. });
  900. },
  901. /**
  902. * 不离开
  903. */
  904. noLeave() {
  905. this.isLastCount = false;
  906. },
  907. /**
  908. * 立即离开并交卷
  909. */
  910. leaveNow() {
  911. this.isSubmit = true;
  912. uni.navigateBack({
  913. delta: 1
  914. });
  915. //需要拍照没有拍,返回不扣次数
  916. if(this.needPhoto && !this.isTakePhoto) {
  917. return;
  918. }
  919. let score = 0; //计算总分
  920. let reportStatus = 0;
  921. let number = 0;
  922. let passScore = 0;
  923. let allScore = 0; //总分
  924. this.questionList.forEach((item, index) => {
  925. passScore = item.passScore
  926. if (item.type == 1) {
  927. if (item.ques == item.ans) {
  928. item.scoreResult = item.score;
  929. score += item.score;
  930. number++;
  931. } else {
  932. item.scoreResult = 0;
  933. }
  934. allScore += item.score;
  935. } else if (item.type == 2) {
  936. let isRight =
  937. item.ques &&
  938. item.ques.every((quesItem, quesIndex) => {
  939. return item.ques[quesIndex] == item.ans[quesIndex];
  940. });
  941. if (isRight) { //全对
  942. item.scoreResult = item.score;
  943. score += item.score;
  944. number++;
  945. } else {
  946. let checkboxScore = item.score; //获取单题总分数
  947. item.ques && item.ques.forEach((ques,quesIndex) => {
  948. //选错一个全扣
  949. if(item.ques) {
  950. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  951. checkboxScore = 0;
  952. }
  953. } else {
  954. checkboxScore = 0;
  955. }
  956. })
  957. //没选错
  958. if(checkboxScore) {
  959. item.ans.forEach((ans,quesIndex) => {
  960. //漏选扣一部分
  961. if(item.ques) {
  962. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  963. checkboxScore = item.partScore;
  964. }
  965. } else {
  966. checkboxScore = 0;
  967. }
  968. })
  969. }
  970. if(checkboxScore <= 0) {
  971. item.scoreResult = 0;
  972. } else {
  973. item.scoreResult = checkboxScore;
  974. }
  975. score += checkboxScore;
  976. }
  977. allScore += item.score;
  978. } else if (item.type == 3) {
  979. if (item.ques == item.ans) {
  980. item.scoreResult = item.score;
  981. score += item.score;
  982. number++;
  983. } else {
  984. item.scoreResult = 0;
  985. }
  986. allScore += item.score;
  987. }
  988. });
  989. if(score >= passScore) {
  990. reportStatus = 1
  991. } else {
  992. reportStatus = 0
  993. }
  994. this.$api
  995. .bankRecordEdit({
  996. chapterId:this.chapterId || 0,
  997. moduleId:this.moduleId || 0,
  998. examId: this.id,
  999. goodsId: this.goodsId,
  1000. recordId:this.recordId,
  1001. courseId:this.courseId,
  1002. reportStatus:reportStatus,
  1003. rightQuestionNum: number,
  1004. status: 1,
  1005. gradeId:this.gradeId,
  1006. performance: score,
  1007. totalScore: allScore,
  1008. // examTime: parseInt(this.allTimes),
  1009. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1010. // historyExamJson: JSON.stringify(this.questionList)
  1011. })
  1012. .then(res => {});
  1013. },
  1014. /**
  1015. * 立即交卷
  1016. */
  1017. submitNow() {
  1018. this.showpopups = false;
  1019. this.needBack = false;
  1020. this.submit();
  1021. },
  1022. /**
  1023. * 离开页面统计回答正确题数
  1024. */
  1025. examRecordEdit() {
  1026. if (!this.isSubmit) {
  1027. let number = 0;
  1028. let score = 0;
  1029. let doQuestionNum = 0;
  1030. let reportStatus = 0;
  1031. this.questionList.forEach((item, index) => {
  1032. if (item.type == 1) {
  1033. if (item.ques == item.ans) {
  1034. score += item.score;
  1035. number++;
  1036. }
  1037. if (item.ques) {
  1038. doQuestionNum++;
  1039. }
  1040. } else if (item.type == 2) {
  1041. let isRight =
  1042. item.ques &&
  1043. item.ques.every((quesItem, quesIndex) => {
  1044. return item.ques[quesIndex] == item.ans[quesIndex];
  1045. });
  1046. if (isRight) {
  1047. score += item.score;
  1048. number++;
  1049. } else {
  1050. let checkboxScore = item.score; //获取单题总分数
  1051. item.ques.forEach((ques,quesIndex) => {
  1052. //选错一个全扣
  1053. if(item.ques) {
  1054. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1055. checkboxScore = 0;
  1056. }
  1057. } else {
  1058. checkboxScore = 0;
  1059. }
  1060. })
  1061. //没选错
  1062. if(checkboxScore) {
  1063. item.ans.forEach((ans,quesIndex) => {
  1064. //漏选扣一部分
  1065. if(item.ques) {
  1066. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  1067. checkboxScore = item.partScore;
  1068. }
  1069. } else {
  1070. checkboxScore = 0;
  1071. }
  1072. })
  1073. }
  1074. if(checkboxScore <= 0) {
  1075. item.scoreResult = 0;
  1076. } else {
  1077. item.scoreResult = checkboxScore;
  1078. score += checkboxScore;
  1079. number++;
  1080. }
  1081. }
  1082. if (item.ques && item.ques.length) {
  1083. doQuestionNum++;
  1084. }
  1085. } else if (item.type == 3) {
  1086. if (item.ques == item.ans) {
  1087. score += item.score;
  1088. number++;
  1089. }
  1090. if (item.ques) {
  1091. doQuestionNum++;
  1092. }
  1093. } else if (item == 4) {
  1094. if (item.ques.length) {
  1095. doQuestionNum++;
  1096. }
  1097. } else if (item.type == 5) {
  1098. if (item.ques) {
  1099. doQuestionNum++;
  1100. }
  1101. }
  1102. });
  1103. if(score >= 60) {
  1104. reportStatus = 1
  1105. }
  1106. this.$api
  1107. .bankRecordEdit({
  1108. chapterId:this.chapterId || 0,
  1109. moduleId:this.moduleId || 0,
  1110. gradeId:this.gradeId,
  1111. examId: this.id,
  1112. courseId:this.courseId,
  1113. goodsId: this.goodsId,
  1114. recordId:this.recordId,
  1115. performance:score,
  1116. reportStatus:reportStatus,
  1117. status: 1,
  1118. // historyExamJson: JSON.stringify(this.questionList)
  1119. })
  1120. .then(res => {});
  1121. }
  1122. },
  1123. /**
  1124. * @param {Object} second倒计时过滤器
  1125. */
  1126. countdown(second) {
  1127. if (second) {
  1128. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1129. let m = parseInt((second / 60) % 60); // 计算分数
  1130. let s = parseInt(second % 60); // 计算当前秒数
  1131. if (h < 10) h = '0' + h;
  1132. if (m < 10) m = '0' + m;
  1133. if (s < 10) s = '0' + s;
  1134. return h + ':' + m + ':' + s;
  1135. } else {
  1136. return '';
  1137. }
  1138. },
  1139. /**
  1140. * 请求题目列表
  1141. */
  1142. goodsQuestionList() {
  1143. this.$api
  1144. .goodsQuestionList({
  1145. examId: this.id
  1146. })
  1147. .then(res => {
  1148. if (!res.data.data.length) {
  1149. this.hideDialog();
  1150. uni.showModal({
  1151. showCancel: false,
  1152. content: '该试卷暂无题目',
  1153. success: function(k) {
  1154. if (k.confirm) {
  1155. uni.navigateBack();
  1156. }
  1157. }
  1158. });
  1159. return;
  1160. }
  1161. this.allTimes = res.data.data[0].answerTime * 60;
  1162. this.lastTime = res.data.data[0].answerTime && res.data.data[0].answerTime * 60;
  1163. res.data.data.forEach((item, index) => {
  1164. if (typeof item.jsonStr == 'string') {
  1165. item.jsonStr = JSON.parse(item.jsonStr);
  1166. if (item.type == 2) {
  1167. //多选
  1168. item.jsonStr.forEach(str => {
  1169. str.optionsId = '' + str.optionsId;
  1170. });
  1171. let arr = item.answerQuestion.split(',');
  1172. arr.forEach((a, i) => {
  1173. arr[i] = '' + a;
  1174. });
  1175. item.ans = arr;
  1176. return;
  1177. } else if (item.type == 5) {
  1178. //简答题
  1179. item.ansText = {
  1180. text: '',
  1181. imageList: []
  1182. };
  1183. item.ques = {
  1184. text: '',
  1185. imageList: []
  1186. }
  1187. } else if (item.type == 4) {
  1188. //案例题
  1189. console.log(item.jsonStr);
  1190. item.ques = [];
  1191. item.current = 0;
  1192. let ansArr = [];
  1193. item.jsonStr.forEach((json, index) => {
  1194. if (json.type == 1) {
  1195. ansArr[index] = json.answerQuestion;
  1196. } else if (json.type == 2) {
  1197. json.optionsList.forEach(str => {
  1198. str.optionsId = '' + str.optionsId;
  1199. });
  1200. let arr = json.answerQuestion.split(',');
  1201. arr.forEach((a, i) => {
  1202. arr[i] = '' + a;
  1203. });
  1204. ansArr[index] = arr;
  1205. } else if (json.type == 3) {
  1206. ansArr[index] = json.answerQuestion;
  1207. } else if (json.type == 5) {
  1208. ansArr[index] = {
  1209. text: '',
  1210. imageList: []
  1211. };
  1212. json.ansText = {
  1213. text: '',
  1214. imageList: []
  1215. };
  1216. }
  1217. });
  1218. item.ans = ansArr;
  1219. return;
  1220. }
  1221. item.ans = item.answerQuestion;
  1222. }
  1223. });
  1224. this.questionList = res.data.data;
  1225. this.lastCount = this.questionList.length;
  1226. if(this.needPhoto) {
  1227. this.photoPopup = true; //拍照
  1228. } else {
  1229. this.examRecord();
  1230. }
  1231. });
  1232. },
  1233. /**
  1234. * 记录总题数
  1235. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1236. */
  1237. examRecord(hasSpecial) {
  1238. let self = this
  1239. let questionList = 0;
  1240. if(!hasSpecial) {
  1241. this.questionList.forEach((item, index) => {
  1242. if(item.type == 1 || item.type == 2 || item.type == 3) {
  1243. questionList++;
  1244. }
  1245. })
  1246. } else {
  1247. questionList = this.questionList.length;
  1248. }
  1249. this.$api
  1250. .bankRecord({
  1251. chapterExamId: this.chapterId || 0,
  1252. moduleExamId: this.moduleId || 0,
  1253. examId: this.id,
  1254. goodsId: this.goodsId,
  1255. gradeId:this.gradeId,
  1256. totalQuestionNum: questionList
  1257. })
  1258. .then(res => {
  1259. this.recordId = res.data.data;
  1260. // if(self.needPhoto){
  1261. // self.photoPopup = true; //拍照
  1262. // } else {
  1263. if(this.lastTime) {
  1264. this.timer = setInterval(() => {
  1265. if (this.lastTime <= 0) {
  1266. clearInterval(this.timer);
  1267. uni.showToast({
  1268. icon:'none',
  1269. mask:true,
  1270. title:'考试时间已到,系统将自动交卷',
  1271. duration:10000
  1272. })
  1273. this.submit();
  1274. return;
  1275. }
  1276. this.lastTime--;
  1277. }, 1000);
  1278. }
  1279. // }
  1280. });
  1281. },
  1282. /**
  1283. * @param {Object} e单选点击
  1284. */
  1285. radioSelect(optionsId, bindex) {
  1286. if (this.questionList[bindex].ques) return;
  1287. this.$set(this.questionList[bindex], 'ques', optionsId);
  1288. this.isDoOver()
  1289. },
  1290. /**
  1291. * @param {Object} e案例单选点击
  1292. */
  1293. radioSelectChild(optionsId, ansIndex, bindex) {
  1294. if (this.questionList[bindex].ques[ansIndex]) return;
  1295. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  1296. this.isDoOver()
  1297. },
  1298. /**
  1299. * @param {Object} 多选点击
  1300. */
  1301. checkboxSelect(optionsId, bindex, index) {
  1302. this.$set(this.questionList[bindex].jsonStr[index], 'checked', !this.questionList[bindex].jsonStr[index].checked);
  1303. },
  1304. /**
  1305. * @param {Object} 案例多选点击
  1306. */
  1307. checkboxSelectChild(bindex, ansIndex, childIndex) {
  1308. this.$set(this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex], 'checked', !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex].checked);
  1309. },
  1310. isCheckboxChecked(arr) {
  1311. return arr.some(item => {
  1312. if (item.checked) {
  1313. return true;
  1314. }
  1315. });
  1316. },
  1317. /**
  1318. * @param {Object} 多选确认
  1319. */
  1320. checkboxSubmit(bindex) {
  1321. if (this.questionList[bindex].ques) return;
  1322. let arr = [];
  1323. this.questionList[bindex].jsonStr.forEach(item => {
  1324. if (item.checked) {
  1325. arr.push(item.optionsId);
  1326. }
  1327. });
  1328. if(!arr.length) {
  1329. uni.showToast({
  1330. title:'请选择答案',
  1331. icon:'none'
  1332. })
  1333. return;
  1334. }
  1335. this.$set(this.questionList[bindex], 'ques', arr);
  1336. this.isDoOver()
  1337. let isWrong = this.questionList[bindex].ques.some((quesItem, quesIndex) => {
  1338. return this.questionList[bindex].ques[quesIndex] != this.questionList[bindex].ans[quesIndex];
  1339. });
  1340. },
  1341. /**
  1342. * @param {Object} 案例多选确认
  1343. */
  1344. checkboxSubmitChild(bindex, ansIndex) {
  1345. if (this.questionList[bindex].ques[ansIndex]) return;
  1346. let arr = [];
  1347. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(item => {
  1348. if (item.checked) {
  1349. arr.push(item.optionsId);
  1350. }
  1351. });
  1352. if(!arr.length) {
  1353. uni.showToast({
  1354. title:'请选择答案',
  1355. icon:'none'
  1356. })
  1357. return;
  1358. }
  1359. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  1360. this.isDoOver()
  1361. },
  1362. /**
  1363. * @param {Object} index
  1364. * @param {Object} bindex
  1365. * 判断题
  1366. */
  1367. judgeSelect(index, bindex) {
  1368. if (this.questionList[bindex].ques) return;
  1369. this.$set(this.questionList[bindex], 'ques', index + '');
  1370. this.isDoOver()
  1371. },
  1372. /**
  1373. * @param {Object} ansindex
  1374. * @param {Object} childindex
  1375. * @param {Object} bindex
  1376. * 案例判断题
  1377. */
  1378. judgeSelectChild(ansindex, childindex, bindex) {
  1379. if (this.questionList[bindex].ques[ansindex]) return;
  1380. this.$set(this.questionList[bindex].ques, ansindex, childindex + '');
  1381. this.isDoOver()
  1382. },
  1383. openFooterTab() {
  1384. this.show = true;
  1385. },
  1386. hideDialog() {
  1387. this.showDialog = false;
  1388. },
  1389. changeIndex(index) {
  1390. this.current = index;
  1391. },
  1392. swiperChange(e) {
  1393. this.current = e.detail.current;
  1394. },
  1395. pdsubmit() {
  1396. let ansCount = this.questionOverNum(true); //已答题数
  1397. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1398. //没有答完
  1399. if (this.lastCount !== 0) {
  1400. this.cgType = 6;
  1401. this.showpopups = true;
  1402. return;
  1403. }
  1404. if(this.bankType == 2) {
  1405. if(this.lastTime > 0) {
  1406. let lastTime = this.countdown(this.lastTime)
  1407. uni.showModal({
  1408. title:'提示',
  1409. content:`时间还剩余${lastTime},确定交卷吗?`,
  1410. confirmText:'交卷',
  1411. cancelText:'继续答题',
  1412. success:(res) => {
  1413. if(res.confirm) { //确定
  1414. this.submit();
  1415. } else { //取消
  1416. }
  1417. }
  1418. })
  1419. return;
  1420. }
  1421. }
  1422. this.submit();
  1423. },
  1424. /**
  1425. * 交卷
  1426. */
  1427. submit() {
  1428. let score = 0; //计算总分
  1429. let reportStatus = 0;
  1430. let number = 0; //做对的题目数量
  1431. let doQuestionNum = 0; //做过的题目数量
  1432. let allScore = 0; //总分
  1433. let passScore = 0;
  1434. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  1435. let doQuestionIds = []; //做过的题目id
  1436. let rightQuestionIds = []; //做对的题目id
  1437. this.questionList.forEach((item, index) => {
  1438. passScore = item.passScore
  1439. if (item.type == 1) {
  1440. //正确
  1441. if (item.ques == item.ans) {
  1442. item.scoreResult = item.score;
  1443. score += item.score;
  1444. number++;
  1445. rightQuestionIds.push(item.questionId)
  1446. } else { //错误
  1447. item.scoreResult = 0;
  1448. doWrongQuestionIds.push(item.questionId)
  1449. }
  1450. allScore += item.score;
  1451. if (item.ques) {
  1452. doQuestionNum++;
  1453. doQuestionIds.push(item.questionId)
  1454. }
  1455. } else if (item.type == 2) {
  1456. let isRight =
  1457. item.ans &&
  1458. item.ans.every((quesItem, quesIndex) => {
  1459. if(item.ques) {
  1460. return item.ques[quesIndex] == item.ans[quesIndex];
  1461. } else {
  1462. return false;
  1463. }
  1464. });
  1465. if (isRight) {
  1466. score += item.score;
  1467. number++;
  1468. item.scoreResult = item.score;
  1469. rightQuestionIds.push(item.questionId)
  1470. } else {
  1471. let checkboxScore = item.score; //获取单题总分数
  1472. item.ques && item.ques.forEach((ques,quesIndex) => {
  1473. //选错一个全扣
  1474. if(item.ques) {
  1475. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1476. checkboxScore = 0;
  1477. }
  1478. } else {
  1479. checkboxScore = 0;
  1480. }
  1481. })
  1482. console.log(checkboxScore)
  1483. //没选错
  1484. if(checkboxScore) {
  1485. item.ans.forEach((ans,quesIndex) => {
  1486. //漏选扣一部分
  1487. if(item.ques) {
  1488. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  1489. checkboxScore = item.partScore;
  1490. }
  1491. } else {
  1492. checkboxScore = 0;
  1493. }
  1494. })
  1495. }
  1496. if(checkboxScore <= 0) { //0分
  1497. item.scoreResult = 0;
  1498. doWrongQuestionIds.push(item.questionId)
  1499. } else { //部分分
  1500. number++;
  1501. item.scoreResult = checkboxScore;
  1502. score += checkboxScore;
  1503. rightQuestionIds.push(item.questionId)
  1504. }
  1505. }
  1506. allScore += item.score;
  1507. if (item.ques && item.ques.length) {
  1508. doQuestionNum++;
  1509. doQuestionIds.push(item.questionId)
  1510. }
  1511. } else if (item.type == 3) {
  1512. if (item.ques == item.ans) {
  1513. item.scoreResult = item.score;
  1514. score += item.score;
  1515. number++;
  1516. rightQuestionIds.push(item.questionId)
  1517. } else {
  1518. item.scoreResult = 0;
  1519. doWrongQuestionIds.push(item.questionId)
  1520. }
  1521. allScore += item.score;
  1522. if (item.ques) {
  1523. doQuestionNum++;
  1524. doQuestionIds.push(item.questionId)
  1525. }
  1526. } else if (item.type == 4) {
  1527. if (item.ques && item.ques.length) {
  1528. doQuestionNum++;
  1529. }
  1530. } else if (item.type == 5) {
  1531. if (item.ques) {
  1532. doQuestionNum++;
  1533. }
  1534. }
  1535. });
  1536. //大于分及格
  1537. if(score >= passScore) {
  1538. reportStatus = 1
  1539. } else {
  1540. reportStatus = 0
  1541. }
  1542. //交卷
  1543. this.$api
  1544. .bankRecordEdit({
  1545. moduleId:this.moduleId || 0,
  1546. chapterId:this.chapterId || 0,
  1547. gradeId:this.gradeId,
  1548. examId: this.id,
  1549. goodsId: this.goodsId,
  1550. reportStatus:reportStatus,
  1551. recordId: this.recordId,
  1552. courseId:this.courseId,
  1553. // rightQuestionNum: number,
  1554. status: 1,
  1555. // doQuestionIds:doQuestionIds.join(','),
  1556. // rightQuestionIds:rightQuestionIds.join(','),
  1557. // doQuestionNum: doQuestionNum,
  1558. performance: score,
  1559. totalScore: allScore,
  1560. // examTime: parseInt(this.allTimes),
  1561. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1562. // historyExamJson: JSON.stringify(this.questionList)
  1563. })
  1564. .then(res => {
  1565. this.isSubmit = true;
  1566. if (res.data.code == 200) {
  1567. uni.showToast({
  1568. title: '交卷成功',
  1569. duration: 1000,
  1570. mask:true,
  1571. icon: 'none'
  1572. });
  1573. setTimeout(() => {
  1574. uni.redirectTo({
  1575. url: '/pages2/class/question_report?rightQuestionNum='+number+'&doWrongQuestionNum='+doWrongQuestionIds.length+'&score='+score+'&totalScore='+allScore+'&reportStatus='+reportStatus
  1576. });
  1577. }, 1000);
  1578. }
  1579. });
  1580. },
  1581. /**
  1582. * @param {Object} imgIndex
  1583. * @param {Object} bankIndex
  1584. * 删除简答图片
  1585. */
  1586. deleteImg(imgIndex, bankIndex) {
  1587. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  1588. },
  1589. /**
  1590. * @param {Object} imgIndex
  1591. * @param {Object} bankIndex
  1592. * @param {Object} ansIndex
  1593. * 删除案例题简答图片
  1594. */
  1595. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  1596. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(imgIndex, 1);
  1597. },
  1598. /**
  1599. * @param {Object} bankindex
  1600. * 选择上传图片
  1601. */
  1602. chooseImg(bankindex) {
  1603. if(this.questionList[bankindex] && this.questionList[bankindex].ansText && this.questionList[bankindex].ansText.imageList.length >= 4) {
  1604. uni.showToast({
  1605. icon:'none',
  1606. title:'最多选择4张'
  1607. })
  1608. return;
  1609. }
  1610. uni.chooseImage({
  1611. count: 1, //默认9
  1612. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  1613. sourceType: ['album', 'camera'], //从相册选择
  1614. success: res => {
  1615. let self = this;
  1616. // console.log(JSON.stringify(res.tempFilePaths));
  1617. let img = res.tempFilePaths[0];
  1618. uni.getImageInfo({
  1619. src: img,
  1620. success: async res => {
  1621. let canvasWidth = res.width; //图片原始长宽
  1622. let canvasHeight = res.height;
  1623. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1624. uni.compressImage({
  1625. src: img,
  1626. quality: 75,
  1627. width: '50%',
  1628. height: '50%',
  1629. success: async rest => {
  1630. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1631. this.questionList[bankindex].ansText.imageList.push(dir);
  1632. }
  1633. });
  1634. } else {
  1635. const dir = await self.uploadFile(img, 0);
  1636. this.questionList[bankindex].ansText.imageList.push(dir);
  1637. }
  1638. }
  1639. });
  1640. }
  1641. });
  1642. },
  1643. /**
  1644. * @param {Object} bankindex
  1645. * @param {Object} ansindex
  1646. * 案例题选择上传图片
  1647. */
  1648. chooseImgChild(bankindex, ansindex) {
  1649. uni.chooseImage({
  1650. count: 1, //默认9
  1651. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  1652. sourceType: ['album', 'camera'], //从相册选择
  1653. success: res => {
  1654. let self = this;
  1655. // console.log(JSON.stringify(res.tempFilePaths));
  1656. let img = res.tempFilePaths[0];
  1657. uni.getImageInfo({
  1658. src: img,
  1659. success: async res => {
  1660. let canvasWidth = res.width; //图片原始长宽
  1661. let canvasHeight = res.height;
  1662. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1663. uni.compressImage({
  1664. src: img,
  1665. quality: 75,
  1666. width: '50%',
  1667. height: '50%',
  1668. success: async rest => {
  1669. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1670. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir);
  1671. }
  1672. });
  1673. } else {
  1674. const dir = await self.uploadFile(img, 0);
  1675. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir);
  1676. }
  1677. }
  1678. });
  1679. }
  1680. });
  1681. },
  1682. uploadFile(options, int) {
  1683. var self = this;
  1684. return new Promise((resolve, reject) => {
  1685. var data = {
  1686. imageStatus: int
  1687. };
  1688. self.$api.aliyunpolicy(data).then(res => {
  1689. console.log(res.data, 6);
  1690. if (res.data.code != 200) {
  1691. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  1692. return;
  1693. }
  1694. var ossToken = res.data.data.resultContent;
  1695. if (ossToken.host == null || ossToken.host == undefined) {
  1696. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  1697. return;
  1698. }
  1699. uni.uploadFile({
  1700. url: ossToken.host,
  1701. name: 'file',
  1702. filePath: options,
  1703. fileType: 'image',
  1704. header: {
  1705. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  1706. },
  1707. formData: {
  1708. key: ossToken.dir,
  1709. OSSAccessKeyId: ossToken.accessid,
  1710. policy: ossToken.policy,
  1711. Signature: ossToken.signature,
  1712. callback: ossToken.callback,
  1713. success_action_status: 200
  1714. },
  1715. success: result => {
  1716. if (result.statusCode === 200) {
  1717. self.ossAvatarUrl = ossToken.dir;
  1718. resolve(ossToken.dir);
  1719. } else {
  1720. uni.showToast({
  1721. title: '上传失败',
  1722. icon: 'none'
  1723. });
  1724. return;
  1725. }
  1726. },
  1727. fail: error => {
  1728. uni.showToast({
  1729. title: '上传接口报错' + error,
  1730. icon: 'none'
  1731. });
  1732. return;
  1733. }
  1734. });
  1735. });
  1736. });
  1737. },
  1738. /**
  1739. * @param {Object} type
  1740. * @param {Object} bankindex
  1741. * 简答题答案确认
  1742. */
  1743. submitAns(bankindex) {
  1744. console.log(this.questionList[bankindex]);
  1745. if (!this.questionList[bankindex].ansText.text && !this.questionList[bankindex].ansText.imageList.length) {
  1746. uni.showToast({
  1747. title: '请输入内容或上传图片',
  1748. duration: 2000,
  1749. icon: 'none'
  1750. });
  1751. return;
  1752. }
  1753. this.$set(this.questionList[bankindex], 'ques', {
  1754. imageList: this.questionList[bankindex].ansText.imageList,
  1755. text: this.questionList[bankindex].ansText.text
  1756. });
  1757. this.isDoOver()
  1758. },
  1759. /**
  1760. * @param {Object} bankindex
  1761. * @param {Object} ansindex
  1762. * 案例题简答答案确认
  1763. */
  1764. submitAnsChild(bankindex, ansindex) {
  1765. if (!this.questionList[bankindex].jsonStr[ansindex].ansText.text && !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length) {
  1766. uni.showToast({
  1767. title: '请输入内容或上传图片',
  1768. duration: 2000,
  1769. icon: 'none'
  1770. });
  1771. return;
  1772. }
  1773. this.$set(this.questionList[bankindex].ques, ansindex, {
  1774. imageList: this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  1775. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text
  1776. });
  1777. this.isDoOver()
  1778. },
  1779. isRight(item, index) {
  1780. //单选
  1781. if (this.questionList[index].ques) {
  1782. if (item.type == 1) {
  1783. return this.questionList[index].ques == this.questionList[index].ans;
  1784. //多选
  1785. } else if (item.type == 2) {
  1786. //每一项都相等
  1787. return this.questionList[index].ques.every((item, i) => {
  1788. return item == this.questionList[index].ans[i];
  1789. });
  1790. //判断
  1791. } else if (item.type == 3) {
  1792. return this.questionList[index].ques == this.questionList[index].ans;
  1793. // } else if (item.type == 5) {
  1794. // if(this.questionList[index].ques.text){
  1795. // return true
  1796. // }else{
  1797. // return false
  1798. // }
  1799. } else {
  1800. return false;
  1801. }
  1802. } else {
  1803. return false;
  1804. }
  1805. },
  1806. right(bankIndex, ansIndex, option) {
  1807. if (this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1808. if (this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 || this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) != -1) {
  1809. return true;
  1810. } else {
  1811. return false;
  1812. }
  1813. } else {
  1814. return false;
  1815. }
  1816. },
  1817. wrong(bankIndex, ansIndex, option) {
  1818. if (this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1819. if (this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 && this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) == -1) {
  1820. return true;
  1821. } else {
  1822. return false;
  1823. }
  1824. } else {
  1825. return false;
  1826. }
  1827. },
  1828. isWrong(item, index) {
  1829. if (this.questionList[index].ques) {
  1830. //单选
  1831. if (item.type == 1) {
  1832. return this.questionList[index].ques != this.questionList[index].ans;
  1833. //多选
  1834. } else if (item.type == 2) {
  1835. //每一项都相等
  1836. return this.questionList[index].ques.some((item, index) => {
  1837. return item != this.questionList[index].ans;
  1838. });
  1839. //判断
  1840. } else if (item.type == 3) {
  1841. return this.questionList[index].ques != this.questionList[index].ans;
  1842. } else {
  1843. return false;
  1844. }
  1845. } else {
  1846. return false;
  1847. }
  1848. },
  1849. tabSelect(index, bankindex) {
  1850. this.$set(this.questionList[bankindex], 'current', index);
  1851. }
  1852. }
  1853. };
  1854. </script>
  1855. <style lang="scss" scoped>
  1856. .photoBox {
  1857. background-color: #FFFFFF;
  1858. border-radius: 32px 32px 0px 0px;
  1859. .photoTop {
  1860. height: 74upx;
  1861. display: flex;
  1862. align-items: center;
  1863. justify-content: space-between;
  1864. padding: 0upx 38upx;
  1865. .sqzz {
  1866. width: 28upx;
  1867. height: 28upx;
  1868. display: flex;
  1869. align-items: center;
  1870. justify-content: center;
  1871. }
  1872. .centersq {
  1873. color: #333;
  1874. font-size: 30upx;
  1875. font-weight: 500;
  1876. }
  1877. }
  1878. .photoCenter {
  1879. width: 750upx;
  1880. height: 979upx;
  1881. position: relative;
  1882. .custom {
  1883. width: 750upx;
  1884. height: 979upx;
  1885. position: absolute;
  1886. z-index: 1000;
  1887. top: 0;
  1888. left: 0;
  1889. image {
  1890. width: 100%;
  1891. height: 100%;
  1892. }
  1893. }
  1894. }
  1895. .btnResult {
  1896. height: 100rpx;
  1897. width: 100%;
  1898. background-color: #07c160;
  1899. text-align: center;
  1900. line-height: 100upx;
  1901. color: #fff;
  1902. font-size: 32upx;
  1903. font-weight: bold;
  1904. }
  1905. }
  1906. .navbar {
  1907. position: relative;
  1908. z-index: 20000;
  1909. }
  1910. .questionBank {
  1911. width:100%;
  1912. height:100vh;
  1913. display: flex;
  1914. flex-direction: column;
  1915. }
  1916. .swiper {
  1917. width: 100%;
  1918. flex:1;
  1919. }
  1920. .lisSty {
  1921. margin-bottom: 16rpx;
  1922. display: flex;
  1923. .flex_auto {
  1924. flex: 1;
  1925. }
  1926. }
  1927. .activeTI {
  1928. vertical-align: middle;
  1929. display: inline-block;
  1930. border: 1rpx solid #eee;
  1931. border-radius: 50rpx;
  1932. height: 48rpx;
  1933. line-height: 46rpx;
  1934. text-align: center;
  1935. width: 48rpx;
  1936. margin-right: 15rpx;
  1937. color: #666;
  1938. font-size: 30rpx;
  1939. &.right {
  1940. color: #fff;
  1941. background: #36C75A;
  1942. }
  1943. &.wrong {
  1944. color: #fff;
  1945. background: #FF3B30;
  1946. }
  1947. &.checked {
  1948. color: #fff;
  1949. background: #007AFF;
  1950. }
  1951. }
  1952. .submit_checkbox {
  1953. position:fixed;
  1954. left:0;
  1955. right:0;
  1956. bottom:120rpx;
  1957. margin: 20rpx auto;
  1958. width: 526rpx;
  1959. height: 80rpx;
  1960. background: rgba(0, 122, 255, 1);
  1961. color: #fff;
  1962. text-align: center;
  1963. line-height: 80rpx;
  1964. font-size: 30rpx;
  1965. border-radius: 40rpx;
  1966. &.disabled {
  1967. opacity: 0.6;
  1968. }
  1969. }
  1970. .titles {
  1971. overflow: hidden;
  1972. margin-bottom: 24rpx;
  1973. }
  1974. .titBox {
  1975. padding: 41rpx 25rpx 24rpx 25rpx;
  1976. }
  1977. .titBox_title {
  1978. padding: 21rpx;
  1979. }
  1980. .tabs {
  1981. margin: 10rpx;
  1982. display: flex;
  1983. .tab {
  1984. margin: 0 4rpx;
  1985. padding:10rpx 13rpx;
  1986. text-align: center;
  1987. color: #007aff;
  1988. font-size: 28rpx;
  1989. border-radius: 16rpx;
  1990. background:#fff;
  1991. &.current {
  1992. color: #fff;
  1993. background: #007aff;
  1994. }
  1995. }
  1996. }
  1997. .ans {
  1998. margin: 8rpx 8rpx 8rpx;
  1999. .ans_input {
  2000. border-radius: 16rpx;
  2001. background: #fff;
  2002. .top {
  2003. border-bottom: 1rpx solid #eeeeee;
  2004. padding: 16rpx;
  2005. display: flex;
  2006. align-items: center;
  2007. .icon {
  2008. margin-right: 20rpx;
  2009. width: 40rpx;
  2010. height: 38rpx;
  2011. }
  2012. .progress {
  2013. flex: 1;
  2014. }
  2015. .submit {
  2016. width: 168rpx;
  2017. height: 48rpx;
  2018. line-height: 48rpx;
  2019. text-align: center;
  2020. color: #fff;
  2021. font-size: 30rpx;
  2022. background: #007aff;
  2023. border-radius: 24rpx;
  2024. &.disabled {
  2025. opacity: 0.6;
  2026. }
  2027. }
  2028. }
  2029. .textarea {
  2030. textarea {
  2031. width: 100%;
  2032. height: 287rpx;
  2033. padding: 10rpx;
  2034. }
  2035. }
  2036. .imgs {
  2037. overflow: hidden;
  2038. display: flex;
  2039. width: 100%;
  2040. .img {
  2041. width: 104rpx;
  2042. height: 104rpx;
  2043. border-radius: 8rpx;
  2044. position: relative;
  2045. margin: 20rpx;
  2046. text {
  2047. position: absolute;
  2048. right: -15rpx;
  2049. top: -15rpx;
  2050. width: 30rpx;
  2051. height: 30rpx;
  2052. text-align: center;
  2053. line-height: 30rpx;
  2054. color: #fff;
  2055. background: #FF3B30;
  2056. border-radius: 50%;
  2057. }
  2058. image {
  2059. width: 100%;
  2060. height: 100%;
  2061. }
  2062. }
  2063. }
  2064. }
  2065. .ans_submit {
  2066. padding: 16rpx;
  2067. border-radius: 16rpx;
  2068. background: #fff;
  2069. .imgs {
  2070. overflow: hidden;
  2071. display: flex;
  2072. width: 100%;
  2073. .img {
  2074. width: 104rpx;
  2075. height: 104rpx;
  2076. border-radius: 8rpx;
  2077. position: relative;
  2078. margin: 20rpx;
  2079. image {
  2080. width: 100%;
  2081. height: 100%;
  2082. }
  2083. }
  2084. }
  2085. }
  2086. }
  2087. .leftLetters {
  2088. display: flex;
  2089. align-items: center;
  2090. width: 220rpx;
  2091. .btnType {
  2092. padding: 5rpx 10rpx;
  2093. border: 1rpx solid #007aff;
  2094. border-radius: 10rpx;
  2095. background-color: rgba(0, 122, 255, 0.1);
  2096. font-size: 28rpx;
  2097. color: #007aff;
  2098. margin-right: 15rpx;
  2099. }
  2100. }
  2101. .firstLetter {
  2102. display: flex;
  2103. justify-content: space-between;
  2104. align-items: center;
  2105. margin-bottom: 30rpx;
  2106. }
  2107. .popupView {
  2108. height: 100%;
  2109. padding-bottom: 100rpx;
  2110. .popupTops {
  2111. height: 77rpx;
  2112. border-bottom: 1rpx solid #eee;
  2113. text-align: center;
  2114. line-height: 77rpx;
  2115. font-size: 24rpx;
  2116. color: #999;
  2117. position: relative;
  2118. .topIcon {
  2119. position: absolute;
  2120. top: 10rpx;
  2121. left: 50%;
  2122. transform: translateX(-50%);
  2123. width: 80rpx;
  2124. height: 8rpx;
  2125. background-color: #999;
  2126. border-radius: 4rpx;
  2127. }
  2128. }
  2129. .popupContent {
  2130. }
  2131. }
  2132. .pageContent {
  2133. position: relative;
  2134. background-color: #eaeef1;
  2135. height: 100%;
  2136. padding-top: 8rpx;
  2137. padding-bottom: 100rpx;
  2138. overflow-y: scroll;
  2139. }
  2140. .pad_8 {
  2141. background-color: #fff;
  2142. margin: 0rpx 8rpx 8rpx;
  2143. border-radius: 16rpx;
  2144. &.no-margin {
  2145. margin-top:-16rpx;
  2146. border-radius: 0 0 16rpx 16rpx;
  2147. }
  2148. }
  2149. .answer {
  2150. height: 80rpx;
  2151. line-height: 80rpx;
  2152. padding: 0rpx 24rpx;
  2153. display: flex;
  2154. align-items: center;
  2155. justify-content: space-between;
  2156. color: #666;
  2157. font-size: 30rpx;
  2158. }
  2159. .footer_btn {
  2160. background-color: #fff;
  2161. z-index: 10078;
  2162. position: fixed;
  2163. bottom: 0rpx;
  2164. display: flex;
  2165. align-items: center;
  2166. justify-content: space-between;
  2167. width: 100%;
  2168. height: 98rpx;
  2169. padding: 0rpx 38rpx;
  2170. border-top: 1rpx solid #eee;
  2171. .flex_center {
  2172. flex:1;
  2173. display: flex;
  2174. justify-content: center;
  2175. align-items: center;
  2176. flex-direction: column;
  2177. margin:0 200rpx;
  2178. font-size: 24rpx;
  2179. color: #999999;
  2180. .up-icon {
  2181. margin-bottom:18rpx;
  2182. width:100%;
  2183. display: flex;
  2184. justify-content: center;
  2185. image {
  2186. width:58rpx;
  2187. height:21rpx;
  2188. }
  2189. }
  2190. }
  2191. .collect {
  2192. visibility: hidden;
  2193. width:100rpx;
  2194. &.show {
  2195. visibility: visible;
  2196. }
  2197. >view {
  2198. display: flex;
  2199. flex-direction: column;
  2200. align-items: center;
  2201. justify-content: center;
  2202. image {
  2203. width:32rpx;
  2204. height:32rpx;
  2205. margin-bottom:6rpx;
  2206. }
  2207. view {
  2208. font-size: 24rpx;
  2209. color: #999999;
  2210. }
  2211. }
  2212. }
  2213. }
  2214. .boxSty {
  2215. padding: 44rpx 41rpx 0rpx;
  2216. }
  2217. .liListSty {
  2218. border: 1rpx solid #eeeeee;
  2219. width: 88rpx;
  2220. height: 88rpx;
  2221. border-radius: 32rpx;
  2222. text-align: center;
  2223. line-height: 88rpx;
  2224. color: #333;
  2225. font-size: 32rpx;
  2226. float: left;
  2227. margin: 20rpx 23rpx;
  2228. &.isRight {
  2229. border: 1rpx solid #eeeeee;
  2230. color: #fff;
  2231. background: #36C75A;
  2232. }
  2233. &.isWrong {
  2234. border: 1rpx solid #eeeeee;
  2235. color: #fff;
  2236. background: #FF3B30;
  2237. }
  2238. }
  2239. .answerInfos {
  2240. padding: 25rpx 25rpx 25rpx 23rpx;
  2241. }
  2242. .answerTitle {
  2243. margin-bottom: 28rpx;
  2244. color: #666;
  2245. font-size: 30rpx;
  2246. }
  2247. .answerContent {
  2248. font-size: 30rpx;
  2249. color: #666;
  2250. }
  2251. .textChild {
  2252. display: inline-block;
  2253. vertical-align: middle;
  2254. }
  2255. .dialog {
  2256. position: fixed;
  2257. left: 0;
  2258. top: 0;
  2259. width: 100%;
  2260. height: 100%;
  2261. background-color: rgba(0, 0, 0, 0.8);
  2262. display: flex;
  2263. flex-direction: column;
  2264. align-items: center;
  2265. justify-content: center;
  2266. z-index: 20000;
  2267. .text {
  2268. font-size: 32rpx;
  2269. color: #ffffff;
  2270. text-align: center;
  2271. }
  2272. .btn {
  2273. width: 242rpx;
  2274. height: 82rpx;
  2275. border: 2rpx solid #ffffff;
  2276. border-radius: 16rpx;
  2277. text-align: center;
  2278. line-height: 82rpx;
  2279. margin: 41rpx auto;
  2280. color: #fff;
  2281. font-size: 32rpx;
  2282. }
  2283. }
  2284. .dialog-arrow {
  2285. padding-top:124rpx;
  2286. position: fixed;
  2287. left: 0;
  2288. top: 0;
  2289. width: 100%;
  2290. height: 100%;
  2291. background-color: rgba(0, 0, 0, 0.8);
  2292. z-index: 20000;
  2293. .pointer {
  2294. margin-left:87rpx;
  2295. display: block;
  2296. width:95rpx;
  2297. height:98rpx;
  2298. }
  2299. .text {
  2300. padding-left:177rpx;
  2301. font-size: 32rpx;
  2302. color: #ffffff;
  2303. }
  2304. .btn {
  2305. width: 242rpx;
  2306. height: 82rpx;
  2307. border: 2rpx solid #ffffff;
  2308. border-radius: 16rpx;
  2309. text-align: center;
  2310. line-height: 82rpx;
  2311. margin: 500rpx auto 0;
  2312. color: #fff;
  2313. font-size: 32rpx;
  2314. }
  2315. }
  2316. .dialog_wrap {
  2317. position: fixed;
  2318. left: 0;
  2319. top: 0;
  2320. width: 100%;
  2321. height: 100%;
  2322. z-index: 9999999999;
  2323. .bg {
  2324. background: rgba(0, 0, 0, 0.3);
  2325. position: absolute;
  2326. left: 0;
  2327. top: 0;
  2328. width: 100%;
  2329. height: 100%;
  2330. }
  2331. .dialog {
  2332. position: absolute;
  2333. left: 50%;
  2334. top: 50%;
  2335. transform: translate3D(-50%, -50%, 0);
  2336. width: 640rpx;
  2337. height: 439rpx;
  2338. background: #ffffff;
  2339. border-radius: 24rpx;
  2340. .title {
  2341. font-size: 30rpx;
  2342. font-weight: bold;
  2343. color: #333333;
  2344. line-height: 48rpx;
  2345. text-align: center;
  2346. margin-top: 40rpx;
  2347. }
  2348. .content {
  2349. margin: 35rpx 35rpx 0;
  2350. font-size: 30rpx;
  2351. color: #666666;
  2352. line-height: 48rpx;
  2353. }
  2354. .btns {
  2355. margin-top: 35rpx;
  2356. display: flex;
  2357. align-items: center;
  2358. justify-content: center;
  2359. .btn {
  2360. width: 200rpx;
  2361. height: 80rpx;
  2362. line-height: 80rpx;
  2363. text-align: center;
  2364. background: #f5f5f5;
  2365. border-radius: 40rpx;
  2366. font-size: 30rpx;
  2367. color: rgba(0, 122, 255, 1);
  2368. background: #f5f5f5;
  2369. margin: 0 20rpx;
  2370. &.active {
  2371. color: #f5f5f5;
  2372. background: rgba(0, 122, 255, 1);
  2373. }
  2374. }
  2375. }
  2376. }
  2377. }
  2378. .popboxs {
  2379. width: 100%;
  2380. height: 100%;
  2381. display: flex;
  2382. flex-direction: column;
  2383. align-items: center;
  2384. }
  2385. .classTops {
  2386. flex-shrink: 0;
  2387. padding: 39rpx 0rpx 4rpx;
  2388. font-weight: bold;
  2389. color: #333;
  2390. font-size: 30rpx;
  2391. }
  2392. .textStys {
  2393. width: 100%;
  2394. flex: 1;
  2395. padding: 36rpx;
  2396. }
  2397. .classFootsty {
  2398. flex-shrink: 0;
  2399. display: flex;
  2400. align-items: center;
  2401. justify-content: center;
  2402. padding: 10rpx 0rpx 40rpx;
  2403. .btnsty {
  2404. width: 200rpx;
  2405. height: 80rpx;
  2406. border-radius: 40rpx;
  2407. font-weight: bold;
  2408. font-size: 30rpx;
  2409. text-align: center;
  2410. line-height: 80rpx;
  2411. }
  2412. .btns1 {
  2413. background-color: #f5f5f5;
  2414. color: #007aff;
  2415. }
  2416. .btns2 {
  2417. margin-left: 40rpx;
  2418. background-color: #007aff;
  2419. color: #ffffff;
  2420. }
  2421. }
  2422. </style>