questionBank.vue 88 KB

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