1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef} from '@angular/core';
import * as _ from 'lodash';
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.scss']
})
export class FormComponent implements OnInit, OnChanges, OnDestroy {
// titleObj = {
// audio_url: 'http://iplayabc-courseware.oss-cn-beijing.aliyuncs.com/dev/imman/audios/d108d5d06105fda0526059a3e372f926.mp3',
// content: 'what is this? ',
// icons: [],
// type: 'a'
// };
titleObj = {
audio_url: '',
content: '',
icons: [],
type: ''
};
teststr = "";
constructor(private appRef: ApplicationRef) {
}
ngOnInit() {
let _this = this;
(<any>window).courseware.getData(function(data){
if(data){
_this.titleObj = data;
setTimeout(() => {
_this.appRef.tick();
}, 1);
}
});
}
ngOnChanges() {
}
ngOnDestroy() {
}
updateTitleObjSuccess(titleObj) {
this.titleObj = titleObj;
this.save();
}
onTitleAudioUploadSuccess(res) {
this.titleObj.audio_url = res.url;
this.save();
}
save() {
(<any>window).courseware.setData(this.titleObj);
}
}