textbook-details.component.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import {
  2. Component,
  3. OnInit,
  4. ViewChild,
  5. } from '@angular/core';
  6. import { CommonCompModule } from '../../../services/common.modules';
  7. import { Router, ActivatedRoute } from '@angular/router';
  8. import { ReactiveFormsModule } from '@angular/forms';
  9. import { NzAnchorModule } from 'ng-zorro-antd/anchor';
  10. import { DatePipe } from '@angular/common';
  11. import Parse from 'parse';
  12. @Component({
  13. selector: 'app-textbook-details',
  14. imports: [
  15. CommonCompModule,
  16. ReactiveFormsModule,
  17. NzAnchorModule,
  18. DatePipe,
  19. ],
  20. standalone: true,
  21. templateUrl: './textbook-details.component.html',
  22. styleUrls: ['./textbook-details.component.scss'],
  23. providers: [DatePipe],
  24. })
  25. export class TextbookDetailsComponent implements OnInit {
  26. @ViewChild('templ1') templ1: any;
  27. user?:Parse.Object
  28. textBook: object | any = {}
  29. constructor(private router: Router, private activeRoute: ActivatedRoute) {}
  30. ngOnInit() {
  31. this.activeRoute.paramMap.subscribe(async (params) => {
  32. this.user = Parse.User.current()
  33. let id = params.get('id');
  34. if (id) {
  35. let query = new Parse.Query('EduTextbook');
  36. query.equalTo('objectId', id);
  37. let r = await query.first();
  38. this.textBook = r?.toJSON()
  39. console.log(this.textBook);
  40. }
  41. });
  42. }
  43. handleClick(e: string): void {
  44. console.log(e);
  45. }
  46. back() {
  47. history.back();
  48. }
  49. edit(){
  50. this.router?.navigate(['/nav-author/manage/apply',{id:this.textBook.objectId}],{ replaceUrl: true })
  51. }
  52. openFile(url:string){
  53. console.log(url);
  54. window.open(url)
  55. }
  56. /**锚点 */
  57. herfLink(domId:string){
  58. console.log(domId)
  59. let topEle = document.getElementById(domId)
  60. if(topEle){
  61. topEle.scrollIntoView({ behavior: 'smooth' });
  62. }
  63. }
  64. }