Commit 397452a5 authored by limingzhe's avatar limingzhe

fix: test_002 转移

parent 4340345d
......@@ -18,7 +18,7 @@
</div>
<iframe *ngIf="isShowFrame" #iframe id="iframe" [src]="safeUrl" style="width: 98%; height: 70vh; border: 1px solid #ccc; padding: 5px;" frameborder="0">
<iframe #iframe id="iframe" [src]="safeUrl" style="width: 98%; height: 70vh; border: 1px solid #ccc; padding: 5px;" frameborder="0">
</iframe>
......
......@@ -42,7 +42,6 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
_item;
_data;
isShowFrame = true;
@Input()
......@@ -65,22 +64,11 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
window['air'].getUploadCallback = (url, data) => {
console.log(' in getUploadCallback , url: ', url)
this.uploadUrl = url;
this.uploadData = data;
};
this.setUploadUrl();
if (!window['hw_test_count']) {
window['hw_test_count'] = 0
}
window['hw_test_count'] += 1;
console.log('window_count:', window['hw_test_count'])
}
......@@ -88,30 +76,14 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
if (!this.uploadUrl) {
console.log('this.uploadUrl -- 1 : ', this.uploadUrl)
this.uploadUrl = (<any> window).courseware.uploadUrl();
this.uploadData = (<any> window).courseware.uploadData();
console.log('this.uploadUrl -- 2 : ', this.uploadUrl)
console.log('(<any> window).courseware: ', (<any> window).courseware);
console.log('window_count:', window['hw_test_count'])
// console.log('this.iframe cWindow: ', this.iframe.nativeElement.contentWindow)
setTimeout(() => {
this.setUploadUrl();
}, 500);
} else {
console.log('this.uploadUrl -- 3 : ', this.uploadUrl)
if (this._data) {
this._item = this._data;
console.log(' __ refreshSafeUrl 4')
this.refreshSafeUrl()
}
......@@ -123,11 +95,9 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
if (!formUrl) {
formUrl = this._item.formUrl || '';
}
console.log(' in refreshSafeUrl formUrl:', formUrl)
this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(formUrl);
console.log(' in refreshSafeUrl safeUrl:', this.safeUrl)
}
......@@ -145,12 +115,9 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
this._item = {};
}
console.log(' __ refreshSafeUrl 1')
this.initListener();
}
......@@ -188,7 +155,6 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
console.log('formUrl: ', formUrl)
console.log(' __ refreshSafeUrl 2')
this.refreshSafeUrl();
this.closePanel();
this.sendData();
......@@ -223,7 +189,6 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
const msgFunc = (e) => {
console.log('!!!e : ', e);
if (!this.iframe || !this.iframe.nativeElement || !this.iframe.nativeElement.contentWindow) {
console.log('this.iframe not exist');
......@@ -254,11 +219,6 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
}
if ( !this.iframe.nativeElement ) {
return;
}
const data = { msg: 'success', data: JSON.stringify(this._item.data)};
// iframeContent.postMessage( { action: 'getData', data: JSON.stringify(data) }, '*');
this.iframe.nativeElement.contentWindow.postMessage( { action: 'getData', data: JSON.stringify(data) }, '*');
......@@ -281,9 +241,6 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
console.log("setData e: ", e);
if (this.iframe) {
console.log('ifram exist: ', this.iframe);
}
if (typeof(msgData.data) === "string") {
......@@ -300,9 +257,6 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
console.log( ' in getUpload')
if (this.iframe) {
console.log('ifram exist: ', this.iframe);
}
// const iframeContent = this.el.nativeElement.querySelector('#iframe').contentWindow;
......@@ -316,8 +270,10 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
}
}
if (this.iframe?.nativeElement?.contentWindow) {
this.iframe.nativeElement.contentWindow.addEventListener('message', msgFunc);
console.log(' init Listener !');
window.addEventListener('message', msgFunc);
}
......@@ -334,17 +290,17 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
c.getTemplates((data) => {
data =
[
{"id": 26, "uuid":"c94fb1b0-3395-42ca-9ae3-03ca7c242d3f", "name": "hw_001", "description": "音频课件", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/3feddb01-4350-42ad-909f-236ad052fbb2.jpg", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 16},
{"id": 27, "uuid":"b8bedc68-9ef6-42a6-ba99-513daa244a6d", "name": "hw_002", "description": "视频课件", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/1b11d370-9d8b-4358-98d3-4757f825d2a4.jpg", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 16},
{"id": 28, "uuid":"068fcffb-4e99-4148-bc8e-2a89ee9bfe7c", "name": "hw_003", "description": "转盘课件", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/de3d8498-7523-4601-934e-932ac219a408.jpg", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 17},
{"id": 29, "uuid":"b2bfd8df-e0e4-41c9-b65f-12160628e1a3", "name": "hw_004", "description": "连线课件", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/824989ac-78fb-4db7-848a-790cba00effe.jpg", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 9 },
{"id": 30, "uuid":"d7be3c21-fc25-482d-a4a6-1a371970457a", "name": "hw_005", "description": "分类课件", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/aa69d85a-3430-48b2-91bf-a804dee1826d.jpg", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 19},
{"id": 31, "uuid":"34e98c65-f3f0-46e4-a7b8-5caf72954847", "name": "hw_006", "description": "翻卡游戏", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/fe54031b-7879-4c65-8de7-102fa5e5e9f5.png", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 5 }
]
resolve(data);
return
// data =
// [
// {"id": 26, "uuid":"c94fb1b0-3395-42ca-9ae3-03ca7c242d3f", "name": "hw_001", "description": "音频课件", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/3feddb01-4350-42ad-909f-236ad052fbb2.jpg", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 16},
// {"id": 27, "uuid":"b8bedc68-9ef6-42a6-ba99-513daa244a6d", "name": "hw_002", "description": "视频课件", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/1b11d370-9d8b-4358-98d3-4757f825d2a4.jpg", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 16},
// {"id": 28, "uuid":"068fcffb-4e99-4148-bc8e-2a89ee9bfe7c", "name": "hw_003", "description": "转盘课件", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/de3d8498-7523-4601-934e-932ac219a408.jpg", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 17},
// {"id": 29, "uuid":"b2bfd8df-e0e4-41c9-b65f-12160628e1a3", "name": "hw_004", "description": "连线课件", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/824989ac-78fb-4db7-848a-790cba00effe.jpg", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 9 },
// {"id": 30, "uuid":"d7be3c21-fc25-482d-a4a6-1a371970457a", "name": "hw_005", "description": "分类课件", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/aa69d85a-3430-48b2-91bf-a804dee1826d.jpg", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 19},
// {"id": 31, "uuid":"34e98c65-f3f0-46e4-a7b8-5caf72954847", "name": "hw_006", "description": "翻卡游戏", "cover": "http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/fe54031b-7879-4c65-8de7-102fa5e5e9f5.png", "type": 1, "t_type": 2, "form_url": "index.html?type=form", "play_url": "index.html", "last_version": 5 }
// ]
// resolve(data);
// return
if (data) {
console.log('data~~~:', data);
resolve(JSON.parse(data));
......@@ -406,7 +362,7 @@ export class SubTemplateComponent implements OnDestroy, OnChanges {
}
ngOnDestroy() {
this.isShowFrame = false;
}
}
......@@ -28,7 +28,7 @@
</div>
<!-- <div *ngIf="item.templateArr" >
<div *ngIf="item.templateArr" >
<div *ngFor="let template of item.templateArr; let i = index" style="margin-bottom: 10px;">
<app-sub-template
......@@ -44,10 +44,10 @@
<button nz-button nzType="primary" (click)="addSubTemplate()" style="border-radius: 0.5rem; border: 1px solid #ddd; margin-top: 15px;">
<button *ngIf=" item.templateArr.length < 2 " nz-button nzType="primary" (click)="addSubTemplate()" style="border-radius: 0.5rem; border: 1px solid #ddd; margin-top: 15px;">
<i nz-icon nzType="plus" nzTheme="outline"></i>
添加子模板
</button> -->
</button>
<!--
......
......@@ -5,22 +5,27 @@
export async function loadFonts () {
const font = new FontFace(
"DroidSansFallback",
"url(" + "../../assets/play/font/DroidSansFallback.ttf" + ")"
);
// console.log(location.href.split("#")[0] + "assets/play/font/DroidSansFallback.ttf");
// const font = new FontFace(
// "DroidSansFallback",
// "url(" + location.href.split("#")[0] + "assets/play/font/DroidSansFallback.ttf" + ")"
// "url(" + "../../assets/play/font/DroidSansFallback.ttf" + ")"
// );
try {
console.log(location.href.split("#")[0] + "assets/play/font/DroidSansFallback.ttf");
const font = new FontFace(
"DroidSansFallback",
"url(" + location.href.split("#")[0] + "assets/play/font/DroidSansFallback.ttf" + ")"
);
console.log('start: ', new Date().getTime())
await font.load();
console.log('end: ', new Date().getTime())
document.fonts.add(font);
document.body.classList.add("fonts-loaded");
} catch (error) {
console.log(error);
}
}
......
......@@ -4,7 +4,7 @@
<canvas id="canvas" style="width: 100%; height: 100%;" #canvas></canvas>
</div>
<div #iframeContent style="position: absolute; top: 0">
<div #iframeContent style="position: absolute; top: 0;">
<div *ngFor="let t of templateArr; let i = index">
<iframe *ngIf="t.isShow" [src]="t.playUrl || ''" style="width: 100vw; height: 100vh; border: 0px solid #ccc; padding: 5px;" frameborder="0">
</iframe>
......
......@@ -226,7 +226,7 @@ export class PlayComponent implements OnInit, OnDestroy {
initDefaultData() {
const data = {"sentenceArr":[{"text":"1.She was not only _ but also very musical.","answer":"intelligent1"},{"text":"2.She was not only _ but also very musical.","answer":"intelligent2"},{"text":"3.She was not only _ but also very musical.","answer":"intelligent3"},{"text":"4.She was not only _ but also very musical.","answer":"intelligent4"}],"title":"\bVocabulary box"};
const data = {"sentenceArr":[{"text":"222 _ 33333","answer":"2"},{"text":"4444 _ 55 5555","answer":"5"},{"text":"666 666 66 _ 77777","answer":"6"},{"text":"888 88 8 _ 999","answer":"9"}],"templateArr":[{"formUrl":"http://staging-teach.cdn.ireadabc.com/h5template/hw_001/v16/index.html?type=form&key=1","template":{"id":26,"uuid":"c94fb1b0-3395-42ca-9ae3-03ca7c242d3f","name":"hw_001","description":"音频课件","cover":"http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/3feddb01-4350-42ad-909f-236ad052fbb2.jpg","type":1,"t_type":2,"form_url":"index.html?type=form","play_url":"index.html","last_version":16},"data":{"contentObj":{"picArr":[{"pic_url":"http://staging-teach.cdn.ireadabc.com/c8abf7383d65bcbdba8f390785cece60.png","audio_url":"http://staging-teach.cdn.ireadabc.com/85cff126986f5cc11b05e95181da5869.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/f6f4bbef497409fef3c8f1d375893829.png","audio_url":"http://staging-teach.cdn.ireadabc.com/9f0aee80e252005721a445cbbf04e8b1.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/7b18a7931d64f7b9e8b7ecd25cb5e3d4.png","audio_url":""}]}}},{"formUrl":"http://staging-teach.cdn.ireadabc.com/h5template/hw_002/v16/index.html?type=form&key=2","template":{"id":27,"uuid":"b8bedc68-9ef6-42a6-ba99-513daa244a6d","name":"hw_002","description":"视频课件","interaction_type":"个人 | 集体","recommend_type":"| 动画 | 绘本 | 儿歌 | 看图辨意","cover":"http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/1b11d370-9d8b-4358-98d3-4757f825d2a4.jpg","type":1,"t_type":2,"form_url":"index.html?type=form","play_url":"index.html","developer_id":12,"git":"{\"id\":59,\"ssh\":\"git@vcs.ireadabc.com:template/hw_002.git\",\"http\":\"http://vcs.ireadabc.com/template/hw_002.git\"}","del":0,"publish":1,"last_version":16,"pub_date":null,"is_public":1,"created_date":"2019-11-11T10:05:25.000Z","updated_date":"2020-10-12T02:01:13.000Z"},"data":{"contentObj":{"video_url":"http://staging-teach.cdn.ireadabc.com/f309f8dd44d59c65e44f375f818871e1.mp4"}}}],"title":"1111"};
this.data = { contentObj: data };
......@@ -460,6 +460,8 @@ export class PlayComponent implements OnInit, OnDestroy {
const c = window['courseware'];
if (!c) {
console.log(' window.courseware not exist !!!!!!!!')
return;
}
......@@ -472,6 +474,7 @@ export class PlayComponent implements OnInit, OnDestroy {
air.onCourseInScreen = (next) => {
//各种逻辑
// this.showTemplateStartAnima();
console.log('in onCourseInScreen')
this.loadEnd(() => {
next();
});
......@@ -546,23 +549,45 @@ export class PlayComponent implements OnInit, OnDestroy {
this.changeBtnOff();
this.initIframe();
this.initWindowListener();
this.relink();
}
relink() {
const progress = this.getPageData('progress');
if (this.isTeacher) {
if (progress == '1') {
this.gameStart();
return;
}
return;
}
if (progress == '1') {
const resultData = this.getPageData('resultData')
if (resultData) {
this.initResultView(resultData);
return;
}
const progress = this.getPageData('progress');
if (progress == '1') {
this.gameStart();
return;
}
if (progress == '2') {
const submitCount = this.getPageData('submitCount')
this.submitCount = submitCount;
this.checkShowSubTemplateOne();
}
}
......@@ -577,6 +602,7 @@ export class PlayComponent implements OnInit, OnDestroy {
resultLayer;
resultPanel;
moreBtn;
initResultView(data = null) {
if (data) {
......@@ -638,6 +664,7 @@ export class PlayComponent implements OnInit, OnDestroy {
btn.setScaleXY(this.mapScale);
btn.y = panel.y + ( panel.height / 2 + 120 ) * panel.scaleY;
resultLayer.addChild(btn, 2);
this.moreBtn = btn;
const btnShadow = new MySprite();
btnShadow.init(this.images.get("big_btn_shadow"));
......@@ -1230,6 +1257,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.downFlag = true;
if (this.isTeacher) {
if (this.sentBtn && this.sentBtn.visible) {
if (this.checkClickTarget(this.sentBtn)) {
......@@ -1241,6 +1269,13 @@ export class PlayComponent implements OnInit, OnDestroy {
return;
}
if (this.moreBtn) {
if (this.checkClickTarget(this.moreBtn)) {
this.moreBtnClick();
return;
}
}
for (let i = 0; i < this.btnArr.length; i++) {
......@@ -1307,6 +1342,22 @@ export class PlayComponent implements OnInit, OnDestroy {
this.curMoveItem = null;
}
moreBtnClick() {
this.setPageData('progress', '2', false);
this.setPageData('submitCount', this.submitCount);
this.checkShowSubTemplateOne();
}
checkShowSubTemplateOne() {
if (this.submitCount == 1) {
this.showSubTemplate(1);
} else {
this.showSubTemplate(0);
}
}
btnDown(btn) {
this.curMoveItem = btn;
}
......@@ -1540,7 +1591,7 @@ export class PlayComponent implements OnInit, OnDestroy {
templateArr = [];
initIframe() {
this.templateArr = this.data.templateArr;
this.templateArr = this.data.contentObj.templateArr;
console.log('arr: ', this.templateArr);
......@@ -1551,14 +1602,12 @@ export class PlayComponent implements OnInit, OnDestroy {
console.log('playUrl: ', playUrl);
}
this.showSubTemplate(0);
// this.showSubTemplate(0);
setTimeout(() => {
this.showSubTemplate(1);
}, 5000);
// setTimeout(() => {
// this.showSubTemplate(1);
// }, 5000);
}
showSubTemplate(index) {
......
This diff is collapsed.
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