Commit 0085e0cd by Sweet Zhang

银盾学院

parent 99bcaf2d
<video *ngIf="!pdfPath" #video <iframe [src]="filePath | safeResourceUrl" frameborder="0" width="100%" height="100%" style="min-height: 100vh;"></iframe>
[src]="videoSrc" \ No newline at end of file
controls="true"
width="100%" preload="auto" (contextmenu)="menuPrevent()" x5-playsinline="true" playsinline="true" webkit-playsinline="true" disablePictureInPicture>
您的浏览器不支持 video 标签。
</video>
<!-- <button type="button" class="downloadBtn" (click)="download(videoSrc)" *ngIf="permissions.isDownload&&deviceType!='1'&&!pdfPath">下载资源</button> -->
<iframe *ngIf="pdfPath" [src]="pdfPath | safeResourceUrl" frameborder="0" width="100%" height="100%" style="min-height: 100vh;"></iframe>
\ No newline at end of file
import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild, } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { MyService } from 'src/app/my/my.service'; import { MyService } from 'src/app/my/my.service';
import { LifeCommonService } from '../life-common.service';
@Component({ @Component({
selector: 'ydlife-video', selector: 'ydlife-video',
templateUrl: './video.component.html', templateUrl: './video.component.html',
styleUrls: ['./video.component.scss'] styleUrls: ['./video.component.scss']
}) })
export class VideoComponent implements OnInit, AfterViewInit, OnDestroy { export class VideoComponent implements OnInit {
@ViewChild('video') video: ElementRef; filePath:string;
videoSrc: string;
pdfPath: any;
permissions: any;
lifeCustomerInfo: any;
timer: any;
timer2: any;
videoPlaybacks: Array<any>;
originTime: number = 0;
fileId:string; fileId:string;
deviceType:string; constructor(private activatedRoute: ActivatedRoute, private myService: MyService) { }
maxViewTime:number = 0;
constructor(private activatedRoute: ActivatedRoute, private myService: MyService,private lifeCommonService:LifeCommonService) { }
ngOnInit() { ngOnInit() {
this.deviceType = this.lifeCommonService.checkDeviceType(); this.fileId = this.activatedRoute.snapshot.params.fileId;
this.videoSrc = sessionStorage.getItem('videoPath'); this.filePathQuery(null,this.fileId)
this.permissions = JSON.parse(sessionStorage.getItem('permissions'));
this.pdfPath = this.activatedRoute.snapshot.queryParams['path'];
this.lifeCustomerInfo = JSON.parse(localStorage.getItem('lifeCustomerInfo'));
this.fileId = this.activatedRoute.snapshot.params['fileId'];
if(!this.pdfPath){
this.queryVideoPlayback(1);
}
} }
ngAfterViewInit(): void {
if(!this.pdfPath){
this.video.nativeElement.addEventListener('pause', ()=> { //暂停开始执行的函数
clearInterval(this.timer);
clearInterval(this.timer2);
console.log('暂停播放')
this.saveVideoPlayback();
});
this.video.nativeElement.addEventListener('play', ()=> { //开始执行的函数
this.timer = setInterval(() => {
console.log('开始播放')
this.saveVideoPlayback();
}, 1000 * 20)
this.queryVideoPlayback(2)
});
if (this.permissions.isDownload == '2') {
this.video.nativeElement.setAttribute('controlslist', this.video.nativeElement.getAttribute('controlslist') + ' nodownload')
} else {
this.video.nativeElement.setAttribute('controlslist', this.video.nativeElement.getAttribute('controlslist'))
}
if (this.permissions.isControlPlayback == '2') {
this.video.nativeElement.setAttribute('controlslist', this.video.nativeElement.getAttribute('controlslist') + ' noplaybackrate')
} else {
this.video.nativeElement.setAttribute('controlslist', this.video.nativeElement.getAttribute('controlslist'))
}
}
}
ngOnDestroy(): void {
if(!this.pdfPath){
clearInterval(this.timer);
clearInterval(this.timer2);
this.saveVideoPlayback();
}
}
menuPrevent() {
return false;
}
saveVideoPlayback() {
// playbackStatus 视频播放状态(1:未播放完;2:已播放完) 【必填】
const param = {
id: '',
customerId: this.lifeCustomerInfo.customerId,
practitionerId: this.lifeCustomerInfo.practitionerId,
fileId: this.fileId,
totalTime: this.video.nativeElement.duration,
viewTime: this.video.nativeElement.currentTime,
playbackStatus: this.video.nativeElement.currentTime >= this.video.nativeElement.duration ? 2 : 1,
}
this.myService.saveVideoPlayback(param).subscribe(res => {
console.log(res);
})
}
queryVideoPlayback(type) { filePathQuery(status, fileId) {
const param = { this.myService.filePath('3', '0', '23', 'yd_trainning_file_type', null, null, status, fileId).subscribe(res => {
id: null, if(res['success']){
customerId: this.lifeCustomerInfo.customerId, const fileUploadItem = res['data']['fileUploadItemList'][0];
practitionerId: this.lifeCustomerInfo.practitionerId, this.filePath = `assets/pdfjs/web/viewer.html?file=${fileUploadItem.filePath}&isneeddownload=${fileUploadItem.isDownload=='1'?'true':'false'}`
fileId: this.fileId,
}
this.myService.queryVideoPlayback(param).subscribe(res => {
if (res['success']) {
this.videoPlaybacks = res['data']['videoPlaybacks'];
this.maxViewTime = this.videoPlaybacks[0]['maxViewTime'];
if(type===1){
// 设置开始播放时间为上次离开时间
this.originTime = this.video.nativeElement.currentTime = this.videoPlaybacks.length > 0 ? this.videoPlaybacks[0]['viewTime'] : 0;
}else{
// 监测有没有拖动进度条
this.timer2 = setInterval(()=>{
if (this.video.nativeElement.currentTime - this.originTime > 1 && this.video.nativeElement.currentTime > this.maxViewTime) {
this.video.nativeElement.currentTime = this.originTime;
}
this.originTime = this.video.nativeElement.currentTime;
},500)
}
} else {
this.video.nativeElement.currentTime = 0;
} }
console.log(res);
}) })
} }
download(path){ menuPrevent() {
window.open(path) return false;
} }
} }
<div class="courseDetailContainer"> <div class="courseDetailContainer">
<div class="courseInitShow"> <div class="courseInitShow">
<video *ngIf="!pdfPath" #video <video *ngIf="canplay" #video
[src]="fileUploadItem?.filePath" [src]="fileUploadItem?.filePath"
controls="true" controls="true"
[poster]="fileUploadItem?.fileFirstImg" [poster]="fileUploadItem?.fileFirstImg"
width="100%" height="200px" preload="auto" (contextmenu)="menuPrevent()" x5-playsinline="true" playsinline="true" webkit-playsinline="true" disablePictureInPicture> width="100%" height="200px" preload="auto" (contextmenu)="menuPrevent()" x5-playsinline="true" playsinline="true" webkit-playsinline="true" disablePictureInPicture>
您的浏览器不支持 video 标签。 您的浏览器不支持 video 标签。
</video> </video>
<img *ngIf="!canplay" [src]="fileUploadItem?.fileFirstImg" alt="" srcset="">
</div> </div>
<div class="courseTitle"> <div class="courseTitle">
<h4>{{fileUploadItem?.itemName}}</h4> <h4>{{fileUploadItem?.itemName}}</h4>
<div> <span class="viewpdf" *ngIf="fileUploadItem?.filePath && fileUploadItem?.filePath.indexOf('.pdf') > -1" [routerLink]="['/pdfView',fileId]">立即阅读</span>
<span *ngIf="pdfPath">立即阅读</span>
<span>不可下载</span>
</div>
</div> </div>
<div class="courseIntroContent"> <div class="courseIntroContent">
<div class="tab"> <div class="tab">
...@@ -42,7 +39,7 @@ ...@@ -42,7 +39,7 @@
<p style="width: 30px;"> <p style="width: 30px;">
<img [src]="'assets/images/icons/' + (fileUploadItem.learningStatus == '3' ? 'disablePlay' : 'play') + '.png'" alt="" srcset=""> <img [src]="'assets/images/icons/' + (fileUploadItem.learningStatus == '3' ? 'disablePlay' : 'play') + '.png'" alt="" srcset="">
</p> </p>
<p>{{fileUploadItem.learningStatus == '3' ? '不可播放' : '播放'}}</p> <p>{{fileUploadItem?.filePath.indexOf('.pdf') > -1 ? '点击阅读' : (fileUploadItem.learningStatus == '3' ? '不可播放' : '播放')}}</p>
</div> </div>
</li> </li>
</ul> </ul>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
height: calc(100vh - 70px); height: calc(100vh - 70px);
.courseInitShow{ .courseInitShow{
height: 200px; height: 200px;
background: rgba(237,237,237,.5);
} }
.courseTitle{ .courseTitle{
padding: 0 13px; padding: 0 13px;
...@@ -14,7 +15,15 @@ ...@@ -14,7 +15,15 @@
h4{ h4{
font-size: 20px; font-size: 20px;
color: #333; color: #333;
width: 70%; flex: 1 1 auto;
width: 0;
}
.viewpdf{
padding: 3px 8px;
background: #5f83ff;
border-radius: 5px;
color: #fff;
white-space: nowrap;
} }
} }
.courseIntroContent{ .courseIntroContent{
......
...@@ -53,10 +53,12 @@ export class MoreFeaturesComponent implements OnInit,OnDestroy { ...@@ -53,10 +53,12 @@ export class MoreFeaturesComponent implements OnInit,OnDestroy {
{no:23,name:'保险ABC',icon:'insuranceABC',link:'',path:`https://${window.location.host}/issue`,isOpen:true}, {no:23,name:'保险ABC',icon:'insuranceABC',link:'',path:`https://${window.location.host}/issue`,isOpen:true},
{no:24,name:'岗前训',icon:'preJobTraining',link:'/prejobTraining',path:'',isOpen:true}, {no:24,name:'岗前训',icon:'preJobTraining',link:'/prejobTraining',path:'',isOpen:true},
{no:25,name:'新人训',icon:'newTraining',link:'/newTraining',path:'',isOpen:true}, {no:25,name:'新人训',icon:'newTraining',link:'/newTraining',path:'',isOpen:true},
{no:27,name:'CFFP初级训',icon:'cffpTraining',link:'/cffpElementaryTraining',path:'',isOpen:true},
{no:26,name:'提升训',icon:'promotionTraining',link:'/advanceTraining',path:'',isOpen:true}, {no:26,name:'提升训',icon:'promotionTraining',link:'/advanceTraining',path:'',isOpen:true},
{no:27,name:'CFFP培训',icon:'cffpTraining',link:'/cffpTraining',path:'',isOpen:true}, {no:27,name:'CFFP衔接训',icon:'cffpTraining',link:'/cffpBridgingTraining',path:'',isOpen:true},
{no:27,name:'CFFP高阶训',icon:'cffpTraining',link:'/cffpAdvancedTraining',path:'',isOpen:true},
{no:28,name:'产品培训',icon:'productTraining',link:'/productTraining',path:'',isOpen:true}, {no:28,name:'产品培训',icon:'productTraining',link:'/productTraining',path:'',isOpen:true},
{no:29,name:'我的培训',icon:'training',link:'',path:'',isOpen:false}, {no:29,name:'我的培训',icon:'training',link:'/myTraining',path:'',isOpen:true},
] ]
} }
,{ ,{
......
...@@ -90,13 +90,14 @@ const myRoutes: Routes = [ ...@@ -90,13 +90,14 @@ const myRoutes: Routes = [
{ path: 'material', component: MkMaterialComponent, canActivate: [AuthGuard],data:[{title:'产品海报'}] }, { path: 'material', component: MkMaterialComponent, canActivate: [AuthGuard],data:[{title:'产品海报'}] },
{ path: 'material/:itemId', component: MkMaterialDetailComponent, canActivate: [AuthGuard],data:[{title:'产品海报'}] }, { path: 'material/:itemId', component: MkMaterialDetailComponent, canActivate: [AuthGuard],data:[{title:'产品海报'}] },
{ path: 'fileUpload', component: FileUploadComponent, canActivate: [AuthGuard], data: [{ type: 'fileUpload',title:'文件下载' }] }, { path: 'fileUpload', component: FileUploadComponent, canActivate: [AuthGuard], data: [{ type: 'fileUpload',title:'文件下载' }] },
{ path: 'training', component: FileUploadComponent, canActivate: [AuthGuard], data: [{ type: 'training' ,title:'我的培训'}] },
{ path: 'trainingVideo', component: FileUploadComponent, canActivate: [AuthGuard], data: [{ type: 'trainingVideo' ,title:'视频培训'}] }, { path: 'trainingVideo', component: FileUploadComponent, canActivate: [AuthGuard], data: [{ type: 'trainingVideo' ,title:'视频培训'}] },
{ path: 'prejobTraining', component: FileUploadComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type' ,title:'岗前训'}] }, { path: 'prejobTraining', component: TrainingRecordsComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type' ,title:'岗前训'}] },
{ path: 'newTraining', component: FileUploadComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type',title:'新人训' }] }, { path: 'newTraining', component: TrainingRecordsComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type',title:'新人训' }] },
{ path: 'advanceTraining', component: FileUploadComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type',title:'提升训' }] }, { path: 'advanceTraining', component: TrainingRecordsComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type',title:'提升训' }] },
{ path: 'cffpTraining', component: FileUploadComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type',title:'CFFP培训' }] }, { path: 'cffpElementaryTraining', component: TrainingRecordsComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type',title:'CFFP初级训' }] },
{ path: 'productTraining', component: FileUploadComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type',title:'产品培训' }] }, { path: 'cffpBridgingTraining', component: TrainingRecordsComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type',title:'CFFP衔接训' }] },
{ path: 'cffpAdvancedTraining', component: TrainingRecordsComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type',title:'CFFP高阶训' }] },
{ path: 'productTraining', component: TrainingRecordsComponent, canActivate: [AuthGuard], data: [{ type: 'yd_trainning_file_type',title:'产品培训' }] },
{ path: 'importantAnnouncement', component: ImportantAnnouncementComponent, canActivate: [AuthGuard] ,data:[{title:'重要公告'}]}, { path: 'importantAnnouncement', component: ImportantAnnouncementComponent, canActivate: [AuthGuard] ,data:[{title:'重要公告'}]},
{ path: 'salesDetail', component: SalesDetailComponent, canActivate: [AuthGuard],data:[{title:'我的保单'}] }, { path: 'salesDetail', component: SalesDetailComponent, canActivate: [AuthGuard],data:[{title:'我的保单'}] },
{ path: 'importantAnnouncement/:id', component: AnnouncementDetailComponent, canActivate: [AuthGuard] ,data:[{title:'重要公告'}] }, { path: 'importantAnnouncement/:id', component: AnnouncementDetailComponent, canActivate: [AuthGuard] ,data:[{title:'重要公告'}] },
...@@ -182,7 +183,7 @@ const myRoutes: Routes = [ ...@@ -182,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',component:VideoComponent,canActivate:[AuthGuard],data:[{title: 'PDF查看'}]}, { path: 'pdfView/:fileId',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: '我的'}]},
......
...@@ -24,5 +24,5 @@ ...@@ -24,5 +24,5 @@
</li> </li>
</ul> </ul>
<h4 *ngIf="!fileUploadItemList">暂无课程列表</h4> <h4 *ngIf="!fileUploadItemList || (fileUploadItemList && fileUploadItemList.length<1)">暂无课程列表</h4>
</div> </div>
\ No newline at end of file
...@@ -10,16 +10,17 @@ ...@@ -10,16 +10,17 @@
margin-bottom: 10px; margin-bottom: 10px;
>div:first-child{ >div:first-child{
margin-right: 7px; margin-right: 7px;
width: 114px; width: 0;
height: 104px; height: 104px;
background-color: #ccc; background-color: #ccc;
overflow: hidden; overflow: hidden;
flex: 0 0 114px;
} }
.introItem{ .introItem{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
flex: 1 1 0;
} }
h5{ h5{
font-size: 16px; font-size: 16px;
......
...@@ -8,6 +8,7 @@ import { MyService } from '../my.service'; ...@@ -8,6 +8,7 @@ import { MyService } from '../my.service';
styleUrls: ['./training-records.component.scss'] styleUrls: ['./training-records.component.scss']
}) })
export class TrainingRecordsComponent implements OnInit { export class TrainingRecordsComponent implements OnInit {
public type:string;
public status:string; public status:string;
public customerId:string = localStorage.getItem('lifeCustomerInfo') ? JSON.parse(localStorage.getItem('lifeCustomerInfo')).customerId : null; public customerId:string = localStorage.getItem('lifeCustomerInfo') ? JSON.parse(localStorage.getItem('lifeCustomerInfo')).customerId : null;
public fileUploadItemList:Array<any>; public fileUploadItemList:Array<any>;
...@@ -16,18 +17,25 @@ export class TrainingRecordsComponent implements OnInit { ...@@ -16,18 +17,25 @@ export class TrainingRecordsComponent implements OnInit {
filePathQuery(status){ filePathQuery(status,code=null){
this.myService.filePath(3,0,23,'yd_trainning_file_type',null,this.customerId,status).subscribe(res=>{ this.myService.filePath(3,0,23,'yd_trainning_file_type',code,this.customerId,status).subscribe(res=>{
if(res['success']){ if(res['success']){
this.fileUploadItemList = res['data']['fileUploadItemList'] this.fileUploadItemList = res['data']['fileUploadItemList']
} }
}) })
} }
constructor(private activatedRoute:ActivatedRoute,private myService:MyService) { } constructor(private activatedRoute:ActivatedRoute,private myService:MyService) {
this.type = this.activatedRoute.snapshot['data'][0]['type']
}
ngOnInit() { ngOnInit() {
this.status = this.activatedRoute.snapshot.params['status']; this.status = this.activatedRoute.snapshot.params['status'];
this.filePathQuery(this.status) if(this.type=== 'yd_trainning_file_type'){
const code = this.activatedRoute.snapshot.routeConfig.path;
this.filePathQuery(null,code)
}else{
this.filePathQuery(this.status)
}
} }
......
...@@ -11,10 +11,12 @@ export class YdCollegeComponent implements OnInit { ...@@ -11,10 +11,12 @@ export class YdCollegeComponent implements OnInit {
{no:23,name:'保险ABC',icon:'insuranceABC',link:'',path:`https://${window.location.host}/issue`,isOpen:true}, {no:23,name:'保险ABC',icon:'insuranceABC',link:'',path:`https://${window.location.host}/issue`,isOpen:true},
{no:24,name:'岗前训',icon:'preJobTraining',link:'/prejobTraining',path:'',isOpen:true}, {no:24,name:'岗前训',icon:'preJobTraining',link:'/prejobTraining',path:'',isOpen:true},
{no:25,name:'新人训',icon:'newTraining',link:'/newTraining',path:'',isOpen:true}, {no:25,name:'新人训',icon:'newTraining',link:'/newTraining',path:'',isOpen:true},
{no:26,name:'提升训',icon:'promotionTraining',link:'/advanceTraining',path:'',isOpen:true}, {no:26,name:'CFFP初级训',icon:'cffpTraining',link:'/cffpElementaryTraining',path:'',isOpen:true},
{no:27,name:'CFFP培训',icon:'cffpTraining',link:'/cffpTraining',path:'',isOpen:true}, {no:27,name:'提升训',icon:'promotionTraining',link:'/advanceTraining',path:'',isOpen:true},
{no:28,name:'产品培训',icon:'productTraining',link:'/productTraining',path:'',isOpen:true}, {no:28,name:'CFFP衔接训',icon:'cffpTraining',link:'/cffpBridgingTraining',path:'',isOpen:true},
{no:29,name:'我的培训',icon:'training',link:'/myTraining',path:'',isOpen:true} {no:29,name:'CFFP高阶训',icon:'cffpTraining',link:'/cffpAdvancedTraining',path:'',isOpen:true},
{no:30,name:'产品培训',icon:'productTraining',link:'/productTraining',path:'',isOpen:true},
{no:31,name:'我的培训',icon:'training',link:'/myTraining',path:'',isOpen:true}
] ]
public state = { public state = {
modal1:false modal1:false
......

1.31 KB | W: | H:

3.98 KB | W: | H:

src/assets/images/indexIcons/training.png
src/assets/images/indexIcons/training.png
src/assets/images/indexIcons/training.png
src/assets/images/indexIcons/training.png
  • 2-up
  • Swipe
  • Onion skin
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