questionBank.vue 94 KB

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