index.vue 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475
  1. <template>
  2. <div class="bank-detail">
  3. <section class="section">
  4. <div class="section__body">
  5. <div class="left-box">
  6. <el-tabs v-model="activeName" @tab-click="tabChange">
  7. <el-tab-pane label="章节练习" name="1">
  8. <div class="goods-menu">
  9. <div class="goods-menu__header">
  10. <div class="title">{{ goodsDetail.goodsName }}</div>
  11. <span class="question-num">已做/总数</span>
  12. <span class="question-do"></span>
  13. </div>
  14. <div class="goods-menu__body">
  15. <div
  16. class="item"
  17. v-for="(item, index) in bankList"
  18. :key="index"
  19. >
  20. <template v-if="item.type == 1">
  21. <div class="item__title" @click="moduleExam(item)">
  22. <i
  23. :class="{
  24. 'el-icon-caret-right': !item.showList,
  25. 'el-icon-caret-bottom': item.showList,
  26. }"
  27. ></i>
  28. {{ item.name }}
  29. </div>
  30. <div class="item__content" v-if="item.showList">
  31. <div class="bank-chapter">
  32. <div
  33. class="bank-chapter__item"
  34. v-for="(chapter, chapterIndex) in item.list"
  35. :key="chapterIndex"
  36. >
  37. <div
  38. class="bank-chapter__item__text"
  39. @click="chapterExam(chapter, item.majorId)"
  40. >
  41. <i
  42. :class="{
  43. 'el-icon-caret-right': !chapter.showList,
  44. 'el-icon-caret-bottom': chapter.showList,
  45. }"
  46. ></i
  47. >{{ chapter.name }}
  48. </div>
  49. <div class="bank-section" v-if="chapter.showList">
  50. <div
  51. class="bank-section__item"
  52. v-for="(section, sectionIndex) in chapter.list"
  53. :key="sectionIndex"
  54. >
  55. <div class="bank-section__item__text">
  56. {{ section.examName }}
  57. </div>
  58. <el-button
  59. type="text"
  60. class="btn"
  61. style="width: auto"
  62. >{{ section.questionNum || 0 }}/{{
  63. section.totalQuestionNum || 0
  64. }}</el-button
  65. >
  66. <el-button
  67. v-if="section.recordStatus == -1"
  68. type="primary"
  69. @click="
  70. toDo(
  71. section,
  72. chapter.chapterExamId,
  73. item.majorId
  74. )
  75. "
  76. class="btn"
  77. >开始做题</el-button
  78. >
  79. <el-button
  80. v-if="
  81. section.recordStatus == 0 &&
  82. section.doType == 1
  83. "
  84. type="primary"
  85. @click="
  86. continueDo(
  87. section,
  88. chapter.chapterExamId,
  89. item.majorId
  90. )
  91. "
  92. class="btn"
  93. >继续做题</el-button
  94. >
  95. <el-button
  96. v-if="
  97. section.recordStatus == 1 ||
  98. (section.recordStatus == 0 &&
  99. section.doType == 2)
  100. "
  101. :disabled="
  102. section.answerNum > 0 &&
  103. section.doNum >= section.answerNum
  104. "
  105. type="primary"
  106. @click="
  107. doRepeat(
  108. section,
  109. chapter.chapterExamId,
  110. item.majorId
  111. )
  112. "
  113. class="btn"
  114. >重新做题</el-button
  115. >
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. </template>
  122. <template v-if="item.type == 2">
  123. <div class="item__content">
  124. <div class="bank-chapter">
  125. <div class="bank-chapter__item">
  126. <div
  127. class="bank-chapter__item__text"
  128. @click="chapterExam(item, 0)"
  129. >
  130. <i
  131. :class="{
  132. 'el-icon-caret-right': !item.showList,
  133. 'el-icon-caret-bottom': item.showList,
  134. }"
  135. ></i
  136. >{{ item.name }}
  137. </div>
  138. <div class="bank-section" v-if="item.showList">
  139. <div
  140. class="bank-section__item"
  141. v-for="(section, sectionIndex) in item.list"
  142. :key="sectionIndex"
  143. >
  144. <div class="bank-section__item__text">
  145. {{ section.examName }}
  146. </div>
  147. <el-button
  148. type="text"
  149. class="btn"
  150. style="width: auto"
  151. >{{ section.questionNum || 0 }}/{{
  152. section.totalQuestionNum || 0
  153. }}</el-button
  154. >
  155. <el-button
  156. v-if="section.recordStatus == -1"
  157. type="primary"
  158. @click="toDo(section, item.majorId, 0)"
  159. class="btn"
  160. >开始做题</el-button
  161. >
  162. <el-button
  163. v-if="
  164. section.recordStatus == 0 &&
  165. section.doType == 1
  166. "
  167. type="primary"
  168. @click="continueDo(section, item.majorId, 0)"
  169. class="btn"
  170. >继续做题</el-button
  171. >
  172. <el-button
  173. v-if="
  174. section.recordStatus == 1 ||
  175. (section.recordStatus == 0 &&
  176. section.doType == 2)
  177. "
  178. :disabled="
  179. section.answerNum > 0 &&
  180. section.doNum >= section.answerNum
  181. "
  182. type="primary"
  183. @click="doRepeat(section, item.majorId, 0)"
  184. class="btn"
  185. >重新做题</el-button
  186. >
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192. </template>
  193. <template v-if="item.type == 3">
  194. <div class="item__content">
  195. <div class="bank-section">
  196. <div class="bank-section__item">
  197. <div class="bank-section__item__text">
  198. {{ item.name }}
  199. </div>
  200. <el-button
  201. type="text"
  202. class="btn"
  203. style="width: auto"
  204. >{{ section.questionNum || 0 }}/{{
  205. section.totalQuestionNum || 0
  206. }}</el-button
  207. >
  208. <el-button
  209. v-if="item.recordStatus == -1"
  210. type="primary"
  211. @click="toDo(item, 0, 0)"
  212. class="btn"
  213. >开始做题</el-button
  214. >
  215. <el-button
  216. v-if="item.recordStatus == 0 && item.doType == 1"
  217. type="primary"
  218. @click="continueDo(item, 0, 0)"
  219. class="btn"
  220. >继续做题</el-button
  221. >
  222. <el-button
  223. v-if="
  224. item.recordStatus == 1 ||
  225. (item.recordStatus == 0 && item.doType == 2)
  226. "
  227. :disabled="
  228. item.answerNum > 0 &&
  229. item.doNum >= item.answerNum
  230. "
  231. type="primary"
  232. @click="doRepeat(item, 0, 0)"
  233. class="btn"
  234. >重新做题</el-button
  235. >
  236. </div>
  237. </div>
  238. </div>
  239. </template>
  240. </div>
  241. </div>
  242. </div>
  243. </el-tab-pane>
  244. <el-tab-pane label="收藏题集" name="2">
  245. <div class="goods-collect">
  246. <div class="goods-collect__header">
  247. <div class="selects">
  248. <div class="selects__item">
  249. <el-select
  250. placeholder="请选择"
  251. v-model="collectSelect"
  252. @change="getCollectData"
  253. clearable
  254. @clear="getWrongData"
  255. >
  256. <el-option
  257. v-for="(item, index) in selectList"
  258. :key="index"
  259. :label="item.paperName"
  260. :value="item.paperId"
  261. ></el-option>
  262. </el-select>
  263. </div>
  264. </div>
  265. <div class="tabs">
  266. <el-tabs v-model="collectName" @tab-click="getCollectData">
  267. <el-tab-pane label="试卷归类" name="1"></el-tab-pane>
  268. <el-tab-pane label="题型归类" name="2"></el-tab-pane>
  269. </el-tabs>
  270. </div>
  271. </div>
  272. <div class="goods-collect__body">
  273. <div class="box">
  274. <div class="title">收藏统计</div>
  275. <div class="circle">
  276. <el-progress
  277. type="circle"
  278. :width="160"
  279. :stroke-width="12"
  280. color="#FADB14"
  281. :format="() => collectTotal || '0'"
  282. :percentage="25"
  283. ></el-progress>
  284. </div>
  285. </div>
  286. <div class="list" v-if="collectName == '1'">
  287. <div
  288. class="list__item"
  289. v-for="(item, index) in collectExamList"
  290. :key="index"
  291. >
  292. <div class="title">
  293. {{ item.examName }}
  294. </div>
  295. <div class="content clearfix">
  296. <div class="left">
  297. 收藏题<span class="red">{{ item.questionNum }}</span>
  298. </div>
  299. <div class="right">
  300. <el-button
  301. type="primary"
  302. @click="
  303. go('/subject/collect-bank/' + item.examId, {
  304. orderGoodsId: orderGoodsId,
  305. })
  306. "
  307. round
  308. plain
  309. class="btn"
  310. >重做</el-button
  311. >
  312. <el-button
  313. type="primary"
  314. @click="
  315. go('/subject/collect-bank/' + item.examId, {
  316. explain: 1,
  317. orderGoodsId: orderGoodsId,
  318. })
  319. "
  320. round
  321. plain
  322. class="btn"
  323. >解析</el-button
  324. >
  325. </div>
  326. </div>
  327. </div>
  328. </div>
  329. <div class="list" v-if="collectName == '2'">
  330. <div
  331. class="list__item"
  332. v-for="(item, index) in collectTypeList"
  333. :key="index"
  334. >
  335. <div class="title">
  336. <template v-if="item.type == 1">单选题</template>
  337. <template v-if="item.type == 2">多选题</template>
  338. <template v-if="item.type == 3">判断题</template>
  339. <template v-if="item.type == 4">案例题</template>
  340. <template v-if="item.type == 5">简答题</template>
  341. </div>
  342. <div class="content clearfix">
  343. <div class="left">
  344. 收藏题<span class="red">{{ item.num }}</span>
  345. </div>
  346. <div class="right">
  347. <el-button
  348. type="primary"
  349. @click="
  350. go('/subject/collect-type-bank/' + item.type, {
  351. orderGoodsId: orderGoodsId,
  352. })
  353. "
  354. round
  355. plain
  356. class="btn"
  357. >重做</el-button
  358. >
  359. <el-button
  360. type="primary"
  361. @click="
  362. go('/subject/collect-type-bank/' + item.type, {
  363. explain: 1,
  364. orderGoodsId: orderGoodsId,
  365. })
  366. "
  367. round
  368. plain
  369. class="btn"
  370. >解析</el-button
  371. >
  372. </div>
  373. </div>
  374. </div>
  375. </div>
  376. </div>
  377. </div>
  378. </el-tab-pane>
  379. <el-tab-pane label="错题集" name="3">
  380. <div class="goods-collect">
  381. <div class="goods-collect__header">
  382. <div class="selects">
  383. <div class="selects__item">
  384. <el-select
  385. placeholder="请选择试卷类型"
  386. v-model="wrongSelect"
  387. clearable
  388. @clear="getWrongData"
  389. @change="getWrongData"
  390. >
  391. <el-option
  392. v-for="(item, index) in selectList"
  393. :key="index"
  394. :label="item.paperName"
  395. :value="item.paperId"
  396. ></el-option>
  397. </el-select>
  398. </div>
  399. </div>
  400. <div class="tabs">
  401. <el-tabs v-model="wrongName" @tab-click="getWrongData">
  402. <el-tab-pane label="试卷归类" name="1"></el-tab-pane>
  403. <el-tab-pane label="题型归类" name="2"></el-tab-pane>
  404. </el-tabs>
  405. </div>
  406. </div>
  407. <div class="goods-collect__body">
  408. <div class="box">
  409. <div class="title">错题统计</div>
  410. <div class="circle">
  411. <el-progress
  412. type="circle"
  413. :width="160"
  414. :stroke-width="12"
  415. color="#F5222D"
  416. :format="() => wrongTotal || '0'"
  417. :percentage="25"
  418. ></el-progress>
  419. </div>
  420. </div>
  421. <div class="list" v-if="wrongName == '1'">
  422. <div
  423. class="list__item"
  424. v-for="(item, index) in wrongExamList"
  425. :key="index"
  426. >
  427. <div class="title">
  428. {{ item.examName }}
  429. </div>
  430. <div class="content clearfix">
  431. <div class="left">
  432. 错题数<span class="red">{{
  433. item.wrongQuestionNum
  434. }}</span>
  435. </div>
  436. <div class="right">
  437. <el-button
  438. type="primary"
  439. round
  440. plain
  441. class="btn"
  442. @click="
  443. go('/subject/wrong-bank/' + item.examId, {
  444. orderGoodsId: orderGoodsId,
  445. })
  446. "
  447. >重做</el-button
  448. >
  449. <el-button
  450. type="primary"
  451. round
  452. plain
  453. class="btn"
  454. @click="
  455. go('/subject/wrong-bank/' + item.examId, {
  456. explain: 1,
  457. orderGoodsId: orderGoodsId,
  458. })
  459. "
  460. >解析</el-button
  461. >
  462. </div>
  463. </div>
  464. </div>
  465. </div>
  466. <div class="list" v-if="wrongName == '2'">
  467. <div
  468. class="list__item"
  469. v-for="(item, index) in wrongTypeList"
  470. :key="index"
  471. >
  472. <div class="title">
  473. <template v-if="item.type == 1">单选题</template>
  474. <template v-if="item.type == 2">多选题</template>
  475. <template v-if="item.type == 3">判断题</template>
  476. <template v-if="item.type == 4">案例题</template>
  477. <template v-if="item.type == 5">简答题</template>
  478. </div>
  479. <div class="content clearfix">
  480. <div class="left">
  481. 错题数<span class="red">{{ item.num }}</span>
  482. </div>
  483. <div class="right">
  484. <el-button
  485. type="primary"
  486. round
  487. plain
  488. class="btn"
  489. @click="
  490. go('/subject/wrong-type-bank/' + item.type, {
  491. orderGoodsId: orderGoodsId,
  492. })
  493. "
  494. >重做</el-button
  495. >
  496. <el-button
  497. type="primary"
  498. round
  499. plain
  500. class="btn"
  501. @click="
  502. go('/subject/wrong-type-bank/' + item.type, {
  503. explain: 1,
  504. orderGoodsId: orderGoodsId,
  505. })
  506. "
  507. >解析</el-button
  508. >
  509. </div>
  510. </div>
  511. </div>
  512. </div>
  513. </div>
  514. </div>
  515. </el-tab-pane>
  516. </el-tabs>
  517. </div>
  518. <div class="right-box">
  519. <div class="right-box__header">
  520. <div class="title">
  521. <div
  522. @click="
  523. go('/person-center/my-bank/bank-statistics/' + goodsId, {
  524. orderGoodsId: orderGoodsId,
  525. })
  526. "
  527. >
  528. 做题统计>
  529. </div>
  530. </div>
  531. <div class="content">
  532. <div class="left">
  533. <div class="title">总进度</div>
  534. <div class="note">
  535. {{
  536. goodsCount.totalNum > 0
  537. ? (
  538. (goodsCount.doNum / goodsCount.totalNum) *
  539. 100
  540. ).toFixed(
  541. (goodsCount.doNum / goodsCount.totalNum) * 100 == 100
  542. ? 0
  543. : 1
  544. )
  545. : 0
  546. }}%
  547. </div>
  548. </div>
  549. <div class="right">
  550. <div class="title"><span class="blue">已答题</span>/未答题</div>
  551. <div class="note">
  552. <span class="blue">{{ goodsCount.doNum }}</span
  553. >/{{ goodsCount.totalNum - goodsCount.doNum }}
  554. </div>
  555. </div>
  556. </div>
  557. </div>
  558. <div
  559. class="right-box__body"
  560. v-if="recommendList.goodsList && recommendList.goodsList.length"
  561. >
  562. <div class="title">
  563. 推荐题库
  564. <span class="more" @click="go('/bank-list')">更多></span>
  565. </div>
  566. <ul class="list">
  567. <li
  568. class="course-item"
  569. v-for="(itemy, index) in compyRecommend(
  570. recommendList.goodsList
  571. )"
  572. :key="index"
  573. @click="toGoodsDetail(itemy)"
  574. >
  575. <div
  576. class="course-item__img"
  577. :style="`background-image:url(${$tools.splitImgHost(
  578. itemy.coverUrl,
  579. true
  580. )})`"
  581. >
  582. <div class="note" v-if="itemy.year">{{ itemy.year }}</div>
  583. </div>
  584. <div class="course-item__title">
  585. {{ itemy.goodsName }}
  586. </div>
  587. <div class="course-item__desc">
  588. <div class="price">¥{{ itemy.standPrice }}</div>
  589. <a class="add" @click.stop="addCart(true, itemy.goodsId)"
  590. >加购物车</a
  591. >
  592. </div>
  593. </li>
  594. </ul>
  595. </div>
  596. </div>
  597. </div>
  598. </section>
  599. </div>
  600. </template>
  601. <script>
  602. export default {
  603. name: "BankDetail",
  604. components: {},
  605. data() {
  606. return {
  607. orderGoodsId: "",
  608. activeName: "1",
  609. collectName: "1",
  610. wrongName: "1",
  611. goodsId: "",
  612. goodsDetail: {},
  613. goodsCount: {},
  614. bankList: [],
  615. selectList: [],
  616. collectSelect: "",
  617. wrongSelect: "",
  618. hasClickList: [],
  619. collectTypeList: [],
  620. collectExamList: [],
  621. wrongTypeList: [],
  622. wrongExamList: [],
  623. collectTotal: 0,
  624. wrongTotal: 0,
  625. recommendList: [],
  626. needOpen: true, //是否需要打开第一章节
  627. };
  628. },
  629. mounted() {
  630. this.orderGoodsId = this.$route.query.orderGoodsId;
  631. this.goodsId = this.$route.params.goodsId;
  632. this.goodsBankQuestionNum();
  633. this.goodsBank();
  634. this.getDetail();
  635. this.examaperList();
  636. },
  637. computed: {
  638. compyRecommend: function () {
  639. return function (array) {
  640. let ary = [];
  641. if (array) {
  642. for (let i = 0; i < array.length; i++) {
  643. if (i >= 4) {
  644. break;
  645. } else {
  646. ary.push(array[i]);
  647. }
  648. }
  649. }
  650. return ary;
  651. };
  652. },
  653. },
  654. methods: {
  655. /**
  656. * 跳转
  657. */
  658. toGoodsDetail(item) {
  659. this.$router.push({
  660. path: "/bank-detail/" + item.goodsId,
  661. query: {
  662. orderGoodsId: item.orderGoodsId,
  663. },
  664. });
  665. },
  666. addCart(status, goodsId) {
  667. this.$request
  668. .addCart({ goodsId: status ? goodsId : this.goodsId })
  669. .then((res) => {
  670. this.$message({
  671. message: "加入购物车成功",
  672. type: "success",
  673. });
  674. })
  675. .catch((err) => {
  676. if (err.code == 500) {
  677. this.$message({
  678. message: err.msg,
  679. type: "warning",
  680. });
  681. }
  682. });
  683. },
  684. /**
  685. *
  686. 获取推荐列表
  687. */
  688. getRecommend() {
  689. this.$request
  690. .appCommonActivityRecommendList({
  691. businessId: this.goodsDetail.businessId,
  692. type: 1,
  693. })
  694. .then((res) => {
  695. if (res.rows.length) {
  696. this.recommendList = res.rows[0];
  697. }
  698. });
  699. },
  700. go(path, query = {}) {
  701. console.log(path, query);
  702. this.$router.push({
  703. path,
  704. query,
  705. });
  706. },
  707. examaperList() {
  708. this.$request.examaperList().then((res) => {
  709. this.selectList = res.rows;
  710. });
  711. },
  712. /**
  713. * 获取用户商品统计数据
  714. */
  715. goodsBankQuestionNum() {
  716. this.$request.goodsBankQuestionNum(this.orderGoodsId).then((res) => {
  717. this.goodsCount = res.data;
  718. });
  719. },
  720. getDetail() {
  721. this.$request.commonGoodsDetail(this.goodsId).then((res) => {
  722. this.goodsDetail = res.data;
  723. this.getRecommend();
  724. });
  725. },
  726. /**
  727. * 获取课程目录
  728. */
  729. goodsBank() {
  730. this.$request
  731. .goodsBank({
  732. orderGoodsId: this.orderGoodsId,
  733. goodsId: this.goodsId,
  734. })
  735. .then((res) => {
  736. res.data.forEach((item) => {
  737. if (item.type == 2 || item.type == 1) {
  738. item.showList = false;
  739. item.list = [];
  740. }
  741. });
  742. this.bankList = res.data;
  743. for (let i = 0; i < this.bankList.length; i++) {
  744. if (this.bankList[i].type == 1) {
  745. this.moduleExam(this.bankList[i]);
  746. break;
  747. } else if (this.bankList[i].type == 2) {
  748. this.needOpen = false;
  749. this.chapterExam(this.bankList[i], 0);
  750. break;
  751. }
  752. }
  753. });
  754. },
  755. /**
  756. * 展开模块卷
  757. */
  758. moduleExam(Module) {
  759. if (Module.list.length) {
  760. Module.showList = !Module.showList;
  761. return;
  762. }
  763. this.$request
  764. .goodsChapterList({
  765. orderGoodsId: this.orderGoodsId,
  766. moduleExamId: Module.majorId,
  767. goodsId: this.goodsId,
  768. })
  769. .then((res) => {
  770. res.data.forEach((item) => {
  771. item.showList = false;
  772. item.list = [];
  773. });
  774. Module.showList = !Module.showList;
  775. Module.list = res.data;
  776. if (this.needOpen) {
  777. this.needOpen = false;
  778. this.chapterExam(Module.list[0], Module.majorId);
  779. }
  780. });
  781. },
  782. /**
  783. * 展开章卷
  784. */
  785. chapterExam(chapter, moduleId = 0) {
  786. if (chapter.list.length) {
  787. chapter.showList = !chapter.showList;
  788. return;
  789. }
  790. this.$request
  791. .bankExamExamList({
  792. orderGoodsId: this.orderGoodsId,
  793. moduleExamId: moduleId,
  794. chapterExamId: chapter.chapterExamId || chapter.majorId,
  795. goodsId: this.goodsId,
  796. })
  797. .then((res) => {
  798. chapter.showList = !chapter.showList;
  799. chapter.list = res.data;
  800. });
  801. },
  802. /**
  803. * 去做题
  804. */
  805. async toDo(section, chapterId, moduleId) {
  806. let count = await this.examRecordCount(section.examId || section.majorId);
  807. let answerNum = await this.getExamDetail(
  808. section.examId || section.majorId
  809. );
  810. //超过答题次数
  811. if (answerNum > 0 && count >= answerNum) {
  812. this.$message({
  813. type: "warning",
  814. message: "该试卷只能答题" + answerNum + "次!",
  815. });
  816. return;
  817. }
  818. this.$router.push({
  819. path: "/bank-exam/" + this.goodsId,
  820. query: {
  821. examId: section.examId || section.majorId,
  822. moduleId: moduleId || 0,
  823. chapterId: chapterId || 0,
  824. orderGoodsId: this.orderGoodsId,
  825. },
  826. });
  827. },
  828. /**
  829. * 继续做题
  830. */
  831. continueDo(section, chapterId, moduleId) {
  832. console.log(section);
  833. this.$router.push({
  834. path: "/bank-exam-continue/" + this.goodsId,
  835. query: {
  836. recordId: section.recordId,
  837. examId: section.examId || section.majorId,
  838. chapterId: chapterId,
  839. moduleId: moduleId,
  840. orderGoodsId: this.orderGoodsId,
  841. },
  842. });
  843. },
  844. /**
  845. * 重做
  846. * @param {Object} recordId
  847. * @param {Object} examId
  848. * @param {Object} goodsId
  849. * @param {Object} chapterExamId
  850. */
  851. async doRepeat(section, chapterId = 0, moduleId = 0) {
  852. let count = await this.examRecordCount(section.examId || section.majorId);
  853. let answerNum = await this.getExamDetail(
  854. section.examId || section.majorId
  855. );
  856. //超过答题次数
  857. if (answerNum > 0 && count >= answerNum) {
  858. this.$message({
  859. type: "warning",
  860. message: "该试卷只能答题" + answerNum + "次!",
  861. });
  862. return;
  863. }
  864. this.$confirm(`是否清空答案重做?`, "提示", {
  865. confirmButtonText: "重做",
  866. cancelButtonText: "查看上次",
  867. closeOnClickModal: false,
  868. closeOnPressEscape: false,
  869. distinguishCancelAndClose: false,
  870. showClose: false,
  871. })
  872. .then((_) => {
  873. this.$router.push({
  874. path: "/bank-exam/" + this.goodsId,
  875. query: {
  876. examId: section.examId || section.majorId,
  877. moduleId: moduleId || 0,
  878. chapterId: chapterId || 0,
  879. orderGoodsId: this.orderGoodsId,
  880. },
  881. });
  882. })
  883. .catch((_) => {
  884. this.$router.push({
  885. path: "/bank-exam-all-explain/" + section.recordId,
  886. query: {
  887. examId: section.examId || section.majorId,
  888. moduleId: moduleId || 0,
  889. chapterId: chapterId || 0,
  890. goodsId: this.goodsId,
  891. orderGoodsId: this.orderGoodsId,
  892. },
  893. });
  894. });
  895. },
  896. /**
  897. * 查询试卷历史做题次数
  898. */
  899. examRecordCount(examId) {
  900. return new Promise((resolve) => {
  901. this.$request
  902. .examRecordCount({
  903. examId: examId,
  904. orderGoodsId: this.orderGoodsId,
  905. })
  906. .then((res) => {
  907. resolve(res.data);
  908. });
  909. });
  910. },
  911. /**
  912. * @param {Object} exam_id
  913. * 获取试卷可以做的次数
  914. */
  915. getExamDetail(exam_id) {
  916. return new Promise((resolve) => {
  917. this.$request.getExamDetail(exam_id).then((res) => {
  918. resolve(res.data.answerNum);
  919. });
  920. });
  921. },
  922. getWrongData() {
  923. if (this.wrongName == "1") {
  924. //试卷归类
  925. this.wrongRecordList();
  926. } else if (this.wrongName == "2") {
  927. //题型归类
  928. this.wrongRecordTypeList();
  929. }
  930. },
  931. wrongRecordList() {
  932. this.$request
  933. .wrongRecordList({
  934. paperId: this.wrongSelect,
  935. orderGoodsId: this.orderGoodsId,
  936. })
  937. .then((res) => {
  938. this.wrongExamList = res.rows;
  939. let total = 0;
  940. res.rows.forEach((item) => {
  941. total += item.wrongQuestionNum;
  942. });
  943. this.wrongTotal = total;
  944. });
  945. },
  946. wrongRecordTypeList() {
  947. this.$request
  948. .wrongRecordTypeList({
  949. paperId: this.wrongSelect,
  950. orderGoodsId: this.orderGoodsId,
  951. })
  952. .then((res) => {
  953. this.wrongTypeList = res.rows;
  954. let total = 0;
  955. res.rows.forEach((item) => {
  956. total += item.num;
  957. });
  958. this.wrongTotal = total;
  959. });
  960. },
  961. getCollectData() {
  962. if (this.collectName == "1") {
  963. //试卷归类
  964. this.goodsCollectExamList();
  965. } else if (this.collectName == "2") {
  966. //题型归类
  967. this.collectQuestionTypeList();
  968. }
  969. },
  970. /**
  971. * 收藏按试卷分类
  972. */
  973. goodsCollectExamList() {
  974. this.$request
  975. .goodsCollectExamList({
  976. paperId: this.collectSelect,
  977. orderGoodsId: this.orderGoodsId,
  978. })
  979. .then((res) => {
  980. this.collectExamList = res.rows;
  981. let total = 0;
  982. res.rows.forEach((item) => {
  983. total += item.questionNum;
  984. });
  985. this.collectTotal = total;
  986. });
  987. },
  988. /**
  989. * 收藏按题型分类
  990. */
  991. collectQuestionTypeList() {
  992. this.$request
  993. .collectQuestionTypeList({
  994. paperId: this.wrongSelect,
  995. orderGoodsId: this.orderGoodsId,
  996. })
  997. .then((res) => {
  998. this.collectTypeList = res.rows;
  999. let total = 0;
  1000. res.rows.forEach((item) => {
  1001. total += item.num;
  1002. });
  1003. this.collectTotal = total;
  1004. });
  1005. },
  1006. tabChange(e) {
  1007. if (this.hasClickList.indexOf(e.name) != -1) {
  1008. return;
  1009. }
  1010. this.hasClickList.push(e.name);
  1011. if (e.name == "2") {
  1012. //收藏集
  1013. this.getCollectData();
  1014. } else if (e.name == "3") {
  1015. //错题集
  1016. this.getWrongData();
  1017. }
  1018. },
  1019. },
  1020. };
  1021. </script>
  1022. <!-- Add "scoped" attribute to limit CSS to this component only -->
  1023. <style scoped lang="scss">
  1024. .bank-detail {
  1025. .section {
  1026. &__header {
  1027. height: 40px;
  1028. display: flex;
  1029. align-items: center;
  1030. padding: 0 20px;
  1031. }
  1032. &__body {
  1033. .left-box {
  1034. float: left;
  1035. width: 768px;
  1036. /deep/.el-tabs__item {
  1037. height: 98px;
  1038. line-height: 98px;
  1039. }
  1040. .goods-menu {
  1041. padding: 0 16px 16px;
  1042. border-radius: 10px;
  1043. background: #f5f7fa;
  1044. &__header {
  1045. display: flex;
  1046. padding-right: 8px;
  1047. align-items: center;
  1048. .title {
  1049. padding: 10px 0;
  1050. font-size: 16px;
  1051. font-family: Microsoft YaHei;
  1052. font-weight: bold;
  1053. color: #333333;
  1054. flex: 1;
  1055. }
  1056. .question-num {
  1057. font-size: 14px;
  1058. font-family: Microsoft YaHei;
  1059. font-weight: 400;
  1060. color: #999999;
  1061. text-align: center;
  1062. display: inline-block;
  1063. width: 80px;
  1064. }
  1065. .question-do {
  1066. width: 88px;
  1067. }
  1068. }
  1069. &__body {
  1070. .item {
  1071. overflow: hidden;
  1072. background: #fff;
  1073. padding: 0 10px;
  1074. &__title {
  1075. padding: 20px 0;
  1076. cursor: pointer;
  1077. font-size: 16px;
  1078. font-family: Microsoft YaHei;
  1079. font-weight: bold;
  1080. color: #333333;
  1081. border-bottom: 1px solid #eeeeee;
  1082. .note {
  1083. display: inline-block;
  1084. margin-left: 20px;
  1085. width: 40px;
  1086. height: 24px;
  1087. border: 1px solid #ff3b30;
  1088. border-radius: 8px;
  1089. line-height: 22px;
  1090. color: #ff3b30;
  1091. text-align: center;
  1092. }
  1093. }
  1094. &__content {
  1095. margin-top: 12px;
  1096. background: #fff;
  1097. .bank-chapter {
  1098. margin-left: 4px;
  1099. &__item {
  1100. font-size: 16px;
  1101. &__text {
  1102. padding-top: 20px;
  1103. padding-bottom: 20px;
  1104. border-bottom: 1px solid #eeeeee;
  1105. cursor: pointer;
  1106. flex: 1;
  1107. }
  1108. }
  1109. }
  1110. .bank-section {
  1111. margin-left: 40px;
  1112. &__item {
  1113. padding-top: 20px;
  1114. padding-bottom: 20px;
  1115. border-bottom: 1px solid #eeeeee;
  1116. font-size: 16px;
  1117. display: flex;
  1118. &__text {
  1119. flex: 1;
  1120. }
  1121. .btn {
  1122. margin-right: 20px;
  1123. width: 88px;
  1124. height: 32px;
  1125. padding: 0;
  1126. border-radius: 16px;
  1127. line-height: 32px;
  1128. text-align: center;
  1129. cursor: pointer;
  1130. }
  1131. }
  1132. }
  1133. }
  1134. }
  1135. }
  1136. }
  1137. .goods-collect {
  1138. &__header {
  1139. .selects {
  1140. display: flex;
  1141. justify-content: space-between;
  1142. &__item {
  1143. width: 360px;
  1144. height: 40px;
  1145. border-radius: 8px;
  1146. .el-select {
  1147. width: 100%;
  1148. }
  1149. /deep/ .el-input__inner {
  1150. background: #fafafa;
  1151. border: 1px solid #d9d9d9;
  1152. }
  1153. }
  1154. }
  1155. .tabs {
  1156. }
  1157. }
  1158. &__body {
  1159. .box {
  1160. width: 300px;
  1161. height: 240px;
  1162. background: #ffffff;
  1163. border: 1px solid #d9d9d9;
  1164. border-radius: 8px;
  1165. padding: 16px;
  1166. .title {
  1167. font-size: 14px;
  1168. font-family: Microsoft YaHei;
  1169. font-weight: 400;
  1170. color: #333333;
  1171. }
  1172. .circle {
  1173. width: 160px;
  1174. height: 160px;
  1175. margin: 10px auto 0;
  1176. }
  1177. }
  1178. .list {
  1179. overflow: hidden;
  1180. &__item {
  1181. margin-top: 16px;
  1182. height: 98px;
  1183. background: #f7f9fc;
  1184. box-shadow: 0px 3px 6px 0px #e1e6ed;
  1185. border-radius: 8px;
  1186. .title {
  1187. padding: 10px 16px;
  1188. font-size: 16px;
  1189. font-family: Microsoft YaHei;
  1190. font-weight: bold;
  1191. color: #333333;
  1192. }
  1193. .content {
  1194. border-top: 1px solid #eee;
  1195. .left {
  1196. float: left;
  1197. margin-left: 16px;
  1198. margin-top: 10px;
  1199. padding: 4px 12px;
  1200. border: 1px solid #666666;
  1201. border-radius: 4px;
  1202. font-size: 14px;
  1203. .red {
  1204. margin-left: 12px;
  1205. color: #f5222d;
  1206. font-size: 14px;
  1207. }
  1208. }
  1209. .right {
  1210. float: right;
  1211. margin-right: 16px;
  1212. margin-top: 10px;
  1213. .btn {
  1214. width: 88px;
  1215. height: 32px;
  1216. border-radius: 16px;
  1217. text-align: center;
  1218. padding: 0;
  1219. line-height: 32px;
  1220. }
  1221. }
  1222. }
  1223. }
  1224. }
  1225. }
  1226. }
  1227. }
  1228. .right-box {
  1229. width: 300px;
  1230. float: right;
  1231. &__header {
  1232. height: 98px;
  1233. border-bottom: 2px solid #e4e7ed;
  1234. .title {
  1235. cursor: pointer;
  1236. height: 32px;
  1237. font-size: 14px;
  1238. font-family: Microsoft YaHei;
  1239. font-weight: 400;
  1240. color: #333333;
  1241. line-height: 32px;
  1242. }
  1243. .content {
  1244. height: 64px;
  1245. font-size: 0;
  1246. .left {
  1247. width: 50%;
  1248. display: inline-block;
  1249. border-right: 1px solid #e4e7ed;
  1250. .title {
  1251. font-size: 14px;
  1252. font-family: Microsoft YaHei;
  1253. font-weight: 400;
  1254. color: #999999;
  1255. }
  1256. .note {
  1257. font-size: 24px;
  1258. font-family: Microsoft YaHei;
  1259. font-weight: bold;
  1260. color: #3f8dfd;
  1261. }
  1262. }
  1263. .right {
  1264. text-align: center;
  1265. display: inline-block;
  1266. width: 50%;
  1267. .title {
  1268. font-size: 14px;
  1269. font-family: Microsoft YaHei;
  1270. font-weight: 400;
  1271. color: #999999;
  1272. .blue {
  1273. color: #3f8dfd;
  1274. }
  1275. }
  1276. .note {
  1277. font-size: 24px;
  1278. font-family: Microsoft YaHei;
  1279. color: #999999;
  1280. .blue {
  1281. font-size: 24px;
  1282. color: #3f8dfd;
  1283. }
  1284. }
  1285. }
  1286. }
  1287. }
  1288. &__body {
  1289. .title {
  1290. margin-top: 15px;
  1291. font-size: 16px;
  1292. font-family: Microsoft YaHei;
  1293. font-weight: 400;
  1294. color: #333333;
  1295. text-shadow: 0px 6px 6px rgba(85, 158, 255, 0.08);
  1296. position: relative;
  1297. .more {
  1298. cursor: pointer;
  1299. font-size: 16px;
  1300. font-family: Microsoft YaHei;
  1301. font-weight: 400;
  1302. color: #999999;
  1303. position: absolute;
  1304. right: 0;
  1305. }
  1306. }
  1307. .list {
  1308. .course-item {
  1309. margin: 110px 0 0;
  1310. width: 300px;
  1311. height: 178px;
  1312. background: #ffffff;
  1313. box-shadow: 0px 10px 13px 3px rgba(63, 141, 253, 0.1);
  1314. border-radius: 10px;
  1315. position: relative;
  1316. background: #fff;
  1317. padding-top: 100px;
  1318. &__img {
  1319. width: 280px;
  1320. height: 178px;
  1321. background: #ffffff;
  1322. box-shadow: 0px 0px 9px 1px rgba(0, 0, 0, 0.08);
  1323. border-radius: 10px;
  1324. position: absolute;
  1325. left: 10px;
  1326. top: -78px;
  1327. background: rgba(122, 136, 246, 1);
  1328. overflow: hidden;
  1329. background: no-repeat center center;
  1330. background-size: 280px 178px;
  1331. .note {
  1332. width: 80px;
  1333. height: 24px;
  1334. background: #d94404;
  1335. box-shadow: 0px 1px 1px 0px rgba(248, 78, 5, 0.4);
  1336. border-radius: 10px 0px 20px 0px;
  1337. text-align: center;
  1338. line-height: 24px;
  1339. color: #fff;
  1340. }
  1341. }
  1342. &__title {
  1343. margin: 0 8px;
  1344. font-size: 14px;
  1345. font-family: Microsoft YaHei;
  1346. font-weight: 400;
  1347. color: #333333;
  1348. line-height: 24px;
  1349. }
  1350. &__desc {
  1351. height: 32px;
  1352. position: absolute;
  1353. left: 0;
  1354. right: 0;
  1355. bottom: 0;
  1356. margin-left: 8px;
  1357. display: flex;
  1358. justify-content: space-between;
  1359. .price {
  1360. font-size: 18px;
  1361. font-family: Microsoft YaHei;
  1362. font-weight: bold;
  1363. color: #ff2d55;
  1364. line-height: 32px;
  1365. }
  1366. .add {
  1367. display: block;
  1368. width: 118px;
  1369. height: 32px;
  1370. line-height: 30px;
  1371. background: #f2f4f7;
  1372. border-radius: 10px 0px 10px 0px;
  1373. font-size: 16px;
  1374. color: #3f8dfd;
  1375. text-align: center;
  1376. &:hover {
  1377. background: #3f8dfd;
  1378. color: #f2f4f7;
  1379. }
  1380. }
  1381. }
  1382. }
  1383. }
  1384. }
  1385. }
  1386. }
  1387. }
  1388. }
  1389. </style>