wrong.vue 11 KB

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