question_user.html 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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. .user-question-page {
  18. padding: .2rem .3rem;
  19. }
  20. .user-question-page .nav {
  21. display: -webkit-box;
  22. display: flex;
  23. border-radius: .12rem;
  24. background-color: #fff;
  25. }
  26. .user-question-page .nav a {
  27. -webkit-box-flex: 1;
  28. flex: 1;
  29. position: relative;
  30. height: .9rem;
  31. font-size: .28rem;
  32. line-height: .9rem;
  33. text-align: center;
  34. color: #333;
  35. }
  36. .user-question-page .nav a.on {
  37. color: #191C6E;
  38. }
  39. .user-question-page .nav a.on::before {
  40. content: "";
  41. position: absolute;
  42. bottom: 0;
  43. left: 50%;
  44. width: .7rem;
  45. height: .04rem;
  46. border-radius: .02rem;
  47. background-color: #191C6E;
  48. -webkit-transform: translateX(-50%);
  49. transform: translateX(-50%);
  50. }
  51. .user-question-page .content {
  52. margin-top: .2rem;
  53. }
  54. .user-question-page .problem li {
  55. display: flex;
  56. flex-direction: column;
  57. justify-content: space-between;
  58. height: 2.05rem;
  59. padding: .3rem .3rem .21rem;
  60. border-radius: .12rem;
  61. background-color: #FFFFFF;
  62. }
  63. .user-question-page .problem .title {
  64. display: -webkit-box;
  65. -webkit-box-orient: vertical;
  66. -webkit-line-clamp: 2;
  67. overflow: hidden;
  68. font-size: .3rem;
  69. line-height: .42rem;
  70. color: #282828;
  71. }
  72. .user-question-page .problem .group {
  73. display: -webkit-box;
  74. display: flex;
  75. -webkit-box-align: center;
  76. align-items: center;
  77. font-size: .22rem;
  78. color: #ff6b00;
  79. }
  80. .user-question-page .problem .group div:nth-child(2) {
  81. -webkit-box-flex: 1;
  82. flex: 1;
  83. margin-left: .15rem;
  84. }
  85. .user-question-page .problem .group .gray {
  86. color: #999;
  87. }
  88. .user-question-page .problem .group a {
  89. height: .38rem;
  90. padding: 0 .2rem;
  91. border-radius: .19rem;
  92. margin-left: .1rem;
  93. background-color: #191C6E;
  94. font-size: .2rem;
  95. line-height: .38rem;
  96. color: #FFFFFF;
  97. }
  98. .user-question-page .problem .group a:first-of-type {
  99. background-color: #E8F3FF;
  100. color: #191C6E;
  101. }
  102. .user-question-page .problem .group a:only-of-type {
  103. background-color: #191C6E;
  104. color: #FFFFFF;
  105. }
  106. .user-question-page .question li {
  107. display: flex;
  108. padding: .2rem;
  109. border-radius: .12rem;
  110. margin-top: .2rem;
  111. background-color: #FFFFFF;
  112. }
  113. .user-question-page .question img {
  114. display: block;
  115. width: 2.5rem;
  116. height: 1.4rem;
  117. border-radius: .1rem;
  118. object-fit: contain;
  119. }
  120. .user-question-page .question li>div:last-child {
  121. flex: 1;
  122. display: flex;
  123. flex-direction: column;
  124. justify-content: space-between;
  125. margin-left: .24rem;
  126. }
  127. .user-question-page .question .title {
  128. display: -webkit-box;
  129. -webkit-box-orient: vertical;
  130. -webkit-line-clamp: 2;
  131. overflow: hidden;
  132. font-size: .3rem;
  133. line-height: .41rem;
  134. color: #333333;
  135. }
  136. .user-question-page .question .group {
  137. display: -webkit-box;
  138. display: flex;
  139. -webkit-box-pack: justify;
  140. justify-content: space-between;
  141. -webkit-box-align: center;
  142. align-items: center;
  143. font-size: .22rem;
  144. color: #ff6b00;
  145. }
  146. .user-question-page .question .gray {
  147. color: #999;
  148. }
  149. .user-question-page .question .group a {
  150. height: .38rem;
  151. padding: 0 .2rem;
  152. border-radius: .19rem;
  153. margin-left: .1rem;
  154. background-color: #191C6E;
  155. font-size: .2rem;
  156. line-height: .38rem;
  157. color: #FFFFFF;
  158. }
  159. .user-question-page .question .group a:first-of-type {
  160. background-color: #E8F3FF;
  161. color: #191C6E;
  162. }
  163. .user-question-page .question .group a:only-of-type {
  164. background-color: #191C6E;
  165. color: #FFFFFF;
  166. }
  167. .empty {
  168. position: fixed;
  169. top: 50%;
  170. left: 50%;
  171. -webkit-transform: translate(-50%, -50%);
  172. transform: translate(-50%, -50%);
  173. font-size: .3rem;
  174. text-align: center;
  175. color: #999;
  176. }
  177. .empty img {
  178. width: 4.14rem;
  179. vertical-align: middle;
  180. -webkit-touch-callout: none;
  181. pointer-events: none;
  182. }
  183. </style>
  184. {/block}
  185. {block name="content"}
  186. <div v-cloak id="app">
  187. <div class="user-question-page">
  188. <div class="nav">
  189. <!-- <a :class="{ on: type === 2}" href="javascript:" @click="onNav(2)">考试</a> -->
  190. <!-- <a :class="{ on: type === 1}" href="javascript:" @click="onNav(1)">练习</a> -->
  191. </div>
  192. <div class="content">
  193. <ul v-if="type === 2" class="question">
  194. <li v-for="item in questions" :key="item.test_id">
  195. <div>
  196. <img :src="item.image">
  197. </div>
  198. <div>
  199. <div class="title">{{ item.title }}</div>
  200. <div class="group">
  201. <div :class="{ gray: !item.number }">{{ item.number ? '已完成' : '未完成' }}</div>
  202. <a v-if="item.number" :href="'{:url('special/question_index')}?id=' + item.test_id">再考一次</a>
  203. <a :href="'{:url('topic/question_result')}?from=question_user&test_id=' + item.test_id+'&type=2'" v-if="item.number>0">答题结果</a>
  204. <a :href="'{:url('special/question_index')}?id=' + item.test_id" v-else>开始答题</a>
  205. </div>
  206. </div>
  207. </li>
  208. </ul>
  209. <!-- <ul v-else class="problem">
  210. <li v-for="item in questions">
  211. <div class="title">{{ item.title }}</div>
  212. <div class="group">
  213. <div>共{{ item.item_number }}题</div>
  214. <div :class="{ gray: !item.number }">{{ item.number ? '已完成' : '未完成' }}</div>
  215. <a v-if="item.number" :href="'{:url('topic/problem_index')}?id=' + item.test_id">再考一次</a>
  216. <a :href="'{:url('topic/problem_result')}?test_id=' + item.test_id" v-if="item.number>0">答题结果</a>
  217. <a :href="'{:url('topic/problem_index')}?id=' + item.test_id" v-else>开始答题</a>
  218. </div>
  219. </li>
  220. </ul>
  221. -->
  222. <div v-if="page > 1 && !loading && !questions.length" class="empty">
  223. <img src="{__WAP_PATH}zsff/images/empty-box.png">
  224. <div>暂无数据</div>
  225. </div>
  226. </div>
  227. </div>
  228. <quick-menu></quick-menu>
  229. </div>
  230. <script>
  231. require([
  232. 'vue',
  233. 'helper',
  234. 'store',
  235. 'quick'
  236. ], function (Vue, $h, $http) {
  237. var vm = new Vue({
  238. el: '#app',
  239. data: {
  240. type: 2,
  241. page: 1,
  242. limit: 15,
  243. loading: false,
  244. questions: []
  245. },
  246. watch: {
  247. loading: function (val) {
  248. val ? $h.loadFFF() : $h.loadClear();
  249. }
  250. },
  251. created: function () {
  252. var type = $h.getParmas('type');
  253. if (type) {
  254. this.type = parseInt(type);
  255. }
  256. this.getQuestions();
  257. },
  258. mounted: function () {
  259. this.$nextTick(function () {
  260. $h.EventUtil.listenTouchDirection(document, function () {
  261. !vm.loading && vm.getQuestion();
  262. });
  263. });
  264. },
  265. methods: {
  266. getQuestions: function () {
  267. if (this.loading || this.finished) {
  268. return;
  269. }
  270. this.loading = true;
  271. $http.basePost($h.U({
  272. c: 'topic',
  273. a: 'myTestPaper'
  274. }), {
  275. page: this.page++,
  276. limit: this.limit,
  277. type: this.type
  278. }, function (res) {
  279. var data = res.data.data;
  280. vm.loading = false;
  281. vm.questions = vm.questions.concat(data);
  282. vm.finished = vm.limit > data.length;
  283. });
  284. },
  285. onNav: function (type) {
  286. this.type = type;
  287. this.questions = [];
  288. this.page = 1;
  289. this.finished = false;
  290. this.getQuestions();
  291. }
  292. }
  293. });
  294. });
  295. </script>
  296. {/block}