courseChapter.vue 23 KB

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