courseChapter.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  1. <template>
  2. <view>
  3. <view class="title" @click="openChapter(menuItem)">
  4. <view>
  5. <u-icon name="arrow-down" color="#999" size="24" v-if="!down"></u-icon>
  6. <u-icon name="arrow-right" color="#999" size="24" v-if="down"></u-icon>
  7. <text class="menu_name">{{ menuItem.name }}</text>
  8. </view>
  9. <view class="fl">
  10. <view class="title_status gre" v-if="menuItem.commonSign == 1"
  11. >公共章</view
  12. >
  13. <view
  14. class="title_status"
  15. :class="['grey', 'blue', 'gre'][learnStatus + 1]"
  16. >
  17. {{ ["待学习", "学习中", "已学完"][learnStatus + 1] }}
  18. </view>
  19. </view>
  20. </view>
  21. <view v-show="!down">
  22. <view v-for="(itemM, indexM) in list" :key="indexM">
  23. <view v-if="itemM.type != 2">
  24. <courseSection
  25. ref="ChapterSection"
  26. :isLive="isLive"
  27. :orderGoodsId="orderGoodsId"
  28. :sectionMaxNum="sectionMaxNum"
  29. :preItem="list[indexM - 1] || preItem"
  30. :learningOrder="learningOrder"
  31. :courseId="courseId"
  32. @playEnd="refreshList($event)"
  33. :goodsId="goodsId"
  34. :isBuy="isBuy"
  35. :nextMenuItem="findNextSection(indexM)"
  36. :isRebuild="isRebuild"
  37. :gradeId="gradeId"
  38. :menuItem="itemM"
  39. :levelId="levelId + '-' + itemM.sectionId"
  40. :testType="2"
  41. :ChapterSectionExam="sectionExam"
  42. :menuAllList="menuAllList"
  43. ></courseSection>
  44. <!-- @togoBack='togoBack()' -->
  45. <u-line v-if="indexM < list.length - 1"></u-line>
  46. </view>
  47. <!-- 章卷 -->
  48. <view v-if="itemM.type == 2">
  49. <u-line></u-line>
  50. <view
  51. class="examBox"
  52. @click="
  53. toDo(
  54. itemM.typeId,
  55. goodsId,
  56. itemM.moduleId,
  57. itemM.chapterId,
  58. itemM,
  59. indexM
  60. )
  61. "
  62. >
  63. <view class="exam">
  64. <view class="eTag">
  65. {{ itemM.doType == 1 ? "练习" : "考试" }}
  66. </view>
  67. <view style="margin-left: 15rpx; flex: 1">{{ itemM.name }}</view>
  68. </view>
  69. <view v-if="isRebuild || itemM.rebuild > 0" class="tagRe"
  70. >待重修</view
  71. >
  72. <view v-else>
  73. <view
  74. :class="{
  75. tagGreen: itemM.learning == 1,
  76. tagRe: itemM.learning == 0 || itemM.rebuild > 0,
  77. }"
  78. >
  79. <text v-if="itemM.rebuild > 0">待重测</text>
  80. <text v-else-if="itemM.learning == 1">合格</text>
  81. <text v-else-if="itemM.learning == 0">不及格(需重考)</text>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </template>
  90. <script>
  91. import { mapGetters, mapMutations } from "vuex";
  92. import courseSection from "@/components/course/courseSection.vue";
  93. export default {
  94. name: "courseChapter",
  95. props: {
  96. isLive: false,
  97. orderGoodsId: {
  98. default: 0,
  99. },
  100. preItem: {
  101. default: undefined,
  102. },
  103. learningOrder: {
  104. //是否设置学习顺序 1 章节顺序 0不设置 2从头学到尾顺序
  105. type: Number,
  106. default: 0,
  107. },
  108. needOpen: {
  109. //是否默认展开
  110. type: Boolean,
  111. default: false,
  112. },
  113. menuItem: {
  114. type: Object,
  115. default: {},
  116. },
  117. isBuy: {
  118. type: Boolean,
  119. default: false,
  120. },
  121. levelId: {
  122. type: String,
  123. default: "",
  124. },
  125. goodsId: {
  126. type: Number,
  127. default: 0,
  128. },
  129. courseId: {
  130. type: Number,
  131. default: 0,
  132. },
  133. isRebuild: {
  134. type: Boolean,
  135. default: false,
  136. },
  137. gradeId: {
  138. type: Number,
  139. default: 0,
  140. },
  141. sectionMaxNum: {
  142. default: undefined,
  143. },
  144. // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  145. goodsType: {
  146. type: [Number, String],
  147. default: 0,
  148. },
  149. menuAllList: {
  150. // 课程所有子目录结构列表
  151. type: Array,
  152. default: () => [],
  153. },
  154. sectionItem: {
  155. // 用户最后一次看的录播的信息
  156. type: Object,
  157. default: () => {},
  158. },
  159. },
  160. components: {
  161. courseSection,
  162. },
  163. data() {
  164. return {
  165. down: true,
  166. list: [],
  167. examList: {},
  168. canLearn: false, //是否全部视频看完才可以练习、测试
  169. sectionExam: [],
  170. };
  171. },
  172. onLoad() {},
  173. created() {},
  174. mounted() {
  175. // console.log('needOpen:', this.needOpen, this.chapterOpen);
  176. if (this.needOpen && this.chapterOpen) {
  177. this.updateChapterOpen(false);
  178. this.openChapter(this.menuItem);
  179. }
  180. },
  181. onPageShow() {
  182. if (this.isBuy) {
  183. this.refreshList({ isRebuild: this.isRebuild });
  184. }
  185. },
  186. methods: {
  187. ...mapMutations(["updateChapterOpen"]),
  188. // 调用节的方法
  189. // togoBack(value) {
  190. // this.$refs.ChapterSection[0].ChapterExam()
  191. // },
  192. goodsTodayStudySectionNum() {
  193. return new Promise((resolve) => {
  194. this.$api
  195. .goodsTodayStudySectionNum({
  196. goodsId: this.goodsId,
  197. gradeId: this.gradeId,
  198. orderGoodsId: this.orderGoodsId,
  199. })
  200. .then((res) => {
  201. if (res.data.code == 200) {
  202. resolve(res.data.data);
  203. }
  204. });
  205. });
  206. },
  207. async refreshList(isRebuild) {
  208. // console.log('节的播放结束');
  209. let moduleId = this.menuItem.moduleId ? this.menuItem.moduleId : 0;
  210. if (this.isRebuild) {
  211. this.getReSectionList(
  212. this.menuItem.id,
  213. this.menuItem.courseId,
  214. moduleId
  215. );
  216. } else {
  217. // console.log('重新请求');
  218. this.getBuySectionList(
  219. this.menuItem.id,
  220. this.menuItem.courseId,
  221. moduleId
  222. );
  223. // this.getMenuExamList(item.id,item.courseId,moduleId)
  224. }
  225. this.$emit("playEnd", { isRebuild: isRebuild.isRebuild });
  226. // this.newMenuAllList = await this.studyRecordMenuAllList()
  227. // console.log('播放器节:', this.newMenuAllList);
  228. },
  229. findNextSection(index) {
  230. for (let i = index + 1; i < this.list.length; i++) {
  231. return this.list[i];
  232. }
  233. return {};
  234. },
  235. // /study/record/menuAllList - 查询课程所有子目录结构列表
  236. studyRecordMenuAllList() {
  237. return new Promise((resolve) => {
  238. this.$api
  239. .studyRecordMenuAllList({
  240. courseId: this.courseId,
  241. gradeId: this.gradeId,
  242. goodsId: this.goodsId,
  243. orderGoodsId: this.orderGoodsId,
  244. })
  245. .then((res) => {
  246. if (res.data.code == 200) {
  247. resolve(res.data.data);
  248. }
  249. });
  250. });
  251. },
  252. gradeCheckGoodsStudy(id) {
  253. let moduleId = this.menuItem.moduleId || 0;
  254. let chapterId = this.menuItem.chapterId || 0;
  255. let sectionId = this.menuItem.sectionId || this.menuItem.menuId;
  256. return new Promise((resolve) => {
  257. this.$api
  258. .gradeCheckGoodsStudy({
  259. goodsId: this.goodsId,
  260. gradeId: this.gradeId,
  261. moduleId: this.menuItem.moduleId || 0,
  262. chapterId: this.menuItem.chapterId || 0,
  263. examId: id,
  264. orderGoodsId: this.orderGoodsId,
  265. })
  266. .then((res) => {
  267. resolve(res.data.data);
  268. });
  269. });
  270. },
  271. // 新增用户视频学习日志
  272. studyLog() {
  273. this.$http({
  274. url: "/user/study/log",
  275. method: "post",
  276. data: {
  277. goodsId: this.goodsId,
  278. courseId: this.courseId,
  279. moduleId: this.menuItem.moduleId || 0,
  280. chapterId: this.menuItem.chapterId || 0,
  281. sectionId: this.menuItem.sectionId || this.menuItem.menuId,
  282. fromPlat: 1, //来源平台 1小程序 2PC网站
  283. goodsType: this.goodsType, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  284. orderGoodsId: this.orderGoodsId,
  285. },
  286. }).then((res) => {
  287. console.log("考试的用户学习日志:", res);
  288. });
  289. },
  290. /**
  291. * 去做题
  292. */
  293. async toDo(id, goodsId = 0, moduleId = 0, chapterId = 0, item, index) {
  294. if (item.doType === 2 && item.learning == 1) {
  295. return;
  296. }
  297. // 查询用户商品今天学习节数- /goods/todayStudySectionNum
  298. let learnNum = await this.goodsTodayStudySectionNum();
  299. // 检查用户是否学习过节 - /grade/grade/checkGoodsStudy
  300. let hasLearn = await this.gradeCheckGoodsStudy(id);
  301. if (this.sectionMaxNum > 0) {
  302. if (learnNum >= this.sectionMaxNum && !hasLearn) {
  303. uni.showToast({
  304. icon: "none",
  305. title: `每天最多学习${this.sectionMaxNum}节`,
  306. });
  307. return;
  308. }
  309. }
  310. if (this.learningOrder == 1) {
  311. if (this.canLearn) {
  312. let num = await this.bankRecordDoNum(item.typeId);
  313. //有次数限制
  314. if (item.answerNum - num > 0 && item.answerNum > 0) {
  315. // this.$set(this.list[index],'doNum',(item.doNum+1))
  316. // console.log(this.list[index]);
  317. uni.navigateTo({
  318. url:
  319. "/pages2/class/questionBank?courseId=" +
  320. this.courseId +
  321. "&gradeId=" +
  322. this.gradeId +
  323. "&isFromVideo=1&id=" +
  324. id +
  325. "&goodsid=" +
  326. goodsId +
  327. "&moduleId=" +
  328. moduleId +
  329. "&chapterId=" +
  330. chapterId +
  331. "&orderGoodsId=" +
  332. this.orderGoodsId +
  333. "&type=1" +
  334. "&learning=" +
  335. item.learning +
  336. "&isBackVideo=" +
  337. 1,
  338. });
  339. this.studyLog();
  340. //没有答题次数限制
  341. } else if (item.answerNum == 0) {
  342. uni.navigateTo({
  343. url:
  344. "/pages2/class/questionBank?courseId=" +
  345. this.courseId +
  346. "&gradeId=" +
  347. this.gradeId +
  348. "&isFromVideo=1&id=" +
  349. id +
  350. "&goodsid=" +
  351. goodsId +
  352. "&moduleId=" +
  353. moduleId +
  354. "&chapterId=" +
  355. chapterId +
  356. "&orderGoodsId=" +
  357. this.orderGoodsId +
  358. "&type=1" +
  359. "&learning=" +
  360. item.learning +
  361. "&isBackVideo=" +
  362. 1,
  363. });
  364. this.studyLog();
  365. } else {
  366. uni.showToast({
  367. icon: "none",
  368. title: "该试卷只能答题" + item.answerNum + "次",
  369. });
  370. return;
  371. }
  372. } else {
  373. uni.showToast({
  374. icon: "none",
  375. title: "请按顺序学完视频课程再进行练习和测试",
  376. });
  377. }
  378. } else if (this.learningOrder == 2) {
  379. // !item.rebuild
  380. let rows = this.menuAllList;
  381. const index = this.menuAllList.findIndex((e) => {
  382. let i_sectionId = e.sectionId || 0;
  383. let i_chapterId = e.chapterId || 0;
  384. let i_moduleId = e.moduleId || 0;
  385. return (
  386. i_sectionId == item.sectionId &&
  387. i_chapterId == item.chapterId &&
  388. i_moduleId == item.moduleId
  389. );
  390. });
  391. let isStop = false;
  392. let newRows = [];
  393. for (let i = 0; i < index; i++) {
  394. let moduleTrue = rows[i].moduleId == moduleId;
  395. let chapterTrue = rows[i].chapterId == chapterId;
  396. if (moduleTrue && chapterTrue) {
  397. isStop = true;
  398. if (rows[i].sectionType != 2) {
  399. //忽略直播
  400. newRows.push(rows[i]);
  401. }
  402. } else {
  403. if (!isStop) {
  404. if (rows[i].sectionType != 2) {
  405. //忽略直播
  406. newRows.push(rows[i]);
  407. }
  408. } else {
  409. break;
  410. }
  411. }
  412. }
  413. let isAllLearn = newRows.every((item) => {
  414. return item.studyStatus == 1;
  415. });
  416. if (isAllLearn) {
  417. //之前的都学完了
  418. // if(canLearn) { //视频的上一节学完
  419. let num = await this.bankRecordDoNum(item.typeId);
  420. //有次数限制
  421. if (item.answerNum - num > 0 && item.answerNum > 0) {
  422. // this.$set(this.list[index],'doNum',(item.doNum+1))
  423. // console.log(this.list[index]);
  424. uni.navigateTo({
  425. url:
  426. "/pages2/class/questionBank?courseId=" +
  427. this.courseId +
  428. "&gradeId=" +
  429. this.gradeId +
  430. "&isFromVideo=1&id=" +
  431. id +
  432. "&goodsid=" +
  433. goodsId +
  434. "&moduleId=" +
  435. moduleId +
  436. "&chapterId=" +
  437. chapterId +
  438. "&orderGoodsId=" +
  439. this.orderGoodsId +
  440. "&type=1" +
  441. "&learning=" +
  442. item.learning +
  443. "&isBackVideo=" +
  444. 1,
  445. });
  446. this.studyLog();
  447. //没有答题次数限制
  448. } else if (item.answerNum == 0) {
  449. uni.navigateTo({
  450. url:
  451. "/pages2/class/questionBank?courseId=" +
  452. this.courseId +
  453. "&gradeId=" +
  454. this.gradeId +
  455. "&isFromVideo=1&id=" +
  456. id +
  457. "&goodsid=" +
  458. goodsId +
  459. "&moduleId=" +
  460. moduleId +
  461. "&chapterId=" +
  462. chapterId +
  463. "&orderGoodsId=" +
  464. this.orderGoodsId +
  465. "&type=1" +
  466. "&learning=" +
  467. item.learning +
  468. "&isBackVideo=" +
  469. 1,
  470. });
  471. this.studyLog();
  472. } else {
  473. uni.showToast({
  474. icon: "none",
  475. title: "该试卷只能答题" + item.answerNum + "次",
  476. });
  477. return;
  478. }
  479. } else {
  480. uni.showToast({
  481. icon: "none",
  482. title: "请学完视频课程再进行练习和测试",
  483. });
  484. }
  485. } else {
  486. let num = await this.bankRecordDoNum(item.typeId);
  487. //有次数限制
  488. if (item.answerNum - item.doNum > 0 && item.answerNum > 0) {
  489. // this.$set(this.list[index],'doNum',(item.doNum+1))
  490. // console.log(this.list[index]);
  491. uni.navigateTo({
  492. url:
  493. "/pages2/class/questionBank?courseId=" +
  494. this.courseId +
  495. "&gradeId=" +
  496. this.gradeId +
  497. "&isFromVideo=1&id=" +
  498. id +
  499. "&goodsid=" +
  500. goodsId +
  501. "&moduleId=" +
  502. moduleId +
  503. "&chapterId=" +
  504. chapterId +
  505. "&orderGoodsId=" +
  506. this.orderGoodsId +
  507. "&type=1" +
  508. "&learning=" +
  509. item.learning +
  510. "&isBackVideo=" +
  511. 1,
  512. });
  513. this.studyLog();
  514. //没有答题次数限制
  515. } else if (item.answerNum == 0) {
  516. uni.navigateTo({
  517. url:
  518. "/pages2/class/questionBank?courseId=" +
  519. this.courseId +
  520. "&gradeId=" +
  521. this.gradeId +
  522. "&isFromVideo=1&id=" +
  523. id +
  524. "&goodsid=" +
  525. goodsId +
  526. "&moduleId=" +
  527. moduleId +
  528. "&chapterId=" +
  529. chapterId +
  530. "&orderGoodsId=" +
  531. this.orderGoodsId +
  532. "&type=1" +
  533. "&learning=" +
  534. item.learning +
  535. "&isBackVideo=" +
  536. 1,
  537. });
  538. this.studyLog();
  539. } else {
  540. uni.showToast({
  541. icon: "none",
  542. title: "该试卷只能答题" + item.answerNum + "次",
  543. });
  544. return;
  545. }
  546. }
  547. },
  548. bankRecordDoNum(examId) {
  549. return new Promise((resolve) => {
  550. this.$api
  551. .bankRecordDoNum({
  552. goodsId: this.goodsId,
  553. gradeId: this.gradeId,
  554. chapterId: this.menuItem.id,
  555. courseId: this.courseId,
  556. moduleId: 0,
  557. examId: examId,
  558. orderGoodsId: this.orderGoodsId,
  559. })
  560. .then((res) => {
  561. resolve(res.data.data);
  562. });
  563. });
  564. },
  565. async openChapter(item) {
  566. console.log(
  567. "🚀 ~ file: courseChapter.vue:571 ~ openChapter ~ item:",
  568. item
  569. );
  570. // console.log('---zhang',this.menuItem, this.down, item.courseId, item.moduleId);
  571. this.down = !this.down;
  572. if (!this.down && this.list.length == 0) {
  573. // console.log(item.id, 69);
  574. //获取章下面所有节试卷列表-course/sectionExamList
  575. this.$method.isLogin() &&
  576. (await this.$api
  577. .reSectionExamList({
  578. chapterId: item.chapterId || item.menuId,
  579. courseId: item.courseId,
  580. gradeId: item.gradeId,
  581. orderGoodsId: this.orderGoodsId,
  582. })
  583. .then((res) => {
  584. if (res.data.code == 200) {
  585. this.sectionExam = res.data.data || [];
  586. }
  587. }));
  588. if (this.isBuy) {
  589. let moduleId = item.moduleId ? item.moduleId : 0;
  590. let chapterId = item.chapterId || item.id;
  591. if (this.isRebuild) {
  592. this.getReSectionList(chapterId, item.courseId, moduleId);
  593. } else {
  594. this.getBuySectionList(chapterId, item.courseId, moduleId);
  595. // this.getMenuExamList(item.id,item.courseId,moduleId)
  596. }
  597. } else {
  598. this.getSectionList(item.chapterId || item.menuId);
  599. }
  600. }
  601. },
  602. getMenuExamList(chapterId, courseId, moduleId) {
  603. let self = this;
  604. this.$api
  605. .menuExamList({
  606. chapterId: chapterId,
  607. courseId: courseId,
  608. moduleId: moduleId,
  609. })
  610. .then((res) => {
  611. if (res.data.code == 200) {
  612. self.examList = res.data.rows;
  613. }
  614. });
  615. },
  616. getSectionList(chapterId) {
  617. let self = this;
  618. // url: '/app/common/course/sectionList/'+data,
  619. this.$api.sectionList(chapterId).then((res) => {
  620. if (res.data.code == 200) {
  621. for (let i = 0; i < res.data.data.length; i++) {
  622. let item = res.data.data[i];
  623. item.id = item.sectionId;
  624. item.menuType = 3;
  625. //判断是否试听
  626. item.tryListen = false;
  627. if (self.goodsAuditionConfigIdList.indexOf(item.id) !== -1) {
  628. item.tryListen = true;
  629. }
  630. }
  631. let newArr = res.data.data.filter((item) => {
  632. return item.type != 2;
  633. });
  634. this.canLearn = newArr.every((item) => {
  635. if (item.learning == 1) {
  636. return true;
  637. } else {
  638. return false;
  639. }
  640. });
  641. self.list = res.data.data;
  642. }
  643. });
  644. },
  645. getReSectionList(chapterId, courseId, moduleId) {
  646. let self = this;
  647. this.$api
  648. .reSectionList({
  649. chapterId: chapterId,
  650. gradeId: this.gradeId,
  651. courseId: courseId,
  652. rebuild: 1,
  653. moduleId: moduleId,
  654. orderGoodsId: this.orderGoodsId,
  655. })
  656. .then((res) => {
  657. if (res.data.code == 200) {
  658. for (let i = 0; i < res.data.data.length; i++) {
  659. let item = res.data.data[i];
  660. item.id = item.sectionId;
  661. item.courseId = courseId;
  662. item.menuType = 3;
  663. //判断是否试听
  664. item.tryListen = false;
  665. if (self.goodsAuditionConfigIdList.indexOf(item.id) !== -1) {
  666. item.tryListen = true;
  667. }
  668. }
  669. let newArr = res.data.data.filter((item) => {
  670. return item.type != 2;
  671. });
  672. this.canLearn = newArr.every((item) => {
  673. if (item.learning == 1) {
  674. return true;
  675. } else {
  676. return false;
  677. }
  678. });
  679. self.list = res.data.data;
  680. }
  681. });
  682. },
  683. getBuySectionList(chapterId, courseId, moduleId) {
  684. let self = this;
  685. // /course/sectionList
  686. this.$api
  687. .reSectionList({
  688. chapterId: chapterId,
  689. gradeId: this.gradeId,
  690. courseId: courseId,
  691. moduleId: moduleId,
  692. orderGoodsId: this.orderGoodsId,
  693. })
  694. .then((res) => {
  695. if (res.data.code == 200) {
  696. for (let i = 0; i < res.data.data.length; i++) {
  697. let item = res.data.data[i];
  698. item.courseId = courseId;
  699. item.id = item.sectionId;
  700. item.menuType = 3;
  701. //判断是否试听
  702. item.tryListen = false;
  703. if (self.goodsAuditionConfigIdList.indexOf(item.id) !== -1) {
  704. item.tryListen = true;
  705. }
  706. }
  707. let newArr = res.data.data.filter((item) => {
  708. return item.type != 2;
  709. });
  710. this.canLearn = newArr.every((item) => {
  711. if (item.learning == 1) {
  712. return true;
  713. } else {
  714. return false;
  715. }
  716. });
  717. self.list = res.data.data;
  718. // console.log('=======节列表==', this.list);
  719. }
  720. });
  721. },
  722. },
  723. computed: {
  724. ...mapGetters(["goodsAuditionConfigIdList", "chapterOpen"]),
  725. learnStatus() {
  726. if (!this.isBuy) {
  727. return;
  728. }
  729. if (!this.sectionItem) {
  730. return;
  731. }
  732. let { id, courseId, moduleId } = this.menuItem;
  733. if (
  734. this.sectionItem.courseId == courseId &&
  735. this.sectionItem.moduleId == (moduleId || 0) &&
  736. this.sectionItem.chapterId == id
  737. ) {
  738. return 0;
  739. }
  740. const list = this.menuAllList.filter(
  741. (e) =>
  742. e.courseId == courseId &&
  743. e.moduleId == (moduleId || 0) &&
  744. e.chapterId == id
  745. );
  746. const isAllLearn = list.every((item) => {
  747. return item.studyStatus == 1;
  748. });
  749. return isAllLearn ? 1 : -1;
  750. },
  751. },
  752. };
  753. </script>
  754. <style lang="scss" scoped>
  755. .tagRe {
  756. // width: 80rpx;
  757. line-height: 28rpx;
  758. padding: 0 8rpx;
  759. height: 28rpx;
  760. background: #ff3b30;
  761. border-radius: 8rpx;
  762. font-size: 20rpx;
  763. color: #ffffff;
  764. text-align: center;
  765. }
  766. .tagGreen {
  767. width: 80rpx;
  768. height: 28rpx;
  769. background: #34c759;
  770. border-radius: 8rpx;
  771. font-size: 20rpx;
  772. color: #ffffff;
  773. text-align: center;
  774. }
  775. .eTag {
  776. width: 64rpx;
  777. height: 36rpx;
  778. text-align: center;
  779. line-height: 36rpx;
  780. font-size: 20rpx;
  781. background: #007aff;
  782. border-radius: 8rpx;
  783. color: #ffffff;
  784. }
  785. .examBox {
  786. display: flex;
  787. align-items: center;
  788. justify-content: space-between;
  789. }
  790. .exam {
  791. font-size: 30rpx;
  792. display: flex;
  793. align-items: center;
  794. margin: 20rpx 0;
  795. }
  796. .icon_up {
  797. width: 24rpx;
  798. height: 24rpx;
  799. }
  800. .title {
  801. // margin-bottom: 30rpx;
  802. height: 78rpx;
  803. display: flex;
  804. justify-content: space-between;
  805. align-items: center;
  806. border-bottom: 1rpx solid #eeeeee;
  807. .menu_name {
  808. font-size: 24rpx;
  809. font-family: PingFang SC;
  810. font-weight: bold;
  811. color: #333;
  812. white-space: nowrap;
  813. overflow: hidden;
  814. text-overflow: ellipsis;
  815. margin-left: 8rpx;
  816. }
  817. .title_status {
  818. padding: 2rpx 8rpx;
  819. border-radius: 8rpx;
  820. font-size: 20rpx;
  821. color: #ffffff;
  822. text-align: center;
  823. margin-left: 4rpx;
  824. }
  825. .gre {
  826. background: #34c759;
  827. }
  828. .blue {
  829. background: #409eff;
  830. }
  831. .grey {
  832. background: #909399;
  833. }
  834. }
  835. </style>