questionBank.vue 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002
  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. import { goodsExamIsCanLearn, examClientCanLearn } from "@/utils/authority";
  907. export default {
  908. data() {
  909. return {
  910. showpopups: false,
  911. id: "",
  912. current: 0,
  913. questionList: [],
  914. ast: ["A", "B", "C", "D", "E", "F", "G"],
  915. judge: ["正确", "错误"],
  916. ans: [],
  917. ques: [],
  918. show: false,
  919. showDialog: false,
  920. bankList: [],
  921. collectList: [],
  922. goodsId: "",
  923. recordId: "",
  924. isSubmit: false,
  925. lastTime: 0, //剩余考试时长
  926. allTimes: 0, //总考试时长
  927. timer: null,
  928. wrongList: [],
  929. bankType: 0, //试卷类型
  930. needBack: false, //是否是考试
  931. testOver: false,
  932. isLastCount: false, //是否有未答题目
  933. lastCount: 0, //剩余没有回答的题目数
  934. chapterId: 0,
  935. moduleId: 0,
  936. showArrow: false, //退出提示
  937. isFromVideo: "",
  938. gradeId: "",
  939. examData: {},
  940. orderGoodsId: "",
  941. cgType: 0, //对应设计稿弹窗编码
  942. // courseId: '',
  943. entryType: "", // 进入做题页面的入口类型,daily-每日一练进来,random-随机练习, 其他的-题库做题进入
  944. bankNum: 5, // 随机练习的题目数量
  945. simulateExamId: undefined,
  946. };
  947. },
  948. async onLoad(option) {
  949. await goodsExamIsCanLearn(option.goodsid);
  950. this.entryType = option.entryType || "";
  951. this.bankNum = option.bankNum;
  952. // this.courseId = option.courseId || ''
  953. this.orderGoodsId = option.orderGoodsId || 0;
  954. this.current = +option.current || 0;
  955. this.id = option.id;
  956. this.goodsId = option.goodsid;
  957. this.chapterId = option.chapterId || 0;
  958. this.moduleId = option.moduleId || 0;
  959. this.isFromVideo = option.isFromVideo || "";
  960. this.gradeId = option.gradeId || "";
  961. let isBack = option.isback;
  962. let showDialog = uni.getStorageSync("showDialog");
  963. if (showDialog) {
  964. this.showDialog = false;
  965. } else {
  966. this.showDialog = true;
  967. uni.setStorageSync("showDialog", "1");
  968. }
  969. //考试被迫返回
  970. if (isBack) {
  971. let app = getApp();
  972. let globalData = app.globalData;
  973. for (var k in globalData.bankData) {
  974. this[k] = globalData.bankData[k];
  975. }
  976. this.showArrow = true;
  977. this.timer = setInterval(() => {
  978. if (this.lastTime <= 0) {
  979. clearInterval(this.timer);
  980. uni.showToast({
  981. icon: "none",
  982. mask: true,
  983. title: "考试时间已到,系统将自动交卷",
  984. duration: 10000,
  985. });
  986. this.submit();
  987. return;
  988. }
  989. this.lastTime--;
  990. }, 1000);
  991. } else {
  992. if (this.entryType == "random") {
  993. this.bankType = 1; // 随机练习全部都是练习类型
  994. this.randomQuestionList();
  995. } else {
  996. //进入页面
  997. await this.bankExam();
  998. // 请求题目列表
  999. this.goodsQuestionList();
  1000. }
  1001. }
  1002. },
  1003. onUnload() {
  1004. if (this.isSubmit) {
  1005. clearInterval(this.timer);
  1006. return;
  1007. }
  1008. //考试试卷 阻止ios手势返回,自动跳回答题页
  1009. if (this.needBack) {
  1010. let app = getApp();
  1011. app.globalData.bankData = this.$data;
  1012. clearInterval(this.timer);
  1013. uni.navigateTo({
  1014. url:
  1015. "/pages2/bank/questionBank?id=" +
  1016. this.id +
  1017. "&goodsid=" +
  1018. this.goodsId +
  1019. "&isback=true&orderGoodsId=" +
  1020. this.orderGoodsId,
  1021. });
  1022. } else {
  1023. //点击返回按钮确认允许退出,记录答题记录
  1024. clearInterval(this.timer);
  1025. this.examRecordEdit();
  1026. }
  1027. },
  1028. methods: {
  1029. /**
  1030. * 是否有上传图片
  1031. */
  1032. hasImgs(bank) {
  1033. return bank.ansText.imageList.length == 0;
  1034. },
  1035. /**
  1036. * 获取试卷类型2考试,1练习
  1037. * bank/exam + data
  1038. */
  1039. bankExam() {
  1040. return new Promise((resolve, reject) => {
  1041. this.$api.bankExam(this.id).then((res) => {
  1042. const { doType, examLimitClient } = res.data.data;
  1043. if (!examClientCanLearn(examLimitClient)) {
  1044. return;
  1045. }
  1046. if (this.entryType == "daily") {
  1047. // 每日一练类型都是为练习
  1048. this.bankType = 1;
  1049. } else {
  1050. this.bankType = doType;
  1051. }
  1052. this.examData = res.data.data;
  1053. this.allTimes = this.examData.answerTime * 60;
  1054. this.lastTime =
  1055. this.examData.answerTime && this.examData.answerTime * 60;
  1056. if (this.bankType == 2) {
  1057. this.needBack = true;
  1058. }
  1059. resolve();
  1060. });
  1061. });
  1062. },
  1063. /**
  1064. * 点击后退按钮
  1065. */
  1066. clickLeft() {
  1067. if (this.bankType == 1) {
  1068. let ansCount = this.questionOverNum(true); //已答题数
  1069. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1070. //所有题目答完
  1071. if (this.lastCount == 0) {
  1072. // this.testOver = true;
  1073. this.cgType = 7;
  1074. //未答完
  1075. } else {
  1076. this.cgType = 8;
  1077. // this.isLastCount = true;
  1078. }
  1079. this.showpopups = true;
  1080. } else if (this.bankType == 2) {
  1081. let ansCount = this.questionOverNum(true); //已答题数
  1082. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1083. //所有题目答完
  1084. if (this.lastCount == 0) {
  1085. this.testOver = true;
  1086. //未答完
  1087. } else {
  1088. this.isLastCount = true;
  1089. }
  1090. }
  1091. },
  1092. /**
  1093. * 返回上一页
  1094. */
  1095. backPages() {
  1096. this.needBack = false;
  1097. uni.navigateBack({
  1098. delta: 1,
  1099. });
  1100. },
  1101. /**
  1102. * 获取已经回答的题目数
  1103. * hasSpecail (是否包含简答和案例)
  1104. */
  1105. questionOverNum(hasSpecail) {
  1106. let count = 0;
  1107. this.questionList.forEach((item) => {
  1108. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1109. if (item.ques) {
  1110. count++;
  1111. }
  1112. } else if (item.type == 4) {
  1113. //案例题
  1114. if (hasSpecail) {
  1115. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1116. if (
  1117. jsonItem.type == 1 ||
  1118. jsonItem.type == 2 ||
  1119. jsonItem.type == 3
  1120. ) {
  1121. if (item.ques[indexs]) {
  1122. return true;
  1123. } else {
  1124. return false;
  1125. }
  1126. } else if (jsonItem.type == 5) {
  1127. if (
  1128. item.ques[indexs] &&
  1129. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  1130. ) {
  1131. console.log("chil");
  1132. return true;
  1133. } else {
  1134. return false;
  1135. }
  1136. }
  1137. });
  1138. if (isOver) {
  1139. count++;
  1140. }
  1141. }
  1142. } else if (item.type == 5) {
  1143. //简答题
  1144. if (hasSpecail) {
  1145. if (item.ques && (item.ques.text || item.ques.imageList.length)) {
  1146. console.log(5, item);
  1147. count++;
  1148. }
  1149. }
  1150. }
  1151. });
  1152. return count;
  1153. },
  1154. /**
  1155. * 是否做完所有题目
  1156. */
  1157. isDoOver() {
  1158. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  1159. if (this.questionList.length == questionOverNum) {
  1160. //全部做完弹窗
  1161. this.cgType = 9;
  1162. this.showpopups = true;
  1163. }
  1164. },
  1165. /**
  1166. * 暂不交卷
  1167. */
  1168. noSubmit() {
  1169. //设为允许退出页面
  1170. this.needBack = false;
  1171. uni.navigateBack({
  1172. delta: 1,
  1173. });
  1174. },
  1175. /**
  1176. * 不离开
  1177. */
  1178. noLeave() {
  1179. this.isLastCount = false;
  1180. },
  1181. /**
  1182. * 立即离开并交卷
  1183. */
  1184. leaveNow() {
  1185. this.needBack = false;
  1186. this.isSubmit = true;
  1187. this.submit(false);
  1188. uni.navigateBack({
  1189. delta: 1,
  1190. });
  1191. },
  1192. /**
  1193. * 立即交卷
  1194. */
  1195. submitNow() {
  1196. this.showpopups = false;
  1197. this.needBack = false;
  1198. this.submit();
  1199. },
  1200. /**
  1201. * 离开页面统计回答正确题数
  1202. */
  1203. examRecordEdit() {
  1204. if (!this.isSubmit) {
  1205. let {
  1206. doQuestionNum,
  1207. doQuestionIds,
  1208. rightQuestionNum,
  1209. historyExamJson,
  1210. } = this.$method.calculateScore(this.questionList);
  1211. this.$api
  1212. .examRecordEdit({
  1213. orderGoodsId: this.orderGoodsId,
  1214. examId: this.id,
  1215. goodsId: this.goodsId,
  1216. recordId: this.recordId,
  1217. doQuestionIds,
  1218. rightQuestionNum,
  1219. moduleExamId: this.moduleId || 0,
  1220. chapterExamId: this.chapterId || 0,
  1221. status: 0,
  1222. doQuestionNum,
  1223. historyExamJson,
  1224. })
  1225. .then((res) => {
  1226. if (res.data.code == 200) {
  1227. this.entryType == "daily" && this.dailyExam();
  1228. }
  1229. });
  1230. }
  1231. },
  1232. /**
  1233. * 记录总题数
  1234. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1235. */
  1236. examRecord(hasSpecial) {
  1237. let questionList = 0;
  1238. // if(!hasSpecial) {
  1239. this.questionList.forEach((item, index) => {
  1240. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1241. questionList++;
  1242. }
  1243. });
  1244. // } else {
  1245. // questionList = this.questionList.length;
  1246. // }
  1247. this.$api
  1248. .examRecord({
  1249. chapterExamId: this.chapterId || 0,
  1250. orderGoodsId: this.orderGoodsId,
  1251. moduleExamId: this.moduleId || 0,
  1252. examId: this.id,
  1253. goodsId: this.goodsId,
  1254. totalQuestionNum: questionList,
  1255. allQuestionNum: this.questionList.length,
  1256. doMode: this.doMode,
  1257. simulateExamId: this.simulateExamId,
  1258. })
  1259. .then((res) => {
  1260. this.recordId = res.data.data;
  1261. //获取recordId 初始化先提交题目 以防突然下次继续做题退出报错
  1262. if (this.bankType == 1) {
  1263. this.examRecordEdit();
  1264. }
  1265. });
  1266. },
  1267. /**
  1268. * @param {Object} second倒计时过滤器
  1269. */
  1270. countdown(second) {
  1271. if (second) {
  1272. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1273. let m = parseInt((second / 60) % 60); // 计算分数
  1274. let s = parseInt(second % 60); // 计算当前秒数
  1275. if (h < 10) h = "0" + h;
  1276. if (m < 10) m = "0" + m;
  1277. if (s < 10) s = "0" + s;
  1278. return h + ":" + m + ":" + s;
  1279. } else {
  1280. return "";
  1281. }
  1282. },
  1283. hideDialog() {
  1284. this.showDialog = false;
  1285. },
  1286. // 请求随机练习题目列表
  1287. randomQuestionList() {
  1288. this.$http({
  1289. url: "/bank/exam/temp",
  1290. method: "post",
  1291. data: {
  1292. goodsId: this.goodsId,
  1293. orderGoodsId: this.orderGoodsId,
  1294. number: this.bankNum,
  1295. },
  1296. }).then((res) => {
  1297. if (res.data.code == 200) {
  1298. this.examData = res.data.data || {};
  1299. this.id = this.examData.examId;
  1300. if (!this.examData.questionList.length) {
  1301. return this.noListTip();
  1302. }
  1303. this.dataAnlyze(this.examData.questionList || []);
  1304. } else {
  1305. this.$u.toast(res.data.msg);
  1306. setTimeout(() => {
  1307. uni.navigateBack();
  1308. }, 2000);
  1309. }
  1310. });
  1311. },
  1312. noListTip(content = "该试卷暂无题目") {
  1313. this.hideDialog();
  1314. uni.showModal({
  1315. showCancel: false,
  1316. content,
  1317. success: (k) => {
  1318. if (k.confirm) {
  1319. this.isSubmit = true;
  1320. uni.navigateBack();
  1321. }
  1322. },
  1323. });
  1324. },
  1325. /**
  1326. * 请求题目列表 app/common/bank/question/list
  1327. */
  1328. goodsQuestionList() {
  1329. this.$api[
  1330. this.doMode == 3 ? "goodsRandomQuestionList" : "goodsQuestionList"
  1331. ]({
  1332. examId: this.id,
  1333. goodsId: this.goodsId,
  1334. orderGoodsId: this.orderGoodsId,
  1335. from: 1,
  1336. }).then((res) => {
  1337. if (res.data.code == 500) {
  1338. return this.noListTip("你已完成所有题目");
  1339. }
  1340. let data = res.data.data;
  1341. if (this.doMode == 3) {
  1342. this.simulateExamId = data.simulateExamId;
  1343. data = data.questionList;
  1344. }
  1345. if (!data.length) {
  1346. return this.noListTip();
  1347. }
  1348. //考试时间到了自动交卷
  1349. if (this.lastTime) {
  1350. this.timer = setInterval(() => {
  1351. if (this.lastTime <= 0) {
  1352. clearInterval(this.timer);
  1353. uni.showToast({
  1354. icon: "none",
  1355. mask: true,
  1356. title: "考试时间已到,系统将自动交卷",
  1357. duration: 10000,
  1358. });
  1359. this.submit();
  1360. return;
  1361. }
  1362. this.lastTime--;
  1363. }, 1000);
  1364. } else {
  1365. }
  1366. this.dataAnlyze(data);
  1367. });
  1368. },
  1369. dataAnlyze(datas = []) {
  1370. console.log("datas:", datas);
  1371. datas.forEach((item, index) => {
  1372. // if (typeof item.jsonStr == 'string') {
  1373. item.jsonStr = JSON.parse(item.jsonStr);
  1374. if (item.type == 2) {
  1375. //多选
  1376. item.jsonStr.forEach((str) => {
  1377. str.optionsId = "" + str.optionsId;
  1378. });
  1379. let arr = item.answerQuestion.split(",");
  1380. arr.forEach((a, i) => {
  1381. arr[i] = "" + a;
  1382. });
  1383. item.ans = arr;
  1384. item.analysisContent &&
  1385. (item.analysisContent = item.analysisContent.replace(
  1386. /<img/gi,
  1387. '<img style="max-width:100%;"'
  1388. ));
  1389. item.content &&
  1390. (item.content = item.content.replace(
  1391. /<img/gi,
  1392. '<img style="max-width:100%;"'
  1393. ));
  1394. return;
  1395. } else if (item.type == 5) {
  1396. //简答题
  1397. item.ansText = {
  1398. text: "",
  1399. imageList: [],
  1400. };
  1401. item.ques = {
  1402. text: "",
  1403. imageList: [],
  1404. };
  1405. item.analysisContent &&
  1406. (item.analysisContent = item.analysisContent.replace(
  1407. /<img/gi,
  1408. '<img style="max-width:100%;"'
  1409. ));
  1410. item.content &&
  1411. (item.content = item.content.replace(
  1412. /<img/gi,
  1413. '<img style="max-width:100%;"'
  1414. ));
  1415. } else if (item.type == 4) {
  1416. //案例题
  1417. item.ques = [];
  1418. item.current = 0;
  1419. let ansArr = [];
  1420. item.jsonStr.forEach((json, index) => {
  1421. if (json.type == 1) {
  1422. ansArr[index] = json.answerQuestion;
  1423. json.content &&
  1424. (json.content = json.content.replace(
  1425. /<img/gi,
  1426. '<img style="max-width:100%;"'
  1427. ));
  1428. } else if (json.type == 2) {
  1429. json.optionsList.forEach((str) => {
  1430. str.optionsId = "" + str.optionsId;
  1431. });
  1432. let arr = json.answerQuestion.split(",");
  1433. arr.forEach((a, i) => {
  1434. arr[i] = "" + a;
  1435. });
  1436. ansArr[index] = arr;
  1437. json.content &&
  1438. (json.content = json.content.replace(
  1439. /<img/gi,
  1440. '<img style="max-width:100%;"'
  1441. ));
  1442. } else if (json.type == 3) {
  1443. ansArr[index] = json.answerQuestion;
  1444. json.content &&
  1445. (json.content = json.content.replace(
  1446. /<img/gi,
  1447. '<img style="max-width:100%;"'
  1448. ));
  1449. } else if (json.type == 5) {
  1450. ansArr[index] = {
  1451. text: json.answerQuestion,
  1452. imageList: [],
  1453. };
  1454. json.ansText = {
  1455. text: "",
  1456. imageList: [],
  1457. };
  1458. json.content &&
  1459. (json.content = json.content.replace(
  1460. /<img/gi,
  1461. '<img style="max-width:100%;"'
  1462. ));
  1463. }
  1464. });
  1465. item.analysisContent &&
  1466. (item.analysisContent = item.analysisContent.replace(
  1467. /<img/gi,
  1468. '<img style="max-width:100%;"'
  1469. ));
  1470. item.content &&
  1471. (item.content = item.content.replace(
  1472. /<img/gi,
  1473. '<img style="max-width:100%;"'
  1474. ));
  1475. item.ans = ansArr;
  1476. return;
  1477. }
  1478. item.analysisContent &&
  1479. (item.analysisContent = item.analysisContent.replace(
  1480. /<img/gi,
  1481. '<img style="max-width:100%;"'
  1482. ));
  1483. item.content &&
  1484. (item.content = item.content.replace(
  1485. /<img/gi,
  1486. '<img style="max-width:100%;"'
  1487. ));
  1488. item.ans = item.answerQuestion;
  1489. // }
  1490. });
  1491. this.questionList = datas;
  1492. this.lastCount = this.questionList.length;
  1493. this.examRecord();
  1494. this.getCollectInfo(this.current);
  1495. },
  1496. /**
  1497. * @param {Object} e单选点击
  1498. */
  1499. radioSelect(optionsId, bindex) {
  1500. // if (this.questionList[bindex].ques) return;
  1501. if (this.questionList[bindex].ques && this.bankType == 1) {
  1502. return;
  1503. }
  1504. this.$set(this.questionList[bindex], "ques", optionsId);
  1505. // if ((bindex + 1) < this.questionList.length) {
  1506. // this.current = bindex + 1
  1507. // }
  1508. this.isDoOver();
  1509. // 回答错误
  1510. // if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
  1511. // // /exam/wwrong/record
  1512. // this.$api
  1513. // .examWrongRecord({
  1514. // orderGoodsId: this.orderGoodsId,
  1515. // examId: this.id,
  1516. // goodsId: this.goodsId,
  1517. // moduleExamId: this.moduleId || 0,
  1518. // chapterExamId: this.chapterId || 0,
  1519. // questionIds: [this.questionList[bindex].questionId],
  1520. // recordId: this.recordId,
  1521. // })
  1522. // .then((res) => {});
  1523. // } else {
  1524. // // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  1525. // // if(question) {
  1526. // // this.$api.wrongRecordDelete({
  1527. // // "examId": +this.id,
  1528. // // "goodsId": +this.goodsId,
  1529. // // "questionId": this.questionList[bindex].questionId,
  1530. // // }).then(res => {
  1531. // // })
  1532. // // }
  1533. // }
  1534. },
  1535. /**
  1536. * @param {Object} e案例单选点击
  1537. */
  1538. radioSelectChild(optionsId, ansIndex, bindex) {
  1539. // if (this.questionList[bindex].ques[ansIndex]) return;
  1540. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1541. return;
  1542. }
  1543. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  1544. this.isDoOver();
  1545. },
  1546. /**
  1547. * @param {Object} 多选点击
  1548. */
  1549. checkboxSelect(optionsId, bindex, index) {
  1550. if (this.questionList[bindex].ques && this.bankType == 1) {
  1551. return;
  1552. }
  1553. this.$set(
  1554. this.questionList[bindex].jsonStr[index],
  1555. "checked",
  1556. !this.questionList[bindex].jsonStr[index].checked
  1557. );
  1558. },
  1559. /**
  1560. * @param {Object} 案例多选点击
  1561. */
  1562. checkboxSelectChild(bindex, ansIndex, childIndex) {
  1563. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1564. return;
  1565. }
  1566. this.$set(
  1567. this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
  1568. "checked",
  1569. !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex]
  1570. .checked
  1571. );
  1572. },
  1573. isCheckboxChecked(arr) {
  1574. return arr.some((item) => {
  1575. if (item.checked) {
  1576. return true;
  1577. }
  1578. });
  1579. },
  1580. /**
  1581. * @param {Object} 多选确认
  1582. */
  1583. checkboxSubmit(bindex) {
  1584. if (this.questionList[bindex].ques && this.bankType == 1) {
  1585. return;
  1586. }
  1587. let arr = [];
  1588. this.questionList[bindex].jsonStr.forEach((item) => {
  1589. if (item.checked) {
  1590. arr.push(item.optionsId);
  1591. }
  1592. });
  1593. if (!arr.length) {
  1594. delete this.questionList[bindex].ques;
  1595. uni.showToast({
  1596. title: "请选择答案",
  1597. icon: "none",
  1598. });
  1599. return;
  1600. }
  1601. this.$set(this.questionList[bindex], "ques", arr);
  1602. this.$u.toast("已确认答案");
  1603. this.isDoOver();
  1604. // 切换下一题
  1605. if (
  1606. this.bankType != 1 &&
  1607. this.cgType != 9 &&
  1608. bindex != this.questionList.length - 1
  1609. ) {
  1610. this.current = bindex + 1;
  1611. this.getCollectInfo(this.current);
  1612. }
  1613. },
  1614. /**
  1615. * @param {Object} 案例多选确认
  1616. */
  1617. checkboxSubmitChild(bindex, ansIndex) {
  1618. // if (this.questionList[bindex].ques[ansIndex]) return;
  1619. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1620. return;
  1621. }
  1622. let arr = [];
  1623. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
  1624. (item) => {
  1625. if (item.checked) {
  1626. arr.push(item.optionsId);
  1627. }
  1628. }
  1629. );
  1630. if (!arr.length) {
  1631. delete this.questionList[bindex].ques[ansIndex];
  1632. uni.showToast({
  1633. title: "请选择答案",
  1634. icon: "none",
  1635. });
  1636. return;
  1637. }
  1638. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  1639. this.$u.toast("已确认答案");
  1640. this.isDoOver();
  1641. // 切换下一题
  1642. if (
  1643. this.bankType != 1 &&
  1644. this.cgType != 9 &&
  1645. ansIndex != this.questionList[bindex].ques.length - 1
  1646. ) {
  1647. this.questionList[bindex].current += 1;
  1648. }
  1649. },
  1650. /**
  1651. * @param {Object} index
  1652. * @param {Object} bindex
  1653. * 判断题
  1654. */
  1655. judgeSelect(index, bindex) {
  1656. // if (this.questionList[bindex].ques) return;
  1657. if (this.questionList[bindex].ques && this.bankType == 1) {
  1658. return;
  1659. } // 答案: 判断题1正确 0错误
  1660. this.$set(this.questionList[bindex], "ques", index == 0 ? "1" : "0");
  1661. console.log(
  1662. "this.questionList[bindex]:",
  1663. this.questionList[bindex].ques,
  1664. this.questionList[bindex].ans
  1665. );
  1666. this.isDoOver();
  1667. // 回答错误
  1668. // if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
  1669. // this.$api
  1670. // .examWrongRecord({
  1671. // orderGoodsId: this.orderGoodsId,
  1672. // examId: this.id,
  1673. // goodsId: this.goodsId,
  1674. // moduleExamId: this.moduleId || 0,
  1675. // chapterExamId: this.chapterId || 0,
  1676. // questionIds: [this.questionList[bindex].questionId],
  1677. // recordId: this.recordId,
  1678. // })
  1679. // .then((res) => {});
  1680. // } else {
  1681. // // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  1682. // // if(question) {
  1683. // // this.$api.wrongRecordDelete({
  1684. // // "examId": +this.id,
  1685. // // "goodsId": +this.goodsId,
  1686. // // "questionId": this.questionList[bindex].questionId,
  1687. // // }).then(res => {
  1688. // // })
  1689. // // }
  1690. // }
  1691. },
  1692. /**
  1693. * @param {Object} ansindex
  1694. * @param {Object} childindex
  1695. * @param {Object} bindex
  1696. * 案例判断题
  1697. */
  1698. judgeSelectChild(ansindex, childindex, bindex) {
  1699. // if (this.questionList[bindex].ques[ansindex]) return;
  1700. if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
  1701. return;
  1702. }
  1703. this.$set(
  1704. this.questionList[bindex].ques,
  1705. ansindex,
  1706. childindex == 0 ? "1" : "0"
  1707. );
  1708. this.isDoOver();
  1709. },
  1710. openFooterTab() {
  1711. this.show = true;
  1712. },
  1713. changeIndex(index) {
  1714. this.current = index;
  1715. },
  1716. swiperChange(e) {
  1717. this.current = e.detail.current;
  1718. this.getCollectInfo(this.current);
  1719. },
  1720. /**
  1721. * @param {Object} current
  1722. * 获取收藏信息
  1723. */
  1724. getCollectInfo(current) {
  1725. this.$api
  1726. .getCollectInfo({
  1727. examId: this.id,
  1728. questionId: this.questionList[current].questionId,
  1729. goodsId: this.goodsId,
  1730. orderGoodsId: this.orderGoodsId,
  1731. })
  1732. .then((res) => {
  1733. if (res.data.code == 500) {
  1734. this.$set(this.collectList, current, false);
  1735. } else if (res.data.code == 200) {
  1736. this.$set(this.collectList, current, res.data.data);
  1737. }
  1738. });
  1739. },
  1740. pdsubmit() {
  1741. // if (this.bankType == 1) {
  1742. let ansCount = this.questionOverNum(true); //已答题数
  1743. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1744. //没有答完
  1745. if (this.lastCount !== 0) {
  1746. this.cgType = 6;
  1747. this.showpopups = true;
  1748. return;
  1749. }
  1750. // }
  1751. if (this.bankType == 2) {
  1752. if (this.lastTime > 0) {
  1753. let lastTime = this.countdown(this.lastTime);
  1754. uni.showModal({
  1755. title: "提示",
  1756. content: `时间还剩余${lastTime},确定交卷吗?`,
  1757. confirmText: "交卷",
  1758. cancelText: "继续答题",
  1759. success: (res) => {
  1760. if (res.confirm) {
  1761. //确定
  1762. this.submit();
  1763. } else {
  1764. //取消
  1765. }
  1766. },
  1767. });
  1768. return;
  1769. }
  1770. }
  1771. this.submit();
  1772. },
  1773. /**
  1774. * 交卷
  1775. */
  1776. submit(isShowTip = true) {
  1777. let form = this.$method.calculateScore(this.questionList);
  1778. //交卷
  1779. this.$api
  1780. .examRecordEdit({
  1781. examId: this.id,
  1782. goodsId: this.goodsId,
  1783. recordId: this.recordId,
  1784. orderGoodsId: this.orderGoodsId,
  1785. status: 1, // 1是交卷 2是中途离开
  1786. moduleExamId: this.moduleId || 0,
  1787. chapterExamId: this.chapterId || 0,
  1788. examTime: parseInt(this.allTimes),
  1789. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1790. ...form,
  1791. })
  1792. .then((res) => {
  1793. this.isSubmit = true;
  1794. if (res.data.code == 200) {
  1795. this.entryType == "daily" && this.dailyExam();
  1796. if (!isShowTip) {
  1797. return;
  1798. }
  1799. uni.showToast({
  1800. title: "交卷成功",
  1801. duration: 1000,
  1802. icon: "none",
  1803. });
  1804. setTimeout(() => {
  1805. uni.redirectTo({
  1806. url:
  1807. "/pages2/bank/question_report?goodsId=" +
  1808. this.goodsId +
  1809. "&chapterId=" +
  1810. this.chapterId +
  1811. "&moduleId=" +
  1812. this.moduleId +
  1813. "&examId=" +
  1814. this.id +
  1815. "&id=" +
  1816. this.recordId +
  1817. "&orderGoodsId=" +
  1818. this.orderGoodsId +
  1819. "&entryType=" +
  1820. this.entryType +
  1821. "&bankNum=" +
  1822. this.bankNum +
  1823. "&doMode=" +
  1824. this.doMode +
  1825. "&courseType=1",
  1826. });
  1827. }, 1000);
  1828. }
  1829. });
  1830. //错题集id提交(客观题)
  1831. this.$api.examWrongRecord({
  1832. examId: this.id,
  1833. goodsId: this.goodsId,
  1834. orderGoodsId: this.orderGoodsId,
  1835. questionIds: form.questionIds,
  1836. recordId: this.recordId,
  1837. type: 1, // 题库试卷传1
  1838. doMode: this.doMode,
  1839. });
  1840. },
  1841. // 每日一练试卷打卡
  1842. dailyExam() {
  1843. const dateStamp = parseInt(
  1844. new Date(new Date().toLocaleDateString()).getTime() / 1000
  1845. );
  1846. this.$http({
  1847. url: "/bank/question/special/exam/record",
  1848. method: "post",
  1849. data: {
  1850. examId: this.id,
  1851. chapterExamId: this.chapterId, // 章卷ID
  1852. moduleExamId: this.moduleId, //模块卷ID
  1853. goodsId: this.goodsId,
  1854. recordTime: dateStamp, // 传当天0点时间戳(秒)
  1855. },
  1856. }).then((res) => {
  1857. if (res.data.code == 200) {
  1858. }
  1859. });
  1860. },
  1861. /**
  1862. * @param {Object} state
  1863. * @param {Object} index
  1864. * 收藏
  1865. */
  1866. collect(state, index) {
  1867. if (!state) {
  1868. this.$api
  1869. .collectQuestion({
  1870. examId: this.id,
  1871. questionId: this.questionList[index].questionId,
  1872. goodsId: this.goodsId || "",
  1873. orderGoodsId: this.orderGoodsId,
  1874. doMode: this.doMode,
  1875. })
  1876. .then((res) => {
  1877. if (res.data.code == 200) {
  1878. this.$set(this.collectList, index, true);
  1879. uni.showToast({
  1880. title: "收藏成功",
  1881. duration: 2000,
  1882. icon: "none",
  1883. });
  1884. this.getCollectInfo(index);
  1885. }
  1886. });
  1887. } else {
  1888. this.$api
  1889. .deleteCollectQuestion(this.collectList[index].collectQuestionId)
  1890. .then((res) => {
  1891. if (res.data.code == 200) {
  1892. this.$set(this.collectList, index, false);
  1893. uni.showToast({
  1894. title: "取消收藏成功",
  1895. duration: 2000,
  1896. icon: "none",
  1897. });
  1898. }
  1899. });
  1900. }
  1901. return;
  1902. },
  1903. /**
  1904. * @param {Object} imgIndex
  1905. * @param {Object} bankIndex
  1906. * 删除简答图片
  1907. */
  1908. deleteImg(imgIndex, bankIndex) {
  1909. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  1910. },
  1911. /**
  1912. * @param {Object} imgIndex
  1913. * @param {Object} bankIndex
  1914. * @param {Object} ansIndex
  1915. * 删除案例题简答图片
  1916. */
  1917. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  1918. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(
  1919. imgIndex,
  1920. 1
  1921. );
  1922. },
  1923. /**
  1924. * @param {Object} bankindex
  1925. * 选择上传图片
  1926. */
  1927. chooseImg(bankindex) {
  1928. if (
  1929. this.questionList[bankindex] &&
  1930. this.questionList[bankindex].ansText &&
  1931. this.questionList[bankindex].ansText.imageList.length >= 4
  1932. ) {
  1933. uni.showToast({
  1934. icon: "none",
  1935. title: "最多选择4张",
  1936. });
  1937. return;
  1938. }
  1939. uni.chooseImage({
  1940. count: 1, //默认9
  1941. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  1942. sourceType: ["album", "camera"], //从相册选择
  1943. success: (res) => {
  1944. let self = this;
  1945. // console.log(JSON.stringify(res.tempFilePaths));
  1946. let img = res.tempFilePaths[0];
  1947. uni.getImageInfo({
  1948. src: img,
  1949. success: async (res) => {
  1950. let canvasWidth = res.width; //图片原始长宽
  1951. let canvasHeight = res.height;
  1952. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1953. uni.compressImage({
  1954. src: img,
  1955. quality: 75,
  1956. width: "50%",
  1957. height: "50%",
  1958. success: async (rest) => {
  1959. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1960. this.questionList[bankindex].ansText.imageList.push(dir);
  1961. },
  1962. });
  1963. } else {
  1964. const dir = await self.uploadFile(img, 0);
  1965. this.questionList[bankindex].ansText.imageList.push(dir);
  1966. }
  1967. },
  1968. });
  1969. },
  1970. });
  1971. },
  1972. /**
  1973. * @param {Object} bankindex
  1974. * @param {Object} ansindex
  1975. * 案例题选择上传图片
  1976. */
  1977. chooseImgChild(bankindex, ansindex) {
  1978. if (
  1979. this.questionList[bankindex].jsonStr[ansindex] &&
  1980. this.questionList[bankindex].jsonStr[ansindex].ansText &&
  1981. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList
  1982. .length >= 4
  1983. ) {
  1984. uni.showToast({
  1985. icon: "none",
  1986. title: "最多选择4张",
  1987. });
  1988. return;
  1989. }
  1990. uni.chooseImage({
  1991. count: 1, //默认9
  1992. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  1993. sourceType: ["album", "camera"], //从相册选择
  1994. success: (res) => {
  1995. let self = this;
  1996. // console.log(JSON.stringify(res.tempFilePaths));
  1997. let img = res.tempFilePaths[0];
  1998. uni.getImageInfo({
  1999. src: img,
  2000. success: async (res) => {
  2001. let canvasWidth = res.width; //图片原始长宽
  2002. let canvasHeight = res.height;
  2003. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2004. uni.compressImage({
  2005. src: img,
  2006. quality: 75,
  2007. width: "50%",
  2008. height: "50%",
  2009. success: async (rest) => {
  2010. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2011. this.questionList[bankindex].jsonStr[
  2012. ansindex
  2013. ].ansText.imageList.push(dir);
  2014. },
  2015. });
  2016. } else {
  2017. const dir = await self.uploadFile(img, 0);
  2018. this.questionList[bankindex].jsonStr[
  2019. ansindex
  2020. ].ansText.imageList.push(dir);
  2021. }
  2022. },
  2023. });
  2024. },
  2025. });
  2026. },
  2027. uploadFile(options, int) {
  2028. var self = this;
  2029. return new Promise((resolve, reject) => {
  2030. var data = {
  2031. orderGoodsId: this.orderGoodsId,
  2032. imageStatus: int,
  2033. };
  2034. self.$api.aliyunpolicy(data).then((res) => {
  2035. console.log(res.data, 6);
  2036. if (res.data.code != 200) {
  2037. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  2038. return;
  2039. }
  2040. var ossToken = res.data.data.resultContent;
  2041. if (ossToken.host == null || ossToken.host == undefined) {
  2042. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  2043. return;
  2044. }
  2045. uni.uploadFile({
  2046. url: ossToken.host,
  2047. name: "file",
  2048. filePath: options,
  2049. fileType: "image",
  2050. header: {
  2051. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  2052. },
  2053. formData: {
  2054. key: ossToken.dir,
  2055. OSSAccessKeyId: ossToken.accessid,
  2056. policy: ossToken.policy,
  2057. Signature: ossToken.signature,
  2058. callback: ossToken.callback,
  2059. success_action_status: 200,
  2060. },
  2061. success: (result) => {
  2062. // if (result.statusCode === 200) {
  2063. resolve(ossToken.dir);
  2064. // } else {
  2065. // uni.showToast({
  2066. // title: "上传失败",
  2067. // icon: "none",
  2068. // });
  2069. // return;
  2070. // }
  2071. },
  2072. fail: (error) => {
  2073. uni.showToast({
  2074. title: "上传接口报错" + error,
  2075. icon: "none",
  2076. });
  2077. return;
  2078. },
  2079. });
  2080. });
  2081. });
  2082. },
  2083. /**
  2084. * @param {Object} type
  2085. * @param {Object} bankindex
  2086. * 简答题答案确认
  2087. */
  2088. submitAns(bankindex) {
  2089. if (
  2090. !this.questionList[bankindex].ansText.text &&
  2091. !this.questionList[bankindex].ansText.imageList.length
  2092. ) {
  2093. uni.showToast({
  2094. title: "请输入内容或上传图片",
  2095. duration: 2000,
  2096. icon: "none",
  2097. });
  2098. return;
  2099. }
  2100. this.$set(this.questionList[bankindex], "ques", {
  2101. imageList: this.questionList[bankindex].ansText.imageList || [],
  2102. text: this.questionList[bankindex].ansText.text || "",
  2103. });
  2104. this.$u.toast("已确认答案");
  2105. this.isDoOver();
  2106. },
  2107. /**
  2108. * @param {Object} bankindex
  2109. * @param {Object} ansindex
  2110. * 案例题简答答案确认
  2111. */
  2112. submitAnsChild(bankindex, ansindex) {
  2113. if (
  2114. !this.questionList[bankindex].jsonStr[ansindex].ansText.text &&
  2115. !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length
  2116. ) {
  2117. uni.showToast({
  2118. title: "请输入内容或上传图片",
  2119. duration: 2000,
  2120. icon: "none",
  2121. });
  2122. return;
  2123. }
  2124. this.$set(this.questionList[bankindex].ques, ansindex, {
  2125. imageList:
  2126. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList ||
  2127. [],
  2128. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text || "",
  2129. });
  2130. this.$u.toast("已确认答案");
  2131. this.isDoOver();
  2132. },
  2133. isCheck(item, index) {
  2134. // 案例题处理
  2135. let { ques, type, ans } = item;
  2136. if (type == 4) {
  2137. return ans.length == ques.length;
  2138. }
  2139. if (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. if (this.entryType == "sd") {
  2332. return 4;
  2333. }
  2334. return this.examData.simulateStatus
  2335. ? 3
  2336. : this.entryType == "random"
  2337. ? 2
  2338. : 1;
  2339. },
  2340. },
  2341. };
  2342. </script>
  2343. <style lang="scss" scoped>
  2344. .questionBank {
  2345. width: 100%;
  2346. height: 100vh;
  2347. display: flex;
  2348. flex-direction: column;
  2349. }
  2350. .swiper {
  2351. width: 100%;
  2352. flex: 1;
  2353. }
  2354. .lisSty {
  2355. margin-bottom: 16rpx;
  2356. display: flex;
  2357. align-items: center;
  2358. .flex_auto {
  2359. word-break: break-all;
  2360. flex: 1;
  2361. }
  2362. }
  2363. .activeTI {
  2364. vertical-align: middle;
  2365. display: inline-block;
  2366. border: 1rpx solid #eee;
  2367. border-radius: 50rpx;
  2368. height: 48rpx;
  2369. line-height: 46rpx;
  2370. text-align: center;
  2371. width: 48rpx;
  2372. margin-right: 15rpx;
  2373. color: #666;
  2374. font-size: 30rpx;
  2375. &.right {
  2376. color: #fff;
  2377. background: #36c75a;
  2378. }
  2379. &.wrong {
  2380. color: #fff;
  2381. background: #ff3b30;
  2382. }
  2383. &.checked,
  2384. &.user_choose {
  2385. color: #fff;
  2386. background: #007aff;
  2387. }
  2388. }
  2389. .submit_checkbox {
  2390. position: fixed;
  2391. left: 0;
  2392. right: 0;
  2393. bottom: 120rpx;
  2394. margin: 20rpx auto;
  2395. width: 526rpx;
  2396. height: 80rpx;
  2397. background: rgba(0, 122, 255, 1);
  2398. color: #fff;
  2399. text-align: center;
  2400. line-height: 80rpx;
  2401. font-size: 30rpx;
  2402. border-radius: 40rpx;
  2403. &.disabled {
  2404. opacity: 0.6;
  2405. }
  2406. }
  2407. .titles {
  2408. overflow: hidden;
  2409. margin-bottom: 24rpx;
  2410. }
  2411. .titBox {
  2412. padding: 41rpx 25rpx 24rpx 25rpx;
  2413. }
  2414. .titBox_title {
  2415. padding: 21rpx;
  2416. }
  2417. .tabs {
  2418. margin: 10rpx;
  2419. display: flex;
  2420. .tab {
  2421. margin: 0 4rpx;
  2422. padding: 10rpx 13rpx;
  2423. text-align: center;
  2424. color: #007aff;
  2425. font-size: 28rpx;
  2426. border-radius: 16rpx;
  2427. background: #fff;
  2428. &.current {
  2429. color: #fff;
  2430. background: #007aff;
  2431. }
  2432. }
  2433. }
  2434. .ans {
  2435. margin: 8rpx 8rpx 8rpx;
  2436. .ans_input {
  2437. border-radius: 16rpx;
  2438. background: #fff;
  2439. .top {
  2440. border-bottom: 1rpx solid #eeeeee;
  2441. padding: 16rpx;
  2442. display: flex;
  2443. align-items: center;
  2444. .icon {
  2445. margin-right: 20rpx;
  2446. width: 40rpx;
  2447. height: 38rpx;
  2448. }
  2449. .progress {
  2450. flex: 1;
  2451. }
  2452. .submit {
  2453. width: 168rpx;
  2454. height: 48rpx;
  2455. line-height: 48rpx;
  2456. text-align: center;
  2457. color: #fff;
  2458. font-size: 30rpx;
  2459. background: #007aff;
  2460. border-radius: 24rpx;
  2461. &.disabled {
  2462. opacity: 0.6;
  2463. }
  2464. }
  2465. }
  2466. .textarea {
  2467. textarea {
  2468. width: 100%;
  2469. height: 287rpx;
  2470. padding: 10rpx;
  2471. }
  2472. }
  2473. .imgs {
  2474. overflow: hidden;
  2475. display: flex;
  2476. width: 100%;
  2477. .img {
  2478. width: 104rpx;
  2479. height: 104rpx;
  2480. border-radius: 8rpx;
  2481. position: relative;
  2482. margin: 20rpx;
  2483. text {
  2484. position: absolute;
  2485. right: -15rpx;
  2486. top: -15rpx;
  2487. width: 30rpx;
  2488. height: 30rpx;
  2489. text-align: center;
  2490. line-height: 30rpx;
  2491. color: #fff;
  2492. background: #ff3b30;
  2493. border-radius: 50%;
  2494. }
  2495. image {
  2496. width: 100%;
  2497. height: 100%;
  2498. }
  2499. }
  2500. }
  2501. }
  2502. .ans_submit {
  2503. padding: 16rpx;
  2504. border-radius: 16rpx;
  2505. background: #fff;
  2506. .imgs {
  2507. overflow: hidden;
  2508. display: flex;
  2509. width: 100%;
  2510. .img {
  2511. width: 104rpx;
  2512. height: 104rpx;
  2513. border-radius: 8rpx;
  2514. position: relative;
  2515. margin: 20rpx;
  2516. image {
  2517. width: 100%;
  2518. height: 100%;
  2519. }
  2520. }
  2521. }
  2522. }
  2523. }
  2524. .leftLetters {
  2525. display: flex;
  2526. align-items: center;
  2527. width: 220rpx;
  2528. .btnType {
  2529. padding: 5rpx 10rpx;
  2530. border: 1rpx solid #007aff;
  2531. border-radius: 10rpx;
  2532. background-color: rgba(0, 122, 255, 0.1);
  2533. font-size: 28rpx;
  2534. color: #007aff;
  2535. margin-right: 15rpx;
  2536. }
  2537. }
  2538. .firstLetter {
  2539. display: flex;
  2540. justify-content: space-between;
  2541. align-items: center;
  2542. margin-bottom: 30rpx;
  2543. }
  2544. .popupView {
  2545. height: 100%;
  2546. padding-bottom: 100rpx;
  2547. .popupTops {
  2548. height: 77rpx;
  2549. border-bottom: 1rpx solid #eee;
  2550. text-align: center;
  2551. line-height: 77rpx;
  2552. font-size: 24rpx;
  2553. color: #999;
  2554. position: relative;
  2555. .topIcon {
  2556. position: absolute;
  2557. top: 10rpx;
  2558. left: 50%;
  2559. transform: translateX(-50%);
  2560. width: 80rpx;
  2561. height: 8rpx;
  2562. background-color: #999;
  2563. border-radius: 4rpx;
  2564. }
  2565. }
  2566. .popupContent {
  2567. }
  2568. }
  2569. .pageContent {
  2570. position: relative;
  2571. background-color: #eaeef1;
  2572. height: 100%;
  2573. padding-top: 8rpx;
  2574. padding-bottom: 100rpx;
  2575. overflow-y: scroll;
  2576. }
  2577. .pad_8 {
  2578. background-color: #fff;
  2579. margin: 0rpx 8rpx 8rpx;
  2580. border-radius: 16rpx;
  2581. &.no-margin {
  2582. margin-top: -16rpx;
  2583. border-radius: 0 0 16rpx 16rpx;
  2584. }
  2585. }
  2586. .answer {
  2587. height: 80rpx;
  2588. line-height: 80rpx;
  2589. padding: 0rpx 24rpx;
  2590. display: flex;
  2591. align-items: center;
  2592. justify-content: space-between;
  2593. color: #666;
  2594. font-size: 30rpx;
  2595. }
  2596. .footer_btn {
  2597. background-color: #fff;
  2598. z-index: 10078;
  2599. position: fixed;
  2600. bottom: 0rpx;
  2601. display: flex;
  2602. align-items: center;
  2603. justify-content: space-between;
  2604. width: 100%;
  2605. height: 98rpx;
  2606. padding: 0rpx 38rpx;
  2607. border-top: 1rpx solid #eee;
  2608. .flex_center {
  2609. flex: 1;
  2610. display: flex;
  2611. justify-content: center;
  2612. align-items: center;
  2613. flex-direction: column;
  2614. margin: 0 200rpx;
  2615. font-size: 24rpx;
  2616. color: #999999;
  2617. .up-icon {
  2618. margin-bottom: 18rpx;
  2619. width: 100%;
  2620. display: flex;
  2621. justify-content: center;
  2622. image {
  2623. width: 58rpx;
  2624. height: 21rpx;
  2625. }
  2626. }
  2627. }
  2628. .collect {
  2629. visibility: hidden;
  2630. width: 100rpx;
  2631. &.show {
  2632. visibility: visible;
  2633. }
  2634. > view {
  2635. display: flex;
  2636. flex-direction: column;
  2637. align-items: center;
  2638. justify-content: center;
  2639. image {
  2640. width: 32rpx;
  2641. height: 32rpx;
  2642. margin-bottom: 6rpx;
  2643. }
  2644. view {
  2645. font-size: 24rpx;
  2646. color: #999999;
  2647. }
  2648. }
  2649. }
  2650. }
  2651. .boxSty {
  2652. padding: 44rpx 41rpx 0rpx;
  2653. }
  2654. .liListSty {
  2655. border: 1rpx solid #eeeeee;
  2656. width: 88rpx;
  2657. height: 88rpx;
  2658. border-radius: 32rpx;
  2659. text-align: center;
  2660. line-height: 88rpx;
  2661. color: #333;
  2662. font-size: 32rpx;
  2663. float: left;
  2664. margin: 20rpx 23rpx;
  2665. &.isRight {
  2666. border: 1rpx solid #eeeeee;
  2667. color: #fff;
  2668. background: #36c75a;
  2669. }
  2670. &.isWrong {
  2671. border: 1rpx solid #eeeeee;
  2672. color: #fff;
  2673. background: #ff3b30;
  2674. }
  2675. &.isPart {
  2676. border: 1rpx solid #eeeeee;
  2677. color: #fff;
  2678. background: #ffc53d;
  2679. }
  2680. &.isOver {
  2681. border: 1rpx solid #eeeeee;
  2682. color: #fff;
  2683. background: blue;
  2684. }
  2685. &.check_ans {
  2686. border: 1rpx solid #eeeeee;
  2687. color: #fff;
  2688. background: #007aff;
  2689. }
  2690. }
  2691. .answerInfos {
  2692. padding: 25rpx 25rpx 25rpx 23rpx;
  2693. }
  2694. .answerTitle {
  2695. margin-bottom: 28rpx;
  2696. color: #666;
  2697. font-size: 30rpx;
  2698. }
  2699. .answerContent {
  2700. font-size: 30rpx;
  2701. color: #666;
  2702. }
  2703. .textChild {
  2704. display: inline-block;
  2705. vertical-align: middle;
  2706. }
  2707. .dialog {
  2708. position: fixed;
  2709. left: 0;
  2710. top: 0;
  2711. width: 100%;
  2712. height: 100%;
  2713. background-color: rgba(0, 0, 0, 0.8);
  2714. display: flex;
  2715. flex-direction: column;
  2716. align-items: center;
  2717. justify-content: center;
  2718. z-index: 20000;
  2719. .pointer {
  2720. width: 338rpx;
  2721. height: 240rpx;
  2722. }
  2723. .text {
  2724. font-size: 32rpx;
  2725. color: #ffffff;
  2726. text-align: center;
  2727. }
  2728. .btn {
  2729. width: 242rpx;
  2730. height: 82rpx;
  2731. border: 2rpx solid #ffffff;
  2732. border-radius: 16rpx;
  2733. text-align: center;
  2734. line-height: 82rpx;
  2735. margin: 41rpx auto;
  2736. color: #fff;
  2737. font-size: 32rpx;
  2738. }
  2739. }
  2740. .dialog-arrow {
  2741. padding-top: 124rpx;
  2742. position: fixed;
  2743. left: 0;
  2744. top: 0;
  2745. width: 100%;
  2746. height: 100%;
  2747. background-color: rgba(0, 0, 0, 0.8);
  2748. z-index: 20000;
  2749. .pointer {
  2750. margin-left: 87rpx;
  2751. display: block;
  2752. width: 95rpx;
  2753. height: 98rpx;
  2754. }
  2755. .text {
  2756. padding-left: 177rpx;
  2757. font-size: 32rpx;
  2758. color: #ffffff;
  2759. }
  2760. .btn {
  2761. width: 242rpx;
  2762. height: 82rpx;
  2763. border: 2rpx solid #ffffff;
  2764. border-radius: 16rpx;
  2765. text-align: center;
  2766. line-height: 82rpx;
  2767. margin: 500rpx auto 0;
  2768. color: #fff;
  2769. font-size: 32rpx;
  2770. }
  2771. }
  2772. .dialog_wrap {
  2773. position: fixed;
  2774. left: 0;
  2775. top: 0;
  2776. width: 100%;
  2777. height: 100%;
  2778. z-index: 9999999999;
  2779. .bg {
  2780. background: rgba(0, 0, 0, 0.3);
  2781. position: absolute;
  2782. left: 0;
  2783. top: 0;
  2784. width: 100%;
  2785. height: 100%;
  2786. }
  2787. .dialog {
  2788. position: absolute;
  2789. left: 50%;
  2790. top: 50%;
  2791. transform: translate3D(-50%, -50%, 0);
  2792. width: 640rpx;
  2793. height: 439rpx;
  2794. background: #ffffff;
  2795. border-radius: 24rpx;
  2796. .title {
  2797. font-size: 30rpx;
  2798. font-weight: bold;
  2799. color: #333333;
  2800. line-height: 48rpx;
  2801. text-align: center;
  2802. margin-top: 40rpx;
  2803. }
  2804. .content {
  2805. margin: 35rpx 35rpx 0;
  2806. font-size: 30rpx;
  2807. color: #666666;
  2808. line-height: 48rpx;
  2809. }
  2810. .btns {
  2811. margin-top: 35rpx;
  2812. display: flex;
  2813. align-items: center;
  2814. justify-content: center;
  2815. .btn {
  2816. width: 200rpx;
  2817. height: 80rpx;
  2818. line-height: 80rpx;
  2819. text-align: center;
  2820. background: #f5f5f5;
  2821. border-radius: 40rpx;
  2822. font-size: 30rpx;
  2823. color: rgba(0, 122, 255, 1);
  2824. background: #f5f5f5;
  2825. margin: 0 20rpx;
  2826. &.active {
  2827. color: #f5f5f5;
  2828. background: rgba(0, 122, 255, 1);
  2829. }
  2830. }
  2831. }
  2832. }
  2833. }
  2834. .popboxs {
  2835. width: 100%;
  2836. height: 100%;
  2837. display: flex;
  2838. flex-direction: column;
  2839. align-items: center;
  2840. }
  2841. .classTops {
  2842. flex-shrink: 0;
  2843. padding: 39rpx 0rpx 4rpx;
  2844. font-weight: bold;
  2845. color: #333;
  2846. font-size: 30rpx;
  2847. }
  2848. .textStys {
  2849. width: 100%;
  2850. flex: 1;
  2851. padding: 36rpx;
  2852. }
  2853. .classFootsty {
  2854. flex-shrink: 0;
  2855. display: flex;
  2856. align-items: center;
  2857. justify-content: center;
  2858. padding: 10rpx 0rpx 40rpx;
  2859. .btnsty {
  2860. width: 200rpx;
  2861. height: 80rpx;
  2862. border-radius: 40rpx;
  2863. font-weight: bold;
  2864. font-size: 30rpx;
  2865. text-align: center;
  2866. line-height: 80rpx;
  2867. }
  2868. .btns1 {
  2869. background-color: #f5f5f5;
  2870. color: #007aff;
  2871. }
  2872. .btns2 {
  2873. margin-left: 40rpx;
  2874. background-color: #007aff;
  2875. color: #ffffff;
  2876. }
  2877. }
  2878. </style>