questionBank.vue 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999
  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 } 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 } = res.data.data;
  1043. if (this.entryType == "daily") {
  1044. // 每日一练类型都是为练习
  1045. this.bankType = 1;
  1046. } else {
  1047. this.bankType = doType;
  1048. }
  1049. this.examData = res.data.data;
  1050. this.allTimes = this.examData.answerTime * 60;
  1051. this.lastTime =
  1052. this.examData.answerTime && this.examData.answerTime * 60;
  1053. if (this.bankType == 2) {
  1054. this.needBack = true;
  1055. }
  1056. resolve();
  1057. });
  1058. });
  1059. },
  1060. /**
  1061. * 点击后退按钮
  1062. */
  1063. clickLeft() {
  1064. if (this.bankType == 1) {
  1065. let ansCount = this.questionOverNum(true); //已答题数
  1066. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1067. //所有题目答完
  1068. if (this.lastCount == 0) {
  1069. // this.testOver = true;
  1070. this.cgType = 7;
  1071. //未答完
  1072. } else {
  1073. this.cgType = 8;
  1074. // this.isLastCount = true;
  1075. }
  1076. this.showpopups = true;
  1077. } else if (this.bankType == 2) {
  1078. let ansCount = this.questionOverNum(true); //已答题数
  1079. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1080. //所有题目答完
  1081. if (this.lastCount == 0) {
  1082. this.testOver = true;
  1083. //未答完
  1084. } else {
  1085. this.isLastCount = true;
  1086. }
  1087. }
  1088. },
  1089. /**
  1090. * 返回上一页
  1091. */
  1092. backPages() {
  1093. this.needBack = false;
  1094. uni.navigateBack({
  1095. delta: 1,
  1096. });
  1097. },
  1098. /**
  1099. * 获取已经回答的题目数
  1100. * hasSpecail (是否包含简答和案例)
  1101. */
  1102. questionOverNum(hasSpecail) {
  1103. let count = 0;
  1104. this.questionList.forEach((item) => {
  1105. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1106. if (item.ques) {
  1107. count++;
  1108. }
  1109. } else if (item.type == 4) {
  1110. //案例题
  1111. if (hasSpecail) {
  1112. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1113. if (
  1114. jsonItem.type == 1 ||
  1115. jsonItem.type == 2 ||
  1116. jsonItem.type == 3
  1117. ) {
  1118. if (item.ques[indexs]) {
  1119. return true;
  1120. } else {
  1121. return false;
  1122. }
  1123. } else if (jsonItem.type == 5) {
  1124. if (
  1125. item.ques[indexs] &&
  1126. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  1127. ) {
  1128. console.log("chil");
  1129. return true;
  1130. } else {
  1131. return false;
  1132. }
  1133. }
  1134. });
  1135. if (isOver) {
  1136. count++;
  1137. }
  1138. }
  1139. } else if (item.type == 5) {
  1140. //简答题
  1141. if (hasSpecail) {
  1142. if (item.ques && (item.ques.text || item.ques.imageList.length)) {
  1143. console.log(5, item);
  1144. count++;
  1145. }
  1146. }
  1147. }
  1148. });
  1149. return count;
  1150. },
  1151. /**
  1152. * 是否做完所有题目
  1153. */
  1154. isDoOver() {
  1155. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  1156. if (this.questionList.length == questionOverNum) {
  1157. //全部做完弹窗
  1158. this.cgType = 9;
  1159. this.showpopups = true;
  1160. }
  1161. },
  1162. /**
  1163. * 暂不交卷
  1164. */
  1165. noSubmit() {
  1166. //设为允许退出页面
  1167. this.needBack = false;
  1168. uni.navigateBack({
  1169. delta: 1,
  1170. });
  1171. },
  1172. /**
  1173. * 不离开
  1174. */
  1175. noLeave() {
  1176. this.isLastCount = false;
  1177. },
  1178. /**
  1179. * 立即离开并交卷
  1180. */
  1181. leaveNow() {
  1182. this.needBack = false;
  1183. this.isSubmit = true;
  1184. this.submit(false);
  1185. uni.navigateBack({
  1186. delta: 1,
  1187. });
  1188. },
  1189. /**
  1190. * 立即交卷
  1191. */
  1192. submitNow() {
  1193. this.showpopups = false;
  1194. this.needBack = false;
  1195. this.submit();
  1196. },
  1197. /**
  1198. * 离开页面统计回答正确题数
  1199. */
  1200. examRecordEdit() {
  1201. if (!this.isSubmit) {
  1202. let {
  1203. doQuestionNum,
  1204. doQuestionIds,
  1205. rightQuestionNum,
  1206. historyExamJson,
  1207. } = this.$method.calculateScore(this.questionList);
  1208. this.$api
  1209. .examRecordEdit({
  1210. orderGoodsId: this.orderGoodsId,
  1211. examId: this.id,
  1212. goodsId: this.goodsId,
  1213. recordId: this.recordId,
  1214. doQuestionIds,
  1215. rightQuestionNum,
  1216. moduleExamId: this.moduleId || 0,
  1217. chapterExamId: this.chapterId || 0,
  1218. status: 0,
  1219. doQuestionNum,
  1220. historyExamJson,
  1221. })
  1222. .then((res) => {
  1223. if (res.data.code == 200) {
  1224. this.entryType == "daily" && this.dailyExam();
  1225. }
  1226. });
  1227. }
  1228. },
  1229. /**
  1230. * 记录总题数
  1231. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1232. */
  1233. examRecord(hasSpecial) {
  1234. let questionList = 0;
  1235. // if(!hasSpecial) {
  1236. this.questionList.forEach((item, index) => {
  1237. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1238. questionList++;
  1239. }
  1240. });
  1241. // } else {
  1242. // questionList = this.questionList.length;
  1243. // }
  1244. this.$api
  1245. .examRecord({
  1246. chapterExamId: this.chapterId || 0,
  1247. orderGoodsId: this.orderGoodsId,
  1248. moduleExamId: this.moduleId || 0,
  1249. examId: this.id,
  1250. goodsId: this.goodsId,
  1251. totalQuestionNum: questionList,
  1252. allQuestionNum: this.questionList.length,
  1253. doMode: this.doMode,
  1254. simulateExamId: this.simulateExamId,
  1255. })
  1256. .then((res) => {
  1257. this.recordId = res.data.data;
  1258. //获取recordId 初始化先提交题目 以防突然下次继续做题退出报错
  1259. if (this.bankType == 1) {
  1260. this.examRecordEdit();
  1261. }
  1262. });
  1263. },
  1264. /**
  1265. * @param {Object} second倒计时过滤器
  1266. */
  1267. countdown(second) {
  1268. if (second) {
  1269. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1270. let m = parseInt((second / 60) % 60); // 计算分数
  1271. let s = parseInt(second % 60); // 计算当前秒数
  1272. if (h < 10) h = "0" + h;
  1273. if (m < 10) m = "0" + m;
  1274. if (s < 10) s = "0" + s;
  1275. return h + ":" + m + ":" + s;
  1276. } else {
  1277. return "";
  1278. }
  1279. },
  1280. hideDialog() {
  1281. this.showDialog = false;
  1282. },
  1283. // 请求随机练习题目列表
  1284. randomQuestionList() {
  1285. this.$http({
  1286. url: "/bank/exam/temp",
  1287. method: "post",
  1288. data: {
  1289. goodsId: this.goodsId,
  1290. orderGoodsId: this.orderGoodsId,
  1291. number: this.bankNum,
  1292. },
  1293. }).then((res) => {
  1294. if (res.data.code == 200) {
  1295. this.examData = res.data.data || {};
  1296. this.id = this.examData.examId;
  1297. if (!this.examData.questionList.length) {
  1298. return this.noListTip();
  1299. }
  1300. this.dataAnlyze(this.examData.questionList || []);
  1301. } else {
  1302. this.$u.toast(res.data.msg);
  1303. setTimeout(() => {
  1304. uni.navigateBack();
  1305. }, 2000);
  1306. }
  1307. });
  1308. },
  1309. noListTip(content = "该试卷暂无题目") {
  1310. this.hideDialog();
  1311. uni.showModal({
  1312. showCancel: false,
  1313. content,
  1314. success: (k) => {
  1315. if (k.confirm) {
  1316. this.isSubmit = true;
  1317. uni.navigateBack();
  1318. }
  1319. },
  1320. });
  1321. },
  1322. /**
  1323. * 请求题目列表 app/common/bank/question/list
  1324. */
  1325. goodsQuestionList() {
  1326. this.$api[
  1327. this.doMode == 3 ? "goodsRandomQuestionList" : "goodsQuestionList"
  1328. ]({
  1329. examId: this.id,
  1330. goodsId: this.goodsId,
  1331. orderGoodsId: this.orderGoodsId,
  1332. from: 1,
  1333. }).then((res) => {
  1334. if (res.data.code == 500) {
  1335. return this.noListTip("你已完成所有题目");
  1336. }
  1337. let data = res.data.data;
  1338. if (this.doMode == 3) {
  1339. this.simulateExamId = data.simulateExamId;
  1340. data = data.questionList;
  1341. }
  1342. if (!data.length) {
  1343. return this.noListTip();
  1344. }
  1345. //考试时间到了自动交卷
  1346. if (this.lastTime) {
  1347. this.timer = setInterval(() => {
  1348. if (this.lastTime <= 0) {
  1349. clearInterval(this.timer);
  1350. uni.showToast({
  1351. icon: "none",
  1352. mask: true,
  1353. title: "考试时间已到,系统将自动交卷",
  1354. duration: 10000,
  1355. });
  1356. this.submit();
  1357. return;
  1358. }
  1359. this.lastTime--;
  1360. }, 1000);
  1361. } else {
  1362. }
  1363. this.dataAnlyze(data);
  1364. });
  1365. },
  1366. dataAnlyze(datas = []) {
  1367. console.log("datas:", datas);
  1368. datas.forEach((item, index) => {
  1369. // if (typeof item.jsonStr == 'string') {
  1370. item.jsonStr = JSON.parse(item.jsonStr);
  1371. if (item.type == 2) {
  1372. //多选
  1373. item.jsonStr.forEach((str) => {
  1374. str.optionsId = "" + str.optionsId;
  1375. });
  1376. let arr = item.answerQuestion.split(",");
  1377. arr.forEach((a, i) => {
  1378. arr[i] = "" + a;
  1379. });
  1380. item.ans = arr;
  1381. item.analysisContent &&
  1382. (item.analysisContent = item.analysisContent.replace(
  1383. /<img/gi,
  1384. '<img style="max-width:100%;"'
  1385. ));
  1386. item.content &&
  1387. (item.content = item.content.replace(
  1388. /<img/gi,
  1389. '<img style="max-width:100%;"'
  1390. ));
  1391. return;
  1392. } else if (item.type == 5) {
  1393. //简答题
  1394. item.ansText = {
  1395. text: "",
  1396. imageList: [],
  1397. };
  1398. item.ques = {
  1399. text: "",
  1400. imageList: [],
  1401. };
  1402. item.analysisContent &&
  1403. (item.analysisContent = item.analysisContent.replace(
  1404. /<img/gi,
  1405. '<img style="max-width:100%;"'
  1406. ));
  1407. item.content &&
  1408. (item.content = item.content.replace(
  1409. /<img/gi,
  1410. '<img style="max-width:100%;"'
  1411. ));
  1412. } else if (item.type == 4) {
  1413. //案例题
  1414. item.ques = [];
  1415. item.current = 0;
  1416. let ansArr = [];
  1417. item.jsonStr.forEach((json, index) => {
  1418. if (json.type == 1) {
  1419. ansArr[index] = json.answerQuestion;
  1420. json.content &&
  1421. (json.content = json.content.replace(
  1422. /<img/gi,
  1423. '<img style="max-width:100%;"'
  1424. ));
  1425. } else if (json.type == 2) {
  1426. json.optionsList.forEach((str) => {
  1427. str.optionsId = "" + str.optionsId;
  1428. });
  1429. let arr = json.answerQuestion.split(",");
  1430. arr.forEach((a, i) => {
  1431. arr[i] = "" + a;
  1432. });
  1433. ansArr[index] = arr;
  1434. json.content &&
  1435. (json.content = json.content.replace(
  1436. /<img/gi,
  1437. '<img style="max-width:100%;"'
  1438. ));
  1439. } else if (json.type == 3) {
  1440. ansArr[index] = json.answerQuestion;
  1441. json.content &&
  1442. (json.content = json.content.replace(
  1443. /<img/gi,
  1444. '<img style="max-width:100%;"'
  1445. ));
  1446. } else if (json.type == 5) {
  1447. ansArr[index] = {
  1448. text: json.answerQuestion,
  1449. imageList: [],
  1450. };
  1451. json.ansText = {
  1452. text: "",
  1453. imageList: [],
  1454. };
  1455. json.content &&
  1456. (json.content = json.content.replace(
  1457. /<img/gi,
  1458. '<img style="max-width:100%;"'
  1459. ));
  1460. }
  1461. });
  1462. item.analysisContent &&
  1463. (item.analysisContent = item.analysisContent.replace(
  1464. /<img/gi,
  1465. '<img style="max-width:100%;"'
  1466. ));
  1467. item.content &&
  1468. (item.content = item.content.replace(
  1469. /<img/gi,
  1470. '<img style="max-width:100%;"'
  1471. ));
  1472. item.ans = ansArr;
  1473. return;
  1474. }
  1475. item.analysisContent &&
  1476. (item.analysisContent = item.analysisContent.replace(
  1477. /<img/gi,
  1478. '<img style="max-width:100%;"'
  1479. ));
  1480. item.content &&
  1481. (item.content = item.content.replace(
  1482. /<img/gi,
  1483. '<img style="max-width:100%;"'
  1484. ));
  1485. item.ans = item.answerQuestion;
  1486. // }
  1487. });
  1488. this.questionList = datas;
  1489. this.lastCount = this.questionList.length;
  1490. this.examRecord();
  1491. this.getCollectInfo(this.current);
  1492. },
  1493. /**
  1494. * @param {Object} e单选点击
  1495. */
  1496. radioSelect(optionsId, bindex) {
  1497. // if (this.questionList[bindex].ques) return;
  1498. if (this.questionList[bindex].ques && this.bankType == 1) {
  1499. return;
  1500. }
  1501. this.$set(this.questionList[bindex], "ques", optionsId);
  1502. // if ((bindex + 1) < this.questionList.length) {
  1503. // this.current = bindex + 1
  1504. // }
  1505. this.isDoOver();
  1506. // 回答错误
  1507. // if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
  1508. // // /exam/wwrong/record
  1509. // this.$api
  1510. // .examWrongRecord({
  1511. // orderGoodsId: this.orderGoodsId,
  1512. // examId: this.id,
  1513. // goodsId: this.goodsId,
  1514. // moduleExamId: this.moduleId || 0,
  1515. // chapterExamId: this.chapterId || 0,
  1516. // questionIds: [this.questionList[bindex].questionId],
  1517. // recordId: this.recordId,
  1518. // })
  1519. // .then((res) => {});
  1520. // } else {
  1521. // // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  1522. // // if(question) {
  1523. // // this.$api.wrongRecordDelete({
  1524. // // "examId": +this.id,
  1525. // // "goodsId": +this.goodsId,
  1526. // // "questionId": this.questionList[bindex].questionId,
  1527. // // }).then(res => {
  1528. // // })
  1529. // // }
  1530. // }
  1531. },
  1532. /**
  1533. * @param {Object} e案例单选点击
  1534. */
  1535. radioSelectChild(optionsId, ansIndex, bindex) {
  1536. // if (this.questionList[bindex].ques[ansIndex]) return;
  1537. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1538. return;
  1539. }
  1540. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  1541. this.isDoOver();
  1542. },
  1543. /**
  1544. * @param {Object} 多选点击
  1545. */
  1546. checkboxSelect(optionsId, bindex, index) {
  1547. if (this.questionList[bindex].ques && this.bankType == 1) {
  1548. return;
  1549. }
  1550. this.$set(
  1551. this.questionList[bindex].jsonStr[index],
  1552. "checked",
  1553. !this.questionList[bindex].jsonStr[index].checked
  1554. );
  1555. },
  1556. /**
  1557. * @param {Object} 案例多选点击
  1558. */
  1559. checkboxSelectChild(bindex, ansIndex, childIndex) {
  1560. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1561. return;
  1562. }
  1563. this.$set(
  1564. this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
  1565. "checked",
  1566. !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex]
  1567. .checked
  1568. );
  1569. },
  1570. isCheckboxChecked(arr) {
  1571. return arr.some((item) => {
  1572. if (item.checked) {
  1573. return true;
  1574. }
  1575. });
  1576. },
  1577. /**
  1578. * @param {Object} 多选确认
  1579. */
  1580. checkboxSubmit(bindex) {
  1581. if (this.questionList[bindex].ques && this.bankType == 1) {
  1582. return;
  1583. }
  1584. let arr = [];
  1585. this.questionList[bindex].jsonStr.forEach((item) => {
  1586. if (item.checked) {
  1587. arr.push(item.optionsId);
  1588. }
  1589. });
  1590. if (!arr.length) {
  1591. delete this.questionList[bindex].ques;
  1592. uni.showToast({
  1593. title: "请选择答案",
  1594. icon: "none",
  1595. });
  1596. return;
  1597. }
  1598. this.$set(this.questionList[bindex], "ques", arr);
  1599. this.$u.toast("已确认答案");
  1600. this.isDoOver();
  1601. // 切换下一题
  1602. if (
  1603. this.bankType != 1 &&
  1604. this.cgType != 9 &&
  1605. bindex != this.questionList.length - 1
  1606. ) {
  1607. this.current = bindex + 1;
  1608. this.getCollectInfo(this.current);
  1609. }
  1610. },
  1611. /**
  1612. * @param {Object} 案例多选确认
  1613. */
  1614. checkboxSubmitChild(bindex, ansIndex) {
  1615. // if (this.questionList[bindex].ques[ansIndex]) return;
  1616. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1617. return;
  1618. }
  1619. let arr = [];
  1620. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
  1621. (item) => {
  1622. if (item.checked) {
  1623. arr.push(item.optionsId);
  1624. }
  1625. }
  1626. );
  1627. if (!arr.length) {
  1628. delete this.questionList[bindex].ques[ansIndex];
  1629. uni.showToast({
  1630. title: "请选择答案",
  1631. icon: "none",
  1632. });
  1633. return;
  1634. }
  1635. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  1636. this.$u.toast("已确认答案");
  1637. this.isDoOver();
  1638. // 切换下一题
  1639. if (
  1640. this.bankType != 1 &&
  1641. this.cgType != 9 &&
  1642. ansIndex != this.questionList[bindex].ques.length - 1
  1643. ) {
  1644. this.questionList[bindex].current += 1;
  1645. }
  1646. },
  1647. /**
  1648. * @param {Object} index
  1649. * @param {Object} bindex
  1650. * 判断题
  1651. */
  1652. judgeSelect(index, bindex) {
  1653. // if (this.questionList[bindex].ques) return;
  1654. if (this.questionList[bindex].ques && this.bankType == 1) {
  1655. return;
  1656. } // 答案: 判断题1正确 0错误
  1657. this.$set(this.questionList[bindex], "ques", index == 0 ? "1" : "0");
  1658. console.log(
  1659. "this.questionList[bindex]:",
  1660. this.questionList[bindex].ques,
  1661. this.questionList[bindex].ans
  1662. );
  1663. this.isDoOver();
  1664. // 回答错误
  1665. // if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
  1666. // this.$api
  1667. // .examWrongRecord({
  1668. // orderGoodsId: this.orderGoodsId,
  1669. // examId: this.id,
  1670. // goodsId: this.goodsId,
  1671. // moduleExamId: this.moduleId || 0,
  1672. // chapterExamId: this.chapterId || 0,
  1673. // questionIds: [this.questionList[bindex].questionId],
  1674. // recordId: this.recordId,
  1675. // })
  1676. // .then((res) => {});
  1677. // } else {
  1678. // // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  1679. // // if(question) {
  1680. // // this.$api.wrongRecordDelete({
  1681. // // "examId": +this.id,
  1682. // // "goodsId": +this.goodsId,
  1683. // // "questionId": this.questionList[bindex].questionId,
  1684. // // }).then(res => {
  1685. // // })
  1686. // // }
  1687. // }
  1688. },
  1689. /**
  1690. * @param {Object} ansindex
  1691. * @param {Object} childindex
  1692. * @param {Object} bindex
  1693. * 案例判断题
  1694. */
  1695. judgeSelectChild(ansindex, childindex, bindex) {
  1696. // if (this.questionList[bindex].ques[ansindex]) return;
  1697. if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
  1698. return;
  1699. }
  1700. this.$set(
  1701. this.questionList[bindex].ques,
  1702. ansindex,
  1703. childindex == 0 ? "1" : "0"
  1704. );
  1705. this.isDoOver();
  1706. },
  1707. openFooterTab() {
  1708. this.show = true;
  1709. },
  1710. changeIndex(index) {
  1711. this.current = index;
  1712. },
  1713. swiperChange(e) {
  1714. this.current = e.detail.current;
  1715. this.getCollectInfo(this.current);
  1716. },
  1717. /**
  1718. * @param {Object} current
  1719. * 获取收藏信息
  1720. */
  1721. getCollectInfo(current) {
  1722. this.$api
  1723. .getCollectInfo({
  1724. examId: this.id,
  1725. questionId: this.questionList[current].questionId,
  1726. goodsId: this.goodsId,
  1727. orderGoodsId: this.orderGoodsId,
  1728. })
  1729. .then((res) => {
  1730. if (res.data.code == 500) {
  1731. this.$set(this.collectList, current, false);
  1732. } else if (res.data.code == 200) {
  1733. this.$set(this.collectList, current, res.data.data);
  1734. }
  1735. });
  1736. },
  1737. pdsubmit() {
  1738. // if (this.bankType == 1) {
  1739. let ansCount = this.questionOverNum(true); //已答题数
  1740. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1741. //没有答完
  1742. if (this.lastCount !== 0) {
  1743. this.cgType = 6;
  1744. this.showpopups = true;
  1745. return;
  1746. }
  1747. // }
  1748. if (this.bankType == 2) {
  1749. if (this.lastTime > 0) {
  1750. let lastTime = this.countdown(this.lastTime);
  1751. uni.showModal({
  1752. title: "提示",
  1753. content: `时间还剩余${lastTime},确定交卷吗?`,
  1754. confirmText: "交卷",
  1755. cancelText: "继续答题",
  1756. success: (res) => {
  1757. if (res.confirm) {
  1758. //确定
  1759. this.submit();
  1760. } else {
  1761. //取消
  1762. }
  1763. },
  1764. });
  1765. return;
  1766. }
  1767. }
  1768. this.submit();
  1769. },
  1770. /**
  1771. * 交卷
  1772. */
  1773. submit(isShowTip = true) {
  1774. let form = this.$method.calculateScore(this.questionList);
  1775. //交卷
  1776. this.$api
  1777. .examRecordEdit({
  1778. examId: this.id,
  1779. goodsId: this.goodsId,
  1780. recordId: this.recordId,
  1781. orderGoodsId: this.orderGoodsId,
  1782. status: 1, // 1是交卷 2是中途离开
  1783. moduleExamId: this.moduleId || 0,
  1784. chapterExamId: this.chapterId || 0,
  1785. examTime: parseInt(this.allTimes),
  1786. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1787. ...form,
  1788. })
  1789. .then((res) => {
  1790. this.isSubmit = true;
  1791. if (res.data.code == 200) {
  1792. this.entryType == "daily" && this.dailyExam();
  1793. if (!isShowTip) {
  1794. return;
  1795. }
  1796. uni.showToast({
  1797. title: "交卷成功",
  1798. duration: 1000,
  1799. icon: "none",
  1800. });
  1801. setTimeout(() => {
  1802. uni.redirectTo({
  1803. url:
  1804. "/pages2/bank/question_report?goodsId=" +
  1805. this.goodsId +
  1806. "&chapterId=" +
  1807. this.chapterId +
  1808. "&moduleId=" +
  1809. this.moduleId +
  1810. "&examId=" +
  1811. this.id +
  1812. "&id=" +
  1813. this.recordId +
  1814. "&orderGoodsId=" +
  1815. this.orderGoodsId +
  1816. "&entryType=" +
  1817. this.entryType +
  1818. "&bankNum=" +
  1819. this.bankNum +
  1820. "&doMode=" +
  1821. this.doMode +
  1822. "&courseType=1",
  1823. });
  1824. }, 1000);
  1825. }
  1826. });
  1827. //错题集id提交(客观题)
  1828. this.$api.examWrongRecord({
  1829. examId: this.id,
  1830. goodsId: this.goodsId,
  1831. orderGoodsId: this.orderGoodsId,
  1832. questionIds: form.questionIds,
  1833. recordId: this.recordId,
  1834. type: 1, // 题库试卷传1
  1835. doMode: this.doMode,
  1836. });
  1837. },
  1838. // 每日一练试卷打卡
  1839. dailyExam() {
  1840. const dateStamp = parseInt(
  1841. new Date(new Date().toLocaleDateString()).getTime() / 1000
  1842. );
  1843. this.$http({
  1844. url: "/bank/question/special/exam/record",
  1845. method: "post",
  1846. data: {
  1847. examId: this.id,
  1848. chapterExamId: this.chapterId, // 章卷ID
  1849. moduleExamId: this.moduleId, //模块卷ID
  1850. goodsId: this.goodsId,
  1851. recordTime: dateStamp, // 传当天0点时间戳(秒)
  1852. },
  1853. }).then((res) => {
  1854. if (res.data.code == 200) {
  1855. }
  1856. });
  1857. },
  1858. /**
  1859. * @param {Object} state
  1860. * @param {Object} index
  1861. * 收藏
  1862. */
  1863. collect(state, index) {
  1864. if (!state) {
  1865. this.$api
  1866. .collectQuestion({
  1867. examId: this.id,
  1868. questionId: this.questionList[index].questionId,
  1869. goodsId: this.goodsId || "",
  1870. orderGoodsId: this.orderGoodsId,
  1871. doMode: this.doMode,
  1872. })
  1873. .then((res) => {
  1874. if (res.data.code == 200) {
  1875. this.$set(this.collectList, index, true);
  1876. uni.showToast({
  1877. title: "收藏成功",
  1878. duration: 2000,
  1879. icon: "none",
  1880. });
  1881. this.getCollectInfo(index);
  1882. }
  1883. });
  1884. } else {
  1885. this.$api
  1886. .deleteCollectQuestion(this.collectList[index].collectQuestionId)
  1887. .then((res) => {
  1888. if (res.data.code == 200) {
  1889. this.$set(this.collectList, index, false);
  1890. uni.showToast({
  1891. title: "取消收藏成功",
  1892. duration: 2000,
  1893. icon: "none",
  1894. });
  1895. }
  1896. });
  1897. }
  1898. return;
  1899. },
  1900. /**
  1901. * @param {Object} imgIndex
  1902. * @param {Object} bankIndex
  1903. * 删除简答图片
  1904. */
  1905. deleteImg(imgIndex, bankIndex) {
  1906. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  1907. },
  1908. /**
  1909. * @param {Object} imgIndex
  1910. * @param {Object} bankIndex
  1911. * @param {Object} ansIndex
  1912. * 删除案例题简答图片
  1913. */
  1914. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  1915. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(
  1916. imgIndex,
  1917. 1
  1918. );
  1919. },
  1920. /**
  1921. * @param {Object} bankindex
  1922. * 选择上传图片
  1923. */
  1924. chooseImg(bankindex) {
  1925. if (
  1926. this.questionList[bankindex] &&
  1927. this.questionList[bankindex].ansText &&
  1928. this.questionList[bankindex].ansText.imageList.length >= 4
  1929. ) {
  1930. uni.showToast({
  1931. icon: "none",
  1932. title: "最多选择4张",
  1933. });
  1934. return;
  1935. }
  1936. uni.chooseImage({
  1937. count: 1, //默认9
  1938. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  1939. sourceType: ["album", "camera"], //从相册选择
  1940. success: (res) => {
  1941. let self = this;
  1942. // console.log(JSON.stringify(res.tempFilePaths));
  1943. let img = res.tempFilePaths[0];
  1944. uni.getImageInfo({
  1945. src: img,
  1946. success: async (res) => {
  1947. let canvasWidth = res.width; //图片原始长宽
  1948. let canvasHeight = res.height;
  1949. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1950. uni.compressImage({
  1951. src: img,
  1952. quality: 75,
  1953. width: "50%",
  1954. height: "50%",
  1955. success: async (rest) => {
  1956. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1957. this.questionList[bankindex].ansText.imageList.push(dir);
  1958. },
  1959. });
  1960. } else {
  1961. const dir = await self.uploadFile(img, 0);
  1962. this.questionList[bankindex].ansText.imageList.push(dir);
  1963. }
  1964. },
  1965. });
  1966. },
  1967. });
  1968. },
  1969. /**
  1970. * @param {Object} bankindex
  1971. * @param {Object} ansindex
  1972. * 案例题选择上传图片
  1973. */
  1974. chooseImgChild(bankindex, ansindex) {
  1975. if (
  1976. this.questionList[bankindex].jsonStr[ansindex] &&
  1977. this.questionList[bankindex].jsonStr[ansindex].ansText &&
  1978. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList
  1979. .length >= 4
  1980. ) {
  1981. uni.showToast({
  1982. icon: "none",
  1983. title: "最多选择4张",
  1984. });
  1985. return;
  1986. }
  1987. uni.chooseImage({
  1988. count: 1, //默认9
  1989. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  1990. sourceType: ["album", "camera"], //从相册选择
  1991. success: (res) => {
  1992. let self = this;
  1993. // console.log(JSON.stringify(res.tempFilePaths));
  1994. let img = res.tempFilePaths[0];
  1995. uni.getImageInfo({
  1996. src: img,
  1997. success: async (res) => {
  1998. let canvasWidth = res.width; //图片原始长宽
  1999. let canvasHeight = res.height;
  2000. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2001. uni.compressImage({
  2002. src: img,
  2003. quality: 75,
  2004. width: "50%",
  2005. height: "50%",
  2006. success: async (rest) => {
  2007. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2008. this.questionList[bankindex].jsonStr[
  2009. ansindex
  2010. ].ansText.imageList.push(dir);
  2011. },
  2012. });
  2013. } else {
  2014. const dir = await self.uploadFile(img, 0);
  2015. this.questionList[bankindex].jsonStr[
  2016. ansindex
  2017. ].ansText.imageList.push(dir);
  2018. }
  2019. },
  2020. });
  2021. },
  2022. });
  2023. },
  2024. uploadFile(options, int) {
  2025. var self = this;
  2026. return new Promise((resolve, reject) => {
  2027. var data = {
  2028. orderGoodsId: this.orderGoodsId,
  2029. imageStatus: int,
  2030. };
  2031. self.$api.aliyunpolicy(data).then((res) => {
  2032. console.log(res.data, 6);
  2033. if (res.data.code != 200) {
  2034. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  2035. return;
  2036. }
  2037. var ossToken = res.data.data.resultContent;
  2038. if (ossToken.host == null || ossToken.host == undefined) {
  2039. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  2040. return;
  2041. }
  2042. uni.uploadFile({
  2043. url: ossToken.host,
  2044. name: "file",
  2045. filePath: options,
  2046. fileType: "image",
  2047. header: {
  2048. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  2049. },
  2050. formData: {
  2051. key: ossToken.dir,
  2052. OSSAccessKeyId: ossToken.accessid,
  2053. policy: ossToken.policy,
  2054. Signature: ossToken.signature,
  2055. callback: ossToken.callback,
  2056. success_action_status: 200,
  2057. },
  2058. success: (result) => {
  2059. // if (result.statusCode === 200) {
  2060. resolve(ossToken.dir);
  2061. // } else {
  2062. // uni.showToast({
  2063. // title: "上传失败",
  2064. // icon: "none",
  2065. // });
  2066. // return;
  2067. // }
  2068. },
  2069. fail: (error) => {
  2070. uni.showToast({
  2071. title: "上传接口报错" + error,
  2072. icon: "none",
  2073. });
  2074. return;
  2075. },
  2076. });
  2077. });
  2078. });
  2079. },
  2080. /**
  2081. * @param {Object} type
  2082. * @param {Object} bankindex
  2083. * 简答题答案确认
  2084. */
  2085. submitAns(bankindex) {
  2086. if (
  2087. !this.questionList[bankindex].ansText.text &&
  2088. !this.questionList[bankindex].ansText.imageList.length
  2089. ) {
  2090. uni.showToast({
  2091. title: "请输入内容或上传图片",
  2092. duration: 2000,
  2093. icon: "none",
  2094. });
  2095. return;
  2096. }
  2097. this.$set(this.questionList[bankindex], "ques", {
  2098. imageList: this.questionList[bankindex].ansText.imageList || [],
  2099. text: this.questionList[bankindex].ansText.text || "",
  2100. });
  2101. this.$u.toast("已确认答案");
  2102. this.isDoOver();
  2103. },
  2104. /**
  2105. * @param {Object} bankindex
  2106. * @param {Object} ansindex
  2107. * 案例题简答答案确认
  2108. */
  2109. submitAnsChild(bankindex, ansindex) {
  2110. if (
  2111. !this.questionList[bankindex].jsonStr[ansindex].ansText.text &&
  2112. !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length
  2113. ) {
  2114. uni.showToast({
  2115. title: "请输入内容或上传图片",
  2116. duration: 2000,
  2117. icon: "none",
  2118. });
  2119. return;
  2120. }
  2121. this.$set(this.questionList[bankindex].ques, ansindex, {
  2122. imageList:
  2123. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList ||
  2124. [],
  2125. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text || "",
  2126. });
  2127. this.$u.toast("已确认答案");
  2128. this.isDoOver();
  2129. },
  2130. isCheck(item, index) {
  2131. // 案例题处理
  2132. let { ques, type, ans } = item;
  2133. if (type == 4) {
  2134. return ans.length == ques.length;
  2135. }
  2136. if (ques) {
  2137. return true;
  2138. }
  2139. },
  2140. isRight(item, index) {
  2141. //单选
  2142. if (this.questionList[index].ques) {
  2143. if (item.type == 1) {
  2144. return this.questionList[index].ques == this.questionList[index].ans;
  2145. //多选
  2146. } else if (item.type == 2) {
  2147. //每一项都相等
  2148. return this.questionList[index].ans.every((item, i) => {
  2149. return item == this.questionList[index].ques[i];
  2150. });
  2151. //判断
  2152. } else if (item.type == 3) {
  2153. return this.questionList[index].ques == this.questionList[index].ans;
  2154. // } else if (item.type == 5) {
  2155. // if(this.questionList[index].ques.text){
  2156. // return true
  2157. // }else{
  2158. // return false
  2159. // }
  2160. } else {
  2161. return false;
  2162. }
  2163. } else {
  2164. return false;
  2165. }
  2166. },
  2167. right(bankIndex, ansIndex, option) {
  2168. if (
  2169. this.questionList[bankIndex].ques[ansIndex] &&
  2170. this.questionList[bankIndex].ans[ansIndex]
  2171. ) {
  2172. if (
  2173. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2174. option.optionsId
  2175. ) != -1 ||
  2176. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2177. option.optionsId
  2178. ) != -1
  2179. ) {
  2180. return true;
  2181. } else {
  2182. return false;
  2183. }
  2184. } else {
  2185. return false;
  2186. }
  2187. },
  2188. wrong(bankIndex, ansIndex, option) {
  2189. if (
  2190. this.questionList[bankIndex].ques[ansIndex] &&
  2191. this.questionList[bankIndex].ans[ansIndex]
  2192. ) {
  2193. if (
  2194. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2195. option.optionsId
  2196. ) != -1 &&
  2197. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2198. option.optionsId
  2199. ) == -1
  2200. ) {
  2201. return true;
  2202. } else {
  2203. return false;
  2204. }
  2205. } else {
  2206. return false;
  2207. }
  2208. },
  2209. isWrong(item, index) {
  2210. if (this.questionList[index].ques) {
  2211. //单选
  2212. if (item.type == 1) {
  2213. return this.questionList[index].ques != this.questionList[index].ans;
  2214. //多选
  2215. } else if (item.type == 2) {
  2216. //每一项都相等
  2217. return this.questionList[index].ques.some((item, i) => {
  2218. return this.questionList[index].ans.indexOf(item) == -1;
  2219. });
  2220. //判断
  2221. } else if (item.type == 3) {
  2222. return this.questionList[index].ques != this.questionList[index].ans;
  2223. } else {
  2224. return false;
  2225. }
  2226. } else {
  2227. return false;
  2228. }
  2229. },
  2230. isPart(item, index) {
  2231. if (this.questionList[index].ques) {
  2232. if (item.type == 2) {
  2233. let isWrong = this.questionList[index].ques.some((item, i) => {
  2234. return this.questionList[index].ans.indexOf(item) == -1;
  2235. });
  2236. let isRight = this.questionList[index].ans.every((item, i) => {
  2237. return item == this.questionList[index].ques[i];
  2238. });
  2239. if (!isRight && !isWrong) {
  2240. return true;
  2241. }
  2242. }
  2243. } else {
  2244. return false;
  2245. }
  2246. },
  2247. isOver(item, index) {
  2248. if (this.questionList[index].ques) {
  2249. if (item.type == 4) {
  2250. //案例题
  2251. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  2252. if (
  2253. jsonItem.type == 1 ||
  2254. jsonItem.type == 2 ||
  2255. jsonItem.type == 3
  2256. ) {
  2257. if (item.ques[indexs]) {
  2258. return true;
  2259. } else {
  2260. return false;
  2261. }
  2262. } else if (jsonItem.type == 5) {
  2263. if (
  2264. item.ques[indexs] &&
  2265. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  2266. ) {
  2267. console.log("chil");
  2268. return true;
  2269. } else {
  2270. return false;
  2271. }
  2272. }
  2273. });
  2274. if (isOver) {
  2275. return true;
  2276. } else {
  2277. return false;
  2278. }
  2279. } else if (item.type == 5) {
  2280. //简答题
  2281. //每一项都相等
  2282. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2283. return true;
  2284. }
  2285. //判断
  2286. } else {
  2287. return false;
  2288. }
  2289. } else {
  2290. return false;
  2291. }
  2292. },
  2293. tabSelect(index, bankindex) {
  2294. this.$set(this.questionList[bankindex], "current", index);
  2295. },
  2296. showPhoto(contentStr) {
  2297. if (contentStr && typeof contentStr == "string") {
  2298. let reg = /<img[^>]*src[=\'\"\s]+([^\'\"]*)[\'\"]?[^>]*>/gi;
  2299. let strArr = contentStr.match(reg);
  2300. strArr.forEach((str, index) => {
  2301. strArr[index] = str.replace(reg, "$1");
  2302. });
  2303. // 预览图片
  2304. uni.previewImage({
  2305. urls: strArr,
  2306. longPressActions: {
  2307. itemList: ["发送给朋友", "保存图片", "收藏"],
  2308. success: function (data) {
  2309. console.log(
  2310. "选中了第" +
  2311. (data.tapIndex + 1) +
  2312. "个按钮,第" +
  2313. (data.index + 1) +
  2314. "张图片"
  2315. );
  2316. },
  2317. fail: function (err) {
  2318. console.log(err.errMsg);
  2319. },
  2320. },
  2321. });
  2322. }
  2323. },
  2324. },
  2325. computed: {
  2326. doMode() {
  2327. // 做题模式 1章卷 2随机练习 3模拟组卷
  2328. if (this.entryType == "sd") {
  2329. return 4;
  2330. }
  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>