question_record.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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. if(this.goodsData.examConfigList) {
  119. let count = await this.examRecordCount(id);
  120. //超过答题次数
  121. if(count >= this.goodsData.examConfigList) {
  122. uni.showToast({
  123. title:'该试卷只能答题'+this.goodsData.examConfigList+'次!'
  124. })
  125. return
  126. }
  127. }
  128. uni.navigateTo({
  129. url:'/pages2/bank/questionBankExplain?id='+id+'&goodsid='+goodsId+'&moduleId='+moduleId+'&chapterId='+chapterId+''
  130. })
  131. },
  132. /**
  133. * 查询试卷历史做题次数
  134. */
  135. examRecordCount(examId) {
  136. return new Promise(resolve => {
  137. this.$api.examRecordCount({
  138. examId:examId,
  139. goodsId:this.id
  140. }).then(res => {
  141. resolve(res.data.data)
  142. })
  143. })
  144. },
  145. getDetail(){
  146. return new Promise(resolve => {
  147. this.$api.goodsDetail(this.id).then(res => {
  148. this.goodsData = res.data.data;
  149. resolve()
  150. })
  151. })
  152. },
  153. testClick(item) {
  154. this.index = 0
  155. this.param.goodsId = item.goodsId
  156. this.param.pageNum = 1
  157. this.getExamRecordList()
  158. },
  159. paperClick(item) {
  160. this.index = 0
  161. this.param.paperId = item.paperId
  162. this.param.pageNum = 1
  163. this.getExamRecordList()
  164. },
  165. tab(e) {
  166. this.index = e.currentTarget.dataset.index;
  167. },
  168. examaperList() {
  169. this.$api.examaperList({
  170. }).then(res => {
  171. this.list1 = res.data.rows;
  172. })
  173. },
  174. listGoodsUserQuestion() {
  175. this.$api.listGoodsUserQuestion({
  176. }).then(res => {
  177. this.list = res.data.rows;
  178. })
  179. },
  180. },
  181. }
  182. </script>
  183. <style >
  184. page {
  185. background: #EAEEF1;
  186. }
  187. </style>
  188. <style lang="scss" scope>
  189. .tabs {
  190. position:fixed;
  191. left:0;
  192. width:100%;
  193. top:0;
  194. display: flex;
  195. z-index: 10;
  196. .tab {
  197. flex:1;
  198. height: 80rpx;
  199. text-align: center;
  200. line-height: 80rpx;
  201. background: #FFFFFF;
  202. font-size: 32rpx;
  203. color: #999999;
  204. &.active {
  205. color:#333333;
  206. }
  207. }
  208. }
  209. .record {
  210. margin-top:80rpx;
  211. padding:16rpx 8rpx;
  212. -moz-column-count:2; /* Firefox */
  213. -webkit-column-count:2; /* Safari 和 Chrome */
  214. column-count:2;
  215. -moz-column-gap: 16rpx;
  216. -webkit-column-gap: 16rpx;
  217. column-gap: 16rpx;
  218. .item {
  219. margin-bottom:16rpx;
  220. -moz-page-break-inside: avoid;
  221. -webkit-column-break-inside: avoid;
  222. break-inside: avoid;
  223. background: #FFFFFF;
  224. border-radius: 16rpx;
  225. padding:65rpx 20rpx 22rpx;
  226. position: relative;
  227. overflow: hidden;
  228. .note {
  229. color:#fff;
  230. position:absolute;
  231. left:0;
  232. top:0;
  233. width: 112rpx;
  234. height: 40rpx;
  235. text-align: center;
  236. line-height: 40rpx;
  237. background: linear-gradient(0deg, #4FACFE, #007AFF);
  238. border-radius: 16rpx 0px 16rpx 0rpx;
  239. }
  240. .title {
  241. font-size: 32rpx;
  242. color: #333333;
  243. font-weight: bold;
  244. }
  245. .desc {
  246. margin-top:26rpx;
  247. view {
  248. margin:16rpx 0;
  249. image {
  250. width: 23rpx;
  251. height: 24rpx;
  252. }
  253. text {
  254. margin-left:15rpx;
  255. font-size: 24rpx;
  256. color: #999999;
  257. line-height: 36rpx;
  258. }
  259. }
  260. }
  261. .btns {
  262. margin-top:26rpx;
  263. display: flex;
  264. justify-content: space-around;
  265. .btn {
  266. width: 100rpx;
  267. height: 48rpx;
  268. line-height: 48rpx;
  269. text-align: center;
  270. color:#007AFF;
  271. background: #FFFFFF;
  272. border: 1rpx solid #007AFF;
  273. border-radius: 16rpx;
  274. }
  275. }
  276. }
  277. }
  278. .modal {
  279. position:fixed;
  280. left:0;
  281. width:100%;
  282. top:80rpx;
  283. bottom:0;
  284. .content {
  285. position: relative;
  286. z-index: 10;
  287. background:#fff;
  288. padding:8rpx 12rpx 20rpx;
  289. display: flex;
  290. flex-wrap: wrap;
  291. .top {
  292. margin:0 auto;
  293. width: 726rpx;
  294. height: 80rpx;
  295. background: #007AFF;
  296. border-radius: 16rpx;
  297. color:#fff;
  298. text-align: center;
  299. line-height: 80rpx;
  300. font-size: 32rpx;
  301. }
  302. .list {
  303. margin-top:16rpx;
  304. display: flex;
  305. flex-wrap: wrap;
  306. justify-content: space-between;
  307. .item {
  308. padding:25rpx 20rpx;
  309. width: 359rpx;
  310. background: #F5F5F5;
  311. border-radius: 16rpx;
  312. font-size: 32rpx;
  313. color: #666666;
  314. margin:8rpx 0;
  315. }
  316. }
  317. }
  318. .modal_wrap {
  319. position: absolute;
  320. left:0;
  321. width:100%;
  322. top:0;
  323. height:100%;
  324. background:rgba(0,0,0,0.3)
  325. }
  326. }
  327. </style>