questionBank.vue 62 KB

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