collect.vue 12 KB

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