Commit 165c7f5f authored by kingweight's avatar kingweight

修复视频上传问题

parent e153ebda
import {Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SecurityContext, ViewChild} from '@angular/core'; import {Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SecurityContext, SimpleChanges, ViewChild} from '@angular/core';
import {HttpClientModule} from '@angular/common/http'; import {HttpClientModule} from '@angular/common/http';
import {HttpClient, HttpHeaders, HttpRequest, HttpEvent, HttpEventType, HttpResponse, HttpParams} from "@angular/common/http"; import {HttpClient, HttpHeaders, HttpRequest, HttpEvent, HttpEventType, HttpResponse, HttpParams} from "@angular/common/http";
...@@ -119,7 +119,6 @@ export class UploadVideoComponent implements OnChanges, OnDestroy, OnInit { ...@@ -119,7 +119,6 @@ export class UploadVideoComponent implements OnChanges, OnDestroy, OnInit {
} }
ngOnInit() { ngOnInit() {
this.playVedioUrl = this.videoUrl.replace(`_h.mp4`, `_l.mp4`);;
this.parentRef.emit(this); this.parentRef.emit(this);
} }
...@@ -127,12 +126,11 @@ export class UploadVideoComponent implements OnChanges, OnDestroy, OnInit { ...@@ -127,12 +126,11 @@ export class UploadVideoComponent implements OnChanges, OnDestroy, OnInit {
md5Short(str, _salt) { md5Short(str, _salt) {
return cryptoJs.MD5(str + _salt).toString(); return cryptoJs.MD5(str + _salt).toString();
} }
ngOnChanges() { ngOnChanges(changes: SimpleChanges) {
// if (!this.videoFile || this.showUploadBtn) { console.log(`=============changes==============`,changes);
// return; if (changes['videoUrl'] && !this.uploaded) {
// } this.playVedioUrl = this.videoUrl ? this.videoUrl.replace(`_h.mp4`, `_l.mp4`) : '';
// this.beforeUpload(this.videoFile); }
// this.handleUpload();
} }
ngOnDestroy(): void { ngOnDestroy(): void {
URL.revokeObjectURL(this.videoUrl); URL.revokeObjectURL(this.videoUrl);
...@@ -281,7 +279,7 @@ export class UploadVideoComponent implements OnChanges, OnDestroy, OnInit { ...@@ -281,7 +279,7 @@ export class UploadVideoComponent implements OnChanges, OnDestroy, OnInit {
} }
uploadSuccess = (file) => { uploadSuccess = (file) => {
this.nzMessageService.info('Upload Success'); //this.nzMessageService.info('Upload Success');
// this.updateStatus(false); // this.updateStatus(false);
this.uploading = false; this.uploading = false;
this.uploaded = true; this.uploaded = true;
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
<div style="margin-bottom: 10px; display: flex; align-items: center;"> <div style="margin-bottom: 10px; display: flex; align-items: center;">
<div style="width: 300px;"> <div style="width: 300px;">
<app-upload-image-with-preview [picUrl]="question.pic_url" <app-upload-image-with-preview [picUrl]="question.pic_url" [TIP]="'点击上传题目图片'"
(imageUploaded)="onItemImgUploadSuccess($event, question, 'pic_url')"> (imageUploaded)="onItemImgUploadSuccess($event, question, 'pic_url')">
</app-upload-image-with-preview> </app-upload-image-with-preview>
</div> </div>
......
...@@ -759,10 +759,11 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -759,10 +759,11 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
initItem() { initItem() {
if (this.item.video_url) {
this.fragmentVideoUrl = this.item.video_url.replace("_h.mp4", ".mp4").replace(".mp4", "_l.mp4");
} }
}
templateTypeChange(e) { templateTypeChange(e) {
console.log("in templateTypeChange e: ", e); console.log("in templateTypeChange e: ", e);
...@@ -772,9 +773,6 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -772,9 +773,6 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
createShell() { createShell() {
this.item.wordList.push({ this.item.wordList.push({
word: '', word: '',
......
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