questionBank.vue 97 KB

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