question_record.vue 7.1 KB

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