Commit def3657a authored by limingzhe's avatar limingzhe

feat: course in msg

parent ed3e411d
...@@ -1444,6 +1444,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1444,6 +1444,8 @@ export class PlayComponent implements OnInit, OnDestroy {
console.log(' progress: ', progress); console.log(' progress: ', progress);
if (progress == '2') { if (progress == '2') {
if (this.submitCount == 1) { if (this.submitCount == 1) {
this.showSubTemplate(1); this.showSubTemplate(1);
...@@ -1835,6 +1837,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1835,6 +1837,10 @@ export class PlayComponent implements OnInit, OnDestroy {
arr[index].leftOff = '100vw'; arr[index].leftOff = '100vw';
this.appRef.tick(); this.appRef.tick();
if (this.readyObj[(index + 1).toString()]) {
this.sendCourseIn(index);
}
} }
...@@ -1847,6 +1853,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1847,6 +1853,7 @@ export class PlayComponent implements OnInit, OnDestroy {
iframeArr; iframeArr;
readyObj;
initWindowListener() { initWindowListener() {
...@@ -1866,6 +1873,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1866,6 +1873,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// console.log('iframeArr: ', iframeArr); // console.log('iframeArr: ', iframeArr);
// // }, 1); // // }, 1);
this.readyObj = {};
window.addEventListener('message', (e) => { window.addEventListener('message', (e) => {
...@@ -1940,11 +1948,33 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1940,11 +1948,33 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
if (msgData.action == 'course-ready') {
console.log(' in course-ready msgData: ', msgData)
console.log('msgData.urlParams: ', msgData);
const key = this.getQueryVariable(msgData.urlParams, 'key');
if (!key) {
return;
}
this.readyObj[key] = true;
}
}); });
} }
sendCourseIn(index) {
const divArr = this.iframeContent.nativeElement.children;
const iframecont = divArr[index].children[0];
const data = { msg: 'success', data: ''};
iframecont.contentWindow.postMessage({ action: 'airEvents', evt: 'course-in-screen', data: JSON.stringify(data) }, '*');
}
getQueryVariable(url, variable) { getQueryVariable(url, variable) {
var query = url.substring(1); var query = url.substring(1);
......
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