index.vue 88 KB

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