Commit 2ea4551e authored by 李维's avatar 李维

dev commit

parent 65c3a252
......@@ -15,21 +15,21 @@
<span>显示选项</span><span> :</span>
</div>
<div style="flex:3">
<nz-radio-group [(ngModel)]="item.contentObj.mainQuestion.type" (ngModelChange)="saveItem()" >
<nz-radio-group [(ngModel)]="contentObj.mainQuestion.type" (ngModelChange)="saveItem()" >
<label nz-radio [nzValue]="'Text'">文字</label>
<label nz-radio [nzValue]="'Image'">图片</label>
<label nz-radio [nzValue]="'LongAudio'">长音频</label>
</nz-radio-group>
</div>
<div style="flex:8">
<div *ngIf="item.contentObj.mainQuestion.type=='Image'">
<app-upload-image-with-preview style="width: 100%;" [picUrl]="item.contentObj.mainQuestion.image_url" (imageUploaded)="onImageUploadSuccessByItem($event, item.contentObj.mainQuestion, 'image_url')"></app-upload-image-with-preview>
<div *ngIf="contentObj.mainQuestion.type=='Image'">
<app-upload-image-with-preview style="width: 100%;" [picUrl]="contentObj.mainQuestion.image_url" (imageUploaded)="onImageUploadSuccessByItem($event, contentObj.mainQuestion, 'image_url')"></app-upload-image-with-preview>
</div>
<div *ngIf="item.contentObj.mainQuestion.type=='Text'">
<textarea type="text" nz-input placeholder="" [(ngModel)]="item.contentObj.mainQuestion.text" (blur)="saveItem()" ></textarea>
<div *ngIf="contentObj.mainQuestion.type=='Text'">
<textarea type="text" nz-input placeholder="" [(ngModel)]="contentObj.mainQuestion.text" (blur)="saveItem()" ></textarea>
</div>
<div *ngIf="item.contentObj.mainQuestion.type=='LongAudio'">
<app-audio-recorder [audioUrl]="item.contentObj.mainQuestion.longAudio_url" (audioUploaded)="onAudioUploadSuccessByItem($event, item, 'longAudio_url')" ></app-audio-recorder>
<div *ngIf="contentObj.mainQuestion.type=='LongAudio'">
<app-audio-recorder [audioUrl]="contentObj.mainQuestion.longAudio_url" (audioUploaded)="onAudioUploadSuccessByItem($event, contentObj.mainQuestion, 'longAudio_url')" ></app-audio-recorder>
</div>
</div>
</div>
......@@ -42,7 +42,7 @@
<span>短音频</span><span> :</span>
</div>
<div style="flex:3">
<app-audio-recorder [audioUrl]="item.contentObj.mainQuestion.shortAudio_url" (audioUploaded)="onAudioUploadSuccessByItem($event, item, 'shortAudio_url')" ></app-audio-recorder>
<app-audio-recorder [audioUrl]="contentObj.mainQuestion.shortAudio_url" (audioUploaded)="onAudioUploadSuccessByItem($event, contentObj.mainQuestion, 'shortAudio_url')" ></app-audio-recorder>
</div>
<div style="flex:8"></div>
</div>
......
......@@ -20,6 +20,19 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
get item() {
return this._item;
}
contentObj = {
"version": "1.0",
key: "DataKey_PU03",
mainQuestion:{
type: "Text",
text: "",
image_url: "",
shortAudio_url: "",
longAudio_url: ""
},
textUp:[],
textDown:[]
}
@Output()
update = new EventEmitter();
......@@ -32,7 +45,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item.contentObj = {};
const getData = (<any> window).courseware.getData;
getData((data) => {
// console.log("读取数据", data)
console.log("读取数据", data)
if (data) {
this.item = data;
} else {
......@@ -42,7 +55,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item.contentObj = {};
}
this.init();
// this.refresh();
this.refresh();
this.save()
}, this.KEY);
}
......@@ -54,9 +67,16 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
init() {
if(!this.item.contentObj || !this.item.contentObj.mainQuestion){
this.item.contentObj = defauleFormData
if (Object.keys(this.item.contentObj).length != 0 && this.item.contentObj.version && this.item.contentObj.version==defauleFormData.version) {
console.log("读取数据", this.item.contentObj)
this.contentObj = this.item.contentObj;
} else {
this.contentObj = defauleFormData;
// console.log("使用默认数据", this.contentObj)
this.item.contentObj = this.contentObj;
}
this.options = []
this.item.contentObj.textDown.forEach((item, index) => {
this.options.push(index)
......
......@@ -170,10 +170,10 @@ export class PlayComponent implements OnInit, OnDestroy {
// 映射预加载音频[网路]资源 返回包含音频路径的数组
mapToAduioArray(contentObj){
let array = []
if(contentObj.mainQuestion.type == "Image"){
array.push(contentObj.mainQuestion.shortAudio_url)
if(contentObj.mainQuestion.type == "LongAudio"){
array.push(contentObj.mainQuestion.longAudio_url)
}
array.push(contentObj.mainQuestion.shortAudio_url)
return array
}
......@@ -476,7 +476,10 @@ export class PlayComponent implements OnInit, OnDestroy {
longAudio.audio = this.g_cartoon.audio.get(this.g_formData.mainQuestion.longAudio_url)
// 时间标签
let time = longAudio.audio.duration
let time = 0;
if(longAudio.audio){
time = longAudio.audio.duration
}
let endTime = Math.floor(time / 60)
let timeString = ""
if(endTime<9){
......@@ -514,6 +517,10 @@ export class PlayComponent implements OnInit, OnDestroy {
slider.enableSlider = false;
slider.release = ()=>{
if(!longAudio.audio){
this.g_enableMapUp = true;
return;
}
slider.enableSlider= false;
this.g_enableMapDown = true;
longAudio.refreshAudioProgress();
......@@ -533,6 +540,7 @@ export class PlayComponent implements OnInit, OnDestroy {
})
// 音频时间
if(longAudio.audio){
longAudio.audio.onended = ()=>{
longAudio.pause()
longAudio.pause_icon.visible = false;
......@@ -545,7 +553,6 @@ export class PlayComponent implements OnInit, OnDestroy {
let per = longAudio.audio.currentTime / time
slider.ref.x = -(527/2) + 527 * per
coverColor.width = slider.ref.x - (-(527/2))
}
let _time = parseInt(longAudio.audio.currentTime)
let m = parseInt(_time/60 + "")
......@@ -558,6 +565,8 @@ export class PlayComponent implements OnInit, OnDestroy {
let per = dis / 527
longAudio.audio.currentTime = longAudio.audio.duration * per
}
}
longAudio.ref.addChild(audioClick.ref)
longAudio.ref.addChild(longAudio_pause)
......@@ -569,6 +578,10 @@ export class PlayComponent implements OnInit, OnDestroy {
// 滑动滑块
this.subscribeMapDownEvent(slider.id, ()=>{
if(!longAudio.audio){
this.g_enableMapDown = true;
return;
}
if(!slider.enableSlider){
slider.enableSlider= true;
this.enableMoveAsstant(()=>{
......@@ -594,6 +607,10 @@ export class PlayComponent implements OnInit, OnDestroy {
// 播放按钮点击
this.subscribeMapDownEvent(audioClick.id, ()=>{
if(!longAudio.audio){
this.g_enableMapDown = true;
return;
}
if(longAudio.isPlay){
longAudio.pause()
longAudio.isPlay = false;
......@@ -706,21 +723,20 @@ export class PlayComponent implements OnInit, OnDestroy {
A3.push(temp.e3)
A4.push(temp.e4)
A5.push(temp.e5)
A6.push(temp.e6)
})
// let movedDis =this.alignCenter(A1)
// A2.forEach(item=>{
// item.x = item.x + movedDis
// })
// A3.forEach(item=>{
// item.x = item.x + movedDis
// })
// A4.forEach(item=>{
// item.x = item.x + movedDis
// })
// A5.forEach(item=>{
// item.x = item.x + movedDis
// })
let movedDis =this.alignCenter(A1)
A2.forEach(item=>{
item.x = item.x + movedDis
})
A3.forEach(item=>{
item.x = item.x + movedDis
})
A4.forEach(item=>{
item.x = item.x + movedDis
})
A5.forEach(item=>{
item.x = item.x + movedDis
})
}
createCardUp(index, label, pos){
......@@ -892,8 +908,7 @@ export class PlayComponent implements OnInit, OnDestroy {
e2: panzi,
e3: label,
e4: dot,
e5: card.startAni,
e6: dot_red
e5: dot_red
}
}
......@@ -1013,7 +1028,7 @@ export class PlayComponent implements OnInit, OnDestroy {
borderRight.ref.visible = true
// 连接节点
let dot = this.g_cartoon.createImage("icon_dian1", (w, h)=>{
let dot = this.g_cartoon.createImage("icon_dian2", (w, h)=>{
return {
sx: 37*this.g_mapScale / w,
sy: 37*this.g_mapScale / h
......
src/assets/play/6.png

187 Bytes | W: | H:

src/assets/play/6.png

1.46 KB | W: | H:

src/assets/play/6.png
src/assets/play/6.png
src/assets/play/6.png
src/assets/play/6.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/7.png

187 Bytes | W: | H:

src/assets/play/7.png

1.6 KB | W: | H:

src/assets/play/7.png
src/assets/play/7.png
src/assets/play/7.png
src/assets/play/7.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