questionBank.vue 97 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270
  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. type: 1, // 题库试卷传1
  1301. })
  1302. .then((res) => {});
  1303. },
  1304. /**
  1305. * 立即交卷
  1306. */
  1307. submitNow() {
  1308. this.showpopups = false;
  1309. this.needBack = false;
  1310. this.submit();
  1311. },
  1312. /**
  1313. * 离开页面统计回答正确题数
  1314. */
  1315. examRecordEdit() {
  1316. if (!this.isSubmit) {
  1317. let number = 0;
  1318. let score = 0;
  1319. let doQuestionNum = 0;
  1320. let doQuestionIds = []; //做过的题目id
  1321. this.questionList.forEach((item, index) => {
  1322. if (item.type == 1) {
  1323. if (item.ques == item.ans) {
  1324. score += item.score;
  1325. number++;
  1326. }
  1327. if (item.ques) {
  1328. doQuestionNum++;
  1329. doQuestionIds.push(item.questionId);
  1330. }
  1331. } else if (item.type == 2) {
  1332. let isRight =
  1333. item.ans &&
  1334. item.ans.every((quesItem, quesIndex) => {
  1335. if (item.ques) {
  1336. return item.ques[quesIndex] == item.ans[quesIndex];
  1337. } else {
  1338. return false;
  1339. }
  1340. });
  1341. if (isRight) {
  1342. score += item.score;
  1343. number++;
  1344. } else {
  1345. let checkboxScore = 1; //获取单题总分数
  1346. item.ques &&
  1347. item.ques.forEach((ques, quesIndex) => {
  1348. //选错一个全扣
  1349. if (item.ques) {
  1350. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1351. checkboxScore = 0;
  1352. }
  1353. } else {
  1354. checkboxScore = 0;
  1355. }
  1356. });
  1357. console.log(checkboxScore);
  1358. //没选错
  1359. if (checkboxScore) {
  1360. checkboxScore = 0;
  1361. item.ans.forEach((ans, quesIndex) => {
  1362. //漏选扣一部分,对n题给n X partScore 分
  1363. if (item.ques) {
  1364. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  1365. checkboxScore += item.partScore;
  1366. }
  1367. } else {
  1368. checkboxScore = 0;
  1369. }
  1370. });
  1371. }
  1372. if (checkboxScore <= 0) {
  1373. //0分
  1374. } else {
  1375. //部分分
  1376. // number++;
  1377. score += checkboxScore;
  1378. }
  1379. }
  1380. if (item.ques && item.ques.length) {
  1381. doQuestionNum++;
  1382. doQuestionIds.push(item.questionId);
  1383. }
  1384. } else if (item.type == 3) {
  1385. if (item.ques == item.ans) {
  1386. score += item.score;
  1387. number++;
  1388. }
  1389. if (item.ques) {
  1390. doQuestionNum++;
  1391. doQuestionIds.push(item.questionId);
  1392. }
  1393. } else if (item == 4) {
  1394. if (item.ques.length) {
  1395. doQuestionNum++;
  1396. doQuestionIds.push(item.questionId);
  1397. }
  1398. } else if (item.type == 5) {
  1399. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  1400. doQuestionNum++;
  1401. doQuestionIds.push(item.questionId);
  1402. }
  1403. }
  1404. });
  1405. this.$api
  1406. .examRecordEdit({
  1407. orderGoodsId: this.orderGoodsId,
  1408. examId: this.id,
  1409. goodsId: this.goodsId,
  1410. recordId: this.recordId,
  1411. doQuestionIds: doQuestionIds.join(","),
  1412. rightQuestionNum: number,
  1413. moduleExamId: this.moduleId || 0,
  1414. chapterExamId: this.chapterId || 0,
  1415. status: 0,
  1416. doQuestionNum: doQuestionNum,
  1417. historyExamJson: JSON.stringify(this.questionList),
  1418. })
  1419. .then((res) => {});
  1420. }
  1421. },
  1422. /**
  1423. * 记录总题数
  1424. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1425. */
  1426. examRecord(hasSpecial) {
  1427. let questionList = 0;
  1428. // if(!hasSpecial) {
  1429. this.questionList.forEach((item, index) => {
  1430. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1431. questionList++;
  1432. }
  1433. });
  1434. // } else {
  1435. // questionList = this.questionList.length;
  1436. // }
  1437. this.$api
  1438. .examRecord({
  1439. chapterExamId: this.chapterId || 0,
  1440. orderGoodsId: this.orderGoodsId,
  1441. moduleExamId: this.moduleId || 0,
  1442. examId: this.id,
  1443. goodsId: this.goodsId,
  1444. totalQuestionNum: questionList,
  1445. allQuestionNum: this.questionList.length,
  1446. courseId: this.courseId,
  1447. // type: ''
  1448. })
  1449. .then((res) => {
  1450. this.recordId = res.data.data;
  1451. //获取recordId 初始化先提交题目 以防突然下次继续做题退出报错
  1452. if (this.bankType == 1) {
  1453. this.examRecordEdit();
  1454. }
  1455. });
  1456. },
  1457. /**
  1458. * @param {Object} second倒计时过滤器
  1459. */
  1460. countdown(second) {
  1461. if (second) {
  1462. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1463. let m = parseInt((second / 60) % 60); // 计算分数
  1464. let s = parseInt(second % 60); // 计算当前秒数
  1465. if (h < 10) h = "0" + h;
  1466. if (m < 10) m = "0" + m;
  1467. if (s < 10) s = "0" + s;
  1468. return h + ":" + m + ":" + s;
  1469. } else {
  1470. return "";
  1471. }
  1472. },
  1473. hideDialog() {
  1474. this.showDialog = false;
  1475. },
  1476. /**
  1477. * 请求题目列表 app/common/bank/question/list
  1478. */
  1479. goodsQuestionList() {
  1480. this.$api
  1481. .goodsQuestionList({
  1482. examId: this.id,
  1483. })
  1484. .then((res) => {
  1485. if (!res.data.data.length) {
  1486. this.hideDialog();
  1487. uni.showModal({
  1488. showCancel: false,
  1489. content: "该试卷暂无题目",
  1490. success: (k) => {
  1491. if (k.confirm) {
  1492. this.isSubmit = true;
  1493. uni.navigateBack();
  1494. }
  1495. },
  1496. });
  1497. return;
  1498. }
  1499. this.allTimes = res.data.data[0].answerTime * 60;
  1500. this.lastTime =
  1501. res.data.data[0].answerTime && res.data.data[0].answerTime * 60;
  1502. //考试时间到了自动交卷
  1503. if (this.lastTime) {
  1504. this.timer = setInterval(() => {
  1505. if (this.lastTime <= 0) {
  1506. clearInterval(this.timer);
  1507. uni.showToast({
  1508. icon: "none",
  1509. mask: true,
  1510. title: "考试时间已到,系统将自动交卷",
  1511. duration: 10000,
  1512. });
  1513. this.submit();
  1514. return;
  1515. }
  1516. this.lastTime--;
  1517. }, 1000);
  1518. } else {
  1519. }
  1520. res.data.data.forEach((item, index) => {
  1521. // if (typeof item.jsonStr == 'string') {
  1522. item.jsonStr = JSON.parse(item.jsonStr);
  1523. if (item.type == 2) {
  1524. //多选
  1525. item.jsonStr.forEach((str) => {
  1526. str.optionsId = "" + str.optionsId;
  1527. });
  1528. let arr = item.answerQuestion.split(",");
  1529. arr.forEach((a, i) => {
  1530. arr[i] = "" + a;
  1531. });
  1532. item.ans = arr;
  1533. item.analysisContent &&
  1534. (item.analysisContent = item.analysisContent.replace(
  1535. /<img/gi,
  1536. '<img style="max-width:100%;"'
  1537. ));
  1538. item.content &&
  1539. (item.content = item.content.replace(
  1540. /<img/gi,
  1541. '<img style="max-width:100%;"'
  1542. ));
  1543. return;
  1544. } else if (item.type == 5) {
  1545. //简答题
  1546. item.ansText = {
  1547. text: "",
  1548. imageList: [],
  1549. };
  1550. item.ques = {
  1551. text: "",
  1552. imageList: [],
  1553. };
  1554. item.analysisContent &&
  1555. (item.analysisContent = item.analysisContent.replace(
  1556. /<img/gi,
  1557. '<img style="max-width:100%;"'
  1558. ));
  1559. item.content &&
  1560. (item.content = item.content.replace(
  1561. /<img/gi,
  1562. '<img style="max-width:100%;"'
  1563. ));
  1564. } else if (item.type == 4) {
  1565. //案例题
  1566. item.ques = [];
  1567. item.current = 0;
  1568. let ansArr = [];
  1569. item.jsonStr.forEach((json, index) => {
  1570. if (json.type == 1) {
  1571. ansArr[index] = json.answerQuestion;
  1572. json.content &&
  1573. (json.content = json.content.replace(
  1574. /<img/gi,
  1575. '<img style="max-width:100%;"'
  1576. ));
  1577. } else if (json.type == 2) {
  1578. json.optionsList.forEach((str) => {
  1579. str.optionsId = "" + str.optionsId;
  1580. });
  1581. let arr = json.answerQuestion.split(",");
  1582. arr.forEach((a, i) => {
  1583. arr[i] = "" + a;
  1584. });
  1585. ansArr[index] = arr;
  1586. json.content &&
  1587. (json.content = json.content.replace(
  1588. /<img/gi,
  1589. '<img style="max-width:100%;"'
  1590. ));
  1591. } else if (json.type == 3) {
  1592. ansArr[index] = json.answerQuestion;
  1593. json.content &&
  1594. (json.content = json.content.replace(
  1595. /<img/gi,
  1596. '<img style="max-width:100%;"'
  1597. ));
  1598. } else if (json.type == 5) {
  1599. ansArr[index] = {
  1600. text: json.answerQuestion,
  1601. imageList: [],
  1602. };
  1603. json.ansText = {
  1604. text: "",
  1605. imageList: [],
  1606. };
  1607. json.content &&
  1608. (json.content = json.content.replace(
  1609. /<img/gi,
  1610. '<img style="max-width:100%;"'
  1611. ));
  1612. }
  1613. });
  1614. item.analysisContent &&
  1615. (item.analysisContent = item.analysisContent.replace(
  1616. /<img/gi,
  1617. '<img style="max-width:100%;"'
  1618. ));
  1619. item.content &&
  1620. (item.content = item.content.replace(
  1621. /<img/gi,
  1622. '<img style="max-width:100%;"'
  1623. ));
  1624. item.ans = ansArr;
  1625. return;
  1626. }
  1627. item.analysisContent &&
  1628. (item.analysisContent = item.analysisContent.replace(
  1629. /<img/gi,
  1630. '<img style="max-width:100%;"'
  1631. ));
  1632. item.content &&
  1633. (item.content = item.content.replace(
  1634. /<img/gi,
  1635. '<img style="max-width:100%;"'
  1636. ));
  1637. item.ans = item.answerQuestion;
  1638. // }
  1639. });
  1640. this.questionList = res.data.data;
  1641. this.lastCount = this.questionList.length;
  1642. this.examRecord();
  1643. this.getCollectInfo(this.current);
  1644. });
  1645. },
  1646. /**
  1647. * @param {Object} e单选点击
  1648. */
  1649. radioSelect(optionsId, bindex) {
  1650. // if (this.questionList[bindex].ques) return;
  1651. if (this.questionList[bindex].ques && this.bankType == 1) {
  1652. return
  1653. }
  1654. this.$set(this.questionList[bindex], "ques", optionsId);
  1655. // if ((bindex + 1) < this.questionList.length) {
  1656. // this.current = bindex + 1
  1657. // }
  1658. this.isDoOver();
  1659. // 回答错误
  1660. // if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
  1661. // // /exam/wwrong/record
  1662. // this.$api
  1663. // .examWrongRecord({
  1664. // orderGoodsId: this.orderGoodsId,
  1665. // examId: this.id,
  1666. // goodsId: this.goodsId,
  1667. // moduleExamId: this.moduleId || 0,
  1668. // chapterExamId: this.chapterId || 0,
  1669. // questionIds: [this.questionList[bindex].questionId],
  1670. // recordId: this.recordId,
  1671. // })
  1672. // .then((res) => {});
  1673. // } else {
  1674. // // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  1675. // // if(question) {
  1676. // // this.$api.wrongRecordDelete({
  1677. // // "examId": +this.id,
  1678. // // "goodsId": +this.goodsId,
  1679. // // "questionId": this.questionList[bindex].questionId,
  1680. // // }).then(res => {
  1681. // // })
  1682. // // }
  1683. // }
  1684. },
  1685. /**
  1686. * @param {Object} e案例单选点击
  1687. */
  1688. radioSelectChild(optionsId, ansIndex, bindex) {
  1689. // if (this.questionList[bindex].ques[ansIndex]) return;
  1690. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1691. return
  1692. }
  1693. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  1694. this.isDoOver();
  1695. },
  1696. /**
  1697. * @param {Object} 多选点击
  1698. */
  1699. checkboxSelect(optionsId, bindex, index) {
  1700. if (this.questionList[bindex].ques && this.bankType == 1) {
  1701. return
  1702. }
  1703. this.$set(
  1704. this.questionList[bindex].jsonStr[index],
  1705. "checked",
  1706. !this.questionList[bindex].jsonStr[index].checked
  1707. );
  1708. },
  1709. /**
  1710. * @param {Object} 案例多选点击
  1711. */
  1712. checkboxSelectChild(bindex, ansIndex, childIndex) {
  1713. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1714. return
  1715. }
  1716. this.$set(
  1717. this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
  1718. "checked",
  1719. !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex]
  1720. .checked
  1721. );
  1722. },
  1723. isCheckboxChecked(arr) {
  1724. return arr.some((item) => {
  1725. if (item.checked) {
  1726. return true;
  1727. }
  1728. });
  1729. },
  1730. /**
  1731. * @param {Object} 多选确认
  1732. */
  1733. checkboxSubmit(bindex) {
  1734. // console.log('')
  1735. // if (this.questionList[bindex].ques) return;
  1736. if (this.questionList[bindex].ques && this.bankType == 1) {
  1737. return
  1738. }
  1739. let arr = [];
  1740. this.questionList[bindex].jsonStr.forEach((item) => {
  1741. if (item.checked) {
  1742. arr.push(item.optionsId);
  1743. }
  1744. });
  1745. if (!arr.length) {
  1746. delete this.questionList[bindex].ques
  1747. uni.showToast({
  1748. title: "请选择答案",
  1749. icon: "none",
  1750. });
  1751. return;
  1752. }
  1753. this.$set(this.questionList[bindex], "ques", arr);
  1754. this.$u.toast('已确认答案')
  1755. this.isDoOver();
  1756. // let isWrong = this.questionList[bindex].ques.some((item, i) => {
  1757. // return this.questionList[bindex].ans.indexOf(item) == -1;
  1758. // })
  1759. // // 回答错误
  1760. // if (isWrong) {
  1761. // this.$api
  1762. // .examWrongRecord({
  1763. // orderGoodsId: this.orderGoodsId,
  1764. // examId: this.id,
  1765. // goodsId: this.goodsId,
  1766. // moduleExamId: this.moduleId || 0,
  1767. // chapterExamId: this.chapterId || 0,
  1768. // questionIds: [this.questionList[bindex].questionId],
  1769. // recordId: this.recordId,
  1770. // })
  1771. // .then((res) => {});
  1772. // } else {
  1773. // // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  1774. // // if(question) {
  1775. // // this.$api.wrongRecordDelete({
  1776. // // "examId": +this.id,
  1777. // // "goodsId": +this.goodsId,
  1778. // // "questionId": this.questionList[bindex].questionId,
  1779. // // }).then(res => {
  1780. // // })
  1781. // // }
  1782. // }
  1783. },
  1784. /**
  1785. * @param {Object} 案例多选确认
  1786. */
  1787. checkboxSubmitChild(bindex, ansIndex) {
  1788. // if (this.questionList[bindex].ques[ansIndex]) return;
  1789. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1790. return
  1791. }
  1792. let arr = [];
  1793. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
  1794. (item) => {
  1795. if (item.checked) {
  1796. arr.push(item.optionsId);
  1797. }
  1798. }
  1799. );
  1800. if (!arr.length) {
  1801. delete this.questionList[bindex].ques[ansIndex]
  1802. uni.showToast({
  1803. title: "请选择答案",
  1804. icon: "none",
  1805. });
  1806. return;
  1807. }
  1808. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  1809. this.$u.toast('已确认答案')
  1810. this.isDoOver();
  1811. },
  1812. /**
  1813. * @param {Object} index
  1814. * @param {Object} bindex
  1815. * 判断题
  1816. */
  1817. judgeSelect(index, bindex) {
  1818. // if (this.questionList[bindex].ques) return;
  1819. if (this.questionList[bindex].ques && this.bankType == 1) {
  1820. return
  1821. }// 答案: 判断题1正确 0错误
  1822. this.$set(this.questionList[bindex], "ques", index == 0 ? '1' : '0');
  1823. console.log('this.questionList[bindex]:', this.questionList[bindex].ques, this.questionList[bindex].ans)
  1824. this.isDoOver();
  1825. // 回答错误
  1826. // if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
  1827. // this.$api
  1828. // .examWrongRecord({
  1829. // orderGoodsId: this.orderGoodsId,
  1830. // examId: this.id,
  1831. // goodsId: this.goodsId,
  1832. // moduleExamId: this.moduleId || 0,
  1833. // chapterExamId: this.chapterId || 0,
  1834. // questionIds: [this.questionList[bindex].questionId],
  1835. // recordId: this.recordId,
  1836. // })
  1837. // .then((res) => {});
  1838. // } else {
  1839. // // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  1840. // // if(question) {
  1841. // // this.$api.wrongRecordDelete({
  1842. // // "examId": +this.id,
  1843. // // "goodsId": +this.goodsId,
  1844. // // "questionId": this.questionList[bindex].questionId,
  1845. // // }).then(res => {
  1846. // // })
  1847. // // }
  1848. // }
  1849. },
  1850. /**
  1851. * @param {Object} ansindex
  1852. * @param {Object} childindex
  1853. * @param {Object} bindex
  1854. * 案例判断题
  1855. */
  1856. judgeSelectChild(ansindex, childindex, bindex) {
  1857. // if (this.questionList[bindex].ques[ansindex]) return;
  1858. if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
  1859. return
  1860. }
  1861. this.$set(this.questionList[bindex].ques, ansindex, childindex == 0 ? '1' : '0');
  1862. this.isDoOver();
  1863. },
  1864. openFooterTab() {
  1865. this.show = true;
  1866. },
  1867. changeIndex(index) {
  1868. this.current = index;
  1869. },
  1870. swiperChange(e) {
  1871. this.current = e.detail.current;
  1872. this.getCollectInfo(this.current);
  1873. },
  1874. /**
  1875. * @param {Object} current
  1876. * 获取收藏信息
  1877. */
  1878. getCollectInfo(current) {
  1879. this.$api
  1880. .getCollectInfo({
  1881. examId: this.id,
  1882. questionId: this.questionList[current].questionId,
  1883. goodsId: this.goodsId,
  1884. orderGoodsId: this.orderGoodsId,
  1885. })
  1886. .then((res) => {
  1887. if (res.data.code == 500) {
  1888. this.$set(this.collectList, current, false);
  1889. } else if (res.data.code == 200) {
  1890. this.$set(this.collectList, current, res.data.data);
  1891. }
  1892. });
  1893. },
  1894. pdsubmit() {
  1895. // if (this.bankType == 1) {
  1896. let ansCount = this.questionOverNum(true); //已答题数
  1897. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1898. //没有答完
  1899. if (this.lastCount !== 0) {
  1900. this.cgType = 6;
  1901. this.showpopups = true;
  1902. return;
  1903. }
  1904. // }
  1905. if (this.bankType == 2) {
  1906. if (this.lastTime > 0) {
  1907. let lastTime = this.countdown(this.lastTime);
  1908. uni.showModal({
  1909. title: "提示",
  1910. content: `时间还剩余${lastTime},确定交卷吗?`,
  1911. confirmText: "交卷",
  1912. cancelText: "继续答题",
  1913. success: (res) => {
  1914. if (res.confirm) {
  1915. //确定
  1916. this.submit();
  1917. } else {
  1918. //取消
  1919. }
  1920. },
  1921. });
  1922. return;
  1923. }
  1924. }
  1925. this.submit();
  1926. },
  1927. /**
  1928. * 交卷
  1929. */
  1930. submit() {
  1931. let score = 0; //计算总分
  1932. let reportStatus = 0;
  1933. let number = 0; //做对的题目数量
  1934. let doQuestionNum = 0; //做过的题目数量
  1935. let allScore = 0; //总分
  1936. let passScore = 0;
  1937. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  1938. let doQuestionIds = []; //做过的题目id
  1939. let lessQuestionNum = 0;
  1940. let rightQuestionIds = []; //做对的题目id
  1941. this.questionList.forEach((item, index) => {
  1942. passScore = item.passScore;
  1943. if (item.type == 1) {
  1944. //正确
  1945. if (item.ques == item.ans) {
  1946. item.scoreResult = item.score;
  1947. score += item.score;
  1948. number++;
  1949. rightQuestionIds.push(item.questionId);
  1950. } else {
  1951. //错误
  1952. item.scoreResult = 0;
  1953. if (item.ques) {
  1954. doWrongQuestionIds.push(item.questionId);
  1955. }
  1956. }
  1957. allScore += item.score;
  1958. if (item.ques) {
  1959. doQuestionNum++;
  1960. doQuestionIds.push(item.questionId);
  1961. }
  1962. } else if (item.type == 2) {
  1963. let isRight =
  1964. item.ans &&
  1965. item.ans.every((quesItem, quesIndex) => {
  1966. if (item.ques) {
  1967. return item.ques[quesIndex] == item.ans[quesIndex];
  1968. } else {
  1969. return false;
  1970. }
  1971. });
  1972. if (isRight) {
  1973. score += item.score;
  1974. number++;
  1975. item.scoreResult = item.score;
  1976. rightQuestionIds.push(item.questionId);
  1977. } else {
  1978. let hasPart = false;
  1979. let checkboxScore = 1; //获取单题总分数
  1980. item.ques &&
  1981. item.ques.forEach((ques, quesIndex) => {
  1982. //选错一个全扣
  1983. if (item.ques) {
  1984. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1985. checkboxScore = 0;
  1986. }
  1987. } else {
  1988. checkboxScore = 0;
  1989. }
  1990. });
  1991. //没选错
  1992. if (checkboxScore) {
  1993. checkboxScore = 0;
  1994. item.ans.forEach((ans, quesIndex) => {
  1995. //漏选扣一部分,对n题给n X partScore 分
  1996. if (item.ques) {
  1997. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  1998. checkboxScore += item.partScore;
  1999. hasPart = true;
  2000. }
  2001. } else {
  2002. checkboxScore = 0;
  2003. }
  2004. });
  2005. }
  2006. if (!hasPart) {
  2007. //0分
  2008. item.scoreResult = 0;
  2009. if (item.ques) {
  2010. doWrongQuestionIds.push(item.questionId);
  2011. }
  2012. } else {
  2013. //部分分
  2014. // number++;
  2015. lessQuestionNum++;
  2016. // doWrongQuestionIds.push(item.questionId);
  2017. item.scoreResult = checkboxScore;
  2018. score += checkboxScore;
  2019. // rightQuestionIds.push(item.questionId)
  2020. }
  2021. }
  2022. allScore += item.score;
  2023. if (item.ques && item.ques.length) {
  2024. doQuestionNum++;
  2025. doQuestionIds.push(item.questionId);
  2026. }
  2027. } else if (item.type == 3) {
  2028. if (item.ques == item.ans) {
  2029. item.scoreResult = item.score;
  2030. score += item.score;
  2031. number++;
  2032. rightQuestionIds.push(item.questionId);
  2033. } else {
  2034. item.scoreResult = 0;
  2035. if (item.ques) {
  2036. doWrongQuestionIds.push(item.questionId);
  2037. }
  2038. }
  2039. allScore += item.score;
  2040. if (item.ques) {
  2041. doQuestionNum++;
  2042. doQuestionIds.push(item.questionId);
  2043. }
  2044. } else if (item.type == 4) {
  2045. allScore += item.score;
  2046. if (item.ques && item.ques.length) {
  2047. doQuestionNum++;
  2048. doQuestionIds.push(item.questionId);
  2049. }
  2050. } else if (item.type == 5) {
  2051. allScore += item.score;
  2052. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2053. doQuestionNum++;
  2054. doQuestionIds.push(item.questionId);
  2055. }
  2056. }
  2057. });
  2058. //大于及格
  2059. if (score >= passScore) {
  2060. reportStatus = 1;
  2061. } else {
  2062. reportStatus = 0;
  2063. }
  2064. //交卷
  2065. this.$api
  2066. .examRecordEdit({
  2067. courseId: this.courseId,
  2068. examId: this.id,
  2069. goodsId: this.goodsId,
  2070. reportStatus: reportStatus,
  2071. recordId: this.recordId,
  2072. rightQuestionNum: number,
  2073. orderGoodsId: this.orderGoodsId,
  2074. status: 1,
  2075. lessQuestionNum: lessQuestionNum,
  2076. moduleExamId: this.moduleId || 0,
  2077. chapterExamId: this.chapterId || 0,
  2078. doQuestionIds: doQuestionIds.join(","),
  2079. rightQuestionIds: rightQuestionIds.join(","),
  2080. doQuestionNum: doQuestionNum,
  2081. performance: score,
  2082. totalScore: allScore,
  2083. examTime: parseInt(this.allTimes),
  2084. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2085. historyExamJson: JSON.stringify(this.questionList),
  2086. // type: ''
  2087. })
  2088. .then((res) => {
  2089. this.isSubmit = true;
  2090. if (res.data.code == 200) {
  2091. uni.showToast({
  2092. title: "交卷成功",
  2093. duration: 1000,
  2094. icon: "none",
  2095. });
  2096. setTimeout(() => {
  2097. uni.redirectTo({
  2098. url:
  2099. "/pages2/bank/question_report?goodsId=" +
  2100. this.goodsId +
  2101. "&chapterId=" +
  2102. this.chapterId +
  2103. "&moduleId=" +
  2104. this.moduleId +
  2105. "&examId=" +
  2106. this.id +
  2107. "&id=" +
  2108. this.recordId +
  2109. "&orderGoodsId=" +
  2110. this.orderGoodsId,
  2111. });
  2112. }, 1000);
  2113. }
  2114. });
  2115. //错题集id提交(客观题)
  2116. this.$api
  2117. .examWrongRecord({
  2118. examId: this.id,
  2119. goodsId: this.goodsId,
  2120. orderGoodsId: this.orderGoodsId,
  2121. questionIds: doWrongQuestionIds,
  2122. recordId: this.recordId,
  2123. type: 1, // 题库试卷传1
  2124. })
  2125. .then((res) => {});
  2126. },
  2127. /**
  2128. * @param {Object} state
  2129. * @param {Object} index
  2130. * 收藏
  2131. */
  2132. collect(state, index) {
  2133. if (!state) {
  2134. this.$api
  2135. .collectQuestion({
  2136. examId: this.id,
  2137. questionId: this.questionList[index].questionId,
  2138. goodsId: this.goodsId || "",
  2139. orderGoodsId: this.orderGoodsId,
  2140. })
  2141. .then((res) => {
  2142. if (res.data.code == 200) {
  2143. this.$set(this.collectList, index, true);
  2144. uni.showToast({
  2145. title: "收藏成功",
  2146. duration: 2000,
  2147. icon: "none",
  2148. });
  2149. this.getCollectInfo(index);
  2150. }
  2151. });
  2152. } else {
  2153. this.$api
  2154. .deleteCollectQuestion(this.collectList[index].collectQuestionId)
  2155. .then((res) => {
  2156. if (res.data.code == 200) {
  2157. this.$set(this.collectList, index, false);
  2158. uni.showToast({
  2159. title: "取消收藏成功",
  2160. duration: 2000,
  2161. icon: "none",
  2162. });
  2163. }
  2164. });
  2165. }
  2166. return;
  2167. },
  2168. /**
  2169. * @param {Object} imgIndex
  2170. * @param {Object} bankIndex
  2171. * 删除简答图片
  2172. */
  2173. deleteImg(imgIndex, bankIndex) {
  2174. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  2175. },
  2176. /**
  2177. * @param {Object} imgIndex
  2178. * @param {Object} bankIndex
  2179. * @param {Object} ansIndex
  2180. * 删除案例题简答图片
  2181. */
  2182. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  2183. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(
  2184. imgIndex,
  2185. 1
  2186. );
  2187. },
  2188. /**
  2189. * @param {Object} bankindex
  2190. * 选择上传图片
  2191. */
  2192. chooseImg(bankindex) {
  2193. if (
  2194. this.questionList[bankindex] &&
  2195. this.questionList[bankindex].ansText &&
  2196. this.questionList[bankindex].ansText.imageList.length >= 4
  2197. ) {
  2198. uni.showToast({
  2199. icon: "none",
  2200. title: "最多选择4张",
  2201. });
  2202. return;
  2203. }
  2204. uni.chooseImage({
  2205. count: 1, //默认9
  2206. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2207. sourceType: ["album", "camera"], //从相册选择
  2208. success: (res) => {
  2209. let self = this;
  2210. // console.log(JSON.stringify(res.tempFilePaths));
  2211. let img = res.tempFilePaths[0];
  2212. uni.getImageInfo({
  2213. src: img,
  2214. success: async (res) => {
  2215. let canvasWidth = res.width; //图片原始长宽
  2216. let canvasHeight = res.height;
  2217. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2218. uni.compressImage({
  2219. src: img,
  2220. quality: 75,
  2221. width: "50%",
  2222. height: "50%",
  2223. success: async (rest) => {
  2224. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2225. this.questionList[bankindex].ansText.imageList.push(dir);
  2226. },
  2227. });
  2228. } else {
  2229. const dir = await self.uploadFile(img, 0);
  2230. this.questionList[bankindex].ansText.imageList.push(dir);
  2231. }
  2232. },
  2233. });
  2234. },
  2235. });
  2236. },
  2237. /**
  2238. * @param {Object} bankindex
  2239. * @param {Object} ansindex
  2240. * 案例题选择上传图片
  2241. */
  2242. chooseImgChild(bankindex, ansindex) {
  2243. if (
  2244. this.questionList[bankindex].jsonStr[ansindex] &&
  2245. this.questionList[bankindex].jsonStr[ansindex].ansText &&
  2246. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList
  2247. .length >= 4
  2248. ) {
  2249. uni.showToast({
  2250. icon: "none",
  2251. title: "最多选择4张",
  2252. });
  2253. return;
  2254. }
  2255. uni.chooseImage({
  2256. count: 1, //默认9
  2257. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2258. sourceType: ["album", "camera"], //从相册选择
  2259. success: (res) => {
  2260. let self = this;
  2261. // console.log(JSON.stringify(res.tempFilePaths));
  2262. let img = res.tempFilePaths[0];
  2263. uni.getImageInfo({
  2264. src: img,
  2265. success: async (res) => {
  2266. let canvasWidth = res.width; //图片原始长宽
  2267. let canvasHeight = res.height;
  2268. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2269. uni.compressImage({
  2270. src: img,
  2271. quality: 75,
  2272. width: "50%",
  2273. height: "50%",
  2274. success: async (rest) => {
  2275. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2276. this.questionList[bankindex].jsonStr[
  2277. ansindex
  2278. ].ansText.imageList.push(dir);
  2279. },
  2280. });
  2281. } else {
  2282. const dir = await self.uploadFile(img, 0);
  2283. this.questionList[bankindex].jsonStr[
  2284. ansindex
  2285. ].ansText.imageList.push(dir);
  2286. }
  2287. },
  2288. });
  2289. },
  2290. });
  2291. },
  2292. uploadFile(options, int) {
  2293. var self = this;
  2294. return new Promise((resolve, reject) => {
  2295. var data = {
  2296. orderGoodsId: this.orderGoodsId,
  2297. imageStatus: int,
  2298. };
  2299. self.$api.aliyunpolicy(data).then((res) => {
  2300. console.log(res.data, 6);
  2301. if (res.data.code != 200) {
  2302. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  2303. return;
  2304. }
  2305. var ossToken = res.data.data.resultContent;
  2306. if (ossToken.host == null || ossToken.host == undefined) {
  2307. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  2308. return;
  2309. }
  2310. uni.uploadFile({
  2311. url: ossToken.host,
  2312. name: "file",
  2313. filePath: options,
  2314. fileType: "image",
  2315. header: {
  2316. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  2317. },
  2318. formData: {
  2319. key: ossToken.dir,
  2320. OSSAccessKeyId: ossToken.accessid,
  2321. policy: ossToken.policy,
  2322. Signature: ossToken.signature,
  2323. callback: ossToken.callback,
  2324. success_action_status: 200,
  2325. },
  2326. success: (result) => {
  2327. // if (result.statusCode === 200) {
  2328. resolve(ossToken.dir);
  2329. // } else {
  2330. // uni.showToast({
  2331. // title: "上传失败",
  2332. // icon: "none",
  2333. // });
  2334. // return;
  2335. // }
  2336. },
  2337. fail: (error) => {
  2338. uni.showToast({
  2339. title: "上传接口报错" + error,
  2340. icon: "none",
  2341. });
  2342. return;
  2343. },
  2344. });
  2345. });
  2346. });
  2347. },
  2348. /**
  2349. * @param {Object} type
  2350. * @param {Object} bankindex
  2351. * 简答题答案确认
  2352. */
  2353. submitAns(bankindex) {
  2354. console.log(this.questionList[bankindex]);
  2355. if (
  2356. !this.questionList[bankindex].ansText.text &&
  2357. !this.questionList[bankindex].ansText.imageList.length
  2358. ) {
  2359. uni.showToast({
  2360. title: "请输入内容或上传图片",
  2361. duration: 2000,
  2362. icon: "none",
  2363. });
  2364. return;
  2365. }
  2366. this.$set(this.questionList[bankindex], "ques", {
  2367. imageList: this.questionList[bankindex].ansText.imageList || [],
  2368. text: this.questionList[bankindex].ansText.text || "",
  2369. });
  2370. this.isDoOver();
  2371. },
  2372. /**
  2373. * @param {Object} bankindex
  2374. * @param {Object} ansindex
  2375. * 案例题简答答案确认
  2376. */
  2377. submitAnsChild(bankindex, ansindex) {
  2378. if (
  2379. !this.questionList[bankindex].jsonStr[ansindex].ansText.text &&
  2380. !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length
  2381. ) {
  2382. uni.showToast({
  2383. title: "请输入内容或上传图片",
  2384. duration: 2000,
  2385. icon: "none",
  2386. });
  2387. return;
  2388. }
  2389. this.$set(this.questionList[bankindex].ques, ansindex, {
  2390. imageList:
  2391. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList ||
  2392. [],
  2393. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text || "",
  2394. });
  2395. this.isDoOver();
  2396. },
  2397. isCheck(item, index) {
  2398. if (this.questionList[index].ques) {
  2399. return true
  2400. }
  2401. },
  2402. isRight(item, index) {
  2403. //单选
  2404. if (this.questionList[index].ques) {
  2405. if (item.type == 1) {
  2406. return this.questionList[index].ques == this.questionList[index].ans;
  2407. //多选
  2408. } else if (item.type == 2) {
  2409. //每一项都相等
  2410. return this.questionList[index].ans.every((item, i) => {
  2411. return item == this.questionList[index].ques[i];
  2412. });
  2413. //判断
  2414. } else if (item.type == 3) {
  2415. return this.questionList[index].ques == this.questionList[index].ans;
  2416. // } else if (item.type == 5) {
  2417. // if(this.questionList[index].ques.text){
  2418. // return true
  2419. // }else{
  2420. // return false
  2421. // }
  2422. } else {
  2423. return false;
  2424. }
  2425. } else {
  2426. return false;
  2427. }
  2428. },
  2429. right(bankIndex, ansIndex, option) {
  2430. if (
  2431. this.questionList[bankIndex].ques[ansIndex] &&
  2432. this.questionList[bankIndex].ans[ansIndex]
  2433. ) {
  2434. if (
  2435. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2436. option.optionsId
  2437. ) != -1 ||
  2438. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2439. option.optionsId
  2440. ) != -1
  2441. ) {
  2442. return true;
  2443. } else {
  2444. return false;
  2445. }
  2446. } else {
  2447. return false;
  2448. }
  2449. },
  2450. wrong(bankIndex, ansIndex, option) {
  2451. if (
  2452. this.questionList[bankIndex].ques[ansIndex] &&
  2453. this.questionList[bankIndex].ans[ansIndex]
  2454. ) {
  2455. if (
  2456. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2457. option.optionsId
  2458. ) != -1 &&
  2459. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2460. option.optionsId
  2461. ) == -1
  2462. ) {
  2463. return true;
  2464. } else {
  2465. return false;
  2466. }
  2467. } else {
  2468. return false;
  2469. }
  2470. },
  2471. isWrong(item, index) {
  2472. if (this.questionList[index].ques) {
  2473. //单选
  2474. if (item.type == 1) {
  2475. return this.questionList[index].ques != this.questionList[index].ans;
  2476. //多选
  2477. } else if (item.type == 2) {
  2478. //每一项都相等
  2479. return this.questionList[index].ques.some((item, i) => {
  2480. return this.questionList[index].ans.indexOf(item) == -1;
  2481. });
  2482. //判断
  2483. } else if (item.type == 3) {
  2484. return this.questionList[index].ques != this.questionList[index].ans;
  2485. } else {
  2486. return false;
  2487. }
  2488. } else {
  2489. return false;
  2490. }
  2491. },
  2492. isPart(item, index) {
  2493. if (this.questionList[index].ques) {
  2494. if (item.type == 2) {
  2495. let isWrong = this.questionList[index].ques.some((item, i) => {
  2496. return this.questionList[index].ans.indexOf(item) == -1;
  2497. });
  2498. let isRight = this.questionList[index].ans.every((item, i) => {
  2499. return item == this.questionList[index].ques[i];
  2500. });
  2501. if (!isRight && !isWrong) {
  2502. return true;
  2503. }
  2504. }
  2505. } else {
  2506. return false;
  2507. }
  2508. },
  2509. isOver(item, index) {
  2510. if (this.questionList[index].ques) {
  2511. if (item.type == 4) {
  2512. //案例题
  2513. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  2514. if (
  2515. jsonItem.type == 1 ||
  2516. jsonItem.type == 2 ||
  2517. jsonItem.type == 3
  2518. ) {
  2519. if (item.ques[indexs]) {
  2520. return true;
  2521. } else {
  2522. return false;
  2523. }
  2524. } else if (jsonItem.type == 5) {
  2525. if (
  2526. item.ques[indexs] &&
  2527. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  2528. ) {
  2529. console.log("chil");
  2530. return true;
  2531. } else {
  2532. return false;
  2533. }
  2534. }
  2535. });
  2536. if (isOver) {
  2537. return true;
  2538. } else {
  2539. return false;
  2540. }
  2541. } else if (item.type == 5) {
  2542. //简答题
  2543. //每一项都相等
  2544. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2545. return true;
  2546. }
  2547. //判断
  2548. } else {
  2549. return false;
  2550. }
  2551. } else {
  2552. return false;
  2553. }
  2554. },
  2555. tabSelect(index, bankindex) {
  2556. this.$set(this.questionList[bankindex], "current", index);
  2557. },
  2558. showPhoto(contentStr) {
  2559. if (contentStr && typeof contentStr == "string") {
  2560. let reg = /<img[^>]*src[=\'\"\s]+([^\'\"]*)[\'\"]?[^>]*>/gi;
  2561. let strArr = contentStr.match(reg);
  2562. strArr.forEach((str, index) => {
  2563. strArr[index] = str.replace(reg, "$1");
  2564. });
  2565. // 预览图片
  2566. uni.previewImage({
  2567. urls: strArr,
  2568. longPressActions: {
  2569. itemList: ["发送给朋友", "保存图片", "收藏"],
  2570. success: function (data) {
  2571. console.log(
  2572. "选中了第" +
  2573. (data.tapIndex + 1) +
  2574. "个按钮,第" +
  2575. (data.index + 1) +
  2576. "张图片"
  2577. );
  2578. },
  2579. fail: function (err) {
  2580. console.log(err.errMsg);
  2581. },
  2582. },
  2583. });
  2584. }
  2585. },
  2586. },
  2587. };
  2588. </script>
  2589. <style lang="scss" scoped>
  2590. .questionBank {
  2591. width: 100%;
  2592. height: 100vh;
  2593. display: flex;
  2594. flex-direction: column;
  2595. }
  2596. .swiper {
  2597. width: 100%;
  2598. flex: 1;
  2599. }
  2600. .lisSty {
  2601. margin-bottom: 16rpx;
  2602. display: flex;
  2603. align-items: center;
  2604. .flex_auto {
  2605. flex: 1;
  2606. }
  2607. }
  2608. .activeTI {
  2609. vertical-align: middle;
  2610. display: inline-block;
  2611. border: 1rpx solid #eee;
  2612. border-radius: 50rpx;
  2613. height: 48rpx;
  2614. line-height: 46rpx;
  2615. text-align: center;
  2616. width: 48rpx;
  2617. margin-right: 15rpx;
  2618. color: #666;
  2619. font-size: 30rpx;
  2620. &.right {
  2621. color: #fff;
  2622. background: #36c75a;
  2623. }
  2624. &.wrong {
  2625. color: #fff;
  2626. background: #ff3b30;
  2627. }
  2628. &.checked, &.user_choose {
  2629. color: #fff;
  2630. background: #007aff;
  2631. }
  2632. }
  2633. .submit_checkbox {
  2634. position: fixed;
  2635. left: 0;
  2636. right: 0;
  2637. bottom: 120rpx;
  2638. margin: 20rpx auto;
  2639. width: 526rpx;
  2640. height: 80rpx;
  2641. background: rgba(0, 122, 255, 1);
  2642. color: #fff;
  2643. text-align: center;
  2644. line-height: 80rpx;
  2645. font-size: 30rpx;
  2646. border-radius: 40rpx;
  2647. &.disabled {
  2648. opacity: 0.6;
  2649. }
  2650. }
  2651. .titles {
  2652. overflow: hidden;
  2653. margin-bottom: 24rpx;
  2654. }
  2655. .titBox {
  2656. padding: 41rpx 25rpx 24rpx 25rpx;
  2657. }
  2658. .titBox_title {
  2659. padding: 21rpx;
  2660. }
  2661. .tabs {
  2662. margin: 10rpx;
  2663. display: flex;
  2664. .tab {
  2665. margin: 0 4rpx;
  2666. padding: 10rpx 13rpx;
  2667. text-align: center;
  2668. color: #007aff;
  2669. font-size: 28rpx;
  2670. border-radius: 16rpx;
  2671. background: #fff;
  2672. &.current {
  2673. color: #fff;
  2674. background: #007aff;
  2675. }
  2676. }
  2677. }
  2678. .ans {
  2679. margin: 8rpx 8rpx 8rpx;
  2680. .ans_input {
  2681. border-radius: 16rpx;
  2682. background: #fff;
  2683. .top {
  2684. border-bottom: 1rpx solid #eeeeee;
  2685. padding: 16rpx;
  2686. display: flex;
  2687. align-items: center;
  2688. .icon {
  2689. margin-right: 20rpx;
  2690. width: 40rpx;
  2691. height: 38rpx;
  2692. }
  2693. .progress {
  2694. flex: 1;
  2695. }
  2696. .submit {
  2697. width: 168rpx;
  2698. height: 48rpx;
  2699. line-height: 48rpx;
  2700. text-align: center;
  2701. color: #fff;
  2702. font-size: 30rpx;
  2703. background: #007aff;
  2704. border-radius: 24rpx;
  2705. &.disabled {
  2706. opacity: 0.6;
  2707. }
  2708. }
  2709. }
  2710. .textarea {
  2711. textarea {
  2712. width: 100%;
  2713. height: 287rpx;
  2714. padding: 10rpx;
  2715. }
  2716. }
  2717. .imgs {
  2718. overflow: hidden;
  2719. display: flex;
  2720. width: 100%;
  2721. .img {
  2722. width: 104rpx;
  2723. height: 104rpx;
  2724. border-radius: 8rpx;
  2725. position: relative;
  2726. margin: 20rpx;
  2727. text {
  2728. position: absolute;
  2729. right: -15rpx;
  2730. top: -15rpx;
  2731. width: 30rpx;
  2732. height: 30rpx;
  2733. text-align: center;
  2734. line-height: 30rpx;
  2735. color: #fff;
  2736. background: #ff3b30;
  2737. border-radius: 50%;
  2738. }
  2739. image {
  2740. width: 100%;
  2741. height: 100%;
  2742. }
  2743. }
  2744. }
  2745. }
  2746. .ans_submit {
  2747. padding: 16rpx;
  2748. border-radius: 16rpx;
  2749. background: #fff;
  2750. .imgs {
  2751. overflow: hidden;
  2752. display: flex;
  2753. width: 100%;
  2754. .img {
  2755. width: 104rpx;
  2756. height: 104rpx;
  2757. border-radius: 8rpx;
  2758. position: relative;
  2759. margin: 20rpx;
  2760. image {
  2761. width: 100%;
  2762. height: 100%;
  2763. }
  2764. }
  2765. }
  2766. }
  2767. }
  2768. .leftLetters {
  2769. display: flex;
  2770. align-items: center;
  2771. width: 220rpx;
  2772. .btnType {
  2773. padding: 5rpx 10rpx;
  2774. border: 1rpx solid #007aff;
  2775. border-radius: 10rpx;
  2776. background-color: rgba(0, 122, 255, 0.1);
  2777. font-size: 28rpx;
  2778. color: #007aff;
  2779. margin-right: 15rpx;
  2780. }
  2781. }
  2782. .firstLetter {
  2783. display: flex;
  2784. justify-content: space-between;
  2785. align-items: center;
  2786. margin-bottom: 30rpx;
  2787. }
  2788. .popupView {
  2789. height: 100%;
  2790. padding-bottom: 100rpx;
  2791. .popupTops {
  2792. height: 77rpx;
  2793. border-bottom: 1rpx solid #eee;
  2794. text-align: center;
  2795. line-height: 77rpx;
  2796. font-size: 24rpx;
  2797. color: #999;
  2798. position: relative;
  2799. .topIcon {
  2800. position: absolute;
  2801. top: 10rpx;
  2802. left: 50%;
  2803. transform: translateX(-50%);
  2804. width: 80rpx;
  2805. height: 8rpx;
  2806. background-color: #999;
  2807. border-radius: 4rpx;
  2808. }
  2809. }
  2810. .popupContent {
  2811. }
  2812. }
  2813. .pageContent {
  2814. position: relative;
  2815. background-color: #eaeef1;
  2816. height: 100%;
  2817. padding-top: 8rpx;
  2818. padding-bottom: 100rpx;
  2819. overflow-y: scroll;
  2820. }
  2821. .pad_8 {
  2822. background-color: #fff;
  2823. margin: 0rpx 8rpx 8rpx;
  2824. border-radius: 16rpx;
  2825. &.no-margin {
  2826. margin-top: -16rpx;
  2827. border-radius: 0 0 16rpx 16rpx;
  2828. }
  2829. }
  2830. .answer {
  2831. height: 80rpx;
  2832. line-height: 80rpx;
  2833. padding: 0rpx 24rpx;
  2834. display: flex;
  2835. align-items: center;
  2836. justify-content: space-between;
  2837. color: #666;
  2838. font-size: 30rpx;
  2839. }
  2840. .footer_btn {
  2841. background-color: #fff;
  2842. z-index: 10078;
  2843. position: fixed;
  2844. bottom: 0rpx;
  2845. display: flex;
  2846. align-items: center;
  2847. justify-content: space-between;
  2848. width: 100%;
  2849. height: 98rpx;
  2850. padding: 0rpx 38rpx;
  2851. border-top: 1rpx solid #eee;
  2852. .flex_center {
  2853. flex: 1;
  2854. display: flex;
  2855. justify-content: center;
  2856. align-items: center;
  2857. flex-direction: column;
  2858. margin: 0 200rpx;
  2859. font-size: 24rpx;
  2860. color: #999999;
  2861. .up-icon {
  2862. margin-bottom: 18rpx;
  2863. width: 100%;
  2864. display: flex;
  2865. justify-content: center;
  2866. image {
  2867. width: 58rpx;
  2868. height: 21rpx;
  2869. }
  2870. }
  2871. }
  2872. .collect {
  2873. visibility: hidden;
  2874. width: 100rpx;
  2875. &.show {
  2876. visibility: visible;
  2877. }
  2878. > view {
  2879. display: flex;
  2880. flex-direction: column;
  2881. align-items: center;
  2882. justify-content: center;
  2883. image {
  2884. width: 32rpx;
  2885. height: 32rpx;
  2886. margin-bottom: 6rpx;
  2887. }
  2888. view {
  2889. font-size: 24rpx;
  2890. color: #999999;
  2891. }
  2892. }
  2893. }
  2894. }
  2895. .boxSty {
  2896. padding: 44rpx 41rpx 0rpx;
  2897. }
  2898. .liListSty {
  2899. border: 1rpx solid #eeeeee;
  2900. width: 88rpx;
  2901. height: 88rpx;
  2902. border-radius: 32rpx;
  2903. text-align: center;
  2904. line-height: 88rpx;
  2905. color: #333;
  2906. font-size: 32rpx;
  2907. float: left;
  2908. margin: 20rpx 23rpx;
  2909. &.isRight {
  2910. border: 1rpx solid #eeeeee;
  2911. color: #fff;
  2912. background: #36c75a;
  2913. }
  2914. &.isWrong {
  2915. border: 1rpx solid #eeeeee;
  2916. color: #fff;
  2917. background: #ff3b30;
  2918. }
  2919. &.isPart {
  2920. border: 1rpx solid #eeeeee;
  2921. color: #fff;
  2922. background: #ffc53d;
  2923. }
  2924. &.isOver {
  2925. border: 1rpx solid #eeeeee;
  2926. color: #fff;
  2927. background: blue;
  2928. }
  2929. &.check_ans {
  2930. border: 1rpx solid #eeeeee;
  2931. color: #fff;
  2932. background: #007aff;
  2933. }
  2934. }
  2935. .answerInfos {
  2936. padding: 25rpx 25rpx 25rpx 23rpx;
  2937. }
  2938. .answerTitle {
  2939. margin-bottom: 28rpx;
  2940. color: #666;
  2941. font-size: 30rpx;
  2942. }
  2943. .answerContent {
  2944. font-size: 30rpx;
  2945. color: #666;
  2946. }
  2947. .textChild {
  2948. display: inline-block;
  2949. vertical-align: middle;
  2950. }
  2951. .dialog {
  2952. position: fixed;
  2953. left: 0;
  2954. top: 0;
  2955. width: 100%;
  2956. height: 100%;
  2957. background-color: rgba(0, 0, 0, 0.8);
  2958. display: flex;
  2959. flex-direction: column;
  2960. align-items: center;
  2961. justify-content: center;
  2962. z-index: 20000;
  2963. .pointer {
  2964. width: 338rpx;
  2965. height: 240rpx;
  2966. }
  2967. .text {
  2968. font-size: 32rpx;
  2969. color: #ffffff;
  2970. text-align: center;
  2971. }
  2972. .btn {
  2973. width: 242rpx;
  2974. height: 82rpx;
  2975. border: 2rpx solid #ffffff;
  2976. border-radius: 16rpx;
  2977. text-align: center;
  2978. line-height: 82rpx;
  2979. margin: 41rpx auto;
  2980. color: #fff;
  2981. font-size: 32rpx;
  2982. }
  2983. }
  2984. .dialog-arrow {
  2985. padding-top: 124rpx;
  2986. position: fixed;
  2987. left: 0;
  2988. top: 0;
  2989. width: 100%;
  2990. height: 100%;
  2991. background-color: rgba(0, 0, 0, 0.8);
  2992. z-index: 20000;
  2993. .pointer {
  2994. margin-left: 87rpx;
  2995. display: block;
  2996. width: 95rpx;
  2997. height: 98rpx;
  2998. }
  2999. .text {
  3000. padding-left: 177rpx;
  3001. font-size: 32rpx;
  3002. color: #ffffff;
  3003. }
  3004. .btn {
  3005. width: 242rpx;
  3006. height: 82rpx;
  3007. border: 2rpx solid #ffffff;
  3008. border-radius: 16rpx;
  3009. text-align: center;
  3010. line-height: 82rpx;
  3011. margin: 500rpx auto 0;
  3012. color: #fff;
  3013. font-size: 32rpx;
  3014. }
  3015. }
  3016. .dialog_wrap {
  3017. position: fixed;
  3018. left: 0;
  3019. top: 0;
  3020. width: 100%;
  3021. height: 100%;
  3022. z-index: 9999999999;
  3023. .bg {
  3024. background: rgba(0, 0, 0, 0.3);
  3025. position: absolute;
  3026. left: 0;
  3027. top: 0;
  3028. width: 100%;
  3029. height: 100%;
  3030. }
  3031. .dialog {
  3032. position: absolute;
  3033. left: 50%;
  3034. top: 50%;
  3035. transform: translate3D(-50%, -50%, 0);
  3036. width: 640rpx;
  3037. height: 439rpx;
  3038. background: #ffffff;
  3039. border-radius: 24rpx;
  3040. .title {
  3041. font-size: 30rpx;
  3042. font-weight: bold;
  3043. color: #333333;
  3044. line-height: 48rpx;
  3045. text-align: center;
  3046. margin-top: 40rpx;
  3047. }
  3048. .content {
  3049. margin: 35rpx 35rpx 0;
  3050. font-size: 30rpx;
  3051. color: #666666;
  3052. line-height: 48rpx;
  3053. }
  3054. .btns {
  3055. margin-top: 35rpx;
  3056. display: flex;
  3057. align-items: center;
  3058. justify-content: center;
  3059. .btn {
  3060. width: 200rpx;
  3061. height: 80rpx;
  3062. line-height: 80rpx;
  3063. text-align: center;
  3064. background: #f5f5f5;
  3065. border-radius: 40rpx;
  3066. font-size: 30rpx;
  3067. color: rgba(0, 122, 255, 1);
  3068. background: #f5f5f5;
  3069. margin: 0 20rpx;
  3070. &.active {
  3071. color: #f5f5f5;
  3072. background: rgba(0, 122, 255, 1);
  3073. }
  3074. }
  3075. }
  3076. }
  3077. }
  3078. .popboxs {
  3079. width: 100%;
  3080. height: 100%;
  3081. display: flex;
  3082. flex-direction: column;
  3083. align-items: center;
  3084. }
  3085. .classTops {
  3086. flex-shrink: 0;
  3087. padding: 39rpx 0rpx 4rpx;
  3088. font-weight: bold;
  3089. color: #333;
  3090. font-size: 30rpx;
  3091. }
  3092. .textStys {
  3093. width: 100%;
  3094. flex: 1;
  3095. padding: 36rpx;
  3096. }
  3097. .classFootsty {
  3098. flex-shrink: 0;
  3099. display: flex;
  3100. align-items: center;
  3101. justify-content: center;
  3102. padding: 10rpx 0rpx 40rpx;
  3103. .btnsty {
  3104. width: 200rpx;
  3105. height: 80rpx;
  3106. border-radius: 40rpx;
  3107. font-weight: bold;
  3108. font-size: 30rpx;
  3109. text-align: center;
  3110. line-height: 80rpx;
  3111. }
  3112. .btns1 {
  3113. background-color: #f5f5f5;
  3114. color: #007aff;
  3115. }
  3116. .btns2 {
  3117. margin-left: 40rpx;
  3118. background-color: #007aff;
  3119. color: #ffffff;
  3120. }
  3121. }
  3122. </style>