wrong.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <template>
  2. <view class="safeArea">
  3. <view class="sceenBox">
  4. <view :class="['item', {'active':sceenType===1} ]" @click="showSceen(1)">全部题库记录<u-icon class="icon" name="arrow-down"></u-icon></view>
  5. <view :class="['item', {'active':sceenType===2} ]" @click="showSceen(2)">全部试卷类型<u-icon class="icon" name="arrow-down"></u-icon></view>
  6. </view>
  7. <view class="sceenModel" v-if="sceenType">
  8. <view class="sceenModelBg" @click="hideSceen"></view>
  9. <view class="sceenMain">
  10. <template v-if="sceenType===1">
  11. <view :class="['item',{'active':item.checked}]" v-for="(item, index) in scennList1" :key="index" @click="choseRecord(index)">{{item.goodsName}}</view>
  12. </template>
  13. <template v-if="sceenType===2">
  14. <view :class="['item',{'active':item.checked}]" v-for="(item, index) in scennList2" :key="index" @click="choseType(index)">{{item.paperName}}</view>
  15. </template>
  16. </view>
  17. </view>
  18. <view class="wrap">
  19. <view class="wrongTab">
  20. <view class="item" :class="{active:type == 1}" @click="selectType(1)">试卷归类</view>
  21. <view class="item" :class="{active:type == 2}" @click="selectType(2)">题型归类</view>
  22. </view>
  23. <view class="wrongHead">
  24. <view class="title">错题统计<text class="sub">(不含简答和案例题)</text></view>
  25. <view class="progress">
  26. <text>{{total}}</text>
  27. </view>
  28. </view>
  29. <view class="wrongList" v-if="type == 1">
  30. <view class="item" v-for="(item,index) in testList.rows" :key="index">
  31. <view class="title">{{item.examName}}</view>
  32. <view class="bt">
  33. <view class="left">错题数<text class="num">{{item.wrongQuestionNum}}</text></view>
  34. <view class="right">
  35. <navigator :url="'/pages2/subject/wrongBank?id='+item.examId">
  36. <view class="btn">重做</view>
  37. </navigator>
  38. <navigator :url="'/pages2/subject/wrongBank?id='+item.examId+'&explain=1'">
  39. <view class="btn">解析</view>
  40. </navigator>
  41. <!-- <view class="btn">解析</view> -->
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="wrongList" v-if="type == 2">
  47. <view class="item" v-for="(item,index) in typeList.rows" :key="index">
  48. <view class="title">
  49. <text v-if="item.type==1">单选题</text>
  50. <text v-if="item.type==2">多选题</text>
  51. <text v-if="item.type==3">判断题</text>
  52. <text v-if="item.type==4">案例题</text>
  53. <text v-if="item.type==5">简答题</text>
  54. </view>
  55. <view class="bt">
  56. <view class="left">错题数<text class="num">{{item.num}}</text></view>
  57. <view class="right">
  58. <navigator :url="'/pages2/subject/wrongTypeBank?type='+item.type">
  59. <view class="btn">重做</view>
  60. </navigator>
  61. <navigator :url="'/pages2/subject/wrongTypeBank?type='+item.type+'&explain=1'">
  62. <view class="btn">解析</view>
  63. </navigator>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import { mapGetters } from 'vuex';
  73. export default {
  74. components: {},
  75. data() {
  76. return {
  77. sceenType: null,
  78. scennList1:[
  79. {goodsId: '', goodsName: '全部题库记录', checked: true}
  80. ],
  81. scennList2:[
  82. {paperId: '', paperName: '全部试卷类型', checked: true}
  83. ],
  84. type:1,
  85. testList:[],
  86. typeList:[],
  87. goodsid:'',
  88. paperid:'',
  89. total:0,
  90. };
  91. },
  92. onPullDownRefresh() {},
  93. onShow() {
  94. this.getData();
  95. },
  96. onLoad(option) {
  97. this.listGoodsUserQuestion();
  98. this.examaperList();
  99. },
  100. methods: {
  101. getData() {
  102. if(this.type == 1) {
  103. this.wrongRecordList()
  104. } else if(this.type == 2) {
  105. this.wrongRecordTypeList();
  106. }
  107. },
  108. examaperList() {
  109. this.$api.examaperList({
  110. }).then(res => {
  111. this.scennList2 = [...this.scennList2,...res.data.rows];
  112. })
  113. },
  114. listGoodsUserQuestion() {
  115. this.$api.listGoodsUserQuestion({
  116. }).then(res => {
  117. this.scennList1 = [...this.scennList1,...res.data.rows];
  118. })
  119. },
  120. wrongRecordList() {
  121. this.$api.wrongRecordList({
  122. paperId:this.paperid,
  123. goodsId:this.goodsid
  124. }).then(res => {
  125. this.testList = res.data;
  126. let total = 0;
  127. this.testList.rows.forEach(item => {
  128. total += item.wrongQuestionNum;
  129. })
  130. this.total = total
  131. })
  132. },
  133. wrongRecordTypeList() {
  134. this.$api.wrongRecordTypeList({
  135. paperId:this.paperid,
  136. goodsId:this.goodsid
  137. }).then(res => {
  138. this.typeList = res.data;
  139. let total = 0;
  140. this.typeList.rows.forEach(item => {
  141. total += item.num;
  142. })
  143. this.total = total
  144. })
  145. },
  146. selectType(type) {
  147. this.type = type;
  148. this.getData();
  149. },
  150. showSceen(type){
  151. this.sceenType = type
  152. },
  153. hideSceen(){
  154. this.sceenType = null
  155. },
  156. choseRecord(index) {
  157. this.sceenType = null
  158. this.scennList1.forEach((item,idx)=>{
  159. this.$set(item, 'checked',false)
  160. if(index==idx){
  161. this.goodsid = item.goodsId
  162. this.$set(item, 'checked',true)
  163. }
  164. })
  165. this.getData()
  166. },
  167. choseType(index) {
  168. this.sceenType = null
  169. this.scennList2.forEach((item,idx)=>{
  170. this.$set(item, 'checked',false)
  171. if(index==idx){
  172. this.paperid = item.paperId
  173. this.$set(item, 'checked',true)
  174. }
  175. })
  176. this.getData()
  177. },
  178. }
  179. };
  180. </script>
  181. <style lang="scss">
  182. page {
  183. background: #EAEEF1;
  184. }
  185. </style>
  186. <style scoped lang="scss">
  187. .sceenBox {
  188. width:100%;
  189. height: 80rpx;
  190. background: #FFFFFF;
  191. display: flex;
  192. justify-content: center;
  193. align-items: center;
  194. font-size: 32rpx;
  195. font-family: PingFang SC;
  196. font-weight: 500;
  197. color: #999999;
  198. position: fixed;
  199. z-index: 999;
  200. border-bottom: 1px solid #eee;
  201. .item{
  202. flex:1;
  203. text-align: center;
  204. &.active{
  205. color:#333;
  206. font-weight: bold;
  207. .icon{
  208. transform: rotate(180deg);
  209. }
  210. }
  211. }
  212. }
  213. .sceenModel{
  214. width:100%;
  215. height:100%;
  216. position: fixed;
  217. z-index: 998;
  218. .sceenModelBg{
  219. width:100%;
  220. height:100%;
  221. position: fixed;
  222. background: rgba(0,0,0,.3);
  223. z-index: 998;
  224. }
  225. .sceenMain{
  226. position: relative;
  227. z-index: 999;
  228. background: #fff;
  229. margin-top: 80rpx;
  230. display: flex;
  231. flex-wrap: wrap;
  232. padding: 8rpx;
  233. justify-content: space-between;
  234. .item{
  235. width: 350rpx;
  236. background: #F5F5F5;
  237. border-radius: 16rpx;
  238. padding: 25rpx 19rpx;
  239. margin: 8rpx;
  240. font-size: 32rpx;
  241. font-family: PingFang SC;
  242. font-weight: bold;
  243. color: #666666;
  244. &.active{
  245. background: #007AFF;
  246. color:#fff;
  247. }
  248. &:first-child{
  249. width:100%;
  250. text-align: center;
  251. }
  252. }
  253. }
  254. }
  255. .wrap{
  256. padding:96rpx 16rpx 16rpx;
  257. }
  258. .wrongHead{
  259. background: #FFFFFF;
  260. border-radius: 16px;
  261. padding:24rpx;
  262. .title{
  263. font-size: 30rpx;
  264. font-family: PingFang SC;
  265. font-weight: bold;
  266. color: #333333;
  267. .sub{
  268. font-size: 20rpx;
  269. font-weight: 500;
  270. color: #999999;
  271. }
  272. }
  273. .progress{
  274. width: 180rpx;
  275. height: 180rpx;
  276. line-height: 140rpx;
  277. border: 20rpx solid #EEEEEE;
  278. border-radius: 50%;
  279. margin: 24rpx auto;
  280. font-size: 50rpx;
  281. text-align: center;
  282. }
  283. }
  284. .wrongTab{
  285. display: flex;
  286. margin: 24rpx 0;
  287. .item{
  288. width: 144rpx;
  289. height: 48rpx;
  290. line-height: 48rpx;
  291. text-align: center;
  292. background: #fff;
  293. border-radius: 16px;
  294. font-size: 28rpx;
  295. font-family: PingFang SC;
  296. font-weight: 500;
  297. color: #666666;
  298. margin-left: 15rpx;
  299. &.active{
  300. background: #007AFF;
  301. color: #fff;
  302. }
  303. }
  304. }
  305. .wrongList{
  306. margin-top:20rpx;
  307. .item{;
  308. background: #FFFFFF;
  309. border-radius: 16rpx;
  310. padding: 0 30rpx;
  311. margin-bottom: 16rpx;
  312. overflow: hidden;
  313. .title{
  314. font-size: 32rpx;
  315. font-family: PingFang SC;
  316. font-weight: bold;
  317. color: #333333;
  318. margin: 40rpx 0 17rpx;
  319. }
  320. .bt{
  321. display: flex;
  322. justify-content: space-between;
  323. align-items: center;
  324. padding-bottom: 24rpx;
  325. .left{
  326. width: 176rpx;
  327. height: 40rpx;
  328. background: #FFFFFF;
  329. border: 1px solid #EEEEEE;
  330. border-radius: 16rpx;
  331. font-size: 26rpx;
  332. font-family: PingFang SC;
  333. font-weight: 500;
  334. color: #999999;
  335. display: flex;
  336. justify-content: center;
  337. align-items: center;
  338. .num{
  339. font-size: 26rpx;
  340. font-weight: bold;
  341. color: #FF3B30;
  342. margin-left: 16rpx;
  343. }
  344. }
  345. .right{
  346. display: flex;
  347. .btn{
  348. width: 100rpx;
  349. height: 48rpx;
  350. background: #FFFFFF;
  351. border: 1px solid #007AFF;
  352. border-radius: 16px;
  353. font-size: 24rpx;
  354. font-family: PingFang SC;
  355. font-weight: 500;
  356. color: #007AFF;
  357. margin-left:9rpx;
  358. display: flex;
  359. align-items: center;
  360. justify-content: center;
  361. }
  362. }
  363. }
  364. }
  365. }
  366. </style>