question_detail_wrong.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. {extend name="public/container" /}
  2. {block name="title"}错题详情{/block}
  3. {block name="head"}
  4. <style>
  5. body {
  6. padding: 1.44rem .3rem 1.5rem;
  7. background-color: #F5F5F5;
  8. }
  9. .wrong-question .header {
  10. position: fixed;
  11. top: 0;
  12. right: 0;
  13. left: 0;
  14. z-index: 5;
  15. padding: .3rem .3rem 0;
  16. background-color: #F5F5F5;
  17. }
  18. .wrong-question .header .upper {
  19. display: flex;
  20. justify-content: space-between;
  21. align-items: center;
  22. height: 1.14rem;
  23. padding-right: .3rem;
  24. border-radius: .12rem .12rem 0 0;
  25. background-color: #FFFFFF;
  26. }
  27. .wrong-question .header .type {
  28. position: relative;
  29. left: -0.04rem;
  30. height: .5rem;
  31. padding: 0 .3rem 0 .22rem;
  32. border-radius: 0 .25rem .25rem 0;
  33. background-color: #191C6E;
  34. font-size: .26rem;
  35. line-height: .5rem;
  36. color: #FFFFFF;
  37. }
  38. .wrong-question .header .type::after {
  39. content: "";
  40. position: absolute;
  41. bottom: -0.02rem;
  42. left: 0;
  43. border-width: .01rem .02rem;
  44. border-style: solid;
  45. border-color: #0C73E9 #0C73E9 transparent transparent;
  46. }
  47. .wrong-question .header .iconfont {
  48. font-size: .28rem;
  49. color: #666666;
  50. }
  51. .wrong-question .question {
  52. border-radius: 0 0 .12rem .12rem;
  53. background-color: #FFFFFF;
  54. }
  55. .wrong-question .question .title {
  56. padding: 0 .2rem;
  57. font-size: .3rem;
  58. line-height: .45rem;
  59. color: #282828;
  60. }
  61. .wrong-question .question .title-image {
  62. display: block;
  63. width: 6.3rem;
  64. height: 4.4rem;
  65. margin: .3rem auto 0;
  66. }
  67. .wrong-question .question .options {
  68. display: flex;
  69. flex-direction: column;
  70. padding: .3rem .3rem .27rem;
  71. counter-reset: option;
  72. }
  73. .wrong-question .question .options .option {
  74. position: relative;
  75. padding: .24rem .61rem .24rem .73rem;
  76. border-radius: .08rem;
  77. margin: 0 0 .2rem;
  78. background-color: #F9F9F9;
  79. word-break: break-all;
  80. font-size: .3rem;
  81. line-height: .42rem;
  82. color: #282828;
  83. }
  84. .wrong-question .question .options .option.ok {
  85. background-color: #EBF9EB;
  86. color: #52A452;
  87. }
  88. .wrong-question .question .options .option.no {
  89. background-color: #FFF0E5;
  90. color: #FF6B00;
  91. }
  92. .wrong-question .question .options .option::before {
  93. counter-increment: option;
  94. content: counter(option, upper-alpha) ".";
  95. position: absolute;
  96. left: .3rem;
  97. }
  98. .wrong-question .question .options .iconfont {
  99. position: absolute;
  100. top: .24rem;
  101. right: .3rem;
  102. font-size: .23rem;
  103. }
  104. .wrong-question .question .images {
  105. display: flex;
  106. flex-wrap: wrap;
  107. align-content: flex-start;
  108. padding: .3rem .05rem .27rem .25rem;
  109. counter-reset: option;
  110. }
  111. .wrong-question .question .images .option {
  112. position: relative;
  113. padding: .6rem .2rem .28rem;
  114. border-radius: .08rem;
  115. margin: 0 .2rem .2rem 0;
  116. background-color: #F9F9F9;
  117. }
  118. .wrong-question .question .images .option.ok {
  119. background-color: #EBF9EB;
  120. color: #52A452;
  121. }
  122. .wrong-question .question .images .option.no {
  123. background-color: #FFF0E5;
  124. color: #FF6B00;
  125. }
  126. .wrong-question .question .images .option::before {
  127. counter-increment: option;
  128. content: counter(option, upper-alpha) ".";
  129. position: absolute;
  130. top: .3rem;
  131. left: .2rem;
  132. transform: translateY(-50%);
  133. }
  134. .wrong-question .question .images .option img {
  135. width: 2.7rem;
  136. height: 1.62rem;
  137. }
  138. .wrong-question .analysis {
  139. padding: .2rem .2rem .32rem;
  140. border-radius: .12rem;
  141. margin-top: .2rem;
  142. background-color: #FFFFFF;
  143. }
  144. .wrong-question .analysis .upper {
  145. padding-bottom: .3rem;
  146. font-size: .3rem;
  147. line-height: .42rem;
  148. color: #FF6B00;
  149. }
  150. .wrong-question .analysis .upper .iconfont {
  151. margin-right: .15rem;
  152. font-size: .32rem;
  153. }
  154. .wrong-question .analysis .answers {
  155. display: flex;
  156. font-size: .28rem;
  157. line-height: .4rem;
  158. color: #666666;
  159. }
  160. .wrong-question .analysis .answer {
  161. flex: 1;
  162. display: flex;
  163. }
  164. .wrong-question .analysis .answer .value {
  165. flex: 1;
  166. min-width: 0;
  167. padding-left: .26rem;
  168. word-break: break-all;
  169. color: #191C6E;
  170. }
  171. .wrong-question .analysis .answer:first-child .value {
  172. color: #52A452;
  173. }
  174. .wrong-question .analysis .degree {
  175. display: flex;
  176. margin-top: .2rem;
  177. font-size: .28rem;
  178. line-height: .4rem;
  179. color: #666666;
  180. }
  181. .wrong-question .analysis .degree .value {
  182. flex: 1;
  183. padding-left: .26rem;
  184. font-size: 0;
  185. }
  186. .wrong-question .analysis .degree .iconfont {
  187. margin-right: .15rem;
  188. vertical-align: middle;
  189. font-size: .24rem;
  190. color: #FFF0E5;
  191. }
  192. .wrong-question .analysis .degree .active {
  193. color: #FF6B00;
  194. }
  195. .wrong-question .analysis .content {
  196. margin-top: .2rem;
  197. font-size: .28rem;
  198. line-height: .4rem;
  199. color: #676767;
  200. }
  201. .wrong-question .analysis .content .value {
  202. margin-top: .1rem;
  203. font-size: .28rem;
  204. line-height: .44rem;
  205. color: #282828;
  206. }
  207. .wrong-question .special {
  208. margin-top: .2rem;
  209. font-size: .28rem;
  210. line-height: .4rem;
  211. color: #676767;
  212. }
  213. .wrong-question .special .value {
  214. margin-top: .18rem;
  215. counter-reset: special;
  216. }
  217. .wrong-question .special .item {
  218. position: relative;
  219. display: flex;
  220. padding-left: .18rem;
  221. margin-top: .3rem;
  222. }
  223. .wrong-question .special .item:first-child {
  224. margin-top: 0;
  225. }
  226. .wrong-question .special .item::before {
  227. counter-increment: special;
  228. content: counter(special, disc);
  229. position: absolute;
  230. left: 0;
  231. color: rgba(44, 142, 255, 0.4);
  232. }
  233. .wrong-question .special .title {
  234. flex: 1;
  235. color: #191C6E;
  236. }
  237. .wrong-question .special .iconfont {
  238. font-size: .26rem;
  239. color: #999999;
  240. }
  241. .wrong-question .footer {
  242. position: fixed;
  243. right: 0;
  244. bottom: 0;
  245. left: 0;
  246. z-index: 5;
  247. display: flex;
  248. background-color: #FFFFFF;
  249. }
  250. .wrong-question .footer button {
  251. flex: 1;
  252. height: 1.1rem;
  253. font-size: .22rem;
  254. line-height: .3rem;
  255. color: #333333;
  256. }
  257. .wrong-question .footer div {
  258. margin-top: .11rem;
  259. }
  260. .wrong-question .footer div:first-child {
  261. margin-top: 0;
  262. }
  263. .wrong-question .footer .iconfont {
  264. vertical-align: bottom;
  265. font-size: .34rem;
  266. }
  267. .wrong-question .footer button:disabled {
  268. color: #999999;
  269. }
  270. .wrong-question .footer .light {
  271. color: #191C6E;
  272. }
  273. </style>
  274. {/block}
  275. {block name="content"}
  276. <div v-cloak id="app" class="wrong-question">
  277. <template v-if="question">
  278. <div class="header">
  279. <div class="upper">
  280. <div class="type">{{ question.question_type | questionType }}</div>
  281. <button @click="deleteQuestion"><i class="iconfont iconshanchu"></i></button>
  282. </div>
  283. </div>
  284. <div class="question">
  285. <div class="title">{{ question.stem }}</div>
  286. <img v-if="question.image" :src="question.image" class="title-image">
  287. <div v-if="question.is_img" class="images">
  288. <label
  289. v-for="item in question.options"
  290. :key="item.key"
  291. :class="{
  292. ok: question.user_answer.indexOf(item.key) !== -1 && question.answer.indexOf(item.key) !== -1,
  293. no: question.user_answer.indexOf(item.key) !== -1 && question.answer.indexOf(item.key) === -1
  294. }"
  295. class="option"
  296. >
  297. <input type="radio" disabled hidden>
  298. <img :src="item.value">
  299. </label>
  300. </div>
  301. <div v-else class="options">
  302. <label
  303. v-for="item in question.options"
  304. :key="item.key"
  305. :class="{
  306. ok: question.user_answer.indexOf(item.key) !== -1 && question.answer.indexOf(item.key) !== -1,
  307. no: question.user_answer.indexOf(item.key) !== -1 && question.answer.indexOf(item.key) === -1
  308. }"
  309. class="option"
  310. >
  311. <input type="radio" disabled hidden>
  312. {{ item.value }}
  313. <i
  314. v-if="question.user_answer.indexOf(item.key) !== -1"
  315. :class="[question.answer.indexOf(item.key) === -1 ? 'iconguanbi' : 'icongouxuan']"
  316. class="iconfont"
  317. ></i>
  318. </label>
  319. </div>
  320. </div>
  321. <div class="analysis">
  322. <div class="upper"><i class="iconfont iconjurassic_true"></i>回答错误</div>
  323. <div class="answers">
  324. <div class="answer">
  325. <div>正确答案:</div>
  326. <div class="value">{{ question.answer }}</div>
  327. </div>
  328. <div class="answer">
  329. <div>您的答案:</div>
  330. <div class="value">{{ question.user_answer }}</div>
  331. </div>
  332. </div>
  333. <div class="degree">
  334. <div>试题难度:</div>
  335. <div class="value"><i v-for="item in 5" :key="item" :class="{ active: item <= question.difficulty }" class="iconfont iconxing"></i></div>
  336. </div>
  337. <div class="content">
  338. <div>答案解析:</div>
  339. <div class="value" v-html="question.analysis"></div>
  340. </div>
  341. <div v-if="question.special && question.special.length" class="special">
  342. <div>关联知识点:</div>
  343. <div class="value">
  344. <a v-for="item in question.special" :key="item.id" class="item" href="">
  345. <div class="title">{{ item.title }}</div>
  346. <i class="iconfont iconxiangyou"></i>
  347. </a>
  348. </div>
  349. </div>
  350. </div>
  351. <div class="footer">
  352. <button :disabled="!index" @click="changeQuestion(-1)">
  353. <div><i class="iconfont iconshangyige"></i></div>
  354. <div>上一题</div>
  355. </button>
  356. <button :class="{ light: question.is_master }" @click="graspQuestion">
  357. <div><i :class="question.is_master ? 'iconyizhangwo' : 'iconweizhangwo'" class="iconfont"></i></div>
  358. <div>{{ question.is_master ? '已' : '未' }}掌握</div>
  359. </button>
  360. <button :disabled="index === idList.length - 1" @click="changeQuestion(1)">
  361. <div><i class="iconfont iconxiayige"></i></div>
  362. <div>下一题</div>
  363. </button>
  364. </div>
  365. </template>
  366. <quick-menu></quick-menu>
  367. </div>
  368. {/block}
  369. {block name="foot"}
  370. <script>
  371. require(['vue', 'store', 'helper','quick'], function (Vue, store, $h) {
  372. new Vue({
  373. el: '#app',
  374. filters: {
  375. questionType: function (value) {
  376. switch (value) {
  377. case 1:
  378. return '单选题';
  379. case 2:
  380. return '多选题';
  381. case 3:
  382. return '判断题';
  383. }
  384. }
  385. },
  386. data: {
  387. id: 0,
  388. is_master: '',
  389. idList: [],
  390. question: null
  391. },
  392. computed: {
  393. index: function () {
  394. return this.idList.indexOf(this.id);
  395. }
  396. },
  397. created: function () {
  398. var vm = this;
  399. var wrongQuestion = localStorage.getItem('wrong_question');
  400. if (!wrongQuestion) {
  401. return;
  402. }
  403. wrongQuestion = JSON.parse(wrongQuestion);
  404. this.id = this.nodeId = wrongQuestion.id;
  405. this.is_master = wrongQuestion.is_master;
  406. this.idList.push(this.id);
  407. this.getQuestion();
  408. this.getIdList(1);
  409. this.getIdList();
  410. window.addEventListener('beforeunload', function () {
  411. localStorage.setItem('wrong_question', JSON.stringify({
  412. id: vm.id,
  413. is_master: vm.is_master
  414. }));
  415. });
  416. },
  417. methods: {
  418. // 错题消息
  419. getQuestion: function () {
  420. var vm = this;
  421. store.baseGet($h.U({
  422. c: 'topic',
  423. a: 'oneWrongBank',
  424. q: {
  425. id: this.id
  426. }
  427. }), function (res) {
  428. var question = res.data.data;
  429. var option = JSON.parse(question.option);
  430. var answer = question.answer.split(',');
  431. var optionObj = {};
  432. question.options = [];
  433. if (Array.isArray(option)) {
  434. option.forEach(function (item, index) {
  435. optionObj[String.fromCharCode(index + 65)] = item;
  436. });
  437. option = optionObj;
  438. }
  439. for (var key in option) {
  440. if (Object.hasOwnProperty.call(option, key)) {
  441. question.options.push({
  442. key: key,
  443. value: option[key]
  444. });
  445. }
  446. }
  447. vm.question = question;
  448. });
  449. },
  450. getIdList: function (order) {
  451. var vm = this;
  452. store.basePost($h.U({
  453. c: 'topic',
  454. a: 'userWrongBankIdArr'
  455. }), {
  456. id: this.nodeId,
  457. is_master: this.is_master,
  458. order: order || 0
  459. }, function (res) {
  460. vm.idList = vm.idList.concat(res.data.data).sort(function (a, b) {
  461. return b - a;
  462. });
  463. });
  464. },
  465. // 上一题/下一题
  466. changeQuestion: function (value) {
  467. this.id = this.idList[this.index + value];
  468. this.getQuestion();
  469. if (this.index === this.idList.length - 2 && value === 1) {
  470. this.nodeId = this.idList[this.idList.length - 1];
  471. this.getIdList(1);
  472. } else if (this.index === 1 && value === -1) {
  473. this.nodeId = this.idList[0];
  474. this.getIdList();
  475. }
  476. },
  477. // 掌握
  478. graspQuestion: function () {
  479. var vm = this;
  480. var is_master = this.question.is_master ? 0 : 1;
  481. store.basePost($h.U({
  482. c: 'topic',
  483. a: 'submitWrongBank'
  484. }), {
  485. wrong_id: this.id,
  486. questions_id: this.question.questions_id,
  487. is_master: is_master
  488. }, function (res) {
  489. vm.question.is_master = is_master;
  490. });
  491. },
  492. // 删除
  493. deleteQuestion: function () {
  494. var vm = this;
  495. store.baseGet($h.U({
  496. c: 'topic',
  497. a: 'delWrongBank',
  498. q: {
  499. id: this.id
  500. }
  501. }), function (res) {
  502. if (vm.idList.length === 1) {
  503. window.history.back();
  504. } else if (vm.index === vm.idList.length - 1) {
  505. vm.id = vm.idList[vm.idList.length - 2];
  506. vm.idList.splice(vm.index, 1);
  507. vm.getQuestion();
  508. } else {
  509. vm.id = vm.idList[vm.index + 1];
  510. vm.idList.splice(vm.index, 1);
  511. vm.getQuestion();
  512. }
  513. });
  514. }
  515. }
  516. });
  517. });
  518. </script>
  519. {/block}