question.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  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 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 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. };
  189. },
  190. onLoad(option) {
  191. this.bankId = option.bankId;
  192. this.typeId = option.typeId;
  193. this.sc = option.sc;
  194. this.ct = option.ct;
  195. if (option.bankSectionId) {
  196. this.bankSectionId = option.bankSectionId;
  197. }
  198. if (option.examId) {
  199. this.examId = option.examId;
  200. }
  201. this.titleListFn(option);
  202. },
  203. methods: {
  204. //预览图片
  205. seeBigImage(url) {
  206. var urlarr = [];
  207. urlarr.push(this.$method.splitImgHost(url));
  208. uni.previewImage({
  209. urls: urlarr
  210. });
  211. },
  212. favoritesStatus() {
  213. this.$api.questionsystems(this.nowPageData.questionId).then(result => {
  214. if (result.data.data === undefined) {
  215. this.collecStatus = false;
  216. } else {
  217. this.collecStatus = true;
  218. }
  219. });
  220. },
  221. //收藏
  222. favorites() {
  223. console.log(this.collecStatus);
  224. var self = this;
  225. if (!uni.getStorageSync('union_id') && this.$store.state.token === '') {
  226. uni.navigateTo({
  227. url: '/pages/login/login'
  228. });
  229. } else {
  230. if (this.collecStatus) {
  231. this.$api.questionsystems(self.nowPageData.questionId).then(results => {
  232. self.$api.questionsystemdelete(results.data.data.collectQuestionId).then(resz => {
  233. self.favoritesStatus();
  234. });
  235. });
  236. } else {
  237. var data = {
  238. bankId: self.bankId,
  239. questionId: self.nowPageData.questionId
  240. };
  241. this.$api.questionsystemadd(data).then(res => {
  242. self.favoritesStatus();
  243. });
  244. }
  245. }
  246. },
  247. // 查看解析start
  248. showTitle(ids) {
  249. var self = this;
  250. if (this.showJX.indexOf(ids) !== -1) {
  251. var ats = self.showJX.indexOf(ids);
  252. self.showJX.splice(ats, 1);
  253. } else {
  254. self.showJX.push(ids);
  255. }
  256. },
  257. //案例解析
  258. showTitles(int) {
  259. var self = this;
  260. if (this.showJXanli.indexOf(int) !== -1) {
  261. var ats = self.showJXanli.indexOf(int);
  262. self.showJXanli.splice(ats, 1);
  263. } else {
  264. self.showJXanli.push(int);
  265. }
  266. },
  267. changeTM(index, int) {
  268. var self = this;
  269. if (int === 1) {
  270. this.numIndex = index + 1;
  271. } else {
  272. this.numIndex = index;
  273. }
  274. this.initDatas();
  275. this.initLint();
  276. this.getCooieds();
  277. this.favoritesStatus(self.nowPageData.questionId);
  278. this.getBGCchange();
  279. this.show = false;
  280. },
  281. //已做题目颜色变化
  282. getBGCchange() {
  283. var self = this;
  284. this.answerList.forEach((item, index) => {
  285. if (this.isWrites.indexOf(item.questionId) === -1) {
  286. self.isWrites.push(item.questionId);
  287. }
  288. });
  289. },
  290. //数据清空
  291. initDatas() {
  292. this.isWrong = -1;
  293. this.showJX = [];
  294. this.showJXanli = [];
  295. this.selects = [];
  296. },
  297. getCooieds() {
  298. var self = this;
  299. if (this.answerList.length) {
  300. self.answerList.forEach((item, index) => {
  301. if (item.questionId === self.nowPageData.questionId) {
  302. if (self.nowPageData.type === 4) {
  303. self.replyL = item.replyStr;
  304. } else if (self.nowPageData.type === 3) {
  305. self.isWrong = item.isRight;
  306. } else {
  307. self.replyL = item.selectIds;
  308. }
  309. }
  310. });
  311. }
  312. },
  313. initLint() {
  314. var self = this;
  315. self.replyL = [];
  316. if (self.list[self.numIndex].type === 4) {
  317. for (var i = 0; i < self.list[self.numIndex].jsonStr.length; i++) {
  318. self.replyL.push({ selectId: [] });
  319. }
  320. }
  321. self.nowPageData = self.list[self.numIndex];
  322. },
  323. submitChi() {
  324. var self = this;
  325. if (self.nowPageData.type === 1 || self.nowPageData.type === 2 || self.nowPageData.type === 3) {
  326. var yesList = []; //记录正确项索引
  327. self.nowPageData.jsonStr.forEach((item, index) => {
  328. if (item.optionAnswer === 1) {
  329. yesList.push(index);
  330. }
  331. });
  332. var strYesList = yesList.sort().toString();
  333. var isRight = strYesList == self.replyL.sort().toString() ? 1 : 0; //记录是否选择正确
  334. if (self.nowPageData.type === 3) {
  335. if (self.isWrong === self.nowPageData.answerQuestion) {
  336. isRight = 1;
  337. } else {
  338. isRight = 0;
  339. }
  340. }
  341. var objslit = []; //记录选中的选项对象
  342. for (let i = 0; i < self.replyL.length; i++) {
  343. objslit.push(self.nowPageData.jsonStr[self.replyL[i]]);
  344. }
  345. var objList = {
  346. bankId: self.bankId,
  347. questionId: self.nowPageData.questionId,
  348. selectIds: self.replyL,
  349. replyStr: objslit,
  350. isRight: isRight
  351. };
  352. self.answerList[self.numIndex] = objList;
  353. }
  354. if (self.nowPageData.type === 4) {
  355. for (var i = 0; i < self.replyL.length; i++) {
  356. if (self.replyL[i].selectId.length) {
  357. self.replyL[i].selectId = self.replyL[i].selectId;
  358. }
  359. }
  360. var objList = {
  361. bankId: self.bankId,
  362. questionId: self.nowPageData.questionId,
  363. replyStr: self.replyL,
  364. selectIds: self.selects
  365. };
  366. self.answerList[self.numIndex] = objList;
  367. }
  368. if (self.numIndex === self.list.length - 1) {
  369. self.changeTM(self.numIndex, 2);
  370. self.carryOut();
  371. return;
  372. }
  373. self.changeTM(self.numIndex, 1);
  374. },
  375. titleListFn(option) {
  376. console.log(option)
  377. var self = this;
  378. if (option.sc === 'true') {
  379. var data = {
  380. bankId: self.bankId
  381. };
  382. self.$api.systemquestionList(data).then(res => {
  383. if (res.data.rows.length) {
  384. res.data.rows.forEach((items, indexs) => {
  385. items.jsonStr = JSON.parse(items.jsonStr);
  386. });
  387. if (res.data.rows[self.numIndex].type === 4) {
  388. self.replyL = [];
  389. for (var i = 0; i < res.data.rows[self.numIndex].jsonStr.length; i++) {
  390. self.replyL.push({ selectId: [] });
  391. }
  392. }
  393. self.nowPageData = res.data.rows[self.numIndex];
  394. self.favoritesStatus(res.data.rows[self.numIndex].questionId);
  395. self.list = res.data.rows;
  396. } else {
  397. uni.showModal({
  398. title: '提示',
  399. content: '没有题目',
  400. showCancel: false,
  401. confirmText: '返回上级',
  402. success: function(res) {
  403. if (res.confirm) {
  404. uni.navigateBack({
  405. delta: 1
  406. });
  407. }
  408. }
  409. });
  410. }
  411. });
  412. return;
  413. }
  414. if (option.ct === 'true') {
  415. var data = {
  416. bankId: self.bankId
  417. };
  418. self.$api.questionListrecord(data).then(res => {
  419. if (res.data.rows.length) {
  420. res.data.rows.forEach((items, indexs) => {
  421. items.jsonStr = JSON.parse(items.jsonStr);
  422. });
  423. if (res.data.rows[self.numIndex].type === 4) {
  424. self.replyL = [];
  425. for (var i = 0; i < res.data.rows[self.numIndex].jsonStr.length; i++) {
  426. self.replyL.push({ selectId: [] });
  427. }
  428. }
  429. self.nowPageData = res.data.rows[self.numIndex];
  430. self.favoritesStatus(res.data.rows[self.numIndex].questionId);
  431. self.list = res.data.rows;
  432. } else {
  433. uni.showModal({
  434. title: '提示',
  435. content: '没有题目',
  436. showCancel: false,
  437. confirmText: '返回上级',
  438. success: function(res) {
  439. if (res.confirm) {
  440. uni.navigateBack({
  441. delta: 1
  442. });
  443. }
  444. }
  445. });
  446. }
  447. });
  448. return;
  449. }
  450. if (option.bankSectionId) {
  451. var data = {
  452. bankSectionId: option.bankSectionId
  453. };
  454. }
  455. if (option.examId) {
  456. var data = {
  457. examId: option.examId
  458. };
  459. }
  460. if (option.bankSectionId === undefined && option.examId === undefined) {
  461. uni.showModal({
  462. title: '提示',
  463. content: '没有题目',
  464. showCancel: false,
  465. confirmText: '返回上级',
  466. success: function(res) {
  467. if (res.confirm) {
  468. uni.navigateBack({
  469. delta: 1
  470. });
  471. }
  472. }
  473. });
  474. return;
  475. }
  476. self.$api.questiondetailList(data).then(res => {
  477. if (res.data.rows.length) {
  478. res.data.rows.forEach((items, indexs) => {
  479. items.jsonStr = JSON.parse(items.jsonStr);
  480. });
  481. if (res.data.rows[self.numIndex].type === 4) {
  482. self.replyL = [];
  483. for (var i = 0; i < res.data.rows[self.numIndex].jsonStr.length; i++) {
  484. self.replyL.push({ selectId: [] });
  485. }
  486. }
  487. self.nowPageData = res.data.rows[self.numIndex];
  488. self.favoritesStatus(res.data.rows[self.numIndex].questionId);
  489. self.list = res.data.rows;
  490. } else {
  491. uni.showModal({
  492. title: '提示',
  493. content: '没有题目',
  494. showCancel: false,
  495. confirmText: '返回上级',
  496. success: function(res) {
  497. if (res.confirm) {
  498. uni.navigateBack({
  499. delta: 1
  500. });
  501. }
  502. }
  503. });
  504. }
  505. });
  506. },
  507. activeList(data, int) {
  508. var self = this;
  509. if (self.nowPageData.type === 1) {
  510. self.replyL = [int];
  511. } else if (self.nowPageData.type === 2) {
  512. if (self.replyL.indexOf(int) !== -1) {
  513. for (var i = 0; i <= self.replyL.length; i++) {
  514. if (self.replyL[i] === int) {
  515. self.replyL.splice(i, 1);
  516. }
  517. }
  518. } else {
  519. self.replyL.push(int);
  520. }
  521. }
  522. },
  523. activePD(int) {
  524. this.isWrong = int;
  525. },
  526. activePDs(int, fatInt) {
  527. this.isWrong = int;
  528. if (this.replyL[fatInt] === undefined) {
  529. this.replyL[fatInt] = {};
  530. }
  531. if (int === this.nowPageData.jsonStr[fatInt].answerQuestion) {
  532. this.replyL[fatInt].isRight = 1;
  533. } else {
  534. this.replyL[fatInt].isRight = 0;
  535. }
  536. if (this.selects.indexOf(fatInt) === -1) {
  537. this.selects.push(fatInt);
  538. }
  539. },
  540. activeListSitem(data, int, fatInt) {
  541. var self = this;
  542. if (self.replyL[fatInt] === undefined) {
  543. self.replyL[fatInt] = {};
  544. }
  545. if (self.nowPageData.jsonStr[fatInt].type === 1) {
  546. self.replyL[fatInt].selectId = [int];
  547. var objNums = [];
  548. self.nowPageData.jsonStr[fatInt].answer.forEach((itemta, indexta) => {
  549. if (itemta.optionAnswer === 1) {
  550. objNums.push(indexta);
  551. }
  552. });
  553. var strYesList = objNums.sort().toString();
  554. var isRight = strYesList == self.replyL[fatInt].selectId.sort().toString();
  555. if (isRight) {
  556. self.replyL[fatInt].isRight = 1;
  557. } else {
  558. self.replyL[fatInt].isRight = 0;
  559. }
  560. self.replyL[fatInt].repley = [data];
  561. if (self.replyL[fatInt].repley.length) {
  562. if (self.selects.indexOf(fatInt) === -1) {
  563. self.selects.push(fatInt);
  564. }
  565. }
  566. } else if (self.nowPageData.jsonStr[fatInt].type === 2) {
  567. if (self.replyL[fatInt].selectId === undefined) {
  568. self.replyL[fatInt].selectId = [];
  569. }
  570. if (self.replyL[fatInt].selectId.indexOf(int) !== -1) {
  571. for (var i = 0; i < self.replyL[fatInt].selectId.length; i++) {
  572. if (self.replyL[fatInt].selectId[i] === int) {
  573. self.replyL[fatInt].selectId.splice(i, 1);
  574. }
  575. }
  576. } else {
  577. self.replyL[fatInt].selectId.push(int);
  578. }
  579. var objNums = [];
  580. self.nowPageData.jsonStr[fatInt].answer.forEach((itemta, indexta) => {
  581. if (itemta.optionAnswer === 1) {
  582. objNums.push(indexta);
  583. }
  584. });
  585. var strYesList = objNums.sort().toString();
  586. var isRight = strYesList == self.replyL[fatInt].selectId.sort().toString();
  587. if (isRight) {
  588. self.replyL[fatInt].isRight = 1;
  589. } else {
  590. self.replyL[fatInt].isRight = 0;
  591. }
  592. var objst = [];
  593. for (let i = 0; i < self.replyL[fatInt].selectId.length; i++) {
  594. objst.push(self.nowPageData.jsonStr[fatInt].answer[self.replyL[fatInt].selectId[i]]);
  595. }
  596. self.replyL[fatInt].repley = objst;
  597. if (self.replyL[fatInt].repley.length) {
  598. if (self.selects.indexOf(fatInt) === -1) {
  599. self.selects.push(fatInt);
  600. }
  601. } else {
  602. var numt = self.selects.indexOf(fatInt);
  603. self.selects.splice(numt, 1);
  604. }
  605. }
  606. },
  607. menu() {
  608. this.show = true;
  609. },
  610. //交卷
  611. carryOut() {
  612. var self = this;
  613. if (this.isWrites.length !== this.list.length) {
  614. uni.showModal({
  615. title: '提示',
  616. content: '请完成所有作答再交卷',
  617. showCancel: false,
  618. success: function(res) {}
  619. });
  620. return;
  621. }
  622. uni.showModal({
  623. title: '提示',
  624. content: '是否确定交卷',
  625. success: function(res) {
  626. if (res.confirm) {
  627. var correct = 0;
  628. var errorz = 0;
  629. var answerListString = JSON.parse(JSON.stringify(self.answerList));
  630. answerListString.forEach((item, index) => {
  631. if (item.isRight !== undefined) {
  632. if (item.isRight === 1) {
  633. correct++;
  634. } else {
  635. errorz++;
  636. }
  637. }
  638. item.selectIds = item.selectIds.toString();
  639. item.replyStr.forEach((items, indexs) => {
  640. if (items.selectId) {
  641. items.selectId = items.selectId.toString();
  642. }
  643. });
  644. item.replyStr = JSON.stringify(item.replyStr);
  645. });
  646. var data = {
  647. bankId: self.bankId,
  648. type: self.typeId,
  649. answerList: answerListString
  650. };
  651. if (self.examId !== null) {
  652. data.examId = self.examId;
  653. }
  654. if (self.simulateId !== null) {
  655. data.simulateId = self.bankSectionId;
  656. }
  657. if (self.sc === 'true') {
  658. var num = 0;
  659. self.list.forEach((item, index) => {
  660. if (item.type !== 4) {
  661. num++;
  662. }
  663. });
  664. uni.redirectTo({
  665. url: `/pages2/bank/endBG?bankId=${self.bankId}&type=${self.typeId}&allIndex=${num}&correct=${correct}&error=${errorz}`
  666. });
  667. } else {
  668. self.$api.questiondetailrecord(data).then(res => {
  669. if (res.data.code === 200) {
  670. var num = 0;
  671. self.list.forEach((item, index) => {
  672. if (item.type !== 4) {
  673. num++;
  674. }
  675. });
  676. uni.redirectTo({
  677. url: `/pages2/bank/endBG?bankId=${self.bankId}&type=${self.typeId}&allIndex=${num}&correct=${correct}&error=${errorz}`
  678. });
  679. } else {
  680. uni.showToast({
  681. title: '提交失败',
  682. icon: 'none',
  683. duration: 2000
  684. });
  685. }
  686. });
  687. }
  688. } else if (res.cancel) {
  689. }
  690. }
  691. });
  692. }
  693. }
  694. };
  695. </script>
  696. <style>
  697. ::-webkit-scrollbar {
  698. width: 0;
  699. height: 0;
  700. color: transparent;
  701. }
  702. .u-drawer-content-visible {
  703. border-radius: 32rpx 32rpx 0rpx 0rpx;
  704. overflow: hidden;
  705. }
  706. </style>
  707. <style scope>
  708. .bigBox > .contentList {
  709. padding-top: 15rpx;
  710. padding-bottom: 96rpx;
  711. }
  712. .activeListBt {
  713. border: 2rpx solid #32467b !important;
  714. }
  715. .contentList {
  716. padding: 0rpx 32rpx;
  717. }
  718. .contentList > .jxTit {
  719. margin-top: 35rpx;
  720. }
  721. .contentList > .jxTit > .jxSpan {
  722. color: #32467b;
  723. font-size: 34rpx;
  724. margin-right: 8rpx;
  725. }
  726. .contentList > .headerTitle {
  727. display: flex;
  728. align-items: center;
  729. justify-content: space-between;
  730. color: #32467b;
  731. }
  732. .contentList > .content {
  733. margin: 25rpx 0rpx;
  734. }
  735. .contentList > .content > .contentTitle {
  736. color: #333;
  737. font-size: 28rpx;
  738. }
  739. .contentList > .content > .imageBox > image {
  740. max-height: 300rpx;
  741. }
  742. .headerTitle > .leftIcon {
  743. padding: 0rpx 10rpx;
  744. height: 36rpx;
  745. line-height: 36rpx;
  746. border: 1rpx solid #32467b;
  747. font-size: 28rpx;
  748. border-radius: 10rpx;
  749. background-color: rgba(50, 70, 123, 0.1);
  750. }
  751. .headerTitle > .right > .lengNum {
  752. font-size: 28rpx;
  753. color: #999999;
  754. }
  755. .banksChiList {
  756. border: 2rpx solid transparent;
  757. display: flex;
  758. margin-bottom: 8rpx;
  759. border-radius: 16rpx;
  760. font-size: 34rpx;
  761. width: 100%;
  762. background-color: #f7fbff;
  763. padding: 15rpx 18rpx;
  764. box-sizing: border-box;
  765. }
  766. .banksChiList > .leftIndex {
  767. width: 40rpx;
  768. }
  769. .banksChiList > .bankTie {
  770. flex: 1;
  771. }
  772. .banksChiList > .bankTie > image {
  773. max-width: 95%;
  774. }
  775. .btn_bac3 {
  776. background: #4d6dbd;
  777. color: #fff;
  778. }
  779. .btn_bac2 {
  780. background: #32467b;
  781. color: #fff;
  782. }
  783. .btn_bac1 {
  784. background: #f7f8ff;
  785. color: #666666;
  786. }
  787. .btn_num::before {
  788. content: '';
  789. padding-top: 100%;
  790. display: block;
  791. }
  792. .btn_num text {
  793. font-size: 24rpx;
  794. width: 100%;
  795. display: inline-block;
  796. text-align: center;
  797. top: 50%;
  798. position: absolute;
  799. height: 30rpx;
  800. line-height: 30rpx;
  801. margin-top: -15rpx;
  802. }
  803. .btn_num {
  804. border-radius: 32rpx;
  805. width: 16%;
  806. margin: 2%;
  807. display: inline-block;
  808. position: relative;
  809. }
  810. .popup_list {
  811. border-radius: 32rpx 32rpx 0rpx 0rpx;
  812. height: 899rpx;
  813. background: #f2f3f6;
  814. padding-bottom: 30rpx;
  815. }
  816. .popup_box {
  817. height: 899rpx;
  818. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  819. border-radius: 32rpx 32rpx 0rpx 0rpx;
  820. background: #f2f3f6;
  821. padding: 30rpx;
  822. }
  823. .sc_t {
  824. font-size: 22rpx;
  825. color: #000000;
  826. }
  827. .box {
  828. height: 95rpx;
  829. display: flex;
  830. flex-direction: column;
  831. justify-content: center;
  832. position: relative;
  833. }
  834. .sc {
  835. width: 29rpx;
  836. height: 29rpx;
  837. }
  838. .footer_tab {
  839. position: fixed;
  840. bottom: 0;
  841. height: 96rpx;
  842. width: 100%;
  843. background-color: #ffffff;
  844. }
  845. page {
  846. background: #ffffff;
  847. }
  848. </style>