wrong.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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. orderGoodsId:'',
  96. modalTop:0,
  97. };
  98. },
  99. onPullDownRefresh() {},
  100. onShow() {
  101. this.getData();
  102. },
  103. onLoad(option) {
  104. this.orderGoodsId = option.orderGoodsId || ''
  105. this.listGoodsUserQuestion();
  106. this.examaperList();
  107. uni.getSystemInfo({
  108. success:(e) => {
  109. let info = uni.createSelectorQuery().select(".nav");
  110. info.boundingClientRect((navData) => { //data - 各种参数
  111. let info = uni.createSelectorQuery().select(".sceenBox");
  112. info.boundingClientRect((tabData) => { //data - 各种参数
  113. this.modalTop = navData.height + tabData.height
  114. console.log(navData) // 获取元素宽度
  115. console.log(tabData) // 获取元素宽度
  116. }).exec()
  117. }).exec()
  118. }
  119. })
  120. },
  121. methods: {
  122. getData() {
  123. if(this.type == 1) {
  124. this.wrongRecordList()
  125. } else if(this.type == 2) {
  126. this.wrongRecordTypeList();
  127. }
  128. },
  129. examaperList() {
  130. this.$api.examaperList({
  131. }).then(res => {
  132. this.scennList2 = [...this.scennList2,...res.data.rows];
  133. })
  134. },
  135. listGoodsUserQuestion() {
  136. this.$api.listGoodsUserQuestion({
  137. }).then(res => {
  138. this.scennList1 = [...this.scennList1,...res.data.rows];
  139. })
  140. },
  141. wrongRecordList() {
  142. this.$api.wrongRecordList({
  143. paperId:this.paperid,
  144. goodsId:this.goodsid,
  145. orderGoodsId:this.orderGoodsId
  146. }).then(res => {
  147. this.testList = res.data;
  148. let total = 0;
  149. this.testList.rows.forEach(item => {
  150. total += item.wrongQuestionNum;
  151. })
  152. this.total = total
  153. })
  154. },
  155. wrongRecordTypeList() {
  156. this.$api.wrongRecordTypeList({
  157. paperId:this.paperid,
  158. orderGoodsId:this.orderGoodsId
  159. }).then(res => {
  160. this.typeList = res.data;
  161. let total = 0;
  162. this.typeList.rows.forEach(item => {
  163. total += item.num;
  164. })
  165. this.total = total
  166. })
  167. },
  168. selectType(type) {
  169. this.type = type;
  170. this.getData();
  171. },
  172. showSceen(type){
  173. if(this.sceenType == type) {
  174. this.sceenType = null
  175. return;
  176. }
  177. this.sceenType = type
  178. },
  179. hideSceen(){
  180. this.sceenType = null
  181. },
  182. choseRecord(index) {
  183. this.sceenType = null
  184. this.scennList1.forEach((item,idx)=>{
  185. this.$set(item, 'checked',false)
  186. if(index==idx){
  187. this.goodsid = item.goodsId
  188. this.$set(item, 'checked',true)
  189. }
  190. })
  191. this.getData()
  192. },
  193. choseType(index) {
  194. this.sceenType = null
  195. this.scennList2.forEach((item,idx)=>{
  196. this.$set(item, 'checked',false)
  197. if(index==idx){
  198. this.paperid = item.paperId
  199. this.$set(item, 'checked',true)
  200. }
  201. })
  202. this.getData()
  203. },
  204. }
  205. };
  206. </script>
  207. <style lang="scss">
  208. page {
  209. background: #EAEEF1;
  210. }
  211. </style>
  212. <style scoped lang="scss">
  213. .animals{
  214. transition: all 0.3s;
  215. transform: rotate(180deg);
  216. }
  217. .sceenBox {
  218. width:100%;
  219. height: 80rpx;
  220. background: #FFFFFF;
  221. display: flex;
  222. justify-content: center;
  223. align-items: center;
  224. font-size: 32rpx;
  225. font-family: PingFang SC;
  226. font-weight: 500;
  227. color: #999999;
  228. position: fixed;
  229. z-index: 999;
  230. border-bottom: 1px solid #eee;
  231. .item{
  232. flex:1;
  233. text-align: center;
  234. &.active{
  235. color:#333;
  236. font-weight: bold;
  237. .icon{
  238. transform: rotate(180deg);
  239. }
  240. }
  241. }
  242. }
  243. .sceenModel{
  244. left:0;
  245. bottom:0;
  246. width:100%;
  247. position: fixed;
  248. z-index: 998;
  249. .sceenModelBg{
  250. width:100%;
  251. height:100%;
  252. position: fixed;
  253. background: rgba(0,0,0,.3);
  254. z-index: 998;
  255. }
  256. .sceenMain{
  257. position: relative;
  258. z-index: 999;
  259. background: #fff;
  260. height:80%;
  261. .sceenMainContent {
  262. display: flex;
  263. flex-wrap: wrap;
  264. padding: 8rpx;
  265. justify-content: space-between;
  266. .item{
  267. width: 350rpx;
  268. background: #F5F5F5;
  269. border-radius: 16rpx;
  270. padding: 25rpx 19rpx;
  271. margin: 8rpx;
  272. font-size: 32rpx;
  273. font-family: PingFang SC;
  274. font-weight: bold;
  275. color: #666666;
  276. &.active{
  277. background: #007AFF;
  278. color:#fff;
  279. }
  280. &:first-child{
  281. width:100%;
  282. text-align: center;
  283. }
  284. }
  285. }
  286. }
  287. }
  288. .wrap{
  289. padding:96rpx 16rpx 16rpx;
  290. }
  291. .wrongHead{
  292. background: #FFFFFF;
  293. border-radius: 16px;
  294. padding:24rpx;
  295. .title{
  296. font-size: 30rpx;
  297. font-family: PingFang SC;
  298. font-weight: bold;
  299. color: #333333;
  300. .sub{
  301. font-size: 20rpx;
  302. font-weight: 500;
  303. color: #999999;
  304. }
  305. }
  306. .progress{
  307. width: 180rpx;
  308. height: 180rpx;
  309. line-height: 140rpx;
  310. border: 20rpx solid #EEEEEE;
  311. border-radius: 50%;
  312. margin: 24rpx auto;
  313. font-size: 50rpx;
  314. text-align: center;
  315. }
  316. }
  317. .wrongTab{
  318. display: flex;
  319. margin: 24rpx 0;
  320. .item{
  321. width: 144rpx;
  322. height: 48rpx;
  323. line-height: 48rpx;
  324. text-align: center;
  325. background: #fff;
  326. border-radius: 16px;
  327. font-size: 28rpx;
  328. font-family: PingFang SC;
  329. font-weight: 500;
  330. color: #666666;
  331. margin-left: 15rpx;
  332. &.active{
  333. background: #007AFF;
  334. color: #fff;
  335. }
  336. }
  337. }
  338. .wrongList{
  339. margin-top:20rpx;
  340. .item{
  341. background: #FFFFFF;
  342. border-radius: 16rpx;
  343. padding: 0 30rpx;
  344. margin-bottom: 16rpx;
  345. overflow: hidden;
  346. .title{
  347. font-size: 32rpx;
  348. font-family: PingFang SC;
  349. font-weight: bold;
  350. color: #333333;
  351. margin: 40rpx 0 17rpx;
  352. }
  353. .bt{
  354. display: flex;
  355. justify-content: space-between;
  356. align-items: center;
  357. padding-bottom: 24rpx;
  358. .left{
  359. width: 176rpx;
  360. height: 40rpx;
  361. background: #FFFFFF;
  362. border: 1px solid #EEEEEE;
  363. border-radius: 16rpx;
  364. font-size: 26rpx;
  365. font-family: PingFang SC;
  366. font-weight: 500;
  367. color: #999999;
  368. display: flex;
  369. justify-content: center;
  370. align-items: center;
  371. .num{
  372. font-size: 26rpx;
  373. font-weight: bold;
  374. color: #FF3B30;
  375. margin-left: 16rpx;
  376. }
  377. }
  378. .right{
  379. display: flex;
  380. .btn{
  381. width: 100rpx;
  382. height: 48rpx;
  383. background: #FFFFFF;
  384. border: 1px solid #007AFF;
  385. border-radius: 16px;
  386. font-size: 24rpx;
  387. font-family: PingFang SC;
  388. font-weight: 500;
  389. color: #007AFF;
  390. margin-left:9rpx;
  391. display: flex;
  392. align-items: center;
  393. justify-content: center;
  394. }
  395. }
  396. }
  397. }
  398. }
  399. </style>