Angular LMS app
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Este repositório está arquivado. Você pode visualizar os arquivos e realizar clone, mas não poderá realizar push nem abrir issues e pull requests.

course-details.component.ts 2.2 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import { Component, OnInit } from '@angular/core';
  2. import { ActivatedRoute } from '@angular/router';
  3. import { Subscription } from 'rxjs';
  4. import { Location } from '@angular/common';
  5. import { DemoService } from '../../../services/demo.service';
  6. @Component({
  7. selector: 'app-course-details',
  8. templateUrl: './course-details.component.html',
  9. styleUrls: ['./course-details.component.scss']
  10. })
  11. export class CourseDetailsComponent implements OnInit {
  12. selectedSegment: string = 'home';
  13. heading: string;
  14. routeSubscription: Subscription;
  15. selectedChapter: number = 0;
  16. showDeletePopup: boolean = false;
  17. isSubSegment: boolean = true;
  18. selectedTopic: number;
  19. classLevel: string;
  20. demoType: string;
  21. chapterList = [];
  22. constructor(
  23. private route: ActivatedRoute,
  24. private location: Location,
  25. private demoService: DemoService
  26. ) { }
  27. ngOnInit(): void {
  28. let classLevel: string, courseId: string;
  29. this.routeSubscription = this.route.params.subscribe((params) => {
  30. classLevel = params['classLevel'];
  31. this.classLevel = classLevel;
  32. courseId = params['courseId'];
  33. });
  34. this.demoType = localStorage.demoType;
  35. let courseData = this.demoService.courseData;
  36. let course = courseData.find((courseClass) => courseClass.classLevel === classLevel).courses.find((course) => course.id === courseId);
  37. this.heading = course.name;
  38. this.chapterList = course.chapterList;
  39. }
  40. ngOnDestroy() {
  41. this.routeSubscription.unsubscribe();
  42. }
  43. back() {
  44. this.location.back();
  45. }
  46. getPopupDeleteDecision(e : string) {
  47. if (e === 'false') {
  48. this.showDeletePopup = false;
  49. }
  50. if (e === 'true') {
  51. this.chapterList[this.selectedChapter].topics[this.selectedTopic].mediaState = 'none';
  52. this.showDeletePopup = false;
  53. }
  54. }
  55. downloadMedia() {
  56. this.chapterList[this.selectedChapter].topics[this.selectedTopic].mediaState = 'downloading';
  57. setTimeout(() => {
  58. this.chapterList[this.selectedChapter].topics[this.selectedTopic].mediaState = 'downloaded';
  59. }, 1500);
  60. }
  61. }