questionBank.vue 93 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238
  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 == 1 ? 0 : 1) || index != bank.ans),
  188. wrong: bankType == 1 && (index == (bank.ques == 1 ? 0 : 1) && bank.ques != bank.ans),
  189. user_choose: bankType == 2 && (index == (bank.ques == 1 ? 0 : 1)),
  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 == 1 ? 0 : 1] }}</view>
  204. <view>我的答案:{{ ast[bank.ques == 1 ? 0 : 1] }}</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] == 1 ? 0 : 1) ||
  500. childindex != bank.ans[ansIndex]),
  501. wrong:
  502. bankType == 1 && (childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) &&
  503. bank.ques[ansIndex] != bank.ans[ansIndex]),
  504. user_choose: bankType == 2 && (childindex == (bank.ques[ansIndex] == 1 ? 0 : 1)),
  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] == 1 ? 0 : 1] }}</view>
  519. <view>我的答案:{{ ast[bank.ques[ansIndex] == 1 ? 0 : 1] }}</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. sectionId: 0,
  832. showArrow: false, //退出提示
  833. isFromVideo: "",
  834. gradeId: "",
  835. courseId: 0,
  836. cgType: 0, //对应设计稿弹窗编码,
  837. avatarUrl: "",
  838. ossAvatarUrl: "",
  839. goodsDetail: {},
  840. isTakePhoto: false,
  841. orderGoodsId: 0,
  842. isTaking: true, //是否正在拍照
  843. needPhoto: false, //是否需要拍照
  844. examType: 0, // 3-模块,1-章,2-节
  845. compareFaceData: 0, // 拍照匹配相似度
  846. };
  847. },
  848. async onLoad(option) {
  849. this.examType = option.type
  850. this.id = option.id;
  851. this.goodsId = option.goodsid;
  852. this.chapterId = option.chapterId;
  853. this.courseId = option.courseId;
  854. this.sectionId = option.sectionId
  855. this.moduleId = option.moduleId;
  856. this.isFromVideo = option.isFromVideo || "";
  857. this.gradeId = option.gradeId || "";
  858. this.orderGoodsId = Number(option.orderGoodsId);
  859. let isBack = option.isback;
  860. let showDialog = uni.getStorageSync("showDialog");
  861. if (showDialog) {
  862. this.showDialog = false;
  863. } else {
  864. this.showDialog = true;
  865. uni.setStorageSync("showDialog", "1");
  866. }
  867. //考试时候用手势或者返回键 被迫返回做题
  868. if (isBack) {
  869. console.log(getApp());
  870. let app = getApp();
  871. let globalData = app.globalData;
  872. for (var k in globalData.bankData) {
  873. this[k] = globalData.bankData[k];
  874. }
  875. this.showArrow = true;
  876. //需要拍没拍过直接弹出摄像头
  877. if (this.needPhoto && !this.isTakePhoto) {
  878. this.photoPopup = true;
  879. this.isTaking = true;
  880. this.avatarUrl = "";
  881. } else {
  882. //不需要拍照
  883. if (this.lastTime) {
  884. this.timer = setInterval(() => {
  885. if (this.lastTime <= 0) {
  886. clearInterval(this.timer);
  887. uni.showToast({
  888. icon: "none",
  889. mask: true,
  890. title: "考试时间已到,系统将自动交卷",
  891. duration: 10000,
  892. });
  893. this.submit();
  894. return;
  895. }
  896. this.lastTime--;
  897. }, 1000);
  898. }
  899. }
  900. } else {
  901. await this.getGoodsDetail();
  902. // 请求题目列表
  903. this.goodsQuestionList();
  904. this.bankExam();
  905. }
  906. },
  907. onUnload() {
  908. if (this.isSubmit) {
  909. clearInterval(this.timer);
  910. return;
  911. }
  912. if (this.needPhoto && !this.isTakePhoto) {
  913. return;
  914. }
  915. //考试试卷 阻止ios手势返回,自动跳回答题页
  916. if (this.needBack) {
  917. let app = getApp();
  918. app.globalData.bankData = this.$data;
  919. clearInterval(this.timer);
  920. uni.navigateTo({
  921. url:
  922. "/pages2/class/questionBank?id=" +
  923. this.id +
  924. "&goodsid=" +
  925. this.goodsId +
  926. "&isback=true&orderGoodsId=" +
  927. this.orderGoodsId,
  928. });
  929. } else {
  930. //点击返回按钮确认允许退出,交卷
  931. clearInterval(this.timer);
  932. this.examRecordEdit();
  933. }
  934. },
  935. methods: {
  936. getGoodsDetail() {
  937. return new Promise((resolve) => {
  938. let self = this;
  939. this.$api.goodsDetail(this.goodsId).then((res) => {
  940. self.goodsDetail = res.data.data;
  941. if (self.goodsDetail.goodsPhotoExamConfig) {
  942. let goodsPhotoExamConfig = JSON.parse(
  943. self.goodsDetail.goodsPhotoExamConfig
  944. );
  945. if (goodsPhotoExamConfig.photograph > 0) {
  946. self.needPhoto = true;
  947. }
  948. }
  949. resolve();
  950. });
  951. });
  952. },
  953. reTake() {
  954. this.isTaking = true;
  955. },
  956. postStudyRecord() {
  957. let self = this;
  958. let data = {
  959. photo: self.ossAvatarUrl,
  960. recordId: self.recordId,
  961. };
  962. if (this.ossAvatarUrl) {
  963. data.similarity = this.compareFaceData // 相似度
  964. }
  965. // console.log(data, "拍照提交");
  966. this.$api.studyExamPhotoRecord(data).then((res) => {
  967. // console.log(res, "拍照提交结果");
  968. if (res.data.code != 200) {
  969. uni.showToast({
  970. icon: "none",
  971. mask: true,
  972. title: res.data.msg,
  973. duration: 10000,
  974. });
  975. return;
  976. }
  977. self.ossAvatarUrl = "";
  978. self.isTakePhoto = true;
  979. //拍照
  980. if (this.lastTime) {
  981. this.timer = setInterval(() => {
  982. if (this.lastTime <= 0) {
  983. clearInterval(this.timer);
  984. uni.showToast({
  985. icon: "none",
  986. mask: true,
  987. title: "考试时间已到,系统将自动交卷",
  988. duration: 10000,
  989. });
  990. this.submit();
  991. return;
  992. }
  993. this.lastTime--;
  994. }, 1000);
  995. }
  996. });
  997. },
  998. uploadFile(options, int) {
  999. var self = this;
  1000. return new Promise((resolve, reject) => {
  1001. var data = {
  1002. imageStatus: int,
  1003. gradeId: this.gradeId,
  1004. };
  1005. self.$api.aliyunpolicy(data).then((res) => {
  1006. if (res.data.code != 200) {
  1007. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  1008. return;
  1009. }
  1010. var ossToken = res.data.data.resultContent;
  1011. if (ossToken.host == null || ossToken.host == undefined) {
  1012. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  1013. return;
  1014. }
  1015. uni.uploadFile({
  1016. url: ossToken.host,
  1017. name: "file",
  1018. filePath: options,
  1019. fileType: "image",
  1020. header: {
  1021. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1022. },
  1023. formData: {
  1024. key: ossToken.dir,
  1025. OSSAccessKeyId: ossToken.accessid,
  1026. policy: ossToken.policy,
  1027. Signature: ossToken.signature,
  1028. callback: ossToken.callback,
  1029. success_action_status: 200,
  1030. },
  1031. success: (result) => {
  1032. // if (result.statusCode === 200) {
  1033. self.ossAvatarUrl = ossToken.dir;
  1034. resolve(ossToken.dir);
  1035. // } else {
  1036. // uni.showToast({
  1037. // title: "上传失败",
  1038. // icon: "none",
  1039. // });
  1040. // return;
  1041. // }
  1042. },
  1043. fail: (error) => {
  1044. uni.showToast({
  1045. title: "上传接口报错" + error,
  1046. icon: "none",
  1047. });
  1048. return;
  1049. },
  1050. });
  1051. });
  1052. });
  1053. },
  1054. imageInfos() {
  1055. var self = this;
  1056. return new Promise((resolve, reject) => {
  1057. uni.getImageInfo({
  1058. src: self.avatarUrl,
  1059. success: async (res) => {
  1060. let canvasWidth = res.width; //图片原始长宽
  1061. let canvasHeight = res.height;
  1062. if (canvasWidth > 2000 || canvasHeight > 2000) {
  1063. uni.compressImage({
  1064. src: self.avatarUrl,
  1065. quality: 75,
  1066. width: "35%",
  1067. height: "35%",
  1068. success: async (rest) => {
  1069. const waitUpload = await self.uploadFile(
  1070. rest.tempFilePath,
  1071. 0
  1072. );
  1073. resolve(waitUpload);
  1074. },
  1075. });
  1076. } else if (canvasWidth > 1000 || canvasHeight > 1000) {
  1077. uni.compressImage({
  1078. src: self.avatarUrl,
  1079. quality: 75,
  1080. width: "50%",
  1081. height: "50%",
  1082. success: async (rest) => {
  1083. const waitUpload = await self.uploadFile(
  1084. rest.tempFilePath,
  1085. 0
  1086. );
  1087. resolve(waitUpload);
  1088. },
  1089. });
  1090. } else {
  1091. console.log("无需压缩");
  1092. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  1093. resolve(waitUpload);
  1094. }
  1095. },
  1096. });
  1097. });
  1098. },
  1099. /**
  1100. * 人脸匹配
  1101. */
  1102. faceRecognition() {
  1103. return new Promise((resolve) => {
  1104. let fileSystem = uni.getFileSystemManager();
  1105. fileSystem.readFile({
  1106. filePath: `${this.avatarUrl}`,
  1107. encoding: "base64",
  1108. position: 0,
  1109. success: (res) => {
  1110. let base64 = "data:image/jpg;base64," + res.data;
  1111. this.$api
  1112. .faceCertificationCompareFace({
  1113. imageA: base64,
  1114. orderGoodsId: this.orderGoodsId,
  1115. gradeId: this.gradeId,
  1116. })
  1117. .then((res) => {
  1118. resolve(res.data.data);
  1119. });
  1120. },
  1121. fail(err) {
  1122. console.error(err, "err");
  1123. },
  1124. });
  1125. });
  1126. },
  1127. async submitPhoto() {
  1128. let compareFaceData = await this.faceRecognition();
  1129. this.compareFaceData = compareFaceData
  1130. if (compareFaceData == 0) {
  1131. uni.showToast({
  1132. title: "人脸匹配不通过,请重新拍照上传",
  1133. icon: "none",
  1134. duration: 2000,
  1135. });
  1136. setTimeout(() => {
  1137. this.uploadLock = false;
  1138. this.openPhoto();
  1139. }, 2000);
  1140. return;
  1141. }
  1142. if (compareFaceData >= 80) {
  1143. const waitYS = await this.imageInfos();
  1144. this.postStudyRecord(); //提交记录
  1145. this.photoPopup = false;
  1146. }
  1147. },
  1148. //确认拍照
  1149. takePhoto() {
  1150. var self = this;
  1151. const ctx = uni.createCameraContext();
  1152. ctx.takePhoto({
  1153. quality: "high",
  1154. success: (res) => {
  1155. console.log(res.tempImagePath);
  1156. self.avatarUrl = res.tempImagePath;
  1157. // self.submitPhoto();
  1158. this.isTaking = false;
  1159. // self.photoPopup = false;
  1160. },
  1161. fail: (err) => {
  1162. console.log(err);
  1163. },
  1164. });
  1165. },
  1166. /**
  1167. * 是否有上传图片
  1168. */
  1169. hasImgs(bank) {
  1170. return bank.ansText.imageList.length == 0;
  1171. },
  1172. /**
  1173. * 获取试卷类型2考试,1练习
  1174. */
  1175. bankExam() {
  1176. this.$api.bankExam(this.id).then((res) => {
  1177. this.bankType = res.data.data.doType;
  1178. if (this.bankType == 2) {
  1179. this.needBack = true;
  1180. }
  1181. });
  1182. },
  1183. /**
  1184. * 点击后退按钮
  1185. */
  1186. clickLeft() {
  1187. //需要拍照没有拍直接返回
  1188. if (this.needPhoto && !this.isTakePhoto) {
  1189. this.isSubmit = true;
  1190. uni.navigateBack({
  1191. delta: 1,
  1192. });
  1193. return;
  1194. }
  1195. if (this.bankType == 1) {
  1196. let ansCount = this.questionOverNum(); //已答题数
  1197. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1198. //所有题目答完
  1199. if (this.lastCount == 0) {
  1200. // this.testOver = true;
  1201. this.cgType = 7;
  1202. //未答完
  1203. } else {
  1204. this.cgType = 8;
  1205. // this.isLastCount = true;
  1206. }
  1207. this.showpopups = true;
  1208. } else if (this.bankType == 2) {
  1209. let ansCount = this.questionOverNum(); //已答题数
  1210. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1211. //所有题目答完
  1212. if (this.lastCount == 0) {
  1213. this.testOver = true;
  1214. //未答完
  1215. } else {
  1216. this.isLastCount = true;
  1217. }
  1218. }
  1219. },
  1220. /**
  1221. * 返回上一页
  1222. */
  1223. backPages() {
  1224. this.needBack = false;
  1225. uni.navigateBack({
  1226. delta: 1,
  1227. });
  1228. },
  1229. /**
  1230. * 获取已经回答的题目数
  1231. * hasSpecail (是否包含简答和案例)
  1232. */
  1233. questionOverNum(hasSpecail) {
  1234. let count = 0;
  1235. this.questionList.forEach((item) => {
  1236. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1237. if (item.ques) {
  1238. count++;
  1239. }
  1240. } else if (item.type == 4) {
  1241. //案例题
  1242. if (hasSpecail) {
  1243. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1244. if (
  1245. jsonItem.type == 1 ||
  1246. jsonItem.type == 2 ||
  1247. jsonItem.type == 3
  1248. ) {
  1249. if (item.ques[indexs]) {
  1250. return true;
  1251. } else {
  1252. return false;
  1253. }
  1254. } else if (jsonItem.type == 5) {
  1255. console.log(jsonItem, 111);
  1256. if (
  1257. item.ques[indexs] &&
  1258. (item.ques[indexs].text.length ||
  1259. item.ques[indexs].imageList.length)
  1260. ) {
  1261. return true;
  1262. } else {
  1263. return false;
  1264. }
  1265. }
  1266. });
  1267. if (isOver) {
  1268. count++;
  1269. console.log(item, 444);
  1270. }
  1271. }
  1272. } else if (item.type == 5) {
  1273. //简答题
  1274. if (hasSpecail) {
  1275. if (
  1276. item.ques &&
  1277. (item.ques.text.length || item.ques.imageList.length)
  1278. ) {
  1279. count++;
  1280. }
  1281. }
  1282. }
  1283. });
  1284. return count;
  1285. },
  1286. /**
  1287. * 是否做完所有题目
  1288. */
  1289. isDoOver() {
  1290. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  1291. if (this.questionList.length == questionOverNum) {
  1292. //全部做完弹窗
  1293. this.cgType = 9;
  1294. this.showpopups = true;
  1295. }
  1296. },
  1297. /**
  1298. * 暂不交卷
  1299. */
  1300. noSubmit() {
  1301. //设为允许退出页面
  1302. this.needBack = false;
  1303. uni.navigateBack({
  1304. delta: 1,
  1305. });
  1306. },
  1307. /**
  1308. * 不离开
  1309. */
  1310. noLeave() {
  1311. this.isLastCount = false;
  1312. },
  1313. /**
  1314. * 立即离开并交卷
  1315. */
  1316. leaveNow() {
  1317. this.isSubmit = true;
  1318. uni.navigateBack({
  1319. delta: 1,
  1320. });
  1321. //需要拍照没有拍,返回不扣次数
  1322. if (this.needPhoto && !this.isTakePhoto) {
  1323. return;
  1324. }
  1325. let score = 0; //计算总分
  1326. let reportStatus = 0;
  1327. let number = 0;
  1328. let doQuestionIds = []; //做过的题目id
  1329. let doQuestionNum = 0; //做过的题目数量
  1330. let passScore = 0;
  1331. let allScore = 0; //总分
  1332. this.questionList.forEach((item, index) => {
  1333. passScore = item.passScore;
  1334. if (item.type == 1) {
  1335. if (item.ques == item.ans) {
  1336. item.scoreResult = item.score;
  1337. score += item.score;
  1338. number++;
  1339. } else {
  1340. item.scoreResult = 0;
  1341. }
  1342. if (item.ques) {
  1343. doQuestionNum++;
  1344. doQuestionIds.push(item.questionId);
  1345. }
  1346. allScore += item.score;
  1347. } else if (item.type == 2) {
  1348. let isRight =
  1349. item.ques &&
  1350. item.ques.every((quesItem, quesIndex) => {
  1351. return item.ques[quesIndex] == item.ans[quesIndex];
  1352. });
  1353. if (isRight) {
  1354. //全对
  1355. item.scoreResult = item.score;
  1356. score += item.score;
  1357. number++;
  1358. } else {
  1359. let hasPart = false;
  1360. let checkboxScore = 1; //获取单题总分数
  1361. item.ques &&
  1362. item.ques.forEach((ques, quesIndex) => {
  1363. //选错一个全扣
  1364. if (item.ques) {
  1365. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1366. checkboxScore = 0;
  1367. }
  1368. } else {
  1369. checkboxScore = 0;
  1370. }
  1371. });
  1372. //没选错
  1373. if (checkboxScore) {
  1374. checkboxScore = 0;
  1375. item.ans.forEach((ans, quesIndex) => {
  1376. //漏选扣一部分,对n题给n X partScore 分
  1377. if (item.ques) {
  1378. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  1379. checkboxScore += item.partScore;
  1380. hasPart = true;
  1381. }
  1382. } else {
  1383. checkboxScore = 0;
  1384. }
  1385. });
  1386. }
  1387. if (!hasPart) {
  1388. item.scoreResult = 0;
  1389. } else {
  1390. item.scoreResult = checkboxScore;
  1391. }
  1392. score += checkboxScore;
  1393. }
  1394. if (item.ques && item.ques.length) {
  1395. doQuestionNum++;
  1396. doQuestionIds.push(item.questionId);
  1397. }
  1398. allScore += item.score;
  1399. } else if (item.type == 3) {
  1400. if (item.ques == item.ans) {
  1401. item.scoreResult = item.score;
  1402. score += item.score;
  1403. number++;
  1404. } else {
  1405. item.scoreResult = 0;
  1406. }
  1407. if (item.ques) {
  1408. doQuestionNum++;
  1409. doQuestionIds.push(item.questionId);
  1410. }
  1411. allScore += item.score;
  1412. } else {
  1413. allScore += item.score;
  1414. }
  1415. });
  1416. if (score >= passScore) {
  1417. reportStatus = 1;
  1418. } else {
  1419. reportStatus = 0;
  1420. }
  1421. this.$api
  1422. .bankRecordEdit({
  1423. chapterId: this.chapterId || 0,
  1424. moduleId: this.moduleId || 0,
  1425. sectionId: this.sectionId || 0,
  1426. examId: this.id,
  1427. goodsId: this.goodsId,
  1428. orderGoodsId: this.orderGoodsId,
  1429. recordId: this.recordId,
  1430. courseId: this.courseId,
  1431. reportStatus: reportStatus,
  1432. rightQuestionNum: number,
  1433. doQuestionNum: doQuestionNum,
  1434. status: 1,
  1435. doQuestionIds: doQuestionIds.join(","),
  1436. gradeId: this.gradeId,
  1437. performance: score,
  1438. totalScore: allScore,
  1439. type: this.examType,
  1440. // examTime: parseInt(this.allTimes),
  1441. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1442. // historyExamJson: JSON.stringify(this.questionList)
  1443. })
  1444. .then((res) => {});
  1445. },
  1446. /**
  1447. * 立即交卷
  1448. */
  1449. submitNow() {
  1450. this.showpopups = false;
  1451. this.needBack = false;
  1452. this.submit();
  1453. },
  1454. /**
  1455. * 离开页面统计回答正确题数
  1456. */
  1457. examRecordEdit() {
  1458. if (!this.isSubmit) {
  1459. let number = 0;
  1460. let score = 0;
  1461. let doQuestionNum = 0;
  1462. let reportStatus = 0;
  1463. let lessQuestionNum = 0;
  1464. this.questionList.forEach((item, index) => {
  1465. if (item.type == 1) {
  1466. if (item.ques == item.ans) {
  1467. score += item.score;
  1468. number++;
  1469. }
  1470. if (item.ques) {
  1471. doQuestionNum++;
  1472. }
  1473. } else if (item.type == 2) {
  1474. let isRight =
  1475. item.ques &&
  1476. item.ques.every((quesItem, quesIndex) => {
  1477. return item.ques[quesIndex] == item.ans[quesIndex];
  1478. });
  1479. if (isRight) {
  1480. score += item.score;
  1481. number++;
  1482. } else {
  1483. let hasPart = false;
  1484. let checkboxScore = 1; //获取单题总分数
  1485. item.ques.forEach((ques, quesIndex) => {
  1486. //选错一个全扣
  1487. if (item.ques) {
  1488. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1489. checkboxScore = 0;
  1490. }
  1491. } else {
  1492. checkboxScore = 0;
  1493. }
  1494. });
  1495. //没选错
  1496. if (checkboxScore) {
  1497. checkboxScore = 0;
  1498. item.ans.forEach((ans, quesIndex) => {
  1499. //漏选扣一部分
  1500. if (item.ques) {
  1501. if (item.ques.indexOf(item.ans[quesIndex]) == -1) {
  1502. checkboxScore += item.partScore;
  1503. hasPart = true;
  1504. }
  1505. } else {
  1506. checkboxScore = 0;
  1507. }
  1508. });
  1509. }
  1510. if (!hasPart) {
  1511. item.scoreResult = 0;
  1512. } else {
  1513. lessQuestionNum++
  1514. item.scoreResult = checkboxScore;
  1515. score += checkboxScore;
  1516. // number++;
  1517. }
  1518. }
  1519. if (item.ques && item.ques.length) {
  1520. doQuestionNum++;
  1521. }
  1522. } else if (item.type == 3) {
  1523. if (item.ques == item.ans) {
  1524. score += item.score;
  1525. number++;
  1526. }
  1527. if (item.ques) {
  1528. doQuestionNum++;
  1529. }
  1530. } else if (item == 4) {
  1531. if (item.ques.length) {
  1532. doQuestionNum++;
  1533. }
  1534. } else if (item.type == 5) {
  1535. if (item.ques) {
  1536. doQuestionNum++;
  1537. }
  1538. }
  1539. });
  1540. if (score >= 60) {
  1541. reportStatus = 1;
  1542. }
  1543. this.$api
  1544. .bankRecordEdit({
  1545. chapterId: this.chapterId || 0,
  1546. moduleId: this.moduleId || 0,
  1547. sectionId: this.sectionId || 0,
  1548. gradeId: this.gradeId,
  1549. examId: this.id,
  1550. courseId: this.courseId,
  1551. orderGoodsId: this.orderGoodsId,
  1552. goodsId: this.goodsId,
  1553. recordId: this.recordId,
  1554. lessQuestionNum:lessQuestionNum,
  1555. performance: score,
  1556. reportStatus: reportStatus,
  1557. status: 1,
  1558. type: this.examType,
  1559. // historyExamJson: JSON.stringify(this.questionList)
  1560. })
  1561. .then((res) => {});
  1562. }
  1563. },
  1564. /**
  1565. * @param {Object} second倒计时过滤器
  1566. */
  1567. countdown(second) {
  1568. if (second) {
  1569. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1570. let m = parseInt((second / 60) % 60); // 计算分数
  1571. let s = parseInt(second % 60); // 计算当前秒数
  1572. if (h < 10) h = "0" + h;
  1573. if (m < 10) m = "0" + m;
  1574. if (s < 10) s = "0" + s;
  1575. return h + ":" + m + ":" + s;
  1576. } else {
  1577. return "";
  1578. }
  1579. },
  1580. /**
  1581. * 请求题目列表
  1582. */
  1583. goodsQuestionList() {
  1584. this.$api
  1585. .goodsQuestionList({
  1586. examId: this.id,
  1587. })
  1588. .then(async (res) => {
  1589. if (!res.data.data.length) {
  1590. this.hideDialog();
  1591. uni.showModal({
  1592. showCancel: false,
  1593. content: "该试卷暂无题目",
  1594. success: function (k) {
  1595. if (k.confirm) {
  1596. uni.navigateBack();
  1597. }
  1598. },
  1599. });
  1600. return;
  1601. }
  1602. this.allTimes = res.data.data[0].answerTime * 60;
  1603. this.lastTime =
  1604. res.data.data[0].answerTime && res.data.data[0].answerTime * 60;
  1605. res.data.data.forEach((item, index) => {
  1606. if (typeof item.jsonStr == "string") {
  1607. item.jsonStr = JSON.parse(item.jsonStr);
  1608. if (item.type == 2) {
  1609. //多选
  1610. item.jsonStr.forEach((str) => {
  1611. str.optionsId = "" + str.optionsId;
  1612. });
  1613. let arr = item.answerQuestion.split(",");
  1614. arr.forEach((a, i) => {
  1615. arr[i] = "" + a;
  1616. });
  1617. item.ans = arr;
  1618. item.analysisContent &&
  1619. (item.analysisContent = item.analysisContent.replace(
  1620. /<img/gi,
  1621. '<img style="max-width:100%;"'
  1622. ));
  1623. item.content &&
  1624. (item.content = item.content.replace(
  1625. /<img/gi,
  1626. '<img style="max-width:100%;"'
  1627. ));
  1628. return;
  1629. } else if (item.type == 5) {
  1630. //简答题
  1631. item.ansText = {
  1632. text: "",
  1633. imageList: [],
  1634. };
  1635. item.ques = {
  1636. text: "",
  1637. imageList: [],
  1638. };
  1639. item.analysisContent &&
  1640. (item.analysisContent = item.analysisContent.replace(
  1641. /<img/gi,
  1642. '<img style="max-width:100%;"'
  1643. ));
  1644. item.content &&
  1645. (item.content = item.content.replace(
  1646. /<img/gi,
  1647. '<img style="max-width:100%;"'
  1648. ));
  1649. } else if (item.type == 4) {
  1650. //案例题
  1651. console.log(item.jsonStr);
  1652. item.ques = [];
  1653. item.current = 0;
  1654. let ansArr = [];
  1655. item.jsonStr.forEach((json, index) => {
  1656. if (json.type == 1) {
  1657. ansArr[index] = json.answerQuestion;
  1658. json.content &&
  1659. (json.content = json.content.replace(
  1660. /<img/gi,
  1661. '<img style="max-width:100%;"'
  1662. ));
  1663. } else if (json.type == 2) {
  1664. json.optionsList.forEach((str) => {
  1665. str.optionsId = "" + str.optionsId;
  1666. });
  1667. let arr = json.answerQuestion.split(",");
  1668. arr.forEach((a, i) => {
  1669. arr[i] = "" + a;
  1670. });
  1671. ansArr[index] = arr;
  1672. json.content &&
  1673. (json.content = json.content.replace(
  1674. /<img/gi,
  1675. '<img style="max-width:100%;"'
  1676. ));
  1677. } else if (json.type == 3) {
  1678. ansArr[index] = json.answerQuestion;
  1679. json.content &&
  1680. (json.content = json.content.replace(
  1681. /<img/gi,
  1682. '<img style="max-width:100%;"'
  1683. ));
  1684. } else if (json.type == 5) {
  1685. ansArr[index] = {
  1686. text: "",
  1687. imageList: [],
  1688. };
  1689. json.ansText = {
  1690. text: "",
  1691. imageList: [],
  1692. };
  1693. json.content &&
  1694. (json.content = json.content.replace(
  1695. /<img/gi,
  1696. '<img style="max-width:100%;"'
  1697. ));
  1698. }
  1699. });
  1700. item.analysisContent &&
  1701. (item.analysisContent = item.analysisContent.replace(
  1702. /<img/gi,
  1703. '<img style="max-width:100%;"'
  1704. ));
  1705. item.content &&
  1706. (item.content = item.content.replace(
  1707. /<img/gi,
  1708. '<img style="max-width:100%;"'
  1709. ));
  1710. item.ans = ansArr;
  1711. return;
  1712. }
  1713. item.content &&
  1714. (item.content = item.content.replace(
  1715. /<img/gi,
  1716. '<img style="max-width:100%;"'
  1717. ));
  1718. item.ans = item.answerQuestion;
  1719. }
  1720. });
  1721. this.questionList = res.data.data;
  1722. this.lastCount = this.questionList.length;
  1723. await this.examRecord();
  1724. });
  1725. },
  1726. /**
  1727. * 记录总题数,获取recordId
  1728. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1729. */
  1730. examRecord(hasSpecial) {
  1731. return new Promise((resolve) => {
  1732. let self = this;
  1733. let questionList = 0;
  1734. // if(!hasSpecial) {
  1735. this.questionList.forEach((item, index) => {
  1736. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1737. questionList++;
  1738. }
  1739. });
  1740. // } else {
  1741. // questionList = this.questionList.length;
  1742. // }
  1743. this.$api
  1744. .bankRecord({
  1745. courseId: this.courseId,
  1746. chapterExamId: this.chapterId || 0,
  1747. moduleExamId: this.moduleId || 0,
  1748. sectionId: this.sectionId || 0,
  1749. examId: this.id,
  1750. goodsId: this.goodsId,
  1751. orderGoodsId: this.orderGoodsId,
  1752. gradeId: this.gradeId,
  1753. totalQuestionNum: questionList,
  1754. allQuestionNum: this.questionList.length,
  1755. type: this.examType,
  1756. })
  1757. .then((res) => {
  1758. this.recordId = res.data.data;
  1759. if (self.needPhoto) {
  1760. self.photoPopup = true; //拍照
  1761. this.isTaking = true;
  1762. } else {
  1763. if (this.lastTime) {
  1764. this.timer = setInterval(() => {
  1765. if (this.lastTime <= 0) {
  1766. clearInterval(this.timer);
  1767. uni.showToast({
  1768. icon: "none",
  1769. mask: true,
  1770. title: "考试时间已到,系统将自动交卷",
  1771. duration: 10000,
  1772. });
  1773. this.submit();
  1774. return;
  1775. }
  1776. this.lastTime--;
  1777. }, 1000);
  1778. }
  1779. resolve();
  1780. }
  1781. });
  1782. });
  1783. },
  1784. /**
  1785. * @param {Object} e单选点击
  1786. */
  1787. radioSelect(optionsId, bindex) {
  1788. // if (this.questionList[bindex].ques) return;
  1789. if (this.questionList[bindex].ques && this.bankType == 1) {
  1790. return
  1791. }
  1792. this.$set(this.questionList[bindex], "ques", optionsId);
  1793. // if ((bindex + 1) < this.questionList.length) {
  1794. // this.current = bindex + 1
  1795. // }
  1796. this.isDoOver();
  1797. },
  1798. /**
  1799. * @param {Object} e案例单选点击
  1800. */
  1801. radioSelectChild(optionsId, ansIndex, bindex) {
  1802. // if (this.questionList[bindex].ques[ansIndex]) return;
  1803. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1804. return
  1805. }
  1806. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  1807. this.isDoOver();
  1808. },
  1809. /**
  1810. * @param {Object} 多选点击
  1811. */
  1812. checkboxSelect(optionsId, bindex, index) {
  1813. if (this.questionList[bindex].ques && this.bankType == 1) {
  1814. return
  1815. }
  1816. this.$set(
  1817. this.questionList[bindex].jsonStr[index],
  1818. "checked",
  1819. !this.questionList[bindex].jsonStr[index].checked
  1820. );
  1821. console.log('this.questionList[bindex].jsonStr:', this.questionList[bindex].jsonStr[index])
  1822. },
  1823. /**
  1824. * @param {Object} 案例多选点击
  1825. */
  1826. checkboxSelectChild(bindex, ansIndex, childIndex) {
  1827. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1828. return
  1829. }
  1830. this.$set(
  1831. this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
  1832. "checked",
  1833. !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex]
  1834. .checked
  1835. );
  1836. },
  1837. isCheckboxChecked(arr) {
  1838. return arr.some((item) => {
  1839. if (item.checked) {
  1840. return true;
  1841. }
  1842. });
  1843. },
  1844. /**
  1845. * @param {Object} 多选确认
  1846. */
  1847. checkboxSubmit(bindex) {
  1848. // if (this.questionList[bindex].ques) return;
  1849. if (this.questionList[bindex].ques && this.bankType == 1) {
  1850. return
  1851. }
  1852. let arr = [];
  1853. this.questionList[bindex].jsonStr.forEach((item) => {
  1854. if (item.checked) {
  1855. arr.push(item.optionsId);
  1856. }
  1857. });
  1858. if (!arr.length) {
  1859. delete this.questionList[bindex].ques
  1860. uni.showToast({
  1861. title: "请选择答案",
  1862. icon: "none",
  1863. });
  1864. return;
  1865. }
  1866. this.$set(this.questionList[bindex], "ques", arr);
  1867. this.isDoOver();
  1868. // let isWrong = this.questionList[bindex].ques.some(
  1869. // (quesItem, quesIndex) => {
  1870. // return (
  1871. // this.questionList[bindex].ques[quesIndex] !=
  1872. // this.questionList[bindex].ans[quesIndex]
  1873. // );
  1874. // }
  1875. // );
  1876. // let isWrong = this.questionList[bindex].ques.some((item, i) => {
  1877. // return this.questionList[bindex].ans.indexOf(item) == -1;
  1878. // })
  1879. },
  1880. /**
  1881. * @param {Object} 案例多选确认
  1882. */
  1883. checkboxSubmitChild(bindex, ansIndex) {
  1884. // if (this.questionList[bindex].ques[ansIndex]) return;
  1885. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1886. return
  1887. }
  1888. let arr = [];
  1889. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
  1890. (item) => {
  1891. if (item.checked) {
  1892. arr.push(item.optionsId);
  1893. }
  1894. }
  1895. );
  1896. if (!arr.length) {
  1897. delete this.questionList[bindex].ques[ansIndex]
  1898. uni.showToast({
  1899. title: "请选择答案",
  1900. icon: "none",
  1901. });
  1902. return;
  1903. }
  1904. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  1905. this.isDoOver();
  1906. },
  1907. /**
  1908. * @param {Object} index
  1909. * @param {Object} bindex
  1910. * 判断题
  1911. */
  1912. judgeSelect(index, bindex) {
  1913. // if (this.questionList[bindex].ques) return;
  1914. if (this.questionList[bindex].ques && this.bankType == 1) {
  1915. return
  1916. }
  1917. this.$set(this.questionList[bindex], "ques", index == 0 ? '1' : '0');
  1918. this.isDoOver();
  1919. },
  1920. /**
  1921. * @param {Object} ansindex
  1922. * @param {Object} childindex
  1923. * @param {Object} bindex
  1924. * 案例判断题
  1925. */
  1926. judgeSelectChild(ansindex, childindex, bindex) {
  1927. // if (this.questionList[bindex].ques[ansindex]) return;
  1928. if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
  1929. return
  1930. }
  1931. this.$set(this.questionList[bindex].ques, ansindex, childindex == 0 ? '1' : '0');
  1932. this.isDoOver();
  1933. },
  1934. openFooterTab() {
  1935. this.show = true;
  1936. },
  1937. hideDialog() {
  1938. this.showDialog = false;
  1939. },
  1940. changeIndex(index) {
  1941. console.log('点击变化', index)
  1942. this.current = index;
  1943. },
  1944. swiperChange(e) {
  1945. console.log('切换', e.detail.current, this.questionList.length)
  1946. this.current = e.detail.current;
  1947. },
  1948. pdsubmit() {
  1949. let ansCount = this.questionOverNum(true); //已答题数
  1950. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1951. //没有答完
  1952. if (this.lastCount !== 0) {
  1953. this.cgType = 6;
  1954. this.showpopups = true;
  1955. return;
  1956. }
  1957. if (this.bankType == 2) {
  1958. if (this.lastTime > 0) {
  1959. let lastTime = this.countdown(this.lastTime);
  1960. uni.showModal({
  1961. title: "提示",
  1962. content: `时间还剩余${lastTime},确定交卷吗?`,
  1963. confirmText: "交卷",
  1964. cancelText: "继续答题",
  1965. success: (res) => {
  1966. if (res.confirm) {
  1967. //确定
  1968. this.submit();
  1969. } else {
  1970. //取消
  1971. }
  1972. },
  1973. });
  1974. return;
  1975. }
  1976. }
  1977. this.submit();
  1978. },
  1979. /**
  1980. * 交卷
  1981. */
  1982. submit() {
  1983. let score = 0; //计算总分
  1984. let reportStatus = 0;
  1985. let number = 0; //做对的题目数量
  1986. let doQuestionNum = 0; //做过的题目数量
  1987. let allScore = 0; //总分
  1988. let passScore = 0;
  1989. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  1990. let doQuestionIds = []; //做过的题目id
  1991. let rightQuestionIds = []; //做对的题目id
  1992. let lessQuestionNum = 0;
  1993. this.questionList.forEach((item, index) => {
  1994. passScore = item.passScore;
  1995. if (item.type == 1) {
  1996. //正确
  1997. if (item.ques == item.ans) {
  1998. item.scoreResult = item.score;
  1999. score += item.score;
  2000. number++;
  2001. rightQuestionIds.push(item.questionId);
  2002. } else {
  2003. //错误
  2004. item.scoreResult = 0;
  2005. if (item.ques) {
  2006. doWrongQuestionIds.push(item.questionId);
  2007. }
  2008. }
  2009. allScore += item.score;
  2010. if (item.ques) {
  2011. doQuestionNum++;
  2012. doQuestionIds.push(item.questionId);
  2013. }
  2014. } else if (item.type == 2) {
  2015. let isRight =
  2016. item.ans &&
  2017. item.ans.every((quesItem, quesIndex) => {
  2018. if (item.ques) {
  2019. return item.ques[quesIndex] == item.ans[quesIndex];
  2020. } else {
  2021. return false;
  2022. }
  2023. });
  2024. if (isRight) {
  2025. score += item.score;
  2026. number++;
  2027. item.scoreResult = item.score;
  2028. rightQuestionIds.push(item.questionId);
  2029. } else {
  2030. let hasPart = false;
  2031. let checkboxScore = 1; //获取单题总分数
  2032. item.ques &&
  2033. item.ques.forEach((ques, quesIndex) => {
  2034. //选错一个全扣
  2035. if (item.ques) {
  2036. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  2037. checkboxScore = 0;
  2038. }
  2039. } else {
  2040. checkboxScore = 0;
  2041. }
  2042. });
  2043. console.log(checkboxScore);
  2044. //没选错
  2045. if (checkboxScore) {
  2046. checkboxScore = 0;
  2047. item.ans.forEach((ans, quesIndex) => {
  2048. //漏选扣一部分,对n题给n X partScore 分
  2049. if (item.ques) {
  2050. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  2051. checkboxScore += item.partScore;
  2052. hasPart = true;
  2053. }
  2054. } else {
  2055. checkboxScore = 0;
  2056. }
  2057. });
  2058. }
  2059. if (!hasPart) {
  2060. //0分
  2061. item.scoreResult = 0;
  2062. if (item.ques) {
  2063. doWrongQuestionIds.push(item.questionId);
  2064. }
  2065. } else {
  2066. //部分分
  2067. // number++;
  2068. // doWrongQuestionIds.push(item.questionId);
  2069. lessQuestionNum++
  2070. item.scoreResult = checkboxScore;
  2071. score += checkboxScore;
  2072. // rightQuestionIds.push(item.questionId)
  2073. }
  2074. }
  2075. allScore += item.score;
  2076. if (item.ques && item.ques.length) {
  2077. doQuestionNum++;
  2078. doQuestionIds.push(item.questionId);
  2079. }
  2080. } else if (item.type == 3) {
  2081. if (item.ques == item.ans) {
  2082. item.scoreResult = item.score;
  2083. score += item.score;
  2084. number++;
  2085. rightQuestionIds.push(item.questionId);
  2086. } else {
  2087. item.scoreResult = 0;
  2088. if (item.ques) {
  2089. doWrongQuestionIds.push(item.questionId);
  2090. }
  2091. }
  2092. allScore += item.score;
  2093. if (item.ques) {
  2094. doQuestionNum++;
  2095. doQuestionIds.push(item.questionId);
  2096. }
  2097. } else if (item.type == 4) {
  2098. allScore += item.score;
  2099. if (item.ques && item.ques.length) {
  2100. doQuestionNum++;
  2101. doQuestionIds.push(item.questionId);
  2102. }
  2103. } else if (item.type == 5) {
  2104. allScore += item.score;
  2105. if (item.ques && (item.ques.imageList || item.ques.text)) {
  2106. doQuestionNum++;
  2107. doQuestionIds.push(item.questionId);
  2108. }
  2109. }
  2110. });
  2111. //大于分及格
  2112. if (score >= passScore) {
  2113. reportStatus = 1;
  2114. } else {
  2115. reportStatus = 0;
  2116. }
  2117. clearInterval(this.timer);
  2118. //交卷
  2119. this.$api
  2120. .bankRecordEdit({
  2121. moduleId: this.moduleId || 0,
  2122. chapterId: this.chapterId || 0,
  2123. sectionId: this.sectionId || 0,
  2124. gradeId: this.gradeId,
  2125. examId: this.id,
  2126. goodsId: this.goodsId,
  2127. orderGoodsId: this.orderGoodsId,
  2128. reportStatus: reportStatus,
  2129. recordId: this.recordId,
  2130. courseId: this.courseId,
  2131. rightQuestionNum: number,
  2132. status: 1,
  2133. doQuestionIds: doQuestionIds.join(","),
  2134. // rightQuestionIds:rightQuestionIds.join(','),
  2135. // doQuestionNum: doQuestionNum,
  2136. performance: score,
  2137. totalScore: allScore,
  2138. type: this.examType,
  2139. // examTime: parseInt(this.allTimes),
  2140. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2141. // historyExamJson: JSON.stringify(this.questionList)
  2142. })
  2143. .then((res) => {
  2144. this.isSubmit = true;
  2145. if (res.data.code == 200) {
  2146. uni.showToast({
  2147. title: "交卷成功",
  2148. duration: 1000,
  2149. mask: true,
  2150. icon: "none",
  2151. });
  2152. setTimeout(() => {
  2153. uni.redirectTo({
  2154. url:
  2155. "/pages2/class/question_report?rightQuestionNum=" +
  2156. number +
  2157. "&doWrongQuestionNum=" +
  2158. doWrongQuestionIds.length +
  2159. "&score=" +
  2160. score +
  2161. "&totalScore=" +
  2162. allScore +
  2163. "&reportStatus=" +
  2164. reportStatus +
  2165. "&lessQuestionNum=" +
  2166. lessQuestionNum +
  2167. "&examId=" + this.id
  2168. });
  2169. }, 1000);
  2170. }
  2171. });
  2172. },
  2173. /**
  2174. * @param {Object} imgIndex
  2175. * @param {Object} bankIndex
  2176. * 删除简答图片
  2177. */
  2178. deleteImg(imgIndex, bankIndex) {
  2179. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  2180. },
  2181. /**
  2182. * @param {Object} imgIndex
  2183. * @param {Object} bankIndex
  2184. * @param {Object} ansIndex
  2185. * 删除案例题简答图片
  2186. */
  2187. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  2188. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(
  2189. imgIndex,
  2190. 1
  2191. );
  2192. },
  2193. /**
  2194. * @param {Object} bankindex
  2195. * 选择上传图片
  2196. */
  2197. chooseImg(bankindex) {
  2198. if (
  2199. this.questionList[bankindex] &&
  2200. this.questionList[bankindex].ansText &&
  2201. this.questionList[bankindex].ansText.imageList.length >= 4
  2202. ) {
  2203. uni.showToast({
  2204. icon: "none",
  2205. title: "最多选择4张",
  2206. });
  2207. return;
  2208. }
  2209. uni.chooseImage({
  2210. count: 1, //默认9
  2211. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2212. sourceType: ["album", "camera"], //从相册选择
  2213. success: (res) => {
  2214. let self = this;
  2215. // console.log(JSON.stringify(res.tempFilePaths));
  2216. let img = res.tempFilePaths[0];
  2217. uni.getImageInfo({
  2218. src: img,
  2219. success: async (res) => {
  2220. let canvasWidth = res.width; //图片原始长宽
  2221. let canvasHeight = res.height;
  2222. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2223. uni.compressImage({
  2224. src: img,
  2225. quality: 75,
  2226. width: "50%",
  2227. height: "50%",
  2228. success: async (rest) => {
  2229. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2230. this.questionList[bankindex].ansText.imageList.push(dir);
  2231. },
  2232. });
  2233. } else {
  2234. const dir = await self.uploadFile(img, 0);
  2235. this.questionList[bankindex].ansText.imageList.push(dir);
  2236. }
  2237. },
  2238. });
  2239. },
  2240. });
  2241. },
  2242. /**
  2243. * @param {Object} bankindex
  2244. * @param {Object} ansindex
  2245. * 案例题选择上传图片
  2246. */
  2247. chooseImgChild(bankindex, ansindex) {
  2248. uni.chooseImage({
  2249. count: 1, //默认9
  2250. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2251. sourceType: ["album", "camera"], //从相册选择
  2252. success: (res) => {
  2253. let self = this;
  2254. // console.log(JSON.stringify(res.tempFilePaths));
  2255. let img = res.tempFilePaths[0];
  2256. uni.getImageInfo({
  2257. src: img,
  2258. success: async (res) => {
  2259. let canvasWidth = res.width; //图片原始长宽
  2260. let canvasHeight = res.height;
  2261. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2262. uni.compressImage({
  2263. src: img,
  2264. quality: 75,
  2265. width: "50%",
  2266. height: "50%",
  2267. success: async (rest) => {
  2268. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2269. this.questionList[bankindex].jsonStr[
  2270. ansindex
  2271. ].ansText.imageList.push(dir);
  2272. },
  2273. });
  2274. } else {
  2275. const dir = await self.uploadFile(img, 0);
  2276. this.questionList[bankindex].jsonStr[
  2277. ansindex
  2278. ].ansText.imageList.push(dir);
  2279. }
  2280. },
  2281. });
  2282. },
  2283. });
  2284. },
  2285. /**
  2286. * @param {Object} type
  2287. * @param {Object} bankindex
  2288. * 简答题答案确认
  2289. */
  2290. submitAns(bankindex) {
  2291. console.log(this.questionList[bankindex]);
  2292. if (
  2293. !this.questionList[bankindex].ansText.text &&
  2294. !this.questionList[bankindex].ansText.imageList.length
  2295. ) {
  2296. uni.showToast({
  2297. title: "请输入内容或上传图片",
  2298. duration: 2000,
  2299. icon: "none",
  2300. });
  2301. return;
  2302. }
  2303. this.$set(this.questionList[bankindex], "ques", {
  2304. imageList: this.questionList[bankindex].ansText.imageList,
  2305. text: this.questionList[bankindex].ansText.text,
  2306. });
  2307. this.isDoOver();
  2308. },
  2309. /**
  2310. * @param {Object} bankindex
  2311. * @param {Object} ansindex
  2312. * 案例题简答答案确认
  2313. */
  2314. submitAnsChild(bankindex, ansindex) {
  2315. if (
  2316. !this.questionList[bankindex].jsonStr[ansindex].ansText.text &&
  2317. !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length
  2318. ) {
  2319. uni.showToast({
  2320. title: "请输入内容或上传图片",
  2321. duration: 2000,
  2322. icon: "none",
  2323. });
  2324. return;
  2325. }
  2326. this.$set(this.questionList[bankindex].ques, ansindex, {
  2327. imageList:
  2328. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  2329. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text,
  2330. });
  2331. this.isDoOver();
  2332. },
  2333. isCheck(item, index) {
  2334. if (this.questionList[index].ques) {
  2335. return true
  2336. }
  2337. },
  2338. isRight(item, index) {
  2339. //单选
  2340. if (this.questionList[index].ques) {
  2341. if (item.type == 1) {
  2342. return this.questionList[index].ques == this.questionList[index].ans;
  2343. //多选
  2344. } else if (item.type == 2) {
  2345. //每一项都相等
  2346. return this.questionList[index].ans.every((item, i) => {
  2347. return item == this.questionList[index].ques[i];
  2348. });
  2349. //判断
  2350. } else if (item.type == 3) {
  2351. return this.questionList[index].ques == this.questionList[index].ans;
  2352. // } else if (item.type == 5) {
  2353. // if(this.questionList[index].ques.text){
  2354. // return true
  2355. // }else{
  2356. // return false
  2357. // }
  2358. } else {
  2359. return false;
  2360. }
  2361. } else {
  2362. return false;
  2363. }
  2364. },
  2365. right(bankIndex, ansIndex, option) {
  2366. if (
  2367. this.questionList[bankIndex].ques[ansIndex] &&
  2368. this.questionList[bankIndex].ans[ansIndex]
  2369. ) {
  2370. if (
  2371. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2372. option.optionsId
  2373. ) != -1 ||
  2374. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2375. option.optionsId
  2376. ) != -1
  2377. ) {
  2378. return true;
  2379. } else {
  2380. return false;
  2381. }
  2382. } else {
  2383. return false;
  2384. }
  2385. },
  2386. wrong(bankIndex, ansIndex, option) {
  2387. if (
  2388. this.questionList[bankIndex].ques[ansIndex] &&
  2389. this.questionList[bankIndex].ans[ansIndex]
  2390. ) {
  2391. if (
  2392. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2393. option.optionsId
  2394. ) != -1 &&
  2395. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2396. option.optionsId
  2397. ) == -1
  2398. ) {
  2399. return true;
  2400. } else {
  2401. return false;
  2402. }
  2403. } else {
  2404. return false;
  2405. }
  2406. },
  2407. isWrong(item, index) {
  2408. if (this.questionList[index].ques) {
  2409. //单选
  2410. if (item.type == 1) {
  2411. return this.questionList[index].ques != this.questionList[index].ans;
  2412. //多选
  2413. } else if (item.type == 2) {
  2414. //每一项都相等
  2415. return this.questionList[index].ques.some((item, i) => {
  2416. return this.questionList[index].ans.indexOf(item) == -1;
  2417. });
  2418. //判断
  2419. } else if (item.type == 3) {
  2420. return this.questionList[index].ques != this.questionList[index].ans;
  2421. } else {
  2422. return false;
  2423. }
  2424. } else {
  2425. return false;
  2426. }
  2427. },
  2428. isPart(item, index) {
  2429. if (this.questionList[index].ques) {
  2430. if (item.type == 2) {
  2431. let isWrong = this.questionList[index].ques.some((item, i) => {
  2432. return this.questionList[index].ans.indexOf(item) == -1;
  2433. });
  2434. let isRight = this.questionList[index].ans.every((item, i) => {
  2435. return item == this.questionList[index].ques[i];
  2436. });
  2437. if (!isRight && !isWrong) {
  2438. return true;
  2439. }
  2440. }
  2441. } else {
  2442. return false;
  2443. }
  2444. },
  2445. isOver(item, index) {
  2446. if (this.questionList[index].ques) {
  2447. if (item.type == 4) {
  2448. //案例题
  2449. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  2450. if (
  2451. jsonItem.type == 1 ||
  2452. jsonItem.type == 2 ||
  2453. jsonItem.type == 3
  2454. ) {
  2455. if (item.ques[indexs]) {
  2456. return true;
  2457. } else {
  2458. return false;
  2459. }
  2460. } else if (jsonItem.type == 5) {
  2461. if (
  2462. item.ques[indexs] &&
  2463. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  2464. ) {
  2465. console.log("chil");
  2466. return true;
  2467. } else {
  2468. return false;
  2469. }
  2470. }
  2471. });
  2472. if (isOver) {
  2473. return true;
  2474. } else {
  2475. return false;
  2476. }
  2477. } else if (item.type == 5) {
  2478. //简答题
  2479. //每一项都相等
  2480. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2481. return true;
  2482. }
  2483. //判断
  2484. } else {
  2485. return false;
  2486. }
  2487. } else {
  2488. return false;
  2489. }
  2490. },
  2491. tabSelect(index, bankindex) {
  2492. this.$set(this.questionList[bankindex], "current", index);
  2493. },
  2494. },
  2495. };
  2496. </script>
  2497. <style lang="scss" scoped>
  2498. .photoBox {
  2499. background-color: #ffffff;
  2500. border-radius: 32px 32px 0px 0px;
  2501. .photoTop {
  2502. height: 74upx;
  2503. display: flex;
  2504. align-items: center;
  2505. justify-content: space-between;
  2506. padding: 0upx 38upx;
  2507. .sqzz {
  2508. width: 28upx;
  2509. height: 28upx;
  2510. display: flex;
  2511. align-items: center;
  2512. justify-content: center;
  2513. }
  2514. .centersq {
  2515. color: #333;
  2516. font-size: 30upx;
  2517. font-weight: 500;
  2518. }
  2519. }
  2520. .photoCenter {
  2521. width: 750upx;
  2522. height: 979upx;
  2523. position: relative;
  2524. .custom {
  2525. width: 750upx;
  2526. height: 979upx;
  2527. position: absolute;
  2528. z-index: 1000;
  2529. top: 0;
  2530. left: 0;
  2531. image {
  2532. width: 100%;
  2533. height: 100%;
  2534. }
  2535. }
  2536. }
  2537. .photoBoxbtns {
  2538. display: flex;
  2539. .btnResult {
  2540. height: 100rpx;
  2541. width: 100%;
  2542. background-color: #07c160;
  2543. text-align: center;
  2544. line-height: 100upx;
  2545. color: #fff;
  2546. font-size: 32upx;
  2547. font-weight: bold;
  2548. }
  2549. }
  2550. }
  2551. .navbar {
  2552. position: relative;
  2553. z-index: 20000;
  2554. }
  2555. .questionBank {
  2556. width: 100%;
  2557. height: 100vh;
  2558. display: flex;
  2559. flex-direction: column;
  2560. }
  2561. .swiper {
  2562. width: 100%;
  2563. flex: 1;
  2564. }
  2565. .lisSty {
  2566. margin-bottom: 16rpx;
  2567. display: flex;
  2568. .flex_auto {
  2569. flex: 1;
  2570. }
  2571. }
  2572. .activeTI {
  2573. vertical-align: middle;
  2574. display: inline-block;
  2575. border: 1rpx solid #eee;
  2576. border-radius: 50rpx;
  2577. height: 48rpx;
  2578. line-height: 46rpx;
  2579. text-align: center;
  2580. width: 48rpx;
  2581. margin-right: 15rpx;
  2582. color: #666;
  2583. font-size: 30rpx;
  2584. &.right {
  2585. color: #fff;
  2586. background: #36c75a;
  2587. }
  2588. &.wrong {
  2589. color: #fff;
  2590. background: #ff3b30;
  2591. }
  2592. &.checked, &.user_choose {
  2593. color: #fff;
  2594. background: #007aff;
  2595. }
  2596. }
  2597. .submit_checkbox {
  2598. position: fixed;
  2599. left: 0;
  2600. right: 0;
  2601. bottom: 120rpx;
  2602. margin: 20rpx auto;
  2603. width: 526rpx;
  2604. height: 80rpx;
  2605. background: rgba(0, 122, 255, 1);
  2606. color: #fff;
  2607. text-align: center;
  2608. line-height: 80rpx;
  2609. font-size: 30rpx;
  2610. border-radius: 40rpx;
  2611. &.disabled {
  2612. opacity: 0.6;
  2613. }
  2614. }
  2615. .titles {
  2616. overflow: hidden;
  2617. margin-bottom: 24rpx;
  2618. }
  2619. .titBox {
  2620. padding: 41rpx 25rpx 24rpx 25rpx;
  2621. }
  2622. .titBox_title {
  2623. padding: 21rpx;
  2624. }
  2625. .tabs {
  2626. margin: 10rpx;
  2627. display: flex;
  2628. .tab {
  2629. margin: 0 4rpx;
  2630. padding: 10rpx 13rpx;
  2631. text-align: center;
  2632. color: #007aff;
  2633. font-size: 28rpx;
  2634. border-radius: 16rpx;
  2635. background: #fff;
  2636. &.current {
  2637. color: #fff;
  2638. background: #007aff;
  2639. }
  2640. }
  2641. }
  2642. .ans {
  2643. margin: 8rpx 8rpx 8rpx;
  2644. .ans_input {
  2645. border-radius: 16rpx;
  2646. background: #fff;
  2647. .top {
  2648. border-bottom: 1rpx solid #eeeeee;
  2649. padding: 16rpx;
  2650. display: flex;
  2651. align-items: center;
  2652. .icon {
  2653. margin-right: 20rpx;
  2654. width: 40rpx;
  2655. height: 38rpx;
  2656. }
  2657. .progress {
  2658. flex: 1;
  2659. }
  2660. .submit {
  2661. width: 168rpx;
  2662. height: 48rpx;
  2663. line-height: 48rpx;
  2664. text-align: center;
  2665. color: #fff;
  2666. font-size: 30rpx;
  2667. background: #007aff;
  2668. border-radius: 24rpx;
  2669. &.disabled {
  2670. opacity: 0.6;
  2671. }
  2672. }
  2673. }
  2674. .textarea {
  2675. textarea {
  2676. width: 100%;
  2677. height: 287rpx;
  2678. padding: 10rpx;
  2679. }
  2680. }
  2681. .imgs {
  2682. overflow: hidden;
  2683. display: flex;
  2684. width: 100%;
  2685. .img {
  2686. width: 104rpx;
  2687. height: 104rpx;
  2688. border-radius: 8rpx;
  2689. position: relative;
  2690. margin: 20rpx;
  2691. text {
  2692. position: absolute;
  2693. right: -15rpx;
  2694. top: -15rpx;
  2695. width: 30rpx;
  2696. height: 30rpx;
  2697. text-align: center;
  2698. line-height: 30rpx;
  2699. color: #fff;
  2700. background: #ff3b30;
  2701. border-radius: 50%;
  2702. }
  2703. image {
  2704. width: 100%;
  2705. height: 100%;
  2706. }
  2707. }
  2708. }
  2709. }
  2710. .ans_submit {
  2711. padding: 16rpx;
  2712. border-radius: 16rpx;
  2713. background: #fff;
  2714. .imgs {
  2715. overflow: hidden;
  2716. display: flex;
  2717. width: 100%;
  2718. .img {
  2719. width: 104rpx;
  2720. height: 104rpx;
  2721. border-radius: 8rpx;
  2722. position: relative;
  2723. margin: 20rpx;
  2724. image {
  2725. width: 100%;
  2726. height: 100%;
  2727. }
  2728. }
  2729. }
  2730. }
  2731. }
  2732. .leftLetters {
  2733. display: flex;
  2734. align-items: center;
  2735. width: 220rpx;
  2736. .btnType {
  2737. padding: 5rpx 10rpx;
  2738. border: 1rpx solid #007aff;
  2739. border-radius: 10rpx;
  2740. background-color: rgba(0, 122, 255, 0.1);
  2741. font-size: 28rpx;
  2742. color: #007aff;
  2743. margin-right: 15rpx;
  2744. }
  2745. }
  2746. .firstLetter {
  2747. display: flex;
  2748. justify-content: space-between;
  2749. align-items: center;
  2750. margin-bottom: 30rpx;
  2751. }
  2752. .popupView {
  2753. height: 100%;
  2754. padding-bottom: 100rpx;
  2755. .popupTops {
  2756. height: 77rpx;
  2757. border-bottom: 1rpx solid #eee;
  2758. text-align: center;
  2759. line-height: 77rpx;
  2760. font-size: 24rpx;
  2761. color: #999;
  2762. position: relative;
  2763. .topIcon {
  2764. position: absolute;
  2765. top: 10rpx;
  2766. left: 50%;
  2767. transform: translateX(-50%);
  2768. width: 80rpx;
  2769. height: 8rpx;
  2770. background-color: #999;
  2771. border-radius: 4rpx;
  2772. }
  2773. }
  2774. .popupContent {
  2775. }
  2776. }
  2777. .pageContent {
  2778. position: relative;
  2779. background-color: #eaeef1;
  2780. height: 100%;
  2781. padding-top: 8rpx;
  2782. padding-bottom: 100rpx;
  2783. overflow-y: scroll;
  2784. }
  2785. .pad_8 {
  2786. background-color: #fff;
  2787. margin: 0rpx 8rpx 8rpx;
  2788. border-radius: 16rpx;
  2789. &.no-margin {
  2790. margin-top: -16rpx;
  2791. border-radius: 0 0 16rpx 16rpx;
  2792. }
  2793. }
  2794. .answer {
  2795. height: 80rpx;
  2796. line-height: 80rpx;
  2797. padding: 0rpx 24rpx;
  2798. display: flex;
  2799. align-items: center;
  2800. justify-content: space-between;
  2801. color: #666;
  2802. font-size: 30rpx;
  2803. }
  2804. .footer_btn {
  2805. background-color: #fff;
  2806. z-index: 10078;
  2807. position: fixed;
  2808. bottom: 0rpx;
  2809. display: flex;
  2810. align-items: center;
  2811. justify-content: space-between;
  2812. width: 100%;
  2813. height: 98rpx;
  2814. padding: 0rpx 38rpx;
  2815. border-top: 1rpx solid #eee;
  2816. .flex_center {
  2817. flex: 1;
  2818. display: flex;
  2819. justify-content: center;
  2820. align-items: center;
  2821. flex-direction: column;
  2822. margin: 0 200rpx;
  2823. font-size: 24rpx;
  2824. color: #999999;
  2825. .up-icon {
  2826. margin-bottom: 18rpx;
  2827. width: 100%;
  2828. display: flex;
  2829. justify-content: center;
  2830. image {
  2831. width: 58rpx;
  2832. height: 21rpx;
  2833. }
  2834. }
  2835. }
  2836. .collect {
  2837. visibility: hidden;
  2838. width: 100rpx;
  2839. &.show {
  2840. visibility: visible;
  2841. }
  2842. > view {
  2843. display: flex;
  2844. flex-direction: column;
  2845. align-items: center;
  2846. justify-content: center;
  2847. image {
  2848. width: 32rpx;
  2849. height: 32rpx;
  2850. margin-bottom: 6rpx;
  2851. }
  2852. view {
  2853. font-size: 24rpx;
  2854. color: #999999;
  2855. }
  2856. }
  2857. }
  2858. }
  2859. .boxSty {
  2860. padding: 44rpx 41rpx 0rpx;
  2861. }
  2862. .liListSty {
  2863. border: 1rpx solid #eeeeee;
  2864. width: 88rpx;
  2865. height: 88rpx;
  2866. border-radius: 32rpx;
  2867. text-align: center;
  2868. line-height: 88rpx;
  2869. color: #333;
  2870. font-size: 32rpx;
  2871. float: left;
  2872. margin: 20rpx 23rpx;
  2873. &.isRight {
  2874. border: 1rpx solid #eeeeee;
  2875. color: #fff;
  2876. background: #36c75a;
  2877. }
  2878. &.isWrong {
  2879. border: 1rpx solid #eeeeee;
  2880. color: #fff;
  2881. background: #ff3b30;
  2882. }
  2883. &.isPart {
  2884. border: 1rpx solid #eeeeee;
  2885. color: #fff;
  2886. background: #FFC53D;
  2887. }
  2888. &.isOver {
  2889. border: 1rpx solid #eeeeee;
  2890. color: #fff;
  2891. background: blue;
  2892. }
  2893. &.check_ans {
  2894. border: 1rpx solid #eeeeee;
  2895. color: #fff;
  2896. background: #007aff;
  2897. }
  2898. }
  2899. .answerInfos {
  2900. padding: 25rpx 25rpx 25rpx 23rpx;
  2901. }
  2902. .answerTitle {
  2903. margin-bottom: 28rpx;
  2904. color: #666;
  2905. font-size: 30rpx;
  2906. }
  2907. .answerContent {
  2908. font-size: 30rpx;
  2909. color: #666;
  2910. }
  2911. .textChild {
  2912. display: inline-block;
  2913. vertical-align: middle;
  2914. }
  2915. .dialog {
  2916. position: fixed;
  2917. left: 0;
  2918. top: 0;
  2919. width: 100%;
  2920. height: 100%;
  2921. background-color: rgba(0, 0, 0, 0.8);
  2922. display: flex;
  2923. flex-direction: column;
  2924. align-items: center;
  2925. justify-content: center;
  2926. z-index: 20000;
  2927. .text {
  2928. font-size: 32rpx;
  2929. color: #ffffff;
  2930. text-align: center;
  2931. }
  2932. .btn {
  2933. width: 242rpx;
  2934. height: 82rpx;
  2935. border: 2rpx solid #ffffff;
  2936. border-radius: 16rpx;
  2937. text-align: center;
  2938. line-height: 82rpx;
  2939. margin: 41rpx auto;
  2940. color: #fff;
  2941. font-size: 32rpx;
  2942. }
  2943. }
  2944. .dialog-arrow {
  2945. padding-top: 124rpx;
  2946. position: fixed;
  2947. left: 0;
  2948. top: 0;
  2949. width: 100%;
  2950. height: 100%;
  2951. background-color: rgba(0, 0, 0, 0.8);
  2952. z-index: 20000;
  2953. .pointer {
  2954. margin-left: 87rpx;
  2955. display: block;
  2956. width: 95rpx;
  2957. height: 98rpx;
  2958. }
  2959. .text {
  2960. padding-left: 177rpx;
  2961. font-size: 32rpx;
  2962. color: #ffffff;
  2963. }
  2964. .btn {
  2965. width: 242rpx;
  2966. height: 82rpx;
  2967. border: 2rpx solid #ffffff;
  2968. border-radius: 16rpx;
  2969. text-align: center;
  2970. line-height: 82rpx;
  2971. margin: 500rpx auto 0;
  2972. color: #fff;
  2973. font-size: 32rpx;
  2974. }
  2975. }
  2976. .dialog_wrap {
  2977. position: fixed;
  2978. left: 0;
  2979. top: 0;
  2980. width: 100%;
  2981. height: 100%;
  2982. z-index: 9999999999;
  2983. .bg {
  2984. background: rgba(0, 0, 0, 0.3);
  2985. position: absolute;
  2986. left: 0;
  2987. top: 0;
  2988. width: 100%;
  2989. height: 100%;
  2990. }
  2991. .dialog {
  2992. position: absolute;
  2993. left: 50%;
  2994. top: 50%;
  2995. transform: translate3D(-50%, -50%, 0);
  2996. width: 640rpx;
  2997. height: 439rpx;
  2998. background: #ffffff;
  2999. border-radius: 24rpx;
  3000. .title {
  3001. font-size: 30rpx;
  3002. font-weight: bold;
  3003. color: #333333;
  3004. line-height: 48rpx;
  3005. text-align: center;
  3006. margin-top: 40rpx;
  3007. }
  3008. .content {
  3009. margin: 35rpx 35rpx 0;
  3010. font-size: 30rpx;
  3011. color: #666666;
  3012. line-height: 48rpx;
  3013. }
  3014. .btns {
  3015. margin-top: 35rpx;
  3016. display: flex;
  3017. align-items: center;
  3018. justify-content: center;
  3019. .btn {
  3020. width: 200rpx;
  3021. height: 80rpx;
  3022. line-height: 80rpx;
  3023. text-align: center;
  3024. background: #f5f5f5;
  3025. border-radius: 40rpx;
  3026. font-size: 30rpx;
  3027. color: rgba(0, 122, 255, 1);
  3028. background: #f5f5f5;
  3029. margin: 0 20rpx;
  3030. &.active {
  3031. color: #f5f5f5;
  3032. background: rgba(0, 122, 255, 1);
  3033. }
  3034. }
  3035. }
  3036. }
  3037. }
  3038. .popboxs {
  3039. width: 100%;
  3040. height: 100%;
  3041. display: flex;
  3042. flex-direction: column;
  3043. align-items: center;
  3044. }
  3045. .classTops {
  3046. flex-shrink: 0;
  3047. padding: 39rpx 0rpx 4rpx;
  3048. font-weight: bold;
  3049. color: #333;
  3050. font-size: 30rpx;
  3051. }
  3052. .textStys {
  3053. width: 100%;
  3054. flex: 1;
  3055. padding: 36rpx;
  3056. }
  3057. .classFootsty {
  3058. flex-shrink: 0;
  3059. display: flex;
  3060. align-items: center;
  3061. justify-content: center;
  3062. padding: 10rpx 0rpx 40rpx;
  3063. .btnsty {
  3064. width: 200rpx;
  3065. height: 80rpx;
  3066. border-radius: 40rpx;
  3067. font-weight: bold;
  3068. font-size: 30rpx;
  3069. text-align: center;
  3070. line-height: 80rpx;
  3071. }
  3072. .btns1 {
  3073. background-color: #f5f5f5;
  3074. color: #007aff;
  3075. }
  3076. .btns2 {
  3077. margin-left: 40rpx;
  3078. background-color: #007aff;
  3079. color: #ffffff;
  3080. }
  3081. }
  3082. </style>