Commit c4101002 authored by liujiaxin's avatar liujiaxin

111

parent 4d28318e
import { Component, ElementRef, ViewChild, OnInit, Input, OnDestroy, HostListener, OnChanges } from '@angular/core';
import { Component, ChangeDetectorRef, ApplicationRef, ElementRef, ViewChild, OnInit, Input, OnDestroy, HostListener, OnChanges } from '@angular/core';
import * as _ from 'lodash';
......@@ -35,7 +35,7 @@ export class PlayComponent extends BaseResizeComponent implements OnInit {
rightAudio = new Audio();
wrongAudio = new Audio();
constructor() {
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
super();
this.rightAudio.src = 'assets/right.mp3';
this.rightAudio.load();
......@@ -64,11 +64,19 @@ export class PlayComponent extends BaseResizeComponent implements OnInit {
this.data = data;
}
this.dataChange();
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
if (window['air']) {
window['air'].hideAirClassLoading(this.saveKey, this.data);
}
}, this.saveKey);
}
refresh() {
setTimeout(() => {
this.appRef.tick();
}, 1);
}
dataChange() {
this.cardsArray = _.get(this.data, 'contentObj.cards', []);
......
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