courseChapter.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  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. })
  199. .then((res) => {
  200. if (res.data.code == 200) {
  201. resolve(res.data.data);
  202. }
  203. });
  204. });
  205. },
  206. async refreshList(isRebuild) {
  207. // console.log('节的播放结束');
  208. let moduleId = this.menuItem.moduleId ? this.menuItem.moduleId : 0;
  209. if (this.isRebuild) {
  210. this.getReSectionList(
  211. this.menuItem.id,
  212. this.menuItem.courseId,
  213. moduleId
  214. );
  215. } else {
  216. // console.log('重新请求');
  217. this.getBuySectionList(
  218. this.menuItem.id,
  219. this.menuItem.courseId,
  220. moduleId
  221. );
  222. // this.getMenuExamList(item.id,item.courseId,moduleId)
  223. }
  224. this.$emit("playEnd", { isRebuild: isRebuild.isRebuild });
  225. // this.newMenuAllList = await this.studyRecordMenuAllList()
  226. // console.log('播放器节:', this.newMenuAllList);
  227. },
  228. findNextSection(index) {
  229. for (let i = index + 1; i < this.list.length; i++) {
  230. return this.list[i];
  231. }
  232. return {};
  233. },
  234. // /study/record/menuAllList - 查询课程所有子目录结构列表
  235. studyRecordMenuAllList() {
  236. return new Promise((resolve) => {
  237. this.$api
  238. .studyRecordMenuAllList({
  239. courseId: this.courseId,
  240. gradeId: this.gradeId,
  241. goodsId: this.goodsId,
  242. })
  243. .then((res) => {
  244. if (res.data.code == 200) {
  245. resolve(res.data.data);
  246. }
  247. });
  248. });
  249. },
  250. gradeCheckGoodsStudy(id) {
  251. let moduleId = this.menuItem.moduleId || 0;
  252. let chapterId = this.menuItem.chapterId || 0;
  253. let sectionId = this.menuItem.sectionId || this.menuItem.menuId;
  254. return new Promise((resolve) => {
  255. this.$api
  256. .gradeCheckGoodsStudy({
  257. goodsId: this.goodsId,
  258. gradeId: this.gradeId,
  259. moduleId: this.menuItem.moduleId || 0,
  260. chapterId: this.menuItem.chapterId || 0,
  261. examId: id,
  262. })
  263. .then((res) => {
  264. resolve(res.data.data);
  265. });
  266. });
  267. },
  268. // 新增用户视频学习日志
  269. studyLog() {
  270. this.$http({
  271. url: "/user/study/log",
  272. method: "post",
  273. data: {
  274. goodsId: this.goodsId,
  275. courseId: this.courseId,
  276. moduleId: this.menuItem.moduleId || 0,
  277. chapterId: this.menuItem.chapterId || 0,
  278. sectionId: this.menuItem.sectionId || this.menuItem.menuId,
  279. fromPlat: 1, //来源平台 1小程序 2PC网站
  280. goodsType: this.goodsType, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  281. orderGoodsId: this.orderGoodsId,
  282. },
  283. }).then((res) => {
  284. console.log("考试的用户学习日志:", res);
  285. });
  286. },
  287. /**
  288. * 去做题
  289. */
  290. async toDo(id, goodsId = 0, moduleId = 0, chapterId = 0, item, index) {
  291. if (item.doType === 2 && item.learning == 1) {
  292. return;
  293. }
  294. // 查询用户商品今天学习节数- /goods/todayStudySectionNum
  295. let learnNum = await this.goodsTodayStudySectionNum();
  296. // 检查用户是否学习过节 - /grade/grade/checkGoodsStudy
  297. let hasLearn = await this.gradeCheckGoodsStudy(id);
  298. if (this.sectionMaxNum > 0) {
  299. if (learnNum >= this.sectionMaxNum && !hasLearn) {
  300. uni.showToast({
  301. icon: "none",
  302. title: `每天最多学习${this.sectionMaxNum}节`,
  303. });
  304. return;
  305. }
  306. }
  307. if (this.learningOrder == 1) {
  308. if (this.canLearn) {
  309. let num = await this.bankRecordDoNum(item.typeId);
  310. //有次数限制
  311. if (item.answerNum - num > 0 && item.answerNum > 0) {
  312. // this.$set(this.list[index],'doNum',(item.doNum+1))
  313. // console.log(this.list[index]);
  314. uni.navigateTo({
  315. url:
  316. "/pages2/class/questionBank?courseId=" +
  317. this.courseId +
  318. "&gradeId=" +
  319. this.gradeId +
  320. "&isFromVideo=1&id=" +
  321. id +
  322. "&goodsid=" +
  323. goodsId +
  324. "&moduleId=" +
  325. moduleId +
  326. "&chapterId=" +
  327. chapterId +
  328. "&orderGoodsId=" +
  329. this.orderGoodsId +
  330. "&type=1" +
  331. "&learning=" +
  332. item.learning +
  333. "&isBackVideo=" +
  334. 1,
  335. });
  336. this.studyLog();
  337. //没有答题次数限制
  338. } else if (item.answerNum == 0) {
  339. uni.navigateTo({
  340. url:
  341. "/pages2/class/questionBank?courseId=" +
  342. this.courseId +
  343. "&gradeId=" +
  344. this.gradeId +
  345. "&isFromVideo=1&id=" +
  346. id +
  347. "&goodsid=" +
  348. goodsId +
  349. "&moduleId=" +
  350. moduleId +
  351. "&chapterId=" +
  352. chapterId +
  353. "&orderGoodsId=" +
  354. this.orderGoodsId +
  355. "&type=1" +
  356. "&learning=" +
  357. item.learning +
  358. "&isBackVideo=" +
  359. 1,
  360. });
  361. this.studyLog();
  362. } else {
  363. uni.showToast({
  364. icon: "none",
  365. title: "该试卷只能答题" + item.answerNum + "次",
  366. });
  367. return;
  368. }
  369. } else {
  370. uni.showToast({
  371. icon: "none",
  372. title: "请按顺序学完视频课程再进行练习和测试",
  373. });
  374. }
  375. } else if (this.learningOrder == 2) {
  376. // !item.rebuild
  377. let rows = this.menuAllList;
  378. const index = this.menuAllList.findIndex((e) => {
  379. let i_sectionId = e.sectionId || 0;
  380. let i_chapterId = e.chapterId || 0;
  381. let i_moduleId = e.moduleId || 0;
  382. return (
  383. i_sectionId == item.sectionId &&
  384. i_chapterId == item.chapterId &&
  385. i_moduleId == item.moduleId
  386. );
  387. });
  388. let isStop = false;
  389. let newRows = [];
  390. for (let i = 0; i < index; i++) {
  391. let moduleTrue = rows[i].moduleId == moduleId;
  392. let chapterTrue = rows[i].chapterId == chapterId;
  393. if (moduleTrue && chapterTrue) {
  394. isStop = true;
  395. if (rows[i].sectionType != 2) {
  396. //忽略直播
  397. newRows.push(rows[i]);
  398. }
  399. } else {
  400. if (!isStop) {
  401. if (rows[i].sectionType != 2) {
  402. //忽略直播
  403. newRows.push(rows[i]);
  404. }
  405. } else {
  406. break;
  407. }
  408. }
  409. }
  410. let isAllLearn = newRows.every((item) => {
  411. return item.studyStatus == 1;
  412. });
  413. if (isAllLearn) {
  414. //之前的都学完了
  415. // if(canLearn) { //视频的上一节学完
  416. let num = await this.bankRecordDoNum(item.typeId);
  417. //有次数限制
  418. if (item.answerNum - num > 0 && item.answerNum > 0) {
  419. // this.$set(this.list[index],'doNum',(item.doNum+1))
  420. // console.log(this.list[index]);
  421. uni.navigateTo({
  422. url:
  423. "/pages2/class/questionBank?courseId=" +
  424. this.courseId +
  425. "&gradeId=" +
  426. this.gradeId +
  427. "&isFromVideo=1&id=" +
  428. id +
  429. "&goodsid=" +
  430. goodsId +
  431. "&moduleId=" +
  432. moduleId +
  433. "&chapterId=" +
  434. chapterId +
  435. "&orderGoodsId=" +
  436. this.orderGoodsId +
  437. "&type=1" +
  438. "&learning=" +
  439. item.learning +
  440. "&isBackVideo=" +
  441. 1,
  442. });
  443. this.studyLog();
  444. //没有答题次数限制
  445. } else if (item.answerNum == 0) {
  446. uni.navigateTo({
  447. url:
  448. "/pages2/class/questionBank?courseId=" +
  449. this.courseId +
  450. "&gradeId=" +
  451. this.gradeId +
  452. "&isFromVideo=1&id=" +
  453. id +
  454. "&goodsid=" +
  455. goodsId +
  456. "&moduleId=" +
  457. moduleId +
  458. "&chapterId=" +
  459. chapterId +
  460. "&orderGoodsId=" +
  461. this.orderGoodsId +
  462. "&type=1" +
  463. "&learning=" +
  464. item.learning +
  465. "&isBackVideo=" +
  466. 1,
  467. });
  468. this.studyLog();
  469. } else {
  470. uni.showToast({
  471. icon: "none",
  472. title: "该试卷只能答题" + item.answerNum + "次",
  473. });
  474. return;
  475. }
  476. } else {
  477. uni.showToast({
  478. icon: "none",
  479. title: "请学完视频课程再进行练习和测试",
  480. });
  481. }
  482. } else {
  483. let num = await this.bankRecordDoNum(item.typeId);
  484. //有次数限制
  485. if (item.answerNum - item.doNum > 0 && item.answerNum > 0) {
  486. // this.$set(this.list[index],'doNum',(item.doNum+1))
  487. // console.log(this.list[index]);
  488. uni.navigateTo({
  489. url:
  490. "/pages2/class/questionBank?courseId=" +
  491. this.courseId +
  492. "&gradeId=" +
  493. this.gradeId +
  494. "&isFromVideo=1&id=" +
  495. id +
  496. "&goodsid=" +
  497. goodsId +
  498. "&moduleId=" +
  499. moduleId +
  500. "&chapterId=" +
  501. chapterId +
  502. "&orderGoodsId=" +
  503. this.orderGoodsId +
  504. "&type=1" +
  505. "&learning=" +
  506. item.learning +
  507. "&isBackVideo=" +
  508. 1,
  509. });
  510. this.studyLog();
  511. //没有答题次数限制
  512. } else if (item.answerNum == 0) {
  513. uni.navigateTo({
  514. url:
  515. "/pages2/class/questionBank?courseId=" +
  516. this.courseId +
  517. "&gradeId=" +
  518. this.gradeId +
  519. "&isFromVideo=1&id=" +
  520. id +
  521. "&goodsid=" +
  522. goodsId +
  523. "&moduleId=" +
  524. moduleId +
  525. "&chapterId=" +
  526. chapterId +
  527. "&orderGoodsId=" +
  528. this.orderGoodsId +
  529. "&type=1" +
  530. "&learning=" +
  531. item.learning +
  532. "&isBackVideo=" +
  533. 1,
  534. });
  535. this.studyLog();
  536. } else {
  537. uni.showToast({
  538. icon: "none",
  539. title: "该试卷只能答题" + item.answerNum + "次",
  540. });
  541. return;
  542. }
  543. }
  544. },
  545. bankRecordDoNum(examId) {
  546. return new Promise((resolve) => {
  547. this.$api
  548. .bankRecordDoNum({
  549. goodsId: this.goodsId,
  550. gradeId: this.gradeId,
  551. chapterId: this.menuItem.id,
  552. courseId: this.courseId,
  553. moduleId: 0,
  554. examId: examId,
  555. })
  556. .then((res) => {
  557. resolve(res.data.data);
  558. });
  559. });
  560. },
  561. async openChapter(item) {
  562. console.log(
  563. "🚀 ~ file: courseChapter.vue:571 ~ openChapter ~ item:",
  564. item
  565. );
  566. // console.log('---zhang',this.menuItem, this.down, item.courseId, item.moduleId);
  567. this.down = !this.down;
  568. if (!this.down && this.list.length == 0) {
  569. // console.log(item.id, 69);
  570. //获取章下面所有节试卷列表-course/sectionExamList
  571. this.$method.isLogin() &&
  572. (await this.$api
  573. .reSectionExamList({
  574. chapterId: item.chapterId || item.menuId,
  575. courseId: item.courseId,
  576. gradeId: item.gradeId,
  577. })
  578. .then((res) => {
  579. if (res.data.code == 200) {
  580. this.sectionExam = res.data.data || [];
  581. }
  582. }));
  583. if (this.isBuy) {
  584. let moduleId = item.moduleId ? item.moduleId : 0;
  585. let chapterId = item.chapterId || item.id;
  586. if (this.isRebuild) {
  587. this.getReSectionList(chapterId, item.courseId, moduleId);
  588. } else {
  589. this.getBuySectionList(chapterId, item.courseId, moduleId);
  590. // this.getMenuExamList(item.id,item.courseId,moduleId)
  591. }
  592. } else {
  593. this.getSectionList(item.chapterId || item.menuId);
  594. }
  595. }
  596. },
  597. getMenuExamList(chapterId, courseId, moduleId) {
  598. let self = this;
  599. this.$api
  600. .menuExamList({
  601. chapterId: chapterId,
  602. courseId: courseId,
  603. moduleId: moduleId,
  604. })
  605. .then((res) => {
  606. if (res.data.code == 200) {
  607. self.examList = res.data.rows;
  608. }
  609. });
  610. },
  611. getSectionList(chapterId) {
  612. let self = this;
  613. // url: '/app/common/course/sectionList/'+data,
  614. this.$api.sectionList(chapterId).then((res) => {
  615. if (res.data.code == 200) {
  616. for (let i = 0; i < res.data.data.length; i++) {
  617. let item = res.data.data[i];
  618. item.id = item.sectionId;
  619. item.menuType = 3;
  620. //判断是否试听
  621. item.tryListen = false;
  622. if (self.goodsAuditionConfigIdList.indexOf(item.id) !== -1) {
  623. item.tryListen = true;
  624. }
  625. }
  626. let newArr = res.data.data.filter((item) => {
  627. return item.type != 2;
  628. });
  629. this.canLearn = newArr.every((item) => {
  630. if (item.learning == 1) {
  631. return true;
  632. } else {
  633. return false;
  634. }
  635. });
  636. self.list = res.data.data;
  637. }
  638. });
  639. },
  640. getReSectionList(chapterId, courseId, moduleId) {
  641. let self = this;
  642. this.$api
  643. .reSectionList({
  644. chapterId: chapterId,
  645. gradeId: this.gradeId,
  646. courseId: courseId,
  647. rebuild: 1,
  648. moduleId: moduleId,
  649. })
  650. .then((res) => {
  651. if (res.data.code == 200) {
  652. for (let i = 0; i < res.data.data.length; i++) {
  653. let item = res.data.data[i];
  654. item.id = item.sectionId;
  655. item.courseId = courseId;
  656. item.menuType = 3;
  657. //判断是否试听
  658. item.tryListen = false;
  659. if (self.goodsAuditionConfigIdList.indexOf(item.id) !== -1) {
  660. item.tryListen = true;
  661. }
  662. }
  663. let newArr = res.data.data.filter((item) => {
  664. return item.type != 2;
  665. });
  666. this.canLearn = newArr.every((item) => {
  667. if (item.learning == 1) {
  668. return true;
  669. } else {
  670. return false;
  671. }
  672. });
  673. self.list = res.data.data;
  674. }
  675. });
  676. },
  677. getBuySectionList(chapterId, courseId, moduleId) {
  678. let self = this;
  679. // /course/sectionList
  680. this.$api
  681. .reSectionList({
  682. chapterId: chapterId,
  683. gradeId: this.gradeId,
  684. courseId: courseId,
  685. moduleId: moduleId,
  686. })
  687. .then((res) => {
  688. if (res.data.code == 200) {
  689. for (let i = 0; i < res.data.data.length; i++) {
  690. let item = res.data.data[i];
  691. item.courseId = courseId;
  692. item.id = item.sectionId;
  693. item.menuType = 3;
  694. //判断是否试听
  695. item.tryListen = false;
  696. if (self.goodsAuditionConfigIdList.indexOf(item.id) !== -1) {
  697. item.tryListen = true;
  698. }
  699. }
  700. let newArr = res.data.data.filter((item) => {
  701. return item.type != 2;
  702. });
  703. this.canLearn = newArr.every((item) => {
  704. if (item.learning == 1) {
  705. return true;
  706. } else {
  707. return false;
  708. }
  709. });
  710. self.list = res.data.data;
  711. // console.log('=======节列表==', this.list);
  712. }
  713. });
  714. },
  715. },
  716. computed: {
  717. ...mapGetters(["goodsAuditionConfigIdList", "chapterOpen"]),
  718. learnStatus() {
  719. if (!this.isBuy) {
  720. return;
  721. }
  722. let { id, courseId, moduleId } = this.menuItem;
  723. // console.log(this.menuItem, id, courseId, moduleId, "this.menuItem");
  724. // console.log(this.sectionItem,)
  725. if (
  726. this.sectionItem.courseId == courseId &&
  727. this.sectionItem.moduleId == (moduleId || 0) &&
  728. this.sectionItem.chapterId == id
  729. ) {
  730. return 0;
  731. }
  732. const list = this.menuAllList.filter(
  733. (e) =>
  734. e.courseId == courseId &&
  735. e.moduleId == (moduleId || 0) &&
  736. e.chapterId == id
  737. );
  738. const isAllLearn = list.every((item) => {
  739. return item.studyStatus == 1;
  740. });
  741. return isAllLearn ? 1 : -1;
  742. },
  743. },
  744. };
  745. </script>
  746. <style lang="scss" scoped>
  747. .tagRe {
  748. // width: 80rpx;
  749. line-height: 28rpx;
  750. padding: 0 8rpx;
  751. height: 28rpx;
  752. background: #ff3b30;
  753. border-radius: 8rpx;
  754. font-size: 20rpx;
  755. color: #ffffff;
  756. text-align: center;
  757. }
  758. .tagGreen {
  759. width: 80rpx;
  760. height: 28rpx;
  761. background: #34c759;
  762. border-radius: 8rpx;
  763. font-size: 20rpx;
  764. color: #ffffff;
  765. text-align: center;
  766. }
  767. .eTag {
  768. width: 64rpx;
  769. height: 36rpx;
  770. text-align: center;
  771. line-height: 36rpx;
  772. font-size: 20rpx;
  773. background: #007aff;
  774. border-radius: 8rpx;
  775. color: #ffffff;
  776. }
  777. .examBox {
  778. display: flex;
  779. align-items: center;
  780. justify-content: space-between;
  781. }
  782. .exam {
  783. font-size: 30rpx;
  784. display: flex;
  785. align-items: center;
  786. margin: 20rpx 0;
  787. }
  788. .icon_up {
  789. width: 24rpx;
  790. height: 24rpx;
  791. }
  792. .title {
  793. // margin-bottom: 30rpx;
  794. height: 78rpx;
  795. display: flex;
  796. justify-content: space-between;
  797. align-items: center;
  798. border-bottom: 1rpx solid #eeeeee;
  799. .menu_name {
  800. font-size: 24rpx;
  801. font-family: PingFang SC;
  802. font-weight: bold;
  803. color: #333;
  804. white-space: nowrap;
  805. overflow: hidden;
  806. text-overflow: ellipsis;
  807. margin-left: 8rpx;
  808. }
  809. .title_status {
  810. padding: 2rpx 8rpx;
  811. border-radius: 8rpx;
  812. font-size: 20rpx;
  813. color: #ffffff;
  814. text-align: center;
  815. margin-left: 4rpx;
  816. }
  817. .gre {
  818. background: #34c759;
  819. }
  820. .blue {
  821. background: #409eff;
  822. }
  823. .grey {
  824. background: #909399;
  825. }
  826. }
  827. </style>