questionBank.vue 97 KB

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