questionBank.vue 93 KB

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