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

feat: preload

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