Commit 50945ed5 by kyle

公司介绍视频播放不了问题修改

parent fbf4928a
...@@ -87,6 +87,7 @@ export class AppComponent implements OnInit, OnDestroy { ...@@ -87,6 +87,7 @@ export class AppComponent implements OnInit, OnDestroy {
|| event.url.indexOf('/inviter')>=0 || event.url.indexOf('/inviter')>=0
|| event.url.indexOf('/register')>=0 || event.url.indexOf('/register')>=0
|| event.url.indexOf('/invitees')>=0 || event.url.indexOf('/invitees')>=0
|| event.url.indexOf('/video/')>=0
){ ){
this.isShowIndexBtn = false; this.isShowIndexBtn = false;
} }
......
<iframe [src]="filePath | safeResourceUrl" frameborder="0" width="100%" height="100%" style="min-height: 100vh;"></iframe> <iframe [src]="filePath | safeResourceUrl" frameborder="0" width="100%" height="100%" style="min-height: 100vh;" *ngIf="!isVideo"></iframe>
\ No newline at end of file
<video [src]="filePath | safeResourceUrl" frameborder="0" width="100%" height="100%" *ngIf="isVideo" controls></video>
\ No newline at end of file
...@@ -11,6 +11,7 @@ export class VideoComponent implements OnInit { ...@@ -11,6 +11,7 @@ export class VideoComponent implements OnInit {
filePath:string; filePath:string;
fileCategory:string; fileCategory:string;
fileId:string; fileId:string;
isVideo:boolean;
constructor(private activatedRoute: ActivatedRoute, private myService: MyService) { } constructor(private activatedRoute: ActivatedRoute, private myService: MyService) { }
ngOnInit() { ngOnInit() {
...@@ -25,10 +26,40 @@ export class VideoComponent implements OnInit { ...@@ -25,10 +26,40 @@ export class VideoComponent implements OnInit {
this.myService.filePath('3', '0', fileCategory, '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.isVideo = this.judgmentFile(fileUploadItem.filePath,'video');
if(this.isVideo){
this.filePath = fileUploadItem.filePath;
}else{
this.filePath = `assets/pdfjs/web/viewer.html?file=${fileUploadItem.filePath}&isneeddownload=${fileUploadItem.isDownload=='1'?'true':'false'}`
}
} }
}) })
} }
// 判断是不是视频文件
judgmentFile(picUrl,type='video') {
let filename = picUrl; //文件路径地址
let index1 = filename.lastIndexOf(".");
let index2 = filename.length;
let postf = filename.substring(index1, index2).toLowerCase(); //获取文bai件后缀名duzhi
if(type==='video'){
//判断文件后缀名是否等于视频文件的后缀名
if (postf===".avi"||postf===".mp4"||postf===".rmvb"||postf===".mov") {
return true
}else{
return false
}
}else if(type==='pdf'){
//判断文件后缀名是否等于pdf
if (postf===".pdf") {
return true
}else{
return false
}
}
}
menuPrevent() { menuPrevent() {
return false; return false;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<i class="iconfont" style="margin-right: 0;" [ngClass]="fileUploadItem.isDownload=='1' ? 'icon-xiazai' : 'icon-xianshi'"></i> <i class="iconfont" style="margin-right: 0;" [ngClass]="fileUploadItem.isDownload=='1' ? 'icon-xiazai' : 'icon-xianshi'"></i>
</div> </div>
</a> </a>
<a href="javascript:;" [routerLink]="['/video',{'fileId':fileUploadItem.fileId}]" *ngIf="judgmentFile(fileUploadItem.filePath)" (click)="setVideoPath(fileUploadItem)"> <a href="javascript:;" [routerLink]="['/video',fileUploadItem.fileId,fileUploadItem.fileCategory]" *ngIf="judgmentFile(fileUploadItem.filePath)" (click)="setVideoPath(fileUploadItem)">
<div style="overflow-x: hidden; white-space: nowrap;text-overflow: ellipsis;"> <div style="overflow-x: hidden; white-space: nowrap;text-overflow: ellipsis;">
<img src="assets/images/videoIcon.png" alt="视频" *ngIf="judgmentFile(fileUploadItem.filePath)" style=" width: 26px; <img src="assets/images/videoIcon.png" alt="视频" *ngIf="judgmentFile(fileUploadItem.filePath)" style=" width: 26px;
margin-right: 6px;"> margin-right: 6px;">
......
...@@ -182,7 +182,7 @@ const myRoutes: Routes = [ ...@@ -182,7 +182,7 @@ const myRoutes: Routes = [
{ path: 'integration',component:IntegrationComponent,canActivate:[AuthGuard],data:[{title: '我的积分'}]}, { path: 'integration',component:IntegrationComponent,canActivate:[AuthGuard],data:[{title: '我的积分'}]},
{ 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/:fileId/:fileCategory',component:VideoComponent,canActivate:[AuthGuard],data:[{title: '视频播放'}]},
{ path: 'pdfView/:fileId/:fileCategory',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: '全部工具'}]},
......
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