Commit bf85b4b2 authored by limingzhe's avatar limingzhe

feat: 优化显示隐藏

parent 14e1c5cd
......@@ -8,7 +8,7 @@
<div #iframeContent style="position: absolute; top: 0; overflow: hidden; ">
<div *ngFor="let t of templateArr; let i = index" >
<iframe [style.left]="t?.leftOff || '100vw'" [src]="t?.playUrl || safeDefaultUrl" style="position: fixed; width: 100vw; height: 100vh; border: 0px solid #ccc; " frameborder="0">
<iframe *ngIf="!t.isHide" [style.left]="t?.leftOff || '100vw'" [src]="t?.playUrl || safeDefaultUrl" style="position: fixed; width: 100vw; height: 100vh; border: 0px solid #ccc; " frameborder="0">
</iframe>
</div>
</div>
......
......@@ -1386,6 +1386,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.setPageData('progress', '2', false);
this.setPageData('submitCount', this.submitCount);
this.checkShowSubTemplateOne();
this.isUpdateStop = true;
}
checkShowSubTemplateOne() {
......@@ -1414,8 +1415,11 @@ export class PlayComponent implements OnInit, OnDestroy {
let index;
if (this.submitCount == 1) {
index = 0;
this.hideSubTemplate(1);
} else {
index = 1;
this.hideSubTemplate(2);
}
this.showSubTemplate(index);
......@@ -1428,7 +1432,7 @@ export class PlayComponent implements OnInit, OnDestroy {
sendSubTempIsShowMore(index, isShowMore) {
const divArr = this.iframeContent.nativeElement.children;
const iframecont = divArr[index].children[0];
const data = { msg: 'success', data: JSON.stringify({isShowMore})};
const data = { msg: 'success', isShowMore};
iframecont.contentWindow.postMessage({ action: 'is_show_more', data: JSON.stringify(data) }, '*');
console.log(' post msg is_show_more ')
}
......@@ -1756,6 +1760,14 @@ export class PlayComponent implements OnInit, OnDestroy {
}
hideSubTemplate(index) {
this.templateArr[index].isHide = true;
this.appRef.tick();
}
iframeArr;
initWindowListener() {
......@@ -1845,10 +1857,12 @@ export class PlayComponent implements OnInit, OnDestroy {
isUpdateStop = false;
update() {
if (this.isUpdateStop) {
return;
}
this.animationId = window.requestAnimationFrame(this.update.bind(this));
// 清除画布内容
this.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);
......
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