question_wrong.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <!-- +---------------------------------------------------------------------- -->
  2. <!-- | CRMEB [ CRMEB赋能开发者,助力企业发展 ] -->
  3. <!-- +---------------------------------------------------------------------- -->
  4. <!-- | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. -->
  5. <!-- +---------------------------------------------------------------------- -->
  6. <!-- | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 -->
  7. <!-- +---------------------------------------------------------------------- -->
  8. <!-- | Author: CRMEB Team <admin@crmeb.com> -->
  9. <!-- +---------------------------------------------------------------------- -->
  10. {extend name="public/container"}
  11. {block name="title"}我的错题{/block}
  12. {block name="head"}
  13. <style>
  14. body {
  15. background-color: #f5f5f5;
  16. }
  17. .wrong-list-page .nav {
  18. position: fixed;
  19. top: .2rem;
  20. right: .3rem;
  21. left: .3rem;
  22. display: -webkit-box;
  23. display: flex;
  24. border-radius: .12rem;
  25. background-color: #fff;
  26. }
  27. .wrong-list-page .nav a {
  28. -webkit-box-flex: 1;
  29. flex: 1;
  30. position: relative;
  31. height: .9rem;
  32. font-size: .28rem;
  33. line-height: .9rem;
  34. text-align: center;
  35. color: #333;
  36. }
  37. .wrong-list-page .nav a.on {
  38. color: #191C6E;
  39. }
  40. .wrong-list-page .nav a.on::after {
  41. content: "";
  42. position: absolute;
  43. left: 50%;
  44. bottom: 0;
  45. width: .7rem;
  46. height: .04rem;
  47. border-radius: .02rem;
  48. background-color: #191C6E;
  49. -webkit-transform: translateX(-50%);
  50. transform: translateX(-50%);
  51. }
  52. .wrong-list-page .list {
  53. padding: .2rem .3rem;
  54. margin-top: 1.1rem;
  55. }
  56. .wrong-list-page .list a {
  57. display: block;
  58. padding-right: .3rem;
  59. padding-left: .3rem;
  60. border-radius: .12rem;
  61. background-color: #fff;
  62. }
  63. .wrong-list-page .list a ~ a {
  64. margin-top: .3rem;
  65. }
  66. .wrong-list-page .list .name {
  67. display: -webkit-box;
  68. display: flex;
  69. -webkit-box-align: center;
  70. align-items: center;
  71. padding-top: .2rem;
  72. padding-bottom: .2rem;
  73. }
  74. .wrong-list-page .list .name div:nth-child(2) {
  75. -webkit-box-flex: 1;
  76. flex: 1;
  77. margin-right: .18rem;
  78. overflow: hidden;
  79. white-space: nowrap;
  80. text-overflow: ellipsis;
  81. font-size: .3rem;
  82. color: #191C6E;
  83. }
  84. .wrong-list-page .list .name img {
  85. display: block;
  86. width: .28rem;
  87. height: .28rem;
  88. }
  89. .wrong-list-page .list .desc {
  90. border-top: 1px dashed #e3e3e3;
  91. padding-top: .2rem;
  92. padding-bottom: .28rem;
  93. font-size: .3rem;
  94. color: #282828;
  95. }
  96. .wrong-list-page .list .desc div {
  97. display: -webkit-box;
  98. -webkit-box-orient: vertical;
  99. -webkit-line-clamp: 2;
  100. overflow: hidden;
  101. }
  102. .wrong-list-page .list .desc span {
  103. color: #999;
  104. }
  105. .empty {
  106. position: fixed;
  107. top: 50%;
  108. left: 50%;
  109. -webkit-transform: translate(-50%, -50%);
  110. transform: translate(-50%, -50%);
  111. font-size: .3rem;
  112. text-align: center;
  113. color: #999;
  114. }
  115. .empty img {
  116. width: 4.14rem;
  117. vertical-align: middle;
  118. -webkit-touch-callout: none;
  119. pointer-events: none;
  120. }
  121. </style>
  122. {/block}
  123. {block name="content"}
  124. <div v-cloak id="app">
  125. <div class="wrong-list-page">
  126. <div class="nav">
  127. <a :class="{ on: is_master === '' }" href="javascript:" @click="onTab('')">全部</a>
  128. <a :class="{ on: is_master === 1 }" href="javascript:" @click="onTab(1)">已掌握</a>
  129. <a :class="{ on: is_master === 0 }" href="javascript:" @click="onTab(0)">未掌握</a>
  130. </div>
  131. <div v-if="questions.length" class="list">
  132. <a v-for="item in questions" :key="item.id" href="javascript:" @click="goQuestion(item)">
  133. <div class="name">
  134. <div><img src="{__WAP_PATH}zsff/images/question01.png"></div>
  135. <div>{{ item.title }}</div>
  136. <div>
  137. <img v-if="item.is_master" src="{__WAP_PATH}zsff/images/question25.png">
  138. <img v-else src="{__WAP_PATH}zsff/images/question26.png">
  139. </div>
  140. </div>
  141. <div class="desc">
  142. <div><span>[{{ item.question_type_text }}]</span>{{ item.stem }}</div>
  143. </div>
  144. </a>
  145. </div>
  146. <div v-else-if="page > 1 && !loading" class="empty">
  147. <img src="{__WAP_PATH}zsff/images/empty-box.png">
  148. <div>暂无数据</div>
  149. </div>
  150. </div>
  151. <quick-menu></quick-menu>
  152. </div>
  153. <script>
  154. require([
  155. 'vue',
  156. 'helper',
  157. 'store',
  158. 'quick'
  159. ], function (Vue, $h, $http) {
  160. var vm = new Vue({
  161. el: '#app',
  162. data: {
  163. page: 1,
  164. limit: 15,
  165. is_master: '',
  166. loading: false,
  167. finished: false,
  168. questions: []
  169. },
  170. watch: {
  171. loading: function (val) {
  172. val ? $h.loadFFF() : $h.loadClear();
  173. }
  174. },
  175. created: function () {
  176. this.getQuestions();
  177. },
  178. mounted: function () {
  179. this.$nextTick(function () {
  180. $h.EventUtil.listenTouchDirection(document, function () {
  181. vm.getQuestions();
  182. });
  183. });
  184. },
  185. methods: {
  186. getQuestions: function () {
  187. if (this.loading || this.finished) {
  188. return;
  189. }
  190. this.loading = true;
  191. $http.basePost($h.U({
  192. c: 'topic',
  193. a: 'userWrongBank'
  194. }), {
  195. page: this.page++,
  196. limit: this.limit,
  197. is_master: this.is_master
  198. }, function (res) {
  199. var questions = res.data.data;
  200. for (var i = questions.length; i--;) {
  201. switch (questions[i].question_type) {
  202. case 1:
  203. questions[i].question_type_text = '单选题';
  204. break;
  205. case 2:
  206. questions[i].question_type_text = '多选题';
  207. break;
  208. case 3:
  209. questions[i].question_type_text = '判断题';
  210. break;
  211. }
  212. }
  213. vm.questions = vm.questions.concat(questions);
  214. vm.loading = false;
  215. vm.finished = vm.limit > questions.length;
  216. });
  217. },
  218. onTab: function (master) {
  219. if (this.loading) {
  220. return;
  221. }
  222. this.is_master = master;
  223. this.questions = [];
  224. this.page = 1;
  225. this.finished = false;
  226. this.getQuestions();
  227. },
  228. goQuestion: function (item) {
  229. localStorage.setItem('wrong_question', JSON.stringify({
  230. id: item.id,
  231. is_master: this.is_master
  232. }));
  233. window.location.assign("{:url('topic/question_detail_wrong')}");
  234. }
  235. }
  236. });
  237. });
  238. </script>
  239. {/block}