questionBank.vue 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481
  1. <template>
  2. <view class="questionBank">
  3. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" :statusBar="true" title="试卷"></uni-nav-bar>
  4. <swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
  5. <swiper-item v-for="(bank, bankIndex) in questionList" :key="bankIndex">
  6. <view class="pageContent">
  7. <view class="pad_8 titBox">
  8. <view class="firstLetter">
  9. <view class="leftLetters">
  10. <view class="btnType">
  11. <text v-if="bank.type == 1">单选</text>
  12. <text v-if="bank.type == 2">多选</text>
  13. <text v-if="bank.type == 3">判断</text>
  14. <text v-if="bank.type == 4">案例</text>
  15. <text v-if="bank.type == 5">简答</text>
  16. </view>
  17. <text>{{ bankIndex + 1 }}/{{ questionList.length }}</text>
  18. </view>
  19. <view style="color: #666;font-size: 28rpx;">{{ countdown(lastTime) }}</view>
  20. <view class="leftLetters"></view>
  21. </view>
  22. <view class="titles"><rich-text :nodes="bank.content"></rich-text></view>
  23. </view>
  24. <template v-if="bank.type == 1">
  25. <view class="pad_8 titBox no-margin">
  26. <view v-if="!bank.ques">
  27. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="radioSelect(item.optionsId, bankIndex)">
  28. <view class="activeTI">{{ ast[index] }}</view>
  29. <view class="flex_auto">{{ item.content }}</view>
  30. </view>
  31. </view>
  32. <view v-if="bank.ques">
  33. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  34. <text
  35. :class="{ right: item.optionsId == bank.ques || item.optionsId == bank.ans, wrong: item.optionsId == bank.ques && bank.ques != bank.ans }"
  36. class="activeTI"
  37. >
  38. {{ ast[index] }}
  39. </text>
  40. <view class="flex_auto">{{ item.content }}</view>
  41. </view>
  42. </view>
  43. </view>
  44. <view v-if="bank.ques">
  45. <view class="pad_8 answer">
  46. <view>正确答案:{{ ast[bank.ans - 1] }}</view>
  47. <view>我的答案:{{ ast[bank.ques - 1] }}</view>
  48. </view>
  49. <view class="pad_8 answerInfos">
  50. <view class="answerTitle">答案解析</view>
  51. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  52. </view>
  53. </view>
  54. </template>
  55. <template v-if="bank.type == 2">
  56. <view class="pad_8 titBox no-margin">
  57. <view v-if="!bank.ques">
  58. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="checkboxSelect(item.optionsId, bankIndex, index)">
  59. <view :class="{ checked: item.checked }" class="activeTI">{{ ast[index] }}</view>
  60. <view class="flex_auto">{{ item.content }}</view>
  61. </view>
  62. </view>
  63. <view v-if="!bank.ques" class="submit_checkbox" :class="{disabled:!isCheckboxChecked(bank.jsonStr)}" @click="checkboxSubmit(bankIndex)">确认答案</view>
  64. <view v-if="bank.ques">
  65. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  66. <text
  67. :class="{
  68. right: bank.ques.indexOf(item.optionsId) != -1 || bank.ans.indexOf(item.optionsId) != -1,
  69. wrong: bank.ques.indexOf(item.optionsId) != -1 && bank.ans.indexOf(item.optionsId) == -1
  70. }"
  71. class="activeTI"
  72. >
  73. {{ ast[index] }}
  74. </text>
  75. <view class="flex_auto">{{ item.content }}</view>
  76. </view>
  77. </view>
  78. </view>
  79. <view v-if="bank.ques">
  80. <view class="pad_8 answer">
  81. <view>
  82. 正确答案:
  83. <text v-for="(ansItem,ansItemIndex) in bank.ans" :key="ansItemIndex">{{ ast[ansItem - 1] }}</text>
  84. </view>
  85. <view>
  86. 我的答案:
  87. <text v-for="(quesItem,quesItemIndex) in bank.ques" :key="quesItemIndex">{{ ast[quesItem - 1] }}</text>
  88. </view>
  89. </view>
  90. <view class="pad_8 answerInfos">
  91. <view class="answerTitle">答案解析</view>
  92. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  93. </view>
  94. </view>
  95. </template>
  96. <template v-if="bank.type == 3">
  97. <view class="pad_8 titBox no-margin">
  98. <view v-if="!bank.ques">
  99. <view v-for="(item, index) in judge" :key="index" class="lisSty" @click="judgeSelect(index, bankIndex)">
  100. <view class="activeTI">{{ ast[index] }}</view>
  101. {{ item }}
  102. </view>
  103. </view>
  104. <view v-if="bank.ques">
  105. <view v-for="(item, index) in judge" :key="index" class="lisSty">
  106. <text :class="{ right: index == bank.ques || index == bank.ans, wrong: index == bank.ques && bank.ques != bank.ans }" class="activeTI">
  107. {{ ast[index] }}
  108. </text>
  109. {{ item }}
  110. </view>
  111. </view>
  112. </view>
  113. <view v-if="bank.ques">
  114. <view class="pad_8 answer">
  115. <view>正确答案:{{ ast[bank.ans] }}</view>
  116. <view>我的答案:{{ ast[bank.ques] }}</view>
  117. </view>
  118. <view class="pad_8 answerInfos">
  119. <view class="answerTitle">答案解析</view>
  120. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  121. </view>
  122. </view>
  123. </template>
  124. <!-- 简答题 -->
  125. <template v-if="bank.type == 5">
  126. <view class="pad_8 titBox">
  127. <view class="ans">
  128. <view class="ans_input" v-if="!bank.ques || (!bank.ques.text && !bank.ques.imageList.length)">
  129. <view class="top flex">
  130. <image :data-index="bankIndex" class="icon" @click="chooseImg(bankIndex)" src="/static/camera.png" mode=""></image>
  131. <view class="progress">{{bank.ansText.imageList.length || '0'}}/4</view>
  132. <view class="submit" :class="{disabled:!bank.ansText.text && hasImgs(bank)}" @click="submitAns(bankIndex)">确认答案</view>
  133. </view>
  134. <view class="textarea"><textarea v-model="bank.ansText.text" placeholder="在此输入答案"></textarea></view>
  135. <view class="imgs">
  136. <view class="img" v-for="(img, imgIndex) in bank.ansText.imageList" :key="imgIndex">
  137. <text @click="deleteImg(imgIndex, bankIndex)">x</text>
  138. <image :src="$method.splitImgHost(img, true)"></image>
  139. </view>
  140. </view>
  141. </view>
  142. <view class="ans_submit answerInfos" v-if="bank.ques">
  143. <view class="answerTitle">我的答案:</view>
  144. {{ bank.ques.text }}
  145. <view class="imgs"><image class="img" v-for="(ques,quesIndex) in bank.ques.imageList" :key="quesIndex" :src="$method.splitImgHost(ques, true)"></image></view>
  146. </view>
  147. </view>
  148. </view>
  149. <view v-if="bank.ques">
  150. <view class="pad_8 answerInfos">
  151. <view class="answerTitle">答案解析:</view>
  152. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  153. </view>
  154. </view>
  155. </template>
  156. <!-- 案例题 -->
  157. <template v-if="bank.type == 4">
  158. <view class="tabs">
  159. <view
  160. class="tab"
  161. :class="{ current: tabIndex == bank.current }"
  162. :key="tabIndex"
  163. v-for="(tab, tabIndex) in bank.jsonStr"
  164. @click="tabSelect(tabIndex, bankIndex)"
  165. >
  166. 问题{{ tabIndex+1 }}
  167. </view>
  168. </view>
  169. <view v-for="(ansItem, ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
  170. <template v-if="ansItem.type == 1">
  171. <view class="pad_8 titBox">
  172. <view class="leftLetters">
  173. <view class="btnType">
  174. <text>单选</text>
  175. </view>
  176. </view>
  177. <view class="titles">
  178. <rich-text :nodes="ansItem.content"></rich-text>
  179. </view>
  180. <view v-if="!bank.ques[ansIndex]">
  181. <view
  182. v-for="(option, childIndex) in ansItem.optionsList"
  183. :key="childIndex"
  184. class="lisSty"
  185. @click="radioSelectChild(option.optionsId, ansIndex, bankIndex)"
  186. >
  187. <view class="activeTI">{{ ast[childIndex] }}</view>
  188. <rich-text class="textChild" :nodes="option.content"></rich-text>
  189. </view>
  190. </view>
  191. <view v-if="bank.ques[ansIndex]">
  192. <view v-for="(option, childIndex) in ansItem.optionsList" :key="childIndex" class="lisSty">
  193. <text
  194. :class="{
  195. right: option.optionsId == bank.ques[ansIndex] || option.optionsId == bank.ans[ansIndex],
  196. wrong: option.optionsId == bank.ques[ansIndex] && bank.ques[ansIndex] != bank.ans[ansIndex]
  197. }"
  198. class="activeTI"
  199. >
  200. {{ ast[childIndex] }}
  201. </text>
  202. <rich-text :nodes="option.content"></rich-text>
  203. </view>
  204. </view>
  205. </view>
  206. <view v-if="bank.ques[ansIndex]">
  207. <view class="pad_8 answer">
  208. <view>正确答案:{{ ast[bank.ans[ansIndex] - 1] }}</view>
  209. <view>我的答案:{{ ast[bank.ques[ansIndex] - 1] }}</view>
  210. </view>
  211. <view class="pad_8 answerInfos">
  212. <view class="answerTitle">答案解析</view>
  213. <view class="answerContent"><rich-text :nodes="option.analysisContent"></rich-text></view>
  214. </view>
  215. </view>
  216. </template>
  217. <template v-if="ansItem.type == 2">
  218. <view class="pad_8 titBox">
  219. <view class="leftLetters">
  220. <view class="btnType">
  221. <text>多选</text>
  222. </view>
  223. </view>
  224. <view class="titles">
  225. <rich-text :nodes="ansItem.content"></rich-text>
  226. </view>
  227. <view v-if="!bank.ques[ansIndex]">
  228. <view
  229. v-for="(option, childindex) in ansItem.optionsList"
  230. :key="childindex"
  231. class="lisSty"
  232. @click="checkboxSelectChild(bankIndex, ansIndex, childindex)"
  233. >
  234. <view :class="{ checked: option.checked }" class="activeTI">{{ ast[childindex] }}</view>
  235. <rich-text :nodes="option.content"></rich-text>
  236. </view>
  237. </view>
  238. <view v-if="!bank.ques[ansIndex]" class="submit_checkbox" :class="{disabled:!isCheckboxChecked(bank.jsonStr)}" @click="checkboxSubmitChild(bankIndex, ansIndex)">确认答案</view>
  239. <view v-if="bank.ques && bank.ques[ansIndex]">
  240. <view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty">
  241. <text :class="{ right: right(bankIndex, ansIndex, option), wrong: wrong(bankIndex, ansIndex, option) }" class="activeTI">
  242. {{ ast[childindex] }}
  243. </text>
  244. <rich-text :nodes="option.content"></rich-text>
  245. </view>
  246. </view>
  247. </view>
  248. <view v-if="bank.ques[ansIndex]">
  249. <view class="pad_8 answer">
  250. <view>
  251. 正确答案:
  252. <text :key="ansItemIndex1" v-for="(ansItem1,ansItemIndex1) in bank.ans[ansIndex]">{{ ast[ansItem1 - 1] }}</text>
  253. </view>
  254. <view>
  255. 我的答案:
  256. <text :key="quesItemIndex" v-for="(quesItem,quesItemIndex) in bank.ques[ansIndex]">{{ ast[quesItem - 1] }}</text>
  257. </view>
  258. </view>
  259. <view class="pad_8 answerInfos">
  260. <view class="answerTitle">答案解析</view>
  261. <view class="answerContent"><rich-text :nodes="ansItem.analysisContent"></rich-text></view>
  262. </view>
  263. </view>
  264. </template>
  265. <template v-if="ansItem.type == 3">
  266. <view class="pad_8 titBox">
  267. <view class="leftLetters">
  268. <view class="btnType">
  269. <text>判断</text>
  270. </view>
  271. </view>
  272. <view class="titles">
  273. <rich-text :nodes="ansItem.content"></rich-text>
  274. </view>
  275. <view v-if="!bank.ques[ansIndex]">
  276. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty" @click="judgeSelectChild(ansIndex, childindex, bankIndex)">
  277. <view class="activeTI">{{ ast[childindex] }}</view>
  278. {{ option }}
  279. </view>
  280. </view>
  281. <view v-if="bank.ques[ansIndex]">
  282. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty">
  283. <text
  284. :class="{
  285. right: childindex == bank.ques[ansIndex] || childindex == bank.ans[ansIndex],
  286. wrong: childindex == bank.ques[ansIndex] && bank.ques[ansIndex] != bank.ans[ansIndex]
  287. }"
  288. class="activeTI"
  289. >
  290. {{ ast[childindex] }}
  291. </text>
  292. {{ option }}
  293. </view>
  294. </view>
  295. </view>
  296. <view v-if="bank.ques[ansIndex]">
  297. <view class="pad_8 answer">
  298. <view>正确答案:{{ ast[bank.ans[ansIndex]] }}</view>
  299. <view>我的答案:{{ ast[bank.ques[ansIndex]] }}</view>
  300. </view>
  301. <view class="pad_8 answerInfos">
  302. <view class="answerTitle">答案解析</view>
  303. <view class="answerContent"><rich-text :nodes="ansItem.analysisContent"></rich-text></view>
  304. </view>
  305. </view>
  306. </template>
  307. <!-- 简答题 -->
  308. <template v-if="ansItem.type == 5">
  309. <view class="pad_8 titBox_title">
  310. <view class="leftLetters">
  311. <view class="btnType">
  312. <text>简答</text>
  313. </view>
  314. </view>
  315. <view class="titles">
  316. <rich-text :nodes="ansItem.content"></rich-text>
  317. </view>
  318. </view>
  319. <view class="pad_8 titBox_title">
  320. <view class="ans">
  321. <view class="ans_input" v-if="!bank.ques[ansIndex] || (!bank.ques[ansIndex].text && !bank.ques[ansIndex].imageList.length)">
  322. <view class="top flex">
  323. <image class="icon" @click="chooseImgChild(bankIndex, ansIndex)" src="/static/08-10_032.jpg" mode=""></image>
  324. <view class="progress">{{ansItem.ansText.imageList.length || '0'}}/4</view>
  325. <view class="submit" @click="submitAnsChild(bankIndex, ansIndex)">确认答案</view>
  326. </view>
  327. <view class="textarea"><textarea v-model="ansItem.ansText.text" placeholder="在此输入答案"></textarea></view>
  328. <view class="imgs">
  329. <view class="img" :key="imgIndex" v-for="(img, imgIndex) in ansItem.ansText.imageList">
  330. <text @click="deleteImgChild(imgIndex, bankIndex, ansIndex)">x</text>
  331. <image :src="$method.splitImgHost(img, true)"></image>
  332. </view>
  333. </view>
  334. </view>
  335. <view class="ans_submit answerInfos" v-if="bank.ques[ansIndex]">
  336. <view class="answerTitle">我的答案</view>
  337. {{ bank.ques[ansIndex].text }}
  338. <view class="imgs">
  339. <image class="img" :key="quesIndex" v-for="(ques,quesIndex) in bank.ques[ansIndex].imageList" :src="$method.splitImgHost(ques, true)"></image>
  340. </view>
  341. </view>
  342. </view>
  343. </view>
  344. <view v-if="bank.ques[ansIndex]">
  345. <view class="pad_8 answerInfos">
  346. <view class="answerTitle">答案解析</view>
  347. <view class="answerContent"><rich-text :nodes="ansItem.analysisContent"></rich-text></view>
  348. </view>
  349. </view>
  350. </template>
  351. </view>
  352. </template>
  353. <view class="footer_btn">
  354. <view class="collect">
  355. <view v-if="collectList[bankIndex]">
  356. <image src="/static/icon/collected.png" mode=""></image>
  357. <view>取消收藏</view>
  358. </view>
  359. </view>
  360. <view class="flex_center" @click="openFooterTab">
  361. <view class="up-icon">
  362. <image src="/static/up.png"></image>
  363. </view>
  364. 答题卡
  365. </view>
  366. <view class="collect show" @click="pdsubmit">
  367. <view>
  368. <image src="/static/jj.png" mode=""></image>
  369. <view>交卷</view>
  370. </view>
  371. </view>
  372. </view>
  373. </view>
  374. </swiper-item>
  375. </swiper>
  376. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  377. <view class="popupView">
  378. <view class="popupTops">
  379. <view class="topIcon"></view>
  380. 点击编号即可跳转至对应题目
  381. </view>
  382. <view class="popupContent">
  383. <scroll-view scroll-y="true" style="height: 506rpx;">
  384. <view class="boxSty">
  385. <view
  386. v-for="(item, index) in questionList"
  387. :key="index"
  388. @click="changeIndex(index)"
  389. :class="{ isRight: isRight(item, index), isWrong: isWrong(item, index) }"
  390. class="liListSty"
  391. >
  392. {{ index + 1 }}
  393. </view>
  394. </view>
  395. </scroll-view>
  396. </view>
  397. </view>
  398. </u-popup>
  399. <view class="dialog" v-if="showDialog">
  400. <view class="text">左右滑动切换上下题</view>
  401. <view class="btn" @click="hideDialog">我知道了</view>
  402. </view>
  403. <view class="dialog_wrap" v-if="testOver">
  404. <view class="bg"></view>
  405. <view class="dialog">
  406. <view class="title">温馨提示</view>
  407. <view class="content">
  408. <view>您已完成所有题目,</view>
  409. <view>快去交卷吧!</view>
  410. </view>
  411. <view class="btns">
  412. <view class="btn" @click="noSubmit()">暂不交卷</view>
  413. <view class="btn active" @click="submitNow()">立即交卷</view>
  414. </view>
  415. </view>
  416. </view>
  417. <view class="dialog_wrap" v-if="isLastCount">
  418. <view class="bg"></view>
  419. <view class="dialog">
  420. <view class="title">温馨提示</view>
  421. <view class="content">
  422. <view>您当前正在测试,还剩{{ lastCount }}道题未完成,离开视为交卷</view>
  423. </view>
  424. <view class="btns">
  425. <view class="btn" @click="noLeave()">暂不离开</view>
  426. <view class="btn active" @click="leaveNow()">继续离开</view>
  427. </view>
  428. </view>
  429. </view>
  430. <u-popup v-model="showpopups" mode="center" border-radius="24" height="439rpx" width="640rpx" :mask-close-able="false">
  431. <view class="popboxs">
  432. <view class="classTops">温馨提示</view>
  433. <view class="textStys">
  434. {{
  435. cgType === 7
  436. ? '您还未交卷,确定结束做题吗?'
  437. : cgType === 8
  438. ? `您还有${lastCount}道题未作答, 现在继续作答,还是下次继续?`
  439. : cgType === 6
  440. ? `您还有${lastCount}道题未作答, 您确定要交卷吗?`
  441. : cgType == 9
  442. ? `您已完成所有题目,快去交卷吧!`
  443. : ''
  444. }}
  445. </view>
  446. <view class="classFootsty" v-if="cgType === 6">
  447. <view class="btnsty btns1" @click="submit">立即交卷</view>
  448. <view class="btnsty btns2" @click="showpopups = false">继续做题</view>
  449. </view>
  450. <view class="classFootsty" v-if="cgType === 7">
  451. <view class="btnsty btns1" @click="showpopups = false">下次继续</view>
  452. <view class="btnsty btns2" @click="backPages">结束做题</view>
  453. </view>
  454. <view class="classFootsty" v-if="cgType === 8">
  455. <view class="btnsty btns1" @click="leaveNow()">下次继续</view>
  456. <view class="btnsty btns2" @click="showpopups = false">继续作答</view>
  457. </view>
  458. <view class="classFootsty" v-if="cgType === 9">
  459. <view class="btnsty btns1" @click="showpopups = false">暂不交卷</view>
  460. <view class="btnsty btns2" @click="submit">立即交卷</view>
  461. </view>
  462. </view>
  463. </u-popup>
  464. <u-mask :show="photoPopup" >
  465. <!-- 播放前拍照start -->
  466. <view v-if="photoPopup" :mask-close-able="false" style="bottom: 0;position: fixed;width: 100%;z-index: 999;">
  467. <view class="photoBox">
  468. <view class="photoTop">
  469. <view class="sqzz" v-if="false"><u-icon name="close" color="#333333" size="30" @click="closePhoto"></u-icon></view>
  470. <view class="centersq">请正视手机屏幕</view>
  471. <view class="sqzz"></view>
  472. </view>
  473. <view class="photoCenter">
  474. <view style="width: 100%; height: 979rpx;position: fixed;" v-if="photoPopup">
  475. <camera device-position="front" flash="off" @error="error" style="width: 100%; height: 100%;" ></camera>
  476. </view>
  477. <view class="custom"><image src="/static/zhezhao.png" mode=""></image></view>
  478. </view>
  479. <view class="btnResult" @click="takePhoto">拍照</view>
  480. </view>
  481. </view>
  482. </u-mask>
  483. </view>
  484. </template>
  485. <script>
  486. export default {
  487. data() {
  488. return {
  489. photoPopup:false,
  490. showpopups: false,
  491. id: '',
  492. current: 0,
  493. questionList: [],
  494. ast: ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
  495. judge: ['错误', '正确'],
  496. ans: [],
  497. ques: [],
  498. show: false,
  499. showDialog: false,
  500. bankList: [],
  501. collectList: [],
  502. goodsId: '',
  503. recordId: '',
  504. isSubmit: false,
  505. lastTime: 0, //剩余考试时长
  506. allTimes: 0, //总考试时长
  507. timer: null,
  508. wrongList: [],
  509. bankType: 0, //试卷类型
  510. needBack: false, //是否是考试
  511. testOver: false,
  512. isLastCount: false, //是否有未答题目
  513. lastCount: 0, //剩余没有回答的题目数
  514. chapterId: 0,
  515. moduleId: 0,
  516. isFromVideo:'',
  517. gradeId:'',
  518. courseId:0,
  519. cgType: 0 ,//对应设计稿弹窗编码,
  520. avatarUrl:'',
  521. ossAvatarUrl: '',
  522. goodsDetail:{},
  523. isTakePhoto:false,
  524. needPhoto:false //是否需要拍照
  525. };
  526. },
  527. async onLoad(option) {
  528. this.id = option.id;
  529. this.goodsId = option.goodsid;
  530. this.chapterId = option.chapterId;
  531. this.courseId = option.courseId;
  532. this.moduleId = option.moduleId;
  533. this.isFromVideo = option.isFromVideo||'';
  534. this.gradeId = option.gradeId || '';
  535. let isBack = option.isback;
  536. let showDialog = uni.getStorageSync('showDialog');
  537. if(showDialog) {
  538. this.showDialog = false;
  539. } else {
  540. this.showDialog = true;
  541. uni.setStorageSync('showDialog','1');
  542. }
  543. //考试时候用手势或者返回键 被迫返回做题
  544. if (isBack) {
  545. console.log(getApp());
  546. let app = getApp();
  547. let globalData = app.globalData;
  548. for (var k in globalData.bankData) {
  549. this[k] = globalData.bankData[k];
  550. }
  551. //需要拍没拍过直接弹出摄像头
  552. if(this.needPhoto && !this.isTakePhoto) {
  553. this.photoPopup = true;
  554. } else { //不需要拍照
  555. if(this.lastTime) {
  556. this.timer = setInterval(() => {
  557. if (this.lastTime <= 0) {
  558. clearInterval(this.timer);
  559. uni.showToast({
  560. icon:'none',
  561. mask:true,
  562. title:'考试时间已到,系统将自动交卷',
  563. duration:10000
  564. })
  565. this.submit();
  566. return;
  567. }
  568. this.lastTime--;
  569. }, 1000);
  570. }
  571. }
  572. } else {
  573. await this.getGoodsDetail()
  574. this.goodsQuestionList();
  575. this.bankExam();
  576. }
  577. },
  578. onUnload() {
  579. if (this.isSubmit) {
  580. clearInterval(this.timer)
  581. return;
  582. }
  583. //考试试卷 阻止ios手势返回,自动跳回答题页
  584. if (this.needBack) {
  585. let app = getApp();
  586. app.globalData.bankData = this.$data;
  587. clearInterval(this.timer);
  588. uni.navigateTo({
  589. url: '/pages2/class/questionBank?id=' + this.id + '&goodsid=' + this.goodsId + '&isback=true'
  590. });
  591. } else {
  592. //点击返回按钮确认允许退出,交卷
  593. clearInterval(this.timer)
  594. this.examRecordEdit();
  595. }
  596. },
  597. methods: {
  598. getGoodsDetail() {
  599. return new Promise((resolve) => {
  600. let self = this
  601. this.$api.goodsDetail(this.goodsId).then(res => {
  602. self.goodsDetail = res.data.data;
  603. if (self.goodsDetail.goodsPhotoExamConfig) {
  604. let goodsPhotoExamConfig = JSON.parse(self.goodsDetail.goodsPhotoExamConfig);
  605. if (goodsPhotoExamConfig.photograph > 0) {
  606. self.needPhoto = true;
  607. }
  608. }
  609. resolve()
  610. });
  611. })
  612. },
  613. postStudyRecord() {
  614. let self = this
  615. let data = {
  616. photo: self.ossAvatarUrl,
  617. recordId: self.recordId
  618. };
  619. this.$api.studyExamPhotoRecord(data).then(res => {
  620. self.ossAvatarUrl = ''
  621. self.isTakePhoto = true;
  622. //拍照
  623. if(this.lastTime) {
  624. this.timer = setInterval(() => {
  625. if (this.lastTime <= 0) {
  626. clearInterval(this.timer);
  627. uni.showToast({
  628. icon:'none',
  629. mask:true,
  630. title:'考试时间已到,系统将自动交卷',
  631. duration:10000
  632. })
  633. this.submit();
  634. return;
  635. }
  636. this.lastTime--;
  637. }, 1000);
  638. }
  639. });
  640. },
  641. uploadFile(options, int) {
  642. var self = this;
  643. return new Promise((resolve, reject) => {
  644. var data = {
  645. imageStatus: int
  646. };
  647. self.$api.aliyunpolicy(data).then(res => {
  648. if (res.data.code != 200) {
  649. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  650. return;
  651. }
  652. var ossToken = res.data.data.resultContent;
  653. if (ossToken.host == null || ossToken.host == undefined) {
  654. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  655. return;
  656. }
  657. uni.uploadFile({
  658. url: ossToken.host,
  659. name: 'file',
  660. filePath: options,
  661. fileType: 'image',
  662. header: {
  663. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  664. },
  665. formData: {
  666. key: ossToken.dir,
  667. OSSAccessKeyId: ossToken.accessid,
  668. policy: ossToken.policy,
  669. Signature: ossToken.signature,
  670. callback: ossToken.callback,
  671. success_action_status: 200
  672. },
  673. success: result => {
  674. if (result.statusCode === 200) {
  675. self.ossAvatarUrl = ossToken.dir;
  676. resolve();
  677. } else {
  678. uni.showToast({
  679. title: '上传失败',
  680. icon: 'none'
  681. });
  682. return;
  683. }
  684. },
  685. fail: error => {
  686. uni.showToast({
  687. title: '上传接口报错' + error,
  688. icon: 'none'
  689. });
  690. return;
  691. }
  692. });
  693. });
  694. });
  695. },
  696. imageInfos() {
  697. var self = this;
  698. return new Promise((resolve, reject) => {
  699. uni.getImageInfo({
  700. src: self.avatarUrl,
  701. success: async res => {
  702. let canvasWidth = res.width; //图片原始长宽
  703. let canvasHeight = res.height;
  704. if (canvasWidth > 1000 || canvasHeight > 1000) {
  705. uni.compressImage({
  706. src: self.avatarUrl,
  707. quality: 75,
  708. width: '50%',
  709. height: '50%',
  710. success: async rest => {
  711. const waitUpload = await self.uploadFile(rest.tempFilePath, 0);
  712. resolve();
  713. }
  714. });
  715. } else {
  716. console.log('无需压缩');
  717. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  718. resolve();
  719. }
  720. }
  721. });
  722. });
  723. },
  724. async submitPhoto() {
  725. const waitYS = await this.imageInfos();
  726. this.postStudyRecord(); //提交记录
  727. },
  728. //确认拍照
  729. takePhoto() {
  730. var self = this;
  731. const ctx = uni.createCameraContext();
  732. ctx.takePhoto({
  733. quality: 'high',
  734. success: res => {
  735. console.log(res.tempImagePath);
  736. self.avatarUrl = res.tempImagePath;
  737. self.submitPhoto();
  738. self.photoPopup = false;
  739. },
  740. fail: err => {
  741. console.log(err);
  742. }
  743. });
  744. },
  745. /**
  746. * 是否有上传图片
  747. */
  748. hasImgs(bank) {
  749. return bank.ansText.imageList.length == 0;
  750. },
  751. /**
  752. * 获取试卷类型2考试,1练习
  753. */
  754. bankExam() {
  755. this.$api.bankExam(this.id).then(res => {
  756. this.bankType = res.data.data.doType;
  757. if (this.bankType == 2) {
  758. this.needBack = true;
  759. }
  760. });
  761. },
  762. /**
  763. * 点击后退按钮
  764. */
  765. clickLeft() {
  766. if (this.bankType == 1) {
  767. let ansCount = this.questionOverNum(); //已答题数
  768. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  769. //所有题目答完
  770. if (this.lastCount == 0) {
  771. // this.testOver = true;
  772. this.cgType = 7;
  773. //未答完
  774. } else {
  775. this.cgType = 8;
  776. // this.isLastCount = true;
  777. }
  778. this.showpopups = true;
  779. } else if (this.bankType == 2) {
  780. let ansCount = this.questionOverNum(); //已答题数
  781. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  782. //所有题目答完
  783. if (this.lastCount == 0) {
  784. this.testOver = true;
  785. //未答完
  786. } else {
  787. this.isLastCount = true;
  788. }
  789. }
  790. },
  791. /**
  792. * 返回上一页
  793. */
  794. backPages() {
  795. this.needBack = false;
  796. uni.navigateBack({
  797. delta: 1
  798. });
  799. },
  800. /**
  801. * 获取已经回答的题目数
  802. * hasSpecail (是否包含简答和案例)
  803. */
  804. questionOverNum(hasSpecail) {
  805. let count = 0;
  806. this.questionList.forEach(item => {
  807. if (item.type == 1 || item.type == 2 || item.type == 3) {
  808. if (item.ques) {
  809. count++;
  810. }
  811. } else if (item.type == 4) {
  812. //案例题
  813. if(hasSpecail) {
  814. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  815. if (jsonItem.type == 1 || jsonItem.type == 2 || jsonItem.type == 3) {
  816. if (item.ques[indexs]) {
  817. return true;
  818. } else {
  819. return false;
  820. }
  821. } else if (jsonItem.type == 5) {
  822. console.log(jsonItem, 111);
  823. if (item.ques[indexs] && (item.ques[indexs].text.length || item.ques[indexs].imageList.length)) {
  824. return true;
  825. } else {
  826. return false;
  827. }
  828. }
  829. });
  830. if (isOver) {
  831. count++;
  832. console.log(item, 444);
  833. }
  834. }
  835. } else if (item.type == 5) {
  836. //简答题
  837. if(hasSpecail) {
  838. if (item.ques && (item.ques.text.length || item.ques.imageList.length)) {
  839. count++;
  840. }
  841. }
  842. }
  843. });
  844. return count;
  845. },
  846. /**
  847. * 是否做完所有题目
  848. */
  849. isDoOver() {
  850. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  851. if(this.questionList.length == questionOverNum) { //全部做完弹窗
  852. this.cgType = 9;
  853. this.showpopups = true;
  854. }
  855. },
  856. /**
  857. * 暂不交卷
  858. */
  859. noSubmit() {
  860. //设为允许退出页面
  861. this.needBack = false;
  862. uni.navigateBack({
  863. delta: 1
  864. });
  865. },
  866. /**
  867. * 不离开
  868. */
  869. noLeave() {
  870. this.isLastCount = false;
  871. },
  872. /**
  873. * 立即离开并交卷
  874. */
  875. leaveNow() {
  876. this.isSubmit = true;
  877. uni.navigateBack({
  878. delta: 1
  879. });
  880. let score = 0; //计算总分
  881. let reportStatus = 0;
  882. let number = 0;
  883. let passScore = 0;
  884. let allScore = 0; //总分
  885. this.questionList.forEach((item, index) => {
  886. passScore = item.passScore
  887. if (item.type == 1) {
  888. if (item.ques == item.ans) {
  889. item.scoreResult = item.score;
  890. score += item.score;
  891. number++;
  892. } else {
  893. item.scoreResult = 0;
  894. }
  895. allScore += item.score;
  896. } else if (item.type == 2) {
  897. let isRight =
  898. item.ques &&
  899. item.ques.every((quesItem, quesIndex) => {
  900. return item.ques[quesIndex] == item.ans[quesIndex];
  901. });
  902. if (isRight) { //全对
  903. item.scoreResult = item.score;
  904. score += item.score;
  905. number++;
  906. } else {
  907. let checkboxScore = item.score; //获取单题总分数
  908. item.ques && item.ques.forEach((ques,quesIndex) => {
  909. //选错一个全扣
  910. if(item.ques) {
  911. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  912. checkboxScore = 0;
  913. }
  914. } else {
  915. checkboxScore = 0;
  916. }
  917. })
  918. //没选错
  919. if(checkboxScore) {
  920. item.ans.forEach((ans,quesIndex) => {
  921. //漏选扣一部分
  922. if(item.ques) {
  923. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  924. checkboxScore = item.partScore;
  925. }
  926. } else {
  927. checkboxScore = 0;
  928. }
  929. })
  930. }
  931. if(checkboxScore <= 0) {
  932. item.scoreResult = 0;
  933. } else {
  934. item.scoreResult = checkboxScore;
  935. }
  936. score += checkboxScore;
  937. }
  938. allScore += item.score;
  939. } else if (item.type == 3) {
  940. if (item.ques == item.ans) {
  941. item.scoreResult = item.score;
  942. score += item.score;
  943. number++;
  944. } else {
  945. item.scoreResult = 0;
  946. }
  947. allScore += item.score;
  948. }
  949. });
  950. if(score >= passScore) {
  951. reportStatus = 1
  952. } else {
  953. reportStatus = 0
  954. }
  955. this.$api
  956. .bankRecordEdit({
  957. chapterId:this.chapterId || 0,
  958. moduleId:this.moduleId || 0,
  959. examId: this.id,
  960. goodsId: this.goodsId,
  961. recordId:this.recordId,
  962. courseId:this.courseId,
  963. reportStatus:reportStatus,
  964. rightQuestionNum: number,
  965. status: 1,
  966. gradeId:this.gradeId,
  967. performance: score,
  968. totalScore: allScore,
  969. // examTime: parseInt(this.allTimes),
  970. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  971. // historyExamJson: JSON.stringify(this.questionList)
  972. })
  973. .then(res => {});
  974. },
  975. /**
  976. * 立即交卷
  977. */
  978. submitNow() {
  979. this.showpopups = false;
  980. this.needBack = false;
  981. this.submit();
  982. },
  983. /**
  984. * 离开页面统计回答正确题数
  985. */
  986. examRecordEdit() {
  987. if (!this.isSubmit) {
  988. let number = 0;
  989. let score = 0;
  990. let doQuestionNum = 0;
  991. let reportStatus = 0;
  992. this.questionList.forEach((item, index) => {
  993. if (item.type == 1) {
  994. if (item.ques == item.ans) {
  995. score += item.score;
  996. number++;
  997. }
  998. if (item.ques) {
  999. doQuestionNum++;
  1000. }
  1001. } else if (item.type == 2) {
  1002. let isRight =
  1003. item.ques &&
  1004. item.ques.every((quesItem, quesIndex) => {
  1005. return item.ques[quesIndex] == item.ans[quesIndex];
  1006. });
  1007. if (isRight) {
  1008. score += item.score;
  1009. number++;
  1010. } else {
  1011. let checkboxScore = item.score; //获取单题总分数
  1012. item.ques.forEach((ques,quesIndex) => {
  1013. //选错一个全扣
  1014. if(item.ques) {
  1015. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1016. checkboxScore = 0;
  1017. }
  1018. } else {
  1019. checkboxScore = 0;
  1020. }
  1021. })
  1022. //没选错
  1023. if(checkboxScore) {
  1024. item.ans.forEach((ans,quesIndex) => {
  1025. //漏选扣一部分
  1026. if(item.ques) {
  1027. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  1028. checkboxScore = item.partScore;
  1029. }
  1030. } else {
  1031. checkboxScore = 0;
  1032. }
  1033. })
  1034. }
  1035. if(checkboxScore <= 0) {
  1036. item.scoreResult = 0;
  1037. } else {
  1038. item.scoreResult = checkboxScore;
  1039. score += checkboxScore;
  1040. number++;
  1041. }
  1042. }
  1043. if (item.ques && item.ques.length) {
  1044. doQuestionNum++;
  1045. }
  1046. } else if (item.type == 3) {
  1047. if (item.ques == item.ans) {
  1048. score += item.score;
  1049. number++;
  1050. }
  1051. if (item.ques) {
  1052. doQuestionNum++;
  1053. }
  1054. } else if (item == 4) {
  1055. if (item.ques.length) {
  1056. doQuestionNum++;
  1057. }
  1058. } else if (item.type == 5) {
  1059. if (item.ques) {
  1060. doQuestionNum++;
  1061. }
  1062. }
  1063. });
  1064. if(score >= 60) {
  1065. reportStatus = 1
  1066. }
  1067. this.$api
  1068. .bankRecordEdit({
  1069. chapterId:this.chapterId || 0,
  1070. moduleId:this.moduleId || 0,
  1071. gradeId:this.gradeId,
  1072. examId: this.id,
  1073. courseId:this.courseId,
  1074. goodsId: this.goodsId,
  1075. recordId:this.recordId,
  1076. performance:score,
  1077. reportStatus:reportStatus,
  1078. status: 1,
  1079. // historyExamJson: JSON.stringify(this.questionList)
  1080. })
  1081. .then(res => {});
  1082. }
  1083. },
  1084. /**
  1085. * @param {Object} second倒计时过滤器
  1086. */
  1087. countdown(second) {
  1088. if (second) {
  1089. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1090. let m = parseInt((second / 60) % 60); // 计算分数
  1091. let s = parseInt(second % 60); // 计算当前秒数
  1092. if (h < 10) h = '0' + h;
  1093. if (m < 10) m = '0' + m;
  1094. if (s < 10) s = '0' + s;
  1095. return h + ':' + m + ':' + s;
  1096. } else {
  1097. return '';
  1098. }
  1099. },
  1100. /**
  1101. * 请求题目列表
  1102. */
  1103. goodsQuestionList() {
  1104. this.$api
  1105. .goodsQuestionList({
  1106. examId: this.id
  1107. })
  1108. .then(res => {
  1109. if (!res.data.data.length) {
  1110. this.hideDialog();
  1111. uni.showModal({
  1112. showCancel: false,
  1113. content: '该试卷暂无题目',
  1114. success: function(k) {
  1115. if (k.confirm) {
  1116. uni.navigateBack();
  1117. }
  1118. }
  1119. });
  1120. return;
  1121. }
  1122. this.allTimes = res.data.data[0].answerTime * 60;
  1123. this.lastTime = res.data.data[0].answerTime && res.data.data[0].answerTime * 60;
  1124. res.data.data.forEach((item, index) => {
  1125. if (typeof item.jsonStr == 'string') {
  1126. item.jsonStr = JSON.parse(item.jsonStr);
  1127. if (item.type == 2) {
  1128. //多选
  1129. item.jsonStr.forEach(str => {
  1130. str.optionsId = '' + str.optionsId;
  1131. });
  1132. let arr = item.answerQuestion.split(',');
  1133. arr.forEach((a, i) => {
  1134. arr[i] = '' + a;
  1135. });
  1136. item.ans = arr;
  1137. return;
  1138. } else if (item.type == 5) {
  1139. //简答题
  1140. item.ansText = {
  1141. text: '',
  1142. imageList: []
  1143. };
  1144. item.ques = {
  1145. text: '',
  1146. imageList: []
  1147. }
  1148. } else if (item.type == 4) {
  1149. //案例题
  1150. console.log(item.jsonStr);
  1151. item.ques = [];
  1152. item.current = 0;
  1153. let ansArr = [];
  1154. item.jsonStr.forEach((json, index) => {
  1155. if (json.type == 1) {
  1156. ansArr[index] = json.answerQuestion;
  1157. } else if (json.type == 2) {
  1158. json.optionsList.forEach(str => {
  1159. str.optionsId = '' + str.optionsId;
  1160. });
  1161. let arr = json.answerQuestion.split(',');
  1162. arr.forEach((a, i) => {
  1163. arr[i] = '' + a;
  1164. });
  1165. ansArr[index] = arr;
  1166. } else if (json.type == 3) {
  1167. ansArr[index] = json.answerQuestion;
  1168. } else if (json.type == 5) {
  1169. ansArr[index] = {
  1170. text: '',
  1171. imageList: []
  1172. };
  1173. json.ansText = {
  1174. text: '',
  1175. imageList: []
  1176. };
  1177. }
  1178. });
  1179. item.ans = ansArr;
  1180. return;
  1181. }
  1182. item.ans = item.answerQuestion;
  1183. }
  1184. });
  1185. this.questionList = res.data.data;
  1186. this.lastCount = this.questionList.length;
  1187. this.examRecord();
  1188. });
  1189. },
  1190. /**
  1191. * 记录总题数
  1192. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1193. */
  1194. examRecord(hasSpecial) {
  1195. let self = this
  1196. let questionList = 0;
  1197. if(!hasSpecial) {
  1198. this.questionList.forEach((item, index) => {
  1199. if(item.type == 1 || item.type == 2 || item.type == 3) {
  1200. questionList++;
  1201. }
  1202. })
  1203. } else {
  1204. questionList = this.questionList.length;
  1205. }
  1206. this.$api
  1207. .bankRecord({
  1208. chapterExamId: this.chapterId || 0,
  1209. moduleExamId: this.moduleId || 0,
  1210. examId: this.id,
  1211. goodsId: this.goodsId,
  1212. gradeId:this.gradeId,
  1213. totalQuestionNum: questionList
  1214. })
  1215. .then(res => {
  1216. this.recordId = res.data.data;
  1217. if(self.needPhoto){
  1218. self.photoPopup = true; //拍照
  1219. } else {
  1220. if(this.lastTime) {
  1221. this.timer = setInterval(() => {
  1222. if (this.lastTime <= 0) {
  1223. clearInterval(this.timer);
  1224. uni.showToast({
  1225. icon:'none',
  1226. mask:true,
  1227. title:'考试时间已到,系统将自动交卷',
  1228. duration:10000
  1229. })
  1230. this.submit();
  1231. return;
  1232. }
  1233. this.lastTime--;
  1234. }, 1000);
  1235. }
  1236. }
  1237. });
  1238. },
  1239. /**
  1240. * @param {Object} e单选点击
  1241. */
  1242. radioSelect(optionsId, bindex) {
  1243. if (this.questionList[bindex].ques) return;
  1244. this.$set(this.questionList[bindex], 'ques', optionsId);
  1245. this.isDoOver()
  1246. },
  1247. /**
  1248. * @param {Object} e案例单选点击
  1249. */
  1250. radioSelectChild(optionsId, ansIndex, bindex) {
  1251. if (this.questionList[bindex].ques[ansIndex]) return;
  1252. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  1253. this.isDoOver()
  1254. },
  1255. /**
  1256. * @param {Object} 多选点击
  1257. */
  1258. checkboxSelect(optionsId, bindex, index) {
  1259. this.$set(this.questionList[bindex].jsonStr[index], 'checked', !this.questionList[bindex].jsonStr[index].checked);
  1260. },
  1261. /**
  1262. * @param {Object} 案例多选点击
  1263. */
  1264. checkboxSelectChild(bindex, ansIndex, childIndex) {
  1265. this.$set(this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex], 'checked', !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex].checked);
  1266. },
  1267. isCheckboxChecked(arr) {
  1268. return arr.some(item => {
  1269. if (item.checked) {
  1270. return true;
  1271. }
  1272. });
  1273. },
  1274. /**
  1275. * @param {Object} 多选确认
  1276. */
  1277. checkboxSubmit(bindex) {
  1278. if (this.questionList[bindex].ques) return;
  1279. let arr = [];
  1280. this.questionList[bindex].jsonStr.forEach(item => {
  1281. if (item.checked) {
  1282. arr.push(item.optionsId);
  1283. }
  1284. });
  1285. if(!arr.length) {
  1286. uni.showToast({
  1287. title:'请选择答案',
  1288. icon:'none'
  1289. })
  1290. return;
  1291. }
  1292. this.$set(this.questionList[bindex], 'ques', arr);
  1293. this.isDoOver()
  1294. let isWrong = this.questionList[bindex].ques.some((quesItem, quesIndex) => {
  1295. return this.questionList[bindex].ques[quesIndex] != this.questionList[bindex].ans[quesIndex];
  1296. });
  1297. },
  1298. /**
  1299. * @param {Object} 案例多选确认
  1300. */
  1301. checkboxSubmitChild(bindex, ansIndex) {
  1302. if (this.questionList[bindex].ques[ansIndex]) return;
  1303. let arr = [];
  1304. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(item => {
  1305. if (item.checked) {
  1306. arr.push(item.optionsId);
  1307. }
  1308. });
  1309. if(!arr.length) {
  1310. uni.showToast({
  1311. title:'请选择答案',
  1312. icon:'none'
  1313. })
  1314. return;
  1315. }
  1316. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  1317. this.isDoOver()
  1318. },
  1319. /**
  1320. * @param {Object} index
  1321. * @param {Object} bindex
  1322. * 判断题
  1323. */
  1324. judgeSelect(index, bindex) {
  1325. if (this.questionList[bindex].ques) return;
  1326. this.$set(this.questionList[bindex], 'ques', index + '');
  1327. this.isDoOver()
  1328. },
  1329. /**
  1330. * @param {Object} ansindex
  1331. * @param {Object} childindex
  1332. * @param {Object} bindex
  1333. * 案例判断题
  1334. */
  1335. judgeSelectChild(ansindex, childindex, bindex) {
  1336. if (this.questionList[bindex].ques[ansindex]) return;
  1337. this.$set(this.questionList[bindex].ques, ansindex, childindex + '');
  1338. this.isDoOver()
  1339. },
  1340. openFooterTab() {
  1341. this.show = true;
  1342. },
  1343. hideDialog() {
  1344. this.showDialog = false;
  1345. },
  1346. changeIndex(index) {
  1347. this.current = index;
  1348. },
  1349. swiperChange(e) {
  1350. this.current = e.detail.current;
  1351. },
  1352. pdsubmit() {
  1353. if (this.bankType == 1) {
  1354. let ansCount = this.questionOverNum(); //已答题数
  1355. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1356. //没有答完
  1357. if (this.lastCount !== 0) {
  1358. this.cgType = 6;
  1359. this.showpopups = true;
  1360. return;
  1361. }
  1362. }
  1363. this.submit();
  1364. },
  1365. /**
  1366. * 交卷
  1367. */
  1368. submit() {
  1369. let score = 0; //计算总分
  1370. let reportStatus = 0;
  1371. let number = 0; //做对的题目数量
  1372. let doQuestionNum = 0; //做过的题目数量
  1373. let allScore = 0; //总分
  1374. let passScore = 0;
  1375. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  1376. let doQuestionIds = []; //做过的题目id
  1377. let rightQuestionIds = []; //做对的题目id
  1378. this.questionList.forEach((item, index) => {
  1379. passScore = item.passScore
  1380. if (item.type == 1) {
  1381. //正确
  1382. if (item.ques == item.ans) {
  1383. item.scoreResult = item.score;
  1384. score += item.score;
  1385. number++;
  1386. rightQuestionIds.push(item.questionId)
  1387. } else { //错误
  1388. item.scoreResult = 0;
  1389. doWrongQuestionIds.push(item.questionId)
  1390. }
  1391. allScore += item.score;
  1392. if (item.ques) {
  1393. doQuestionNum++;
  1394. doQuestionIds.push(item.questionId)
  1395. }
  1396. } else if (item.type == 2) {
  1397. let isRight =
  1398. item.ans &&
  1399. item.ans.every((quesItem, quesIndex) => {
  1400. if(item.ques) {
  1401. return item.ques[quesIndex] == item.ans[quesIndex];
  1402. } else {
  1403. return false;
  1404. }
  1405. });
  1406. if (isRight) {
  1407. score += item.score;
  1408. number++;
  1409. item.scoreResult = item.score;
  1410. rightQuestionIds.push(item.questionId)
  1411. } else {
  1412. let checkboxScore = item.score; //获取单题总分数
  1413. item.ques && item.ques.forEach((ques,quesIndex) => {
  1414. //选错一个全扣
  1415. if(item.ques) {
  1416. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1417. checkboxScore = 0;
  1418. }
  1419. } else {
  1420. checkboxScore = 0;
  1421. }
  1422. })
  1423. console.log(checkboxScore)
  1424. //没选错
  1425. if(checkboxScore) {
  1426. item.ans.forEach((ans,quesIndex) => {
  1427. //漏选扣一部分
  1428. if(item.ques) {
  1429. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  1430. checkboxScore = item.partScore;
  1431. }
  1432. } else {
  1433. checkboxScore = 0;
  1434. }
  1435. })
  1436. }
  1437. if(checkboxScore <= 0) { //0分
  1438. item.scoreResult = 0;
  1439. doWrongQuestionIds.push(item.questionId)
  1440. } else { //部分分
  1441. number++;
  1442. item.scoreResult = checkboxScore;
  1443. score += checkboxScore;
  1444. rightQuestionIds.push(item.questionId)
  1445. }
  1446. }
  1447. allScore += item.score;
  1448. if (item.ques && item.ques.length) {
  1449. doQuestionNum++;
  1450. doQuestionIds.push(item.questionId)
  1451. }
  1452. } else if (item.type == 3) {
  1453. if (item.ques == item.ans) {
  1454. item.scoreResult = item.score;
  1455. score += item.score;
  1456. number++;
  1457. rightQuestionIds.push(item.questionId)
  1458. } else {
  1459. item.scoreResult = 0;
  1460. doWrongQuestionIds.push(item.questionId)
  1461. }
  1462. allScore += item.score;
  1463. if (item.ques) {
  1464. doQuestionNum++;
  1465. doQuestionIds.push(item.questionId)
  1466. }
  1467. } else if (item.type == 4) {
  1468. if (item.ques && item.ques.length) {
  1469. doQuestionNum++;
  1470. }
  1471. } else if (item.type == 5) {
  1472. if (item.ques) {
  1473. doQuestionNum++;
  1474. }
  1475. }
  1476. });
  1477. //大于分及格
  1478. if(score >= passScore) {
  1479. reportStatus = 1
  1480. } else {
  1481. reportStatus = 0
  1482. }
  1483. //交卷
  1484. this.$api
  1485. .bankRecordEdit({
  1486. moduleId:this.moduleId || 0,
  1487. chapterId:this.chapterId || 0,
  1488. gradeId:this.gradeId,
  1489. examId: this.id,
  1490. goodsId: this.goodsId,
  1491. reportStatus:reportStatus,
  1492. recordId: this.recordId,
  1493. courseId:this.courseId,
  1494. // rightQuestionNum: number,
  1495. status: 1,
  1496. // doQuestionIds:doQuestionIds.join(','),
  1497. // rightQuestionIds:rightQuestionIds.join(','),
  1498. // doQuestionNum: doQuestionNum,
  1499. performance: score,
  1500. totalScore: allScore,
  1501. // examTime: parseInt(this.allTimes),
  1502. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1503. // historyExamJson: JSON.stringify(this.questionList)
  1504. })
  1505. .then(res => {
  1506. this.isSubmit = true;
  1507. if (res.data.code == 200) {
  1508. uni.showToast({
  1509. title: '交卷成功',
  1510. duration: 1000,
  1511. mask:true,
  1512. icon: 'none'
  1513. });
  1514. setTimeout(() => {
  1515. uni.redirectTo({
  1516. url: '/pages2/class/question_report?rightQuestionNum='+number+'&doWrongQuestionNum='+doWrongQuestionIds.length+'&score='+score+'&totalScore='+allScore+'&reportStatus='+reportStatus
  1517. });
  1518. }, 1000);
  1519. }
  1520. });
  1521. },
  1522. /**
  1523. * @param {Object} imgIndex
  1524. * @param {Object} bankIndex
  1525. * 删除简答图片
  1526. */
  1527. deleteImg(imgIndex, bankIndex) {
  1528. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  1529. },
  1530. /**
  1531. * @param {Object} imgIndex
  1532. * @param {Object} bankIndex
  1533. * @param {Object} ansIndex
  1534. * 删除案例题简答图片
  1535. */
  1536. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  1537. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(imgIndex, 1);
  1538. },
  1539. /**
  1540. * @param {Object} bankindex
  1541. * 选择上传图片
  1542. */
  1543. chooseImg(bankindex) {
  1544. if(this.questionList[bankindex] && this.questionList[bankindex].ansText && this.questionList[bankindex].ansText.imageList.length >= 4) {
  1545. uni.showToast({
  1546. icon:'none',
  1547. title:'最多选择4张'
  1548. })
  1549. return;
  1550. }
  1551. uni.chooseImage({
  1552. count: 1, //默认9
  1553. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  1554. sourceType: ['album', 'camera'], //从相册选择
  1555. success: res => {
  1556. let self = this;
  1557. // console.log(JSON.stringify(res.tempFilePaths));
  1558. let img = res.tempFilePaths[0];
  1559. uni.getImageInfo({
  1560. src: img,
  1561. success: async res => {
  1562. let canvasWidth = res.width; //图片原始长宽
  1563. let canvasHeight = res.height;
  1564. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1565. uni.compressImage({
  1566. src: img,
  1567. quality: 75,
  1568. width: '50%',
  1569. height: '50%',
  1570. success: async rest => {
  1571. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1572. this.questionList[bankindex].ansText.imageList.push(dir);
  1573. }
  1574. });
  1575. } else {
  1576. const dir = await self.uploadFile(img, 0);
  1577. this.questionList[bankindex].ansText.imageList.push(dir);
  1578. }
  1579. }
  1580. });
  1581. }
  1582. });
  1583. },
  1584. /**
  1585. * @param {Object} bankindex
  1586. * @param {Object} ansindex
  1587. * 案例题选择上传图片
  1588. */
  1589. chooseImgChild(bankindex, ansindex) {
  1590. uni.chooseImage({
  1591. count: 1, //默认9
  1592. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  1593. sourceType: ['album', 'camera'], //从相册选择
  1594. success: res => {
  1595. let self = this;
  1596. // console.log(JSON.stringify(res.tempFilePaths));
  1597. let img = res.tempFilePaths[0];
  1598. uni.getImageInfo({
  1599. src: img,
  1600. success: async res => {
  1601. let canvasWidth = res.width; //图片原始长宽
  1602. let canvasHeight = res.height;
  1603. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1604. uni.compressImage({
  1605. src: img,
  1606. quality: 75,
  1607. width: '50%',
  1608. height: '50%',
  1609. success: async rest => {
  1610. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1611. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir);
  1612. }
  1613. });
  1614. } else {
  1615. const dir = await self.uploadFile(img, 0);
  1616. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir);
  1617. }
  1618. }
  1619. });
  1620. }
  1621. });
  1622. },
  1623. uploadFile(options, int) {
  1624. var self = this;
  1625. return new Promise((resolve, reject) => {
  1626. var data = {
  1627. imageStatus: int
  1628. };
  1629. self.$api.aliyunpolicy(data).then(res => {
  1630. console.log(res.data, 6);
  1631. if (res.data.code != 200) {
  1632. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  1633. return;
  1634. }
  1635. var ossToken = res.data.data.resultContent;
  1636. if (ossToken.host == null || ossToken.host == undefined) {
  1637. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  1638. return;
  1639. }
  1640. uni.uploadFile({
  1641. url: ossToken.host,
  1642. name: 'file',
  1643. filePath: options,
  1644. fileType: 'image',
  1645. header: {
  1646. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  1647. },
  1648. formData: {
  1649. key: ossToken.dir,
  1650. OSSAccessKeyId: ossToken.accessid,
  1651. policy: ossToken.policy,
  1652. Signature: ossToken.signature,
  1653. callback: ossToken.callback,
  1654. success_action_status: 200
  1655. },
  1656. success: result => {
  1657. if (result.statusCode === 200) {
  1658. self.ossAvatarUrl = ossToken.dir;
  1659. resolve(ossToken.dir);
  1660. } else {
  1661. uni.showToast({
  1662. title: '上传失败',
  1663. icon: 'none'
  1664. });
  1665. return;
  1666. }
  1667. },
  1668. fail: error => {
  1669. uni.showToast({
  1670. title: '上传接口报错' + error,
  1671. icon: 'none'
  1672. });
  1673. return;
  1674. }
  1675. });
  1676. });
  1677. });
  1678. },
  1679. /**
  1680. * @param {Object} type
  1681. * @param {Object} bankindex
  1682. * 简答题答案确认
  1683. */
  1684. submitAns(bankindex) {
  1685. console.log(this.questionList[bankindex]);
  1686. if (!this.questionList[bankindex].ansText.text && !this.questionList[bankindex].ansText.imageList.length) {
  1687. uni.showToast({
  1688. title: '请输入内容或上传图片',
  1689. duration: 2000,
  1690. icon: 'none'
  1691. });
  1692. return;
  1693. }
  1694. this.$set(this.questionList[bankindex], 'ques', {
  1695. imageList: this.questionList[bankindex].ansText.imageList,
  1696. text: this.questionList[bankindex].ansText.text
  1697. });
  1698. this.isDoOver()
  1699. },
  1700. /**
  1701. * @param {Object} bankindex
  1702. * @param {Object} ansindex
  1703. * 案例题简答答案确认
  1704. */
  1705. submitAnsChild(bankindex, ansindex) {
  1706. if (!this.questionList[bankindex].jsonStr[ansindex].ansText.text && !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length) {
  1707. uni.showToast({
  1708. title: '请输入内容或上传图片',
  1709. duration: 2000,
  1710. icon: 'none'
  1711. });
  1712. return;
  1713. }
  1714. this.$set(this.questionList[bankindex].ques, ansindex, {
  1715. imageList: this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  1716. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text
  1717. });
  1718. this.isDoOver()
  1719. },
  1720. isRight(item, index) {
  1721. //单选
  1722. if (this.questionList[index].ques) {
  1723. if (item.type == 1) {
  1724. return this.questionList[index].ques == this.questionList[index].ans;
  1725. //多选
  1726. } else if (item.type == 2) {
  1727. //每一项都相等
  1728. return this.questionList[index].ques.every((item, i) => {
  1729. return item == this.questionList[index].ans[i];
  1730. });
  1731. //判断
  1732. } else if (item.type == 3) {
  1733. return this.questionList[index].ques == this.questionList[index].ans;
  1734. // } else if (item.type == 5) {
  1735. // if(this.questionList[index].ques.text){
  1736. // return true
  1737. // }else{
  1738. // return false
  1739. // }
  1740. } else {
  1741. return false;
  1742. }
  1743. } else {
  1744. return false;
  1745. }
  1746. },
  1747. right(bankIndex, ansIndex, option) {
  1748. if (this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1749. if (this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 || this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) != -1) {
  1750. return true;
  1751. } else {
  1752. return false;
  1753. }
  1754. } else {
  1755. return false;
  1756. }
  1757. },
  1758. wrong(bankIndex, ansIndex, option) {
  1759. if (this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1760. if (this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 && this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) == -1) {
  1761. return true;
  1762. } else {
  1763. return false;
  1764. }
  1765. } else {
  1766. return false;
  1767. }
  1768. },
  1769. isWrong(item, index) {
  1770. if (this.questionList[index].ques) {
  1771. //单选
  1772. if (item.type == 1) {
  1773. return this.questionList[index].ques != this.questionList[index].ans;
  1774. //多选
  1775. } else if (item.type == 2) {
  1776. //每一项都相等
  1777. return this.questionList[index].ques.some((item, index) => {
  1778. return item != this.questionList[index].ans;
  1779. });
  1780. //判断
  1781. } else if (item.type == 3) {
  1782. return this.questionList[index].ques != this.questionList[index].ans;
  1783. } else {
  1784. return false;
  1785. }
  1786. } else {
  1787. return false;
  1788. }
  1789. },
  1790. tabSelect(index, bankindex) {
  1791. this.$set(this.questionList[bankindex], 'current', index);
  1792. }
  1793. }
  1794. };
  1795. </script>
  1796. <style lang="scss" scoped>
  1797. .photoBox {
  1798. background-color: #FFFFFF;
  1799. border-radius: 32px 32px 0px 0px;
  1800. .photoTop {
  1801. height: 74upx;
  1802. display: flex;
  1803. align-items: center;
  1804. justify-content: space-between;
  1805. padding: 0upx 38upx;
  1806. .sqzz {
  1807. width: 28upx;
  1808. height: 28upx;
  1809. display: flex;
  1810. align-items: center;
  1811. justify-content: center;
  1812. }
  1813. .centersq {
  1814. color: #333;
  1815. font-size: 30upx;
  1816. font-weight: 500;
  1817. }
  1818. }
  1819. .photoCenter {
  1820. width: 750upx;
  1821. height: 979upx;
  1822. position: relative;
  1823. .custom {
  1824. width: 750upx;
  1825. height: 979upx;
  1826. position: absolute;
  1827. z-index: 1000;
  1828. top: 0;
  1829. left: 0;
  1830. image {
  1831. width: 100%;
  1832. height: 100%;
  1833. }
  1834. }
  1835. }
  1836. .btnResult {
  1837. height: 100rpx;
  1838. width: 100%;
  1839. background-color: #07c160;
  1840. text-align: center;
  1841. line-height: 100upx;
  1842. color: #fff;
  1843. font-size: 32upx;
  1844. font-weight: bold;
  1845. }
  1846. }
  1847. .questionBank {
  1848. width:100%;
  1849. height:100vh;
  1850. display: flex;
  1851. flex-direction: column;
  1852. }
  1853. .swiper {
  1854. width: 100%;
  1855. flex:1;
  1856. }
  1857. .lisSty {
  1858. margin-bottom: 16rpx;
  1859. display: flex;
  1860. .flex_auto {
  1861. flex: 1;
  1862. }
  1863. }
  1864. .activeTI {
  1865. vertical-align: middle;
  1866. display: inline-block;
  1867. border: 1rpx solid #eee;
  1868. border-radius: 50rpx;
  1869. height: 48rpx;
  1870. line-height: 46rpx;
  1871. text-align: center;
  1872. width: 48rpx;
  1873. margin-right: 15rpx;
  1874. color: #666;
  1875. font-size: 30rpx;
  1876. &.right {
  1877. color: #fff;
  1878. background: #36C75A;
  1879. }
  1880. &.wrong {
  1881. color: #fff;
  1882. background: #FF3B30;
  1883. }
  1884. &.checked {
  1885. color: #fff;
  1886. background: #007AFF;
  1887. }
  1888. }
  1889. .submit_checkbox {
  1890. position:fixed;
  1891. left:0;
  1892. right:0;
  1893. bottom:120rpx;
  1894. margin: 20rpx auto;
  1895. width: 526rpx;
  1896. height: 80rpx;
  1897. background: rgba(0, 122, 255, 1);
  1898. color: #fff;
  1899. text-align: center;
  1900. line-height: 80rpx;
  1901. font-size: 30rpx;
  1902. border-radius: 40rpx;
  1903. &.disabled {
  1904. opacity: 0.6;
  1905. }
  1906. }
  1907. .titles {
  1908. overflow: hidden;
  1909. margin-bottom: 24rpx;
  1910. }
  1911. .titBox {
  1912. padding: 41rpx 25rpx 24rpx 25rpx;
  1913. }
  1914. .titBox_title {
  1915. padding: 21rpx;
  1916. }
  1917. .tabs {
  1918. margin: 10rpx;
  1919. display: flex;
  1920. .tab {
  1921. margin: 0 4rpx;
  1922. padding:10rpx 13rpx;
  1923. text-align: center;
  1924. color: #007aff;
  1925. font-size: 28rpx;
  1926. border-radius: 16rpx;
  1927. background:#fff;
  1928. &.current {
  1929. color: #fff;
  1930. background: #007aff;
  1931. }
  1932. }
  1933. }
  1934. .ans {
  1935. margin: 8rpx 8rpx 8rpx;
  1936. .ans_input {
  1937. border-radius: 16rpx;
  1938. background: #fff;
  1939. .top {
  1940. border-bottom: 1rpx solid #eeeeee;
  1941. padding: 16rpx;
  1942. display: flex;
  1943. align-items: center;
  1944. .icon {
  1945. margin-right: 20rpx;
  1946. width: 40rpx;
  1947. height: 38rpx;
  1948. }
  1949. .progress {
  1950. flex: 1;
  1951. }
  1952. .submit {
  1953. width: 168rpx;
  1954. height: 48rpx;
  1955. line-height: 48rpx;
  1956. text-align: center;
  1957. color: #fff;
  1958. font-size: 30rpx;
  1959. background: #007aff;
  1960. border-radius: 24rpx;
  1961. &.disabled {
  1962. opacity: 0.6;
  1963. }
  1964. }
  1965. }
  1966. .textarea {
  1967. textarea {
  1968. width: 100%;
  1969. height: 287rpx;
  1970. padding: 10rpx;
  1971. }
  1972. }
  1973. .imgs {
  1974. overflow: hidden;
  1975. display: flex;
  1976. width: 100%;
  1977. .img {
  1978. width: 104rpx;
  1979. height: 104rpx;
  1980. border-radius: 8rpx;
  1981. position: relative;
  1982. margin: 20rpx;
  1983. text {
  1984. position: absolute;
  1985. right: -15rpx;
  1986. top: -15rpx;
  1987. width: 30rpx;
  1988. height: 30rpx;
  1989. text-align: center;
  1990. line-height: 30rpx;
  1991. color: #fff;
  1992. background: #FF3B30;
  1993. border-radius: 50%;
  1994. }
  1995. image {
  1996. width: 100%;
  1997. height: 100%;
  1998. }
  1999. }
  2000. }
  2001. }
  2002. .ans_submit {
  2003. padding: 16rpx;
  2004. border-radius: 16rpx;
  2005. background: #fff;
  2006. .imgs {
  2007. overflow: hidden;
  2008. display: flex;
  2009. width: 100%;
  2010. .img {
  2011. width: 104rpx;
  2012. height: 104rpx;
  2013. border-radius: 8rpx;
  2014. position: relative;
  2015. margin: 20rpx;
  2016. image {
  2017. width: 100%;
  2018. height: 100%;
  2019. }
  2020. }
  2021. }
  2022. }
  2023. }
  2024. .leftLetters {
  2025. display: flex;
  2026. align-items: center;
  2027. width: 220rpx;
  2028. .btnType {
  2029. padding: 5rpx 10rpx;
  2030. border: 1rpx solid #007aff;
  2031. border-radius: 10rpx;
  2032. background-color: rgba(0, 122, 255, 0.1);
  2033. font-size: 28rpx;
  2034. color: #007aff;
  2035. margin-right: 15rpx;
  2036. }
  2037. }
  2038. .firstLetter {
  2039. display: flex;
  2040. justify-content: space-between;
  2041. align-items: center;
  2042. margin-bottom: 30rpx;
  2043. }
  2044. .popupView {
  2045. height: 100%;
  2046. padding-bottom: 100rpx;
  2047. .popupTops {
  2048. height: 77rpx;
  2049. border-bottom: 1rpx solid #eee;
  2050. text-align: center;
  2051. line-height: 77rpx;
  2052. font-size: 24rpx;
  2053. color: #999;
  2054. position: relative;
  2055. .topIcon {
  2056. position: absolute;
  2057. top: 10rpx;
  2058. left: 50%;
  2059. transform: translateX(-50%);
  2060. width: 80rpx;
  2061. height: 8rpx;
  2062. background-color: #999;
  2063. border-radius: 4rpx;
  2064. }
  2065. }
  2066. .popupContent {
  2067. }
  2068. }
  2069. .pageContent {
  2070. position: relative;
  2071. background-color: #eaeef1;
  2072. height: 100%;
  2073. padding-top: 8rpx;
  2074. padding-bottom: 100rpx;
  2075. overflow-y: scroll;
  2076. }
  2077. .pad_8 {
  2078. background-color: #fff;
  2079. margin: 0rpx 8rpx 8rpx;
  2080. border-radius: 16rpx;
  2081. &.no-margin {
  2082. margin-top:-16rpx;
  2083. border-radius: 0 0 16rpx 16rpx;
  2084. }
  2085. }
  2086. .answer {
  2087. height: 80rpx;
  2088. line-height: 80rpx;
  2089. padding: 0rpx 24rpx;
  2090. display: flex;
  2091. align-items: center;
  2092. justify-content: space-between;
  2093. color: #666;
  2094. font-size: 30rpx;
  2095. }
  2096. .footer_btn {
  2097. background-color: #fff;
  2098. z-index: 10078;
  2099. position: fixed;
  2100. bottom: 0rpx;
  2101. display: flex;
  2102. align-items: center;
  2103. justify-content: space-between;
  2104. width: 100%;
  2105. height: 98rpx;
  2106. padding: 0rpx 38rpx;
  2107. border-top: 1rpx solid #eee;
  2108. .flex_center {
  2109. flex:1;
  2110. display: flex;
  2111. justify-content: center;
  2112. align-items: center;
  2113. flex-direction: column;
  2114. margin:0 200rpx;
  2115. font-size: 24rpx;
  2116. color: #999999;
  2117. .up-icon {
  2118. margin-bottom:18rpx;
  2119. width:100%;
  2120. display: flex;
  2121. justify-content: center;
  2122. image {
  2123. width:58rpx;
  2124. height:21rpx;
  2125. }
  2126. }
  2127. }
  2128. .collect {
  2129. visibility: hidden;
  2130. width:100rpx;
  2131. &.show {
  2132. visibility: visible;
  2133. }
  2134. >view {
  2135. display: flex;
  2136. flex-direction: column;
  2137. align-items: center;
  2138. justify-content: center;
  2139. image {
  2140. width:32rpx;
  2141. height:32rpx;
  2142. margin-bottom:6rpx;
  2143. }
  2144. view {
  2145. font-size: 24rpx;
  2146. color: #999999;
  2147. }
  2148. }
  2149. }
  2150. }
  2151. .boxSty {
  2152. padding: 44rpx 41rpx 0rpx;
  2153. }
  2154. .liListSty {
  2155. border: 1rpx solid #eeeeee;
  2156. width: 88rpx;
  2157. height: 88rpx;
  2158. border-radius: 32rpx;
  2159. text-align: center;
  2160. line-height: 88rpx;
  2161. color: #333;
  2162. font-size: 32rpx;
  2163. float: left;
  2164. margin: 20rpx 23rpx;
  2165. &.isRight {
  2166. border: 1rpx solid #eeeeee;
  2167. color: #fff;
  2168. background: #36C75A;
  2169. }
  2170. &.isWrong {
  2171. border: 1rpx solid #eeeeee;
  2172. color: #fff;
  2173. background: #FF3B30;
  2174. }
  2175. }
  2176. .answerInfos {
  2177. padding: 25rpx 25rpx 25rpx 23rpx;
  2178. }
  2179. .answerTitle {
  2180. margin-bottom: 28rpx;
  2181. color: #666;
  2182. font-size: 30rpx;
  2183. }
  2184. .answerContent {
  2185. font-size: 30rpx;
  2186. color: #666;
  2187. }
  2188. .textChild {
  2189. display: inline-block;
  2190. vertical-align: middle;
  2191. }
  2192. .dialog {
  2193. position: fixed;
  2194. left: 0;
  2195. top: 0;
  2196. width: 100%;
  2197. height: 100%;
  2198. background-color: rgba(0, 0, 0, 0.8);
  2199. display: flex;
  2200. flex-direction: column;
  2201. align-items: center;
  2202. justify-content: center;
  2203. z-index: 20000;
  2204. .text {
  2205. font-size: 32rpx;
  2206. color: #ffffff;
  2207. text-align: center;
  2208. }
  2209. .btn {
  2210. width: 242rpx;
  2211. height: 82rpx;
  2212. border: 2rpx solid #ffffff;
  2213. border-radius: 16rpx;
  2214. text-align: center;
  2215. line-height: 82rpx;
  2216. margin: 41rpx auto;
  2217. color: #fff;
  2218. font-size: 32rpx;
  2219. }
  2220. }
  2221. .dialog_wrap {
  2222. position: fixed;
  2223. left: 0;
  2224. top: 0;
  2225. width: 100%;
  2226. height: 100%;
  2227. z-index: 9999999999;
  2228. .bg {
  2229. background: rgba(0, 0, 0, 0.3);
  2230. position: absolute;
  2231. left: 0;
  2232. top: 0;
  2233. width: 100%;
  2234. height: 100%;
  2235. }
  2236. .dialog {
  2237. position: absolute;
  2238. left: 50%;
  2239. top: 50%;
  2240. transform: translate3D(-50%, -50%, 0);
  2241. width: 640rpx;
  2242. height: 439rpx;
  2243. background: #ffffff;
  2244. border-radius: 24rpx;
  2245. .title {
  2246. font-size: 30rpx;
  2247. font-weight: bold;
  2248. color: #333333;
  2249. line-height: 48rpx;
  2250. text-align: center;
  2251. margin-top: 40rpx;
  2252. }
  2253. .content {
  2254. margin: 35rpx 35rpx 0;
  2255. font-size: 30rpx;
  2256. color: #666666;
  2257. line-height: 48rpx;
  2258. }
  2259. .btns {
  2260. margin-top: 35rpx;
  2261. display: flex;
  2262. align-items: center;
  2263. justify-content: center;
  2264. .btn {
  2265. width: 200rpx;
  2266. height: 80rpx;
  2267. line-height: 80rpx;
  2268. text-align: center;
  2269. background: #f5f5f5;
  2270. border-radius: 40rpx;
  2271. font-size: 30rpx;
  2272. color: rgba(0, 122, 255, 1);
  2273. background: #f5f5f5;
  2274. margin: 0 20rpx;
  2275. &.active {
  2276. color: #f5f5f5;
  2277. background: rgba(0, 122, 255, 1);
  2278. }
  2279. }
  2280. }
  2281. }
  2282. }
  2283. .popboxs {
  2284. width: 100%;
  2285. height: 100%;
  2286. display: flex;
  2287. flex-direction: column;
  2288. align-items: center;
  2289. }
  2290. .classTops {
  2291. flex-shrink: 0;
  2292. padding: 39rpx 0rpx 4rpx;
  2293. font-weight: bold;
  2294. color: #333;
  2295. font-size: 30rpx;
  2296. }
  2297. .textStys {
  2298. width: 100%;
  2299. flex: 1;
  2300. padding: 36rpx;
  2301. }
  2302. .classFootsty {
  2303. flex-shrink: 0;
  2304. display: flex;
  2305. align-items: center;
  2306. justify-content: center;
  2307. padding: 10rpx 0rpx 40rpx;
  2308. .btnsty {
  2309. width: 200rpx;
  2310. height: 80rpx;
  2311. border-radius: 40rpx;
  2312. font-weight: bold;
  2313. font-size: 30rpx;
  2314. text-align: center;
  2315. line-height: 80rpx;
  2316. }
  2317. .btns1 {
  2318. background-color: #f5f5f5;
  2319. color: #007aff;
  2320. }
  2321. .btns2 {
  2322. margin-left: 40rpx;
  2323. background-color: #007aff;
  2324. color: #ffffff;
  2325. }
  2326. }
  2327. </style>