question.vue 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027
  1. <template>
  2. <view class="bigBox">
  3. <u-navbar v-if="setTimeDjs" back-text="返回" :title="timeDJS"></u-navbar>
  4. <u-navbar v-else back-text="返回" title="题目集"></u-navbar>
  5. <view v-if="nowPageData.type === 4" class="contentList">
  6. <view class="headerTitle">
  7. <view class="leftIcon" v-for="(item, index) in titleS" :key="index" v-if="item.value === nowPageData.type">
  8. <span>{{ item.label }}</span>
  9. </view>
  10. <view class="right">
  11. {{ numIndex + 1 }}
  12. <span class="lengNum">/{{ list.length }}</span>
  13. </view>
  14. </view>
  15. <view class="content">
  16. <view class="contentTitle">{{ nowPageData.content }}</view>
  17. <view class="imageBox" v-if="nowPageData.imgUrl && nowPageData.imgUrl !== null">
  18. <image :src="$method.splitImgHost(nowPageData.imgUrl)" mode="aspectFit" @click="seeBigImage(nowPageData.imgUrl)"></image>
  19. </view>
  20. </view>
  21. <!---案例内容start -->
  22. <view class="contentList" v-for="(itemst, indexst) in nowPageData.jsonStr" :key="indexst">
  23. <view class="headerTitle">
  24. <view class="leftIcon" v-for="(item, index) in titleS" :key="index" v-if="item.value === itemst.type">
  25. <span>{{ item.label }}</span>
  26. </view>
  27. </view>
  28. <view class="content">
  29. <view class="contentTitle">{{ itemst.content }}</view>
  30. <view class="imageBox" v-if="itemst.imgUrl && itemst.imgUrl !== null">
  31. <image :src="$method.splitImgHost(itemst.imgUrl)" mode="aspectFit" @click="seeBigImage(itemst.imgUrl)"></image>
  32. </view>
  33. </view>
  34. <view
  35. class="banksChiList"
  36. v-for="(items, indexs) in itemst.answer"
  37. :key="indexs"
  38. @click="activeListSitem(items, indexs, indexst)"
  39. :class="replyL[indexst].selectId.indexOf(indexs) !== -1 ? 'activeListBt' : ''"
  40. >
  41. <view class="leftIndex">{{ alphabet[indexs] }}.</view>
  42. <view class="bankTie">
  43. <view>{{ items.content }}</view>
  44. <image v-if="items.imgUrl && items.imgUrl !== null" :src="$method.splitImgHost(items.imgUrl)" mode="aspectFit" @click="seeBigImage(items.imgUrl)"></image>
  45. </view>
  46. </view>
  47. <view v-if="itemst.type === 3" class="banksChiList" :class="isWrong === 1 ? 'activeListBt' : ''" @click="activePDs(1, indexst)">正确</view>
  48. <view v-if="itemst.type === 3" class="banksChiList" :class="isWrong === 0 ? 'activeListBt' : ''" @click="activePDs(0, indexst)">错误</view>
  49. <view class="jxTit" style="margin-bottom: 10rpx;" @click="showTitles(indexst)">
  50. <span class="jxSpan">查看解析</span>
  51. <u-icon name="info-circle" color="#999999" size="40"></u-icon>
  52. </view>
  53. <view v-if="showJXanli.indexOf(indexst) !== -1 ? true : false" class="jxslis">{{ itemst.analysisContent }}</view>
  54. </view>
  55. <!-- -案例内容end -->
  56. <view class="jxTit" @click="showTitle(nowPageData.questionId)">
  57. <span class="jxSpan">查看解析</span>
  58. <u-icon name="info-circle" color="#999999" size="40"></u-icon>
  59. </view>
  60. <view v-if="showJX.indexOf(nowPageData.questionId) !== -1 ? true : false" class="jxslis">{{ nowPageData.analysisContent }}</view>
  61. <u-button style="margin-top: 30rpx;" type="primary" @click="submitChi">提交</u-button>
  62. </view>
  63. <view v-else class="contentList">
  64. <view class="headerTitle">
  65. <view class="leftIcon" v-for="(item, index) in titleS" :key="index" v-if="item.value === nowPageData.type">
  66. <span>{{ item.label }}</span>
  67. </view>
  68. <view class="right">
  69. {{ numIndex + 1 }}
  70. <span class="lengNum">/{{ list.length }}</span>
  71. </view>
  72. </view>
  73. <view class="content">
  74. <view class="contentTitle">{{ nowPageData.content }}</view>
  75. <view class="imageBox" v-if="nowPageData.imgUrl && nowPageData.imgUrl !== null">
  76. <image :src="$method.splitImgHost(nowPageData.imgUrl)" mode="aspectFit" @click="seeBigImage(nowPageData.imgUrl)"></image>
  77. </view>
  78. </view>
  79. <view
  80. class="banksChiList"
  81. v-for="(items, indexs) in nowPageData.jsonStr"
  82. :key="indexs"
  83. :class="replyL.indexOf(indexs) !== -1 ? 'activeListBt' : ''"
  84. @click="activeList(items, indexs)"
  85. >
  86. <view class="leftIndex">{{ alphabet[indexs] }}.</view>
  87. <view class="bankTie">
  88. <view>{{ items.content }}</view>
  89. <image v-if="items.imgUrl && items.imgUrl !== null" :src="$method.splitImgHost(items.imgUrl)" mode="aspectFit" @click="seeBigImage(items.imgUrl)"></image>
  90. </view>
  91. </view>
  92. <view v-if="nowPageData.type === 3" class="banksChiList" :class="isWrong === 1 ? 'activeListBt' : ''" @click="activePD(1)">正确</view>
  93. <view v-if="nowPageData.type === 3" class="banksChiList" :class="isWrong === 0 ? 'activeListBt' : ''" @click="activePD(0)">错误</view>
  94. <view class="jxTit" @click="showTitle(nowPageData.questionId)">
  95. <span class="jxSpan">查看解析</span>
  96. <u-icon name="info-circle" color="#999999" size="40"></u-icon>
  97. </view>
  98. <view v-if="showJX.indexOf(nowPageData.questionId) !== -1 ? true : false" class="jxslis">{{ nowPageData.analysisContent }}</view>
  99. <u-button style="margin-top: 30rpx;" type="primary" @click="submitChi">下一题</u-button>
  100. </view>
  101. <view class="footer_tab">
  102. <u-line color="#D6D6DB" />
  103. <u-row gutter="16">
  104. <u-col span="4">
  105. <view class="box">
  106. <view style="text-align: center;margin-left: 30rpx;position: absolute;left: 20rpx;" @click="favorites">
  107. <image :src="collecStatus ? '/static/star.png' : '/static/sc.png'" class="sc"></image>
  108. <view class="sc_t">收藏</view>
  109. </view>
  110. </view>
  111. </u-col>
  112. <u-col span="4">
  113. <view class="box">
  114. <view style="text-align: center;" @click="menu">
  115. <image src="/static/up.png" style="width: 58rpx;height: 22rpx;"></image>
  116. <view class="sc_t">答题卡</view>
  117. </view>
  118. </view>
  119. </u-col>
  120. <u-col span="4">
  121. <view class="box">
  122. <view style="text-align: center;margin-right: 30rpx;position: absolute;right: 20rpx;" @click="carryOut">
  123. <image src="/static/jj.png" class="sc"></image>
  124. <view class="sc_t">交卷</view>
  125. </view>
  126. </view>
  127. </u-col>
  128. </u-row>
  129. </view>
  130. <u-popup v-model="show" mode="bottom" :safe-area-inset-bottom="true">
  131. <view class="popup_box">
  132. <scroll-view scroll-y="true" class="popup_list">
  133. <view
  134. v-for="(item, index) in list"
  135. :key="index"
  136. class="btn_num"
  137. :class="index === numIndex ? 'btn_bac2' : isWrites.indexOf(item.questionId) !== -1 ? 'btn_bac3' : 'btn_bac1'"
  138. @click="changeTM(index, 2)"
  139. >
  140. <text class="">{{ index + 1 }}</text>
  141. </view>
  142. </scroll-view>
  143. </view>
  144. </u-popup>
  145. </view>
  146. </template>
  147. <script>
  148. export default {
  149. data() {
  150. return {
  151. bankSectionId: null,
  152. examId: null,
  153. typeId: null,
  154. numIndex: 0,
  155. show: false,
  156. list: [],
  157. nowPageData: {
  158. jsonStr: []
  159. },
  160. titleS: [
  161. {
  162. label: '单选',
  163. value: 1
  164. },
  165. {
  166. label: '多选',
  167. value: 2
  168. },
  169. {
  170. label: '判断',
  171. value: 3
  172. },
  173. {
  174. label: '案例',
  175. value: 4
  176. }
  177. ],
  178. alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
  179. replyL: [],
  180. isWrong: -1,
  181. answerList: [], //总提交列表
  182. bankId: 0, //题库ID
  183. selects: [], //当前做了哪些题目
  184. showJX: [], // 展开解析列表
  185. showJXanli: [], // 展开案例解析列表
  186. collecStatus: false,
  187. isWrites: [], //已做的题目id
  188. sc: false, //收藏集进来的?
  189. ct: false, //错题进来的?
  190. simulateId: 0,
  191. setTimeDjs: false, //是否倒计时
  192. timeDJS: '00:00:00'
  193. };
  194. },
  195. onLoad(option) {
  196. this.bankId = option.bankId;
  197. this.typeId = option.typeId;
  198. this.sc = option.sc;
  199. this.ct = option.ct;
  200. if (option.bankSectionId) {
  201. this.bankSectionId = option.bankSectionId;
  202. }
  203. if (option.examId) {
  204. this.examId = option.examId;
  205. }
  206. this.titleListFn(option);
  207. },
  208. methods: {
  209. formatSeconds(value) {
  210. let result = parseInt(value);
  211. let h = Math.floor(result / 3600) < 10 ? '0' + Math.floor(result / 3600) : Math.floor(result / 3600);
  212. let m = Math.floor((result / 60) % 60) < 10 ? '0' + Math.floor((result / 60) % 60) : Math.floor((result / 60) % 60);
  213. let s = Math.floor(result % 60) < 10 ? '0' + Math.floor(result % 60) : Math.floor(result % 60);
  214. let res = '';
  215. if (h !== '00') res += `${h}:`;
  216. if (m !== '00') res += `${m}:`;
  217. res += `${s}`;
  218. return res;
  219. },
  220. //倒计时
  221. djsItem(v) {
  222. var self = this;
  223. var dates = v;
  224. const setDates = setInterval(() => {
  225. if (dates < 1) {
  226. self.timeDJS = '考试结束'
  227. clearInterval(setDates);
  228. uni.showLoading({
  229. title: '正在交卷'
  230. });
  231. setTimeout(function() {
  232. uni.hideLoading();
  233. self.carryOutDjsDate();
  234. }, 1000);
  235. return
  236. }
  237. dates--;
  238. self.timeDJS = self.formatSeconds(dates);
  239. }, 1000);
  240. this.setTimeDjs = true;
  241. },
  242. //预览图片
  243. seeBigImage(url) {
  244. var urlarr = [];
  245. urlarr.push(this.$method.splitImgHost(url));
  246. uni.previewImage({
  247. urls: urlarr
  248. });
  249. },
  250. favoritesStatus() {
  251. this.$api.questionsystems(this.nowPageData.questionId).then(result => {
  252. if (result.data.data === undefined) {
  253. this.collecStatus = false;
  254. } else {
  255. this.collecStatus = true;
  256. }
  257. });
  258. },
  259. //收藏
  260. favorites() {
  261. console.log(this.collecStatus);
  262. var self = this;
  263. if (!uni.getStorageSync('union_id') && this.$store.state.token === '') {
  264. uni.navigateTo({
  265. url: '/pages/login/login'
  266. });
  267. } else {
  268. if (this.collecStatus) {
  269. this.$api.questionsystems(self.nowPageData.questionId).then(results => {
  270. self.$api.questionsystemdelete(results.data.data.collectQuestionId).then(resz => {
  271. self.favoritesStatus();
  272. });
  273. });
  274. } else {
  275. var data = {
  276. bankId: self.bankId,
  277. questionId: self.nowPageData.questionId
  278. };
  279. this.$api.questionsystemadd(data).then(res => {
  280. self.favoritesStatus();
  281. });
  282. }
  283. }
  284. },
  285. // 查看解析start
  286. showTitle(ids) {
  287. var self = this;
  288. if (this.showJX.indexOf(ids) !== -1) {
  289. var ats = self.showJX.indexOf(ids);
  290. self.showJX.splice(ats, 1);
  291. } else {
  292. self.showJX.push(ids);
  293. }
  294. },
  295. //案例解析
  296. showTitles(int) {
  297. var self = this;
  298. if (this.showJXanli.indexOf(int) !== -1) {
  299. var ats = self.showJXanli.indexOf(int);
  300. self.showJXanli.splice(ats, 1);
  301. } else {
  302. self.showJXanli.push(int);
  303. }
  304. },
  305. changeTM(index, int) {
  306. var self = this;
  307. if (int === 1) {
  308. this.numIndex = index + 1;
  309. } else {
  310. this.numIndex = index;
  311. }
  312. this.initDatas();
  313. this.initLint();
  314. this.getCooieds();
  315. this.favoritesStatus(self.nowPageData.questionId);
  316. this.getBGCchange();
  317. this.show = false;
  318. },
  319. //已做题目颜色变化
  320. getBGCchange() {
  321. var self = this;
  322. this.answerList.forEach((item, index) => {
  323. if (this.isWrites.indexOf(item.questionId) === -1) {
  324. self.isWrites.push(item.questionId);
  325. }
  326. });
  327. },
  328. //数据清空
  329. initDatas() {
  330. this.isWrong = -1;
  331. this.showJX = [];
  332. this.showJXanli = [];
  333. this.selects = [];
  334. },
  335. getCooieds() {
  336. var self = this;
  337. if (this.answerList.length) {
  338. self.answerList.forEach((item, index) => {
  339. if (item.questionId === self.nowPageData.questionId) {
  340. if (self.nowPageData.type === 4) {
  341. self.replyL = item.replyStr;
  342. } else if (self.nowPageData.type === 3) {
  343. self.isWrong = item.isRight;
  344. } else {
  345. self.replyL = item.selectIds;
  346. }
  347. }
  348. });
  349. }
  350. },
  351. initLint() {
  352. var self = this;
  353. self.replyL = [];
  354. if (self.list[self.numIndex].type === 4) {
  355. for (var i = 0; i < self.list[self.numIndex].jsonStr.length; i++) {
  356. self.replyL.push({ selectId: [] });
  357. }
  358. }
  359. self.nowPageData = self.list[self.numIndex];
  360. },
  361. submitChi() {
  362. var self = this;
  363. if (self.nowPageData.type === 1 || self.nowPageData.type === 2 || self.nowPageData.type === 3) {
  364. var yesList = []; //记录正确项索引
  365. self.nowPageData.jsonStr.forEach((item, index) => {
  366. if (item.optionAnswer === 1) {
  367. yesList.push(index);
  368. }
  369. });
  370. var strYesList = yesList.sort().toString();
  371. var isRight = strYesList == self.replyL.sort().toString() ? 1 : 0; //记录是否选择正确
  372. if (self.nowPageData.type === 3) {
  373. if (self.isWrong === self.nowPageData.answerQuestion) {
  374. isRight = 1;
  375. } else {
  376. isRight = 0;
  377. }
  378. }
  379. var objslit = []; //记录选中的选项对象
  380. for (let i = 0; i < self.replyL.length; i++) {
  381. objslit.push(self.nowPageData.jsonStr[self.replyL[i]]);
  382. }
  383. var objList = {
  384. bankId: self.bankId,
  385. questionId: self.nowPageData.questionId,
  386. selectIds: self.replyL,
  387. replyStr: objslit,
  388. isRight: isRight
  389. };
  390. self.answerList[self.numIndex] = objList;
  391. }
  392. if (self.nowPageData.type === 4) {
  393. for (var i = 0; i < self.replyL.length; i++) {
  394. if (self.replyL[i].selectId.length) {
  395. self.replyL[i].selectId = self.replyL[i].selectId;
  396. }
  397. }
  398. var objList = {
  399. bankId: self.bankId,
  400. isRight: -1,
  401. questionId: self.nowPageData.questionId,
  402. replyStr: self.replyL,
  403. selectIds: self.selects
  404. };
  405. self.answerList[self.numIndex] = objList;
  406. }
  407. if (self.numIndex === self.list.length - 1) {
  408. self.changeTM(self.numIndex, 2);
  409. self.carryOut();
  410. return;
  411. }
  412. self.changeTM(self.numIndex, 1);
  413. },
  414. titleListFn(option) {
  415. console.log(option);
  416. var self = this;
  417. if (option.sc === 'true') {
  418. var data = {
  419. bankId: self.bankId
  420. };
  421. self.$api.systemquestionList(data).then(res => {
  422. if (res.data.rows.length) {
  423. res.data.rows.forEach((items, indexs) => {
  424. items.jsonStr = JSON.parse(items.jsonStr);
  425. });
  426. if (res.data.rows[self.numIndex].type === 4) {
  427. self.replyL = [];
  428. for (var i = 0; i < res.data.rows[self.numIndex].jsonStr.length; i++) {
  429. self.replyL.push({ selectId: [] });
  430. }
  431. }
  432. self.nowPageData = res.data.rows[self.numIndex];
  433. self.favoritesStatus(res.data.rows[self.numIndex].questionId);
  434. self.list = res.data.rows;
  435. } else {
  436. uni.showModal({
  437. title: '提示',
  438. content: '没有题目',
  439. showCancel: false,
  440. confirmText: '返回上级',
  441. success: function(res) {
  442. if (res.confirm) {
  443. uni.navigateBack({
  444. delta: 1
  445. });
  446. }
  447. }
  448. });
  449. }
  450. });
  451. return;
  452. }
  453. if (option.ct === 'true') {
  454. var data = {
  455. bankId: self.bankId
  456. };
  457. self.$api.questionListrecord(data).then(res => {
  458. if (res.data.rows.length) {
  459. res.data.rows.forEach((items, indexs) => {
  460. items.jsonStr = JSON.parse(items.jsonStr);
  461. });
  462. if (res.data.rows[self.numIndex].type === 4) {
  463. self.replyL = [];
  464. for (var i = 0; i < res.data.rows[self.numIndex].jsonStr.length; i++) {
  465. self.replyL.push({ selectId: [] });
  466. }
  467. }
  468. self.nowPageData = res.data.rows[self.numIndex];
  469. self.favoritesStatus(res.data.rows[self.numIndex].questionId);
  470. self.list = res.data.rows;
  471. } else {
  472. uni.showModal({
  473. title: '提示',
  474. content: '没有题目',
  475. showCancel: false,
  476. confirmText: '返回上级',
  477. success: function(res) {
  478. if (res.confirm) {
  479. uni.navigateBack({
  480. delta: 1
  481. });
  482. }
  483. }
  484. });
  485. }
  486. });
  487. return;
  488. }
  489. if (this.typeId === '1') {
  490. self.$api.questionsimulate(self.bankId).then(res => {
  491. if(res.data.code!=200){
  492. uni.showModal({
  493. title: '提示',
  494. content: '没有题目',
  495. showCancel: false,
  496. confirmText: '返回上级',
  497. success: function(res) {
  498. if (res.confirm) {
  499. uni.navigateBack({
  500. delta: 1
  501. });
  502. }
  503. }
  504. });
  505. }
  506. self.simulateId = res.data.data.simulateId;
  507. if (res.data.data.list.length) {
  508. res.data.data.list.forEach((items, indexs) => {
  509. items.jsonStr = JSON.parse(items.jsonStr);
  510. });
  511. if (res.data.data.list[self.numIndex].type === 4) {
  512. self.replyL = [];
  513. for (var i = 0; i < res.data.data.list[self.numIndex].jsonStr.length; i++) {
  514. self.replyL.push({ selectId: [] });
  515. }
  516. }
  517. self.nowPageData = res.data.data.list[self.numIndex];
  518. self.favoritesStatus(res.data.data.list[self.numIndex].questionId);
  519. self.list = res.data.data.list;
  520. self.djsItem(res.data.data.examTime);
  521. } else {
  522. uni.showModal({
  523. title: '提示',
  524. content: '没有题目',
  525. showCancel: false,
  526. confirmText: '返回上级',
  527. success: function(res) {
  528. if (res.confirm) {
  529. uni.navigateBack({
  530. delta: 1
  531. });
  532. }
  533. }
  534. });
  535. }
  536. });
  537. } else {
  538. if (option.bankSectionId) {
  539. var data = {
  540. bankSectionId: option.bankSectionId
  541. };
  542. }
  543. if (option.examId) {
  544. var data = {
  545. examId: option.examId
  546. };
  547. }
  548. if (option.bankSectionId === undefined && (option.examId === undefined || option.examId.length === 0)) {
  549. uni.showModal({
  550. title: '提示',
  551. content: '没有题目',
  552. showCancel: false,
  553. confirmText: '返回上级',
  554. success: function(res) {
  555. if (res.confirm) {
  556. uni.navigateBack({
  557. delta: 1
  558. });
  559. }
  560. }
  561. });
  562. return;
  563. }
  564. self.$api.questiondetailList(data).then(res => {
  565. if (res.data.rows.length) {
  566. res.data.rows.forEach((items, indexs) => {
  567. items.jsonStr = JSON.parse(items.jsonStr);
  568. });
  569. if (res.data.rows[self.numIndex].type === 4) {
  570. self.replyL = [];
  571. for (var i = 0; i < res.data.rows[self.numIndex].jsonStr.length; i++) {
  572. self.replyL.push({ selectId: [] });
  573. }
  574. }
  575. self.nowPageData = res.data.rows[self.numIndex];
  576. self.favoritesStatus(res.data.rows[self.numIndex].questionId);
  577. self.list = res.data.rows;
  578. } else {
  579. uni.showModal({
  580. title: '提示',
  581. content: '没有题目',
  582. showCancel: false,
  583. confirmText: '返回上级',
  584. success: function(res) {
  585. if (res.confirm) {
  586. uni.navigateBack({
  587. delta: 1
  588. });
  589. }
  590. }
  591. });
  592. }
  593. });
  594. }
  595. },
  596. activeList(data, int) {
  597. var self = this;
  598. if (self.nowPageData.type === 1) {
  599. self.replyL = [int];
  600. } else if (self.nowPageData.type === 2) {
  601. if (self.replyL.indexOf(int) !== -1) {
  602. for (var i = 0; i <= self.replyL.length; i++) {
  603. if (self.replyL[i] === int) {
  604. self.replyL.splice(i, 1);
  605. }
  606. }
  607. } else {
  608. self.replyL.push(int);
  609. }
  610. }
  611. },
  612. activePD(int) {
  613. this.isWrong = int;
  614. },
  615. activePDs(int, fatInt) {
  616. this.isWrong = int;
  617. if (this.replyL[fatInt] === undefined) {
  618. this.replyL[fatInt] = {};
  619. }
  620. if (int === this.nowPageData.jsonStr[fatInt].answerQuestion) {
  621. this.replyL[fatInt].isRight = 1;
  622. } else {
  623. this.replyL[fatInt].isRight = 0;
  624. }
  625. if (this.selects.indexOf(fatInt) === -1) {
  626. this.selects.push(fatInt);
  627. }
  628. },
  629. activeListSitem(data, int, fatInt) {
  630. var self = this;
  631. if (self.replyL[fatInt] === undefined) {
  632. self.replyL[fatInt] = {};
  633. }
  634. if (self.nowPageData.jsonStr[fatInt].type === 1) {
  635. self.replyL[fatInt].selectId = [int];
  636. var objNums = [];
  637. self.nowPageData.jsonStr[fatInt].answer.forEach((itemta, indexta) => {
  638. if (itemta.optionAnswer === 1) {
  639. objNums.push(indexta);
  640. }
  641. });
  642. var strYesList = objNums.sort().toString();
  643. var isRight = strYesList == self.replyL[fatInt].selectId.sort().toString();
  644. if (isRight) {
  645. self.replyL[fatInt].isRight = 1;
  646. } else {
  647. self.replyL[fatInt].isRight = 0;
  648. }
  649. self.replyL[fatInt].repley = [data];
  650. if (self.replyL[fatInt].repley.length) {
  651. if (self.selects.indexOf(fatInt) === -1) {
  652. self.selects.push(fatInt);
  653. }
  654. }
  655. } else if (self.nowPageData.jsonStr[fatInt].type === 2) {
  656. if (self.replyL[fatInt].selectId === undefined) {
  657. self.replyL[fatInt].selectId = [];
  658. }
  659. if (self.replyL[fatInt].selectId.indexOf(int) !== -1) {
  660. for (var i = 0; i < self.replyL[fatInt].selectId.length; i++) {
  661. if (self.replyL[fatInt].selectId[i] === int) {
  662. self.replyL[fatInt].selectId.splice(i, 1);
  663. }
  664. }
  665. } else {
  666. self.replyL[fatInt].selectId.push(int);
  667. }
  668. var objNums = [];
  669. self.nowPageData.jsonStr[fatInt].answer.forEach((itemta, indexta) => {
  670. if (itemta.optionAnswer === 1) {
  671. objNums.push(indexta);
  672. }
  673. });
  674. var strYesList = objNums.sort().toString();
  675. var isRight = strYesList == self.replyL[fatInt].selectId.sort().toString();
  676. if (isRight) {
  677. self.replyL[fatInt].isRight = 1;
  678. } else {
  679. self.replyL[fatInt].isRight = 0;
  680. }
  681. var objst = [];
  682. for (let i = 0; i < self.replyL[fatInt].selectId.length; i++) {
  683. objst.push(self.nowPageData.jsonStr[fatInt].answer[self.replyL[fatInt].selectId[i]]);
  684. }
  685. self.replyL[fatInt].repley = objst;
  686. if (self.replyL[fatInt].repley.length) {
  687. if (self.selects.indexOf(fatInt) === -1) {
  688. self.selects.push(fatInt);
  689. }
  690. } else {
  691. var numt = self.selects.indexOf(fatInt);
  692. self.selects.splice(numt, 1);
  693. }
  694. }
  695. },
  696. menu() {
  697. this.show = true;
  698. },
  699. //交卷
  700. carryOut() {
  701. var self = this;
  702. if (this.isWrites.length !== this.list.length) {
  703. uni.showModal({
  704. title: '提示',
  705. content: '请完成所有作答再交卷',
  706. showCancel: false,
  707. success: function(res) {}
  708. });
  709. return;
  710. }
  711. uni.showModal({
  712. title: '提示',
  713. content: '是否确定交卷',
  714. success: function(res) {
  715. if (res.confirm) {
  716. var correct = 0;
  717. var errorz = 0;
  718. var errorArrays = [];
  719. var answerListString = JSON.parse(JSON.stringify(self.answerList));
  720. answerListString.forEach((item, index) => {
  721. if (item.isRight !== undefined) {
  722. if (item.isRight === 1) {
  723. correct++;
  724. } else {
  725. errorArrays.push(item.questionId);
  726. errorz++;
  727. }
  728. }
  729. item.selectIds = item.selectIds.toString();
  730. item.replyStr.forEach((items, indexs) => {
  731. if (items.selectId) {
  732. items.selectId = items.selectId.toString();
  733. }
  734. });
  735. item.replyStr = JSON.stringify(item.replyStr);
  736. });
  737. var data = {
  738. bankId: self.bankId,
  739. type: self.typeId,
  740. answerList: answerListString
  741. };
  742. if (self.examId !== null) {
  743. data.examId = self.examId;
  744. }
  745. if (self.simulateId !== null) {
  746. data.simulateId = self.simulateId;
  747. }
  748. if (self.sc === 'true') {
  749. var num = 0;
  750. self.list.forEach((item, index) => {
  751. if (item.type !== 4) {
  752. num++;
  753. }
  754. });
  755. uni.redirectTo({
  756. url: `/pages2/bank/endBG?bankId=${self.bankId}&type=${
  757. self.typeId
  758. }&allIndex=${num}&correct=${correct}&error=${errorz}&errorArrayList=${errorArrays.toString()}&bankSectionId=${self.bankSectionId}&examId=${
  759. self.examId
  760. }`
  761. });
  762. } else {
  763. self.$api.questiondetailrecord(data).then(res => {
  764. if (res.data.code === 200) {
  765. var num = 0;
  766. self.list.forEach((item, index) => {
  767. if (item.type !== 4) {
  768. num++;
  769. }
  770. });
  771. uni.redirectTo({
  772. url: `/pages2/bank/endBG?bankId=${self.bankId}&type=${
  773. self.typeId
  774. }&allIndex=${num}&correct=${correct}&error=${errorz}&errorArrayList=${errorArrays.toString()}&bankSectionId=${self.bankSectionId}&examId=${
  775. self.examId
  776. }`
  777. });
  778. } else {
  779. uni.showToast({
  780. title: '提交失败',
  781. icon: 'none',
  782. duration: 2000
  783. });
  784. }
  785. });
  786. }
  787. } else if (res.cancel) {
  788. }
  789. }
  790. });
  791. },
  792. //考试结束自动交卷
  793. carryOutDjsDate() {
  794. var self = this;
  795. var correct = 0;
  796. var errorz = 0;
  797. var errorArrays = [];
  798. var answerListString = JSON.parse(JSON.stringify(self.answerList));
  799. answerListString.forEach((item, index) => {
  800. if (item.isRight !== undefined) {
  801. if (item.isRight === 1) {
  802. correct++;
  803. } else {
  804. errorArrays.push(item.questionId);
  805. errorz++;
  806. }
  807. }
  808. item.selectIds = item.selectIds.toString();
  809. item.replyStr.forEach((items, indexs) => {
  810. if (items.selectId) {
  811. items.selectId = items.selectId.toString();
  812. }
  813. });
  814. item.replyStr = JSON.stringify(item.replyStr);
  815. });
  816. var data = {
  817. bankId: self.bankId,
  818. type: self.typeId,
  819. answerList: answerListString
  820. };
  821. if (self.examId !== null) {
  822. data.examId = self.examId;
  823. }
  824. if (self.simulateId !== null) {
  825. data.simulateId = self.simulateId;
  826. }
  827. if (self.sc === 'true') {
  828. var num = 0;
  829. self.list.forEach((item, index) => {
  830. if (item.type !== 4) {
  831. num++;
  832. }
  833. });
  834. uni.redirectTo({
  835. url: `/pages2/bank/endBG?bankId=${self.bankId}&type=${
  836. self.typeId
  837. }&allIndex=${num}&correct=${correct}&error=${errorz}&errorArrayList=${errorArrays.toString()}&bankSectionId=${self.bankSectionId}&examId=${self.examId}`
  838. });
  839. } else {
  840. self.$api.questiondetailrecord(data).then(res => {
  841. if (res.data.code === 200) {
  842. var num = 0;
  843. self.list.forEach((item, index) => {
  844. if (item.type !== 4) {
  845. num++;
  846. }
  847. });
  848. uni.redirectTo({
  849. url: `/pages2/bank/endBG?bankId=${self.bankId}&type=${
  850. self.typeId
  851. }&allIndex=${num}&correct=${correct}&error=${errorz}&errorArrayList=${errorArrays.toString()}&bankSectionId=${self.bankSectionId}&examId=${self.examId}`
  852. });
  853. } else {
  854. uni.showToast({
  855. title: '提交失败',
  856. icon: 'none',
  857. duration: 2000
  858. });
  859. }
  860. });
  861. }
  862. }
  863. }
  864. };
  865. </script>
  866. <style>
  867. ::-webkit-scrollbar {
  868. width: 0;
  869. height: 0;
  870. color: transparent;
  871. }
  872. .u-drawer-content-visible {
  873. border-radius: 32rpx 32rpx 0rpx 0rpx;
  874. overflow: hidden;
  875. }
  876. </style>
  877. <style scope>
  878. .bigBox > .contentList {
  879. padding-top: 15rpx;
  880. padding-bottom: 96rpx;
  881. }
  882. .activeListBt {
  883. border: 2rpx solid #32467b !important;
  884. }
  885. .contentList {
  886. padding: 0rpx 32rpx;
  887. }
  888. .contentList > .jxTit {
  889. margin-top: 35rpx;
  890. }
  891. .contentList > .jxTit > .jxSpan {
  892. color: #32467b;
  893. font-size: 34rpx;
  894. margin-right: 8rpx;
  895. }
  896. .contentList > .headerTitle {
  897. display: flex;
  898. align-items: center;
  899. justify-content: space-between;
  900. color: #32467b;
  901. }
  902. .contentList > .content {
  903. margin: 25rpx 0rpx;
  904. }
  905. .contentList > .content > .contentTitle {
  906. color: #333;
  907. font-size: 28rpx;
  908. }
  909. .contentList > .content > .imageBox {
  910. text-align: center;
  911. }
  912. .contentList > .content > .imageBox > image {
  913. max-height: 300rpx;
  914. }
  915. .headerTitle > .leftIcon {
  916. padding: 0rpx 10rpx;
  917. height: 36rpx;
  918. line-height: 36rpx;
  919. border: 1rpx solid #32467b;
  920. font-size: 28rpx;
  921. border-radius: 10rpx;
  922. background-color: rgba(50, 70, 123, 0.1);
  923. }
  924. .headerTitle > .right > .lengNum {
  925. font-size: 28rpx;
  926. color: #999999;
  927. }
  928. .banksChiList {
  929. border: 2rpx solid transparent;
  930. display: flex;
  931. margin-bottom: 8rpx;
  932. border-radius: 16rpx;
  933. font-size: 34rpx;
  934. width: 100%;
  935. background-color: #f7fbff;
  936. padding: 15rpx 18rpx;
  937. box-sizing: border-box;
  938. }
  939. .banksChiList > .leftIndex {
  940. width: 40rpx;
  941. }
  942. .banksChiList > .bankTie {
  943. flex: 1;
  944. }
  945. .banksChiList > .bankTie > image {
  946. max-width: 95%;
  947. }
  948. .btn_bac3 {
  949. background: #4d6dbd;
  950. color: #fff;
  951. }
  952. .btn_bac2 {
  953. background: #32467b;
  954. color: #fff;
  955. }
  956. .btn_bac1 {
  957. background: #f7f8ff;
  958. color: #666666;
  959. }
  960. .btn_num::before {
  961. content: '';
  962. padding-top: 100%;
  963. display: block;
  964. }
  965. .btn_num text {
  966. font-size: 24rpx;
  967. width: 100%;
  968. display: inline-block;
  969. text-align: center;
  970. top: 50%;
  971. position: absolute;
  972. height: 30rpx;
  973. line-height: 30rpx;
  974. margin-top: -15rpx;
  975. }
  976. .btn_num {
  977. border-radius: 32rpx;
  978. width: 16%;
  979. margin: 2%;
  980. display: inline-block;
  981. position: relative;
  982. }
  983. .popup_list {
  984. border-radius: 32rpx 32rpx 0rpx 0rpx;
  985. height: 899rpx;
  986. background: #f2f3f6;
  987. padding-bottom: 30rpx;
  988. }
  989. .popup_box {
  990. height: 899rpx;
  991. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  992. border-radius: 32rpx 32rpx 0rpx 0rpx;
  993. background: #f2f3f6;
  994. padding: 30rpx;
  995. }
  996. .sc_t {
  997. font-size: 22rpx;
  998. color: #000000;
  999. }
  1000. .box {
  1001. height: 95rpx;
  1002. display: flex;
  1003. flex-direction: column;
  1004. justify-content: center;
  1005. position: relative;
  1006. }
  1007. .sc {
  1008. width: 29rpx;
  1009. height: 29rpx;
  1010. }
  1011. .footer_tab {
  1012. position: fixed;
  1013. z-index: 999;
  1014. bottom: 0;
  1015. height: 96rpx;
  1016. width: 100%;
  1017. background-color: #ffffff;
  1018. }
  1019. page {
  1020. background: #ffffff;
  1021. }
  1022. </style>