questionBank - 副本1.vue 64 KB

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