question.vue 24 KB

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