questionBank.vue 92 KB

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