Commit 92699e89 authored by Li Mingzhe's avatar Li Mingzhe

feat: preload

parent 304acf22
No preview for this file type
import {
ApplicationRef,
Component,
ElementRef,
EventEmitter,
......@@ -115,7 +116,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
constructor(private nzMessageService: NzMessageService) {
constructor(private nzMessageService: NzMessageService, private appRef: ApplicationRef) {
this.uploadUrl = (<any> window).courseware.uploadUrl();
this.uploadData = (<any> window).courseware.uploadData();
......@@ -1026,6 +1027,8 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
this.texPngData = texPngData || {};
this.animaPanelVisible = true;
this.refresh();
}
animaPanelCancel() {
......@@ -1298,4 +1301,16 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
});
}
/**
* 刷新 渲染页面
*/
refresh() {
setTimeout(() => {
this.appRef.tick();
}, 1);
}
}
import {Component, EventEmitter, Input, OnChanges, OnDestroy, Output} from '@angular/core';
import {ApplicationRef, Component, EventEmitter, Input, OnChanges, OnDestroy, Output} from '@angular/core';
import { NzMessageService, UploadXHRArgs, UploadFile } from 'ng-zorro-antd';
......@@ -54,7 +54,7 @@ export class UploadDragonBoneComponent implements OnDestroy, OnChanges {
isTexJsonLoading = false;
isTexPngLoading = false;
constructor(private nzMessageService: NzMessageService) {
constructor(private appRef: ApplicationRef, private nzMessageService: NzMessageService) {
this.uploadUrl = (<any> window).courseware.uploadUrl();
this.uploadData = (<any> window).courseware.uploadData();
......@@ -71,6 +71,7 @@ export class UploadDragonBoneComponent implements OnDestroy, OnChanges {
setAnimaBtnClick() {
this.animaPanelVisible = true;
this.refresh();
}
animaPanelCancel() {
......@@ -150,6 +151,15 @@ export class UploadDragonBoneComponent implements OnDestroy, OnChanges {
/**
* 刷新 渲染页面
*/
refresh() {
setTimeout(() => {
this.appRef.tick();
}, 1);
}
ngOnDestroy() {
......
......@@ -140,8 +140,18 @@ cc.Class({
addPreloadImage() {
if (this.data.groupArr) {
this.data.groupArr.forEach(group => {
this._imageResList.push({url: group.bg_1_url});
this._imageResList.push({url: group.bg_2_url});
if (group.bgItem) {
this._imageResList.push({url: group.bgItem.url});
}
if (group.hotZoneItemArr) {
group.hotZoneItemArr.forEach((item) => {
if (item.pic_url) {
this._imageResList.push({url: item.pic_url});
}
})
}
if (group.picArr) {
group.picArr.forEach(pic => {
......@@ -171,13 +181,25 @@ cc.Class({
if (!this.data.groupArr) {
return;
}
this.data.groupArr.forEach((item) => {
if (item.skeJsonData) {
this.data.groupArr.forEach((group) => {
if (group.hotZoneItemArr) {
group.hotZoneItemArr.forEach((item) => {
if (item.gIdx == '0' &item.skeJsonData) {
this._animaResList.push({url: item.skeJsonData.url});
this._animaResList.push({url: item.texJsonData.url});
this._animaResList.push({url: item.texPngData.url});
}
})
}
if (group.skeJsonData) {
this._animaResList.push({url: group.skeJsonData.url});
this._animaResList.push({url: group.texJsonData.url});
this._animaResList.push({url: group.texPngData.url});
}
})
},
......
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