Commit a0d7069a authored by limingzhe's avatar limingzhe

index loading

parent 1e34b406
......@@ -22,10 +22,7 @@
<div style="display: flex; justify-items: center; padding-top: 10px">
<!--<app-audio-recorder-->
<!--[audioUrl]="it.audio_url"-->
<!--(audioUploaded)="onAudioUploadSuccessByItem($event, it)">-->
<!--</app-audio-recorder>-->
<button style="margin-left: 10px;" nz-button nzType="danger" (click)="deleteItem(it)">
......@@ -46,7 +43,18 @@
<input type="text" nz-input placeholder="" [(ngModel)]="it.question" (blur)="saveItem()">
</div>
<div style="width: 70%; margin: auto">
<div style="display: flex; align-items: center; margin-bottom: 0.5vw">
<span style="width: 80px;"> 题干音频: </span>
<app-audio-recorder
[audioUrl]="it.audio_url"
(audioUploaded)="onAudioUploadSuccessByItem($event, it)">
</app-audio-recorder>
</div>
<div style="width: 70%; margin: auto; padding-top: 0.5vw">
<app-upload-image-with-preview
style="width: 100%"
......@@ -54,9 +62,19 @@
(imageUploaded)="onImageUploadSuccessByItem($event, it, 'question')"
></app-upload-image-with-preview>
<div style="display: flex; align-items: center; margin-bottom: 0.5vw; padding-top: 0.5vw">
<span style="width: 80px;"> 图片音频: </span>
<app-audio-recorder
[audioUrl]="it.pic_audio_url"
(audioUploaded)="onAudioUploadSuccessByItem($event, it, 'pic')">
</app-audio-recorder>
</div>
</div>
<div style="display: flex; align-items: center; width: 70%; margin: auto;padding-top: 1vw">
<span style="margin-right: 2vw"> 答案类型: </span>
......@@ -78,9 +96,20 @@
<div *ngIf="it.answerType == 'A'">
<nz-radio-group style="width: 90%;" [(ngModel)]="it.answerId">
<div style="display: flex; align-items: center; margin-top: 1vw" *ngFor="let ans of it.answerArr; let j = index">
<label nz-radio nzValue="{{j}}" (click)="saveItem()">{{ans.id}}</label>
<input type="text" nz-input placeholder="" [(ngModel)]="ans.text" (blur)="saveItem()">
<div style="margin-top: 1vw" *ngFor="let ans of it.answerArr; let j = index">
<div style="display: flex; align-items: center;">
<label nz-radio nzValue="{{j}}" (click)="saveItem()">{{ans.id}}</label>
<input type="text" nz-input placeholder="" [(ngModel)]="ans.text" (blur)="saveItem()">
</div>
<div style="width: 200px; margin: auto;">
<app-audio-recorder
[audioUrl]="ans[j + '_text_audio_url']"
(audioUploaded)="onAudioUploadSuccessByItem($event, ans, j + '_text')">
</app-audio-recorder>
</div>
</div>
</nz-radio-group>
</div>
......@@ -90,15 +119,28 @@
<div *ngIf="it.answerType == 'B'">
<nz-radio-group style="width: 90%;" [(ngModel)]="it.answerId" >
<div style="display: flex; align-items: center; margin-top: 1vw" *ngFor="let ans of it.answerArr; let j = index"
<div style="margin-top: 1vw;" *ngFor="let ans of it.answerArr; let j = index"
nz-col nzSpan="24">
<label nz-radio nzValue="{{j}}" (click)="saveItem()">{{ans.id}}</label>
<app-upload-image-with-preview
style="width: 60%"
[picUrl]="ans.pic_url"
(imageUploaded)="onImageUploadSuccessByItem($event, ans)"
></app-upload-image-with-preview>
<div style="display: flex; align-items: center;">
<label nz-radio nzValue="{{j}}" (click)="saveItem()">{{ans.id}}</label>
<app-upload-image-with-preview
style="width: 60%"
[picUrl]="ans.pic_url"
(imageUploaded)="onImageUploadSuccessByItem($event, ans)"
></app-upload-image-with-preview>
</div>
<div style="width: 100%; padding-left: 20%">
<app-audio-recorder
style="width: 100%; margin: auto"
[audioUrl]="ans[j +'_pic_audio_url']"
(audioUploaded)="onAudioUploadSuccessByItem($event, ans, j + '_pic')">
</app-audio-recorder>
</div>
</div>
</nz-radio-group>
</div>
......
import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef} from '@angular/core';
import {
Component,
EventEmitter,
Input,
OnDestroy,
OnChanges,
OnInit,
Output,
ApplicationRef,
ChangeDetectorRef
} from '@angular/core';
......@@ -35,7 +45,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
constructor(private appRef: ApplicationRef) {
constructor(private appRef: ApplicationRef,
public changeDetectorRef: ChangeDetectorRef) {
}
......@@ -60,6 +71,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
console.log('~data:', data);
this.init();
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}, this.KEY);
......
......@@ -497,6 +497,9 @@ export class PlayComponent implements OnInit, OnDestroy {
this.loadResources().then(() => {
// this.setfontData();
window['air'].hideAirClassLoading(this.KEY, this.data);
this.init();
this.update();
});
......
......@@ -7,82 +7,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script>
window.courseware = (function(){
if(window.parent.net){
window.net = window.parent.net;
var id = window.frameElement.getAttribute("dataid");
return {
getData: function(callback, key=''){
net.getData("getCoursewareData",id,function(res){
if(res){
res = JSON.parse(res);
if(res.msg==="success"){
let callData = null;
if(res.data&&res.data!='null'){
callData = JSON.parse(res.data);
}
callback&&callback(callData);
}else{
alert('数据加载失败!');
}
}else{
alert('数据加载失败!');
}
});
},
setData: function(data,callback, key=''){
let str = JSON.stringify(data);
net.getData("setCoursewareData",{id: id,data: str},function(res){
if(res){
res = JSON.parse(res);
if(res.msg==="success"){
callback&&callback();
}else{
alert('数据保存失败!');
}
}else{
alert('数据保存失败!');
}
});
},
uploadUrl: function(){
return net.getUploadFileURL();
},
uploadData: function(){
return net.getAjaxData("uploadFile","");
}
}
} else {
return {
getData: function(callback, key=''){
let data = localStorage.getItem("courseware_data_" + key);
if(data){
data = JSON.parse(data);
}
callback&&callback(data);
},
setData: function(data,callback, key=''){
console.log("******local********");
localStorage.setItem("courseware_data_" + key,JSON.stringify(data));
callback&&callback();
},
uploadUrl: function(){
return 'http://localhost:3000/api/test';
},
uploadData: function(){
return {};
}
}
}
})();
</script>
<script type="text/javascript" src="http://teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air.js"></script>
</head>
<body>
<app-root></app-root>
</body>
<app-root></app-root>
</body>
</html>
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