Commit a2bcd4b3 authored by limingzhe's avatar limingzhe

index loading

parent df3295f8
......@@ -8,7 +8,7 @@ import {
OnInit,
Output,
OnDestroy,
ViewChild
ViewChild, ChangeDetectorRef
} from '@angular/core';
import {NzMessageDataFilled, NzMessageService} from 'ng-zorro-antd';
......@@ -39,7 +39,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
constructor(private nzMessageService: NzMessageService,
private appRef: ApplicationRef) {
private appRef: ApplicationRef,
public changeDetectorRef: ChangeDetectorRef) {
}
......@@ -81,6 +82,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.init();
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}, this.KEY);
......
......@@ -413,6 +413,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