wrong.vue 9.3 KB

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