question_record.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view>
  3. <view class="tabs">
  4. <view class="tab" :class="{active:index==1}" data-index="1" @click="tab">全部题库记录</view>
  5. <view class="tab" :class="{active:index==2}" data-index="2" @click="tab">全部试卷类型</view>
  6. </view>
  7. <view class="record">
  8. <view class="item" v-for="record in recordList">
  9. <view class="note">{{record.paperName}}</view>
  10. <view class="title">{{record.examName}}</view>
  11. <view class="desc">
  12. <view>
  13. <image src="/static/icon/wk_icon2.png"></image>
  14. <text>{{$method.timestampToTime(record.updateTime,false)}}</text>
  15. </view>
  16. <view>
  17. <image src="/static/icon/wk_icon2.png"></image>
  18. <text>总共 {{record.totalQuestionNum}} 题 做对 {{record.rightQuestionNum}} 题</text>
  19. </view>
  20. </view>
  21. <view class="btns">
  22. <view class="btn" v-if="record.status == 1" @click="doRepeat(record.examId,record.goodsId,record.moduleExamId,record.chapterExamId)">
  23. 重做
  24. </view>
  25. <navigator :url="'/pages2/bank/questionBankExplain?explain=1&id='+record.examId+'&goodsid='+record.goodsId+'&moduleId='+record.moduleExamId+'&chapterId='+record.chapterExamId+''">
  26. <view class="btn" v-if="record.status == 1">
  27. 解析
  28. </view>
  29. </navigator>
  30. <navigator :url="'/pages2/bank/question_report?id='+record.recordId">
  31. <view class="btn" v-if="record.status == 1">
  32. 报告
  33. </view>
  34. </navigator>
  35. <navigator :url="'/pages2/bank/questionBankExplain?continue=1&recordId='+record.recordId+'&id='+record.examId+'&goodsid='+record.goodsId+'&moduleId='+record.moduleExamId+'&chapterId='+record.chapterExamId+''">
  36. <view class="btn" v-if="record.status == 0">
  37. 继续
  38. </view>
  39. </navigator>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="modal" v-if="index==1">
  44. <view class="content">
  45. <view class="top">全部题库记录</view>
  46. <view class="list">
  47. <view class="item" v-for="listItem in list" @click="testClick(listItem)">{{listItem.goodsName}}</view>
  48. </view>
  49. </view>
  50. <view class="modal_wrap" @click="index=0"></view>
  51. </view>
  52. <view class="modal" v-if="index==2">
  53. <view class="content">
  54. <view class="top">全部试卷类型</view>
  55. <view class="list">
  56. <view class="item" v-for="listItem in list1" @click="paperClick(listItem)">{{listItem.paperName}}</view>
  57. </view>
  58. </view>
  59. <view class="modal_wrap" @click="index=0"></view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. index:0,
  68. list:[],
  69. list1:[],
  70. recordList:[],
  71. goodsData:{},
  72. param:{
  73. pageNum:1,
  74. pageSize:10
  75. },
  76. total:0
  77. }
  78. },
  79. onLoad(option) {
  80. this.listGoodsUserQuestion();
  81. this.examaperList();
  82. this.getExamRecordList()
  83. },
  84. onPullDownRefresh(){
  85. let that = this
  86. this.param = {
  87. pageNum:1,
  88. pageSize:10
  89. }
  90. this.getExamRecordList()
  91. setTimeout(function(){
  92. uni.stopPullDownRefresh()
  93. },500)
  94. },
  95. onReachBottom() {
  96. if (this.recordList.length < this.total) {
  97. this.param.pageNum++
  98. this.getExamRecordList()
  99. }
  100. },
  101. onShow(){
  102. },
  103. methods: {
  104. getExamRecordList(){
  105. if(this.param.pageNum==1){
  106. this.recordList = []
  107. }
  108. this.$api.examRecordList(this.param).then(res => {
  109. this.recordList.push.apply(this.recordList,res.data.rows)
  110. this.total = res.data.total
  111. })
  112. },
  113. /**
  114. * 去做题
  115. */
  116. async doRepeat (id,goodsId,moduleId = 0, chapterId = 0) {
  117. await this.getDetail()
  118. let count = await this.examRecordCount(id);
  119. let answerNum = await this.getExamDetail(id);
  120. //超过答题次数
  121. if(answerNum>0&&count >= answerNum) {
  122. this.$u.toast('该试卷只能答题'+answerNum+'次!');
  123. return
  124. }
  125. uni.navigateTo({
  126. url:'/pages2/bank/questionBankExplain?id='+id+'&goodsid='+goodsId+'&moduleId='+moduleId+'&chapterId='+chapterId+''
  127. })
  128. },
  129. /**
  130. * @param {Object} exam_id
  131. * 获取试卷可以做的次数
  132. */
  133. getExamDetail(exam_id){
  134. return new Promise(resolve => {
  135. this.$api.getExamDetail(exam_id).then(res => {
  136. resolve(res.data.data.answerNum)
  137. })
  138. })
  139. },
  140. /**
  141. * 查询试卷历史做题次数
  142. */
  143. examRecordCount(examId) {
  144. return new Promise(resolve => {
  145. this.$api.examRecordCount({
  146. examId:examId,
  147. goodsId:this.id
  148. }).then(res => {
  149. resolve(res.data.data)
  150. })
  151. })
  152. },
  153. getDetail(){
  154. return new Promise(resolve => {
  155. this.$api.goodsDetail(this.id).then(res => {
  156. this.goodsData = res.data.data;
  157. resolve()
  158. })
  159. })
  160. },
  161. testClick(item) {
  162. this.index = 0
  163. this.param.goodsId = item.goodsId
  164. this.param.pageNum = 1
  165. this.getExamRecordList()
  166. },
  167. paperClick(item) {
  168. this.index = 0
  169. this.param.paperId = item.paperId
  170. this.param.pageNum = 1
  171. this.getExamRecordList()
  172. },
  173. tab(e) {
  174. this.index = e.currentTarget.dataset.index;
  175. },
  176. examaperList() {
  177. this.$api.examaperList({
  178. }).then(res => {
  179. this.list1 = res.data.rows;
  180. })
  181. },
  182. listGoodsUserQuestion() {
  183. this.$api.listGoodsUserQuestion({
  184. }).then(res => {
  185. this.list = res.data.rows;
  186. })
  187. },
  188. },
  189. }
  190. </script>
  191. <style >
  192. page {
  193. background: #EAEEF1;
  194. }
  195. </style>
  196. <style lang="scss" scope>
  197. .tabs {
  198. position:fixed;
  199. left:0;
  200. width:100%;
  201. top:0;
  202. display: flex;
  203. z-index: 10;
  204. .tab {
  205. flex:1;
  206. height: 80rpx;
  207. text-align: center;
  208. line-height: 80rpx;
  209. background: #FFFFFF;
  210. font-size: 32rpx;
  211. color: #999999;
  212. &.active {
  213. color:#333333;
  214. }
  215. }
  216. }
  217. .record {
  218. margin-top:80rpx;
  219. padding:16rpx 8rpx;
  220. -moz-column-count:2; /* Firefox */
  221. -webkit-column-count:2; /* Safari 和 Chrome */
  222. column-count:2;
  223. -moz-column-gap: 16rpx;
  224. -webkit-column-gap: 16rpx;
  225. column-gap: 16rpx;
  226. .item {
  227. margin-bottom:16rpx;
  228. -moz-page-break-inside: avoid;
  229. -webkit-column-break-inside: avoid;
  230. break-inside: avoid;
  231. background: #FFFFFF;
  232. border-radius: 16rpx;
  233. padding:65rpx 20rpx 22rpx;
  234. position: relative;
  235. overflow: hidden;
  236. .note {
  237. color:#fff;
  238. position:absolute;
  239. left:0;
  240. top:0;
  241. width: 112rpx;
  242. height: 40rpx;
  243. text-align: center;
  244. line-height: 40rpx;
  245. background: linear-gradient(0deg, #4FACFE, #007AFF);
  246. border-radius: 16rpx 0px 16rpx 0rpx;
  247. }
  248. .title {
  249. font-size: 32rpx;
  250. color: #333333;
  251. font-weight: bold;
  252. }
  253. .desc {
  254. margin-top:26rpx;
  255. view {
  256. margin:16rpx 0;
  257. image {
  258. width: 23rpx;
  259. height: 24rpx;
  260. }
  261. text {
  262. margin-left:15rpx;
  263. font-size: 24rpx;
  264. color: #999999;
  265. line-height: 36rpx;
  266. }
  267. }
  268. }
  269. .btns {
  270. margin-top:26rpx;
  271. display: flex;
  272. justify-content: space-around;
  273. .btn {
  274. width: 100rpx;
  275. height: 48rpx;
  276. line-height: 48rpx;
  277. text-align: center;
  278. color:#007AFF;
  279. background: #FFFFFF;
  280. border: 1rpx solid #007AFF;
  281. border-radius: 16rpx;
  282. }
  283. }
  284. }
  285. }
  286. .modal {
  287. position:fixed;
  288. left:0;
  289. width:100%;
  290. top:80rpx;
  291. bottom:0;
  292. .content {
  293. position: relative;
  294. z-index: 10;
  295. background:#fff;
  296. padding:8rpx 12rpx 20rpx;
  297. display: flex;
  298. flex-wrap: wrap;
  299. .top {
  300. margin:0 auto;
  301. width: 726rpx;
  302. height: 80rpx;
  303. background: #007AFF;
  304. border-radius: 16rpx;
  305. color:#fff;
  306. text-align: center;
  307. line-height: 80rpx;
  308. font-size: 32rpx;
  309. }
  310. .list {
  311. margin-top:16rpx;
  312. display: flex;
  313. flex-wrap: wrap;
  314. justify-content: space-between;
  315. .item {
  316. padding:25rpx 20rpx;
  317. width: 359rpx;
  318. background: #F5F5F5;
  319. border-radius: 16rpx;
  320. font-size: 32rpx;
  321. color: #666666;
  322. margin:8rpx 0;
  323. }
  324. }
  325. }
  326. .modal_wrap {
  327. position: absolute;
  328. left:0;
  329. width:100%;
  330. top:0;
  331. height:100%;
  332. background:rgba(0,0,0,0.3)
  333. }
  334. }
  335. </style>