courseChapter.vue 24 KB

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