Commit fbf4928a by kyle

解决pdf没办法打开的问题

parent bcc929d4
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
"ng-zorro-antd-mobile": "^0.12.5", "ng-zorro-antd-mobile": "^0.12.5",
"ngx-echarts": "^3.2.0", "ngx-echarts": "^3.2.0",
"ngx-ueditor": "^2.1.3", "ngx-ueditor": "^2.1.3",
"node-sass": "^4.14.1", "node-sass": "4.14.1",
"rxjs": "~6.3.3", "rxjs": "~6.3.3",
"save": "^2.4.0", "save": "^2.4.0",
"signature_pad": "^3.0.0-beta.4", "signature_pad": "^3.0.0-beta.4",
......
...@@ -9,17 +9,20 @@ import { MyService } from 'src/app/my/my.service'; ...@@ -9,17 +9,20 @@ import { MyService } from 'src/app/my/my.service';
}) })
export class VideoComponent implements OnInit { export class VideoComponent implements OnInit {
filePath:string; filePath:string;
fileCategory:string;
fileId:string; fileId:string;
constructor(private activatedRoute: ActivatedRoute, private myService: MyService) { } constructor(private activatedRoute: ActivatedRoute, private myService: MyService) { }
ngOnInit() { ngOnInit() {
this.fileId = this.activatedRoute.snapshot.params.fileId; this.fileId = this.activatedRoute.snapshot.params.fileId;
this.filePathQuery(null,this.fileId) this.fileCategory = this.activatedRoute.snapshot.params.fileCategory;
console.log(this.activatedRoute)
this.filePathQuery(null,this.fileId,this.fileCategory)
} }
filePathQuery(status, fileId) { filePathQuery(status, fileId,fileCategory='23') {
this.myService.filePath('3', '0', '23', 'yd_trainning_file_type', null, null, status, fileId).subscribe(res => { this.myService.filePath('3', '0', fileCategory, 'yd_trainning_file_type', null, null, status, fileId).subscribe(res => {
if(res['success']){ if(res['success']){
const fileUploadItem = res['data']['fileUploadItemList'][0]; const fileUploadItem = res['data']['fileUploadItemList'][0];
this.filePath = `assets/pdfjs/web/viewer.html?file=${fileUploadItem.filePath}&isneeddownload=${fileUploadItem.isDownload=='1'?'true':'false'}` this.filePath = `assets/pdfjs/web/viewer.html?file=${fileUploadItem.filePath}&isneeddownload=${fileUploadItem.isDownload=='1'?'true':'false'}`
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</div> </div>
<div class="courseTitle"> <div class="courseTitle">
<h4>{{fileUploadItem?.itemName}}</h4> <h4>{{fileUploadItem?.itemName}}</h4>
<span class="viewpdf" *ngIf="fileUploadItem?.filePath && fileUploadItem?.filePath.indexOf('.pdf') > -1 && (fileUploadItem.learningStatus == 1 || fileUploadItem.learningStatus == 2)" (click)="viewPdfDetail(fileId)">立即阅读</span> <span class="viewpdf" *ngIf="fileUploadItem?.filePath && fileUploadItem?.filePath.indexOf('.pdf') > -1 && (fileUploadItem.learningStatus == 1 || fileUploadItem.learningStatus == 2)" (click)="viewPdfDetail(fileUploadItem)">立即阅读</span>
</div> </div>
<div class="courseIntroContent"> <div class="courseIntroContent">
<div class="tab"> <div class="tab">
......
...@@ -159,9 +159,9 @@ export class CourseDetailComponent implements OnInit,OnDestroy { ...@@ -159,9 +159,9 @@ export class CourseDetailComponent implements OnInit,OnDestroy {
} }
// 立即阅读 // 立即阅读
viewPdfDetail(fileId){ viewPdfDetail(fileUploadItem){
this.saveVideoPlayback(2); this.saveVideoPlayback(2);
this.router.navigate(['/pdfView',fileId]); this.router.navigate(['/pdfView',fileUploadItem.fileId,fileUploadItem.fileCategory]);
} }
queryVideoPlayback(type) { queryVideoPlayback(type) {
......
...@@ -18,7 +18,7 @@ export class FileUploadComponent implements OnInit { ...@@ -18,7 +18,7 @@ export class FileUploadComponent implements OnInit {
} }
viewPdf(fileUploadItem){ viewPdf(fileUploadItem){
this.router.navigate(['/pdfView'],{queryParams:{path:`assets/pdfjs/web/viewer.html?file=${fileUploadItem.filePath}&isneeddownload=${fileUploadItem.isDownload=='1'?'true':'false'}`}}) this.router.navigate(['/pdfView',fileUploadItem.fileId,fileUploadItem.fileCategory],{queryParams:{path:`assets/pdfjs/web/viewer.html?file=${fileUploadItem.filePath}&isneeddownload=${fileUploadItem.isDownload=='1'?'true':'false'}`}})
sessionStorage.setItem('permissions',JSON.stringify({isDownload: fileUploadItem.isDownload,isControlPlayback:fileUploadItem.isControlPlayback})) sessionStorage.setItem('permissions',JSON.stringify({isDownload: fileUploadItem.isDownload,isControlPlayback:fileUploadItem.isControlPlayback}))
} }
setVideoPath(fileUploadItem){ setVideoPath(fileUploadItem){
......
...@@ -183,7 +183,7 @@ const myRoutes: Routes = [ ...@@ -183,7 +183,7 @@ const myRoutes: Routes = [
{ path: 'integration_detail',component:IntegrationDetailComponent,canActivate:[AuthGuard],data:[{title: '积分明细'}]}, { path: 'integration_detail',component:IntegrationDetailComponent,canActivate:[AuthGuard],data:[{title: '积分明细'}]},
{ path: 'integration_rule',component:IntegrationRuleComponent,canActivate:[AuthGuard],data:[{title: '积分规则'}]}, { path: 'integration_rule',component:IntegrationRuleComponent,canActivate:[AuthGuard],data:[{title: '积分规则'}]},
{ path: 'video',component:VideoComponent,canActivate:[AuthGuard],data:[{title: '视频播放'}]}, { path: 'video',component:VideoComponent,canActivate:[AuthGuard],data:[{title: '视频播放'}]},
{ path: 'pdfView/:fileId',component:VideoComponent,canActivate:[AuthGuard],data:[{title: 'PDF查看'}]}, { path: 'pdfView/:fileId/:fileCategory',component:VideoComponent,canActivate:[AuthGuard],data:[{title: 'PDF查看'}]},
{ path: 'newsDetail/:id',component:NewsDetailComponent,canActivate:[AuthGuard],data:[{title: '消息详情'}]}, { path: 'newsDetail/:id',component:NewsDetailComponent,canActivate:[AuthGuard],data:[{title: '消息详情'}]},
{ path: 'moreFeatures',component:MoreFeaturesComponent,canActivate:[AuthGuard],data:[{title: '全部工具'}]}, { path: 'moreFeatures',component:MoreFeaturesComponent,canActivate:[AuthGuard],data:[{title: '全部工具'}]},
{ path: 'mine',component:MineComponent,canActivate:[AuthGuard],data:[{title: '我的'}]}, { path: 'mine',component:MineComponent,canActivate:[AuthGuard],data:[{title: '我的'}]},
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment