Commit 4141dffc authored by tttal's avatar tttal

2

   /**
     * 上传文件直接返回TRUE
     */
parent b261cae0
...@@ -91,18 +91,21 @@ export class UploadImageWithPreviewComponent implements OnDestroy, OnChanges { ...@@ -91,18 +91,21 @@ export class UploadImageWithPreviewComponent implements OnDestroy, OnChanges {
this.delete.emit(); this.delete.emit();
} }
checkSelectFile(file) { checkSelectFile(file) {
const isImg = ['image/jpeg', 'image/png', 'image/jpeg', 'image/gif', 'image/bmp'].includes(file.type); /**
if (!isImg) { * 上传文件直接返回TRUE
this.nzMessageService.error('You can only upload Image file (jpg|gif|png|bmp)'); */
return false; // const isImg = ['image/jpeg', 'image/png', 'image/jpeg', 'image/gif', 'image/bmp'].includes(file.type);
} // if (!isImg) {
const isGif = !['image/jpeg', 'image/png', 'image/jpeg', 'image/bmp'].includes(file.type); // this.nzMessageService.error('You can only upload Image file (jpg|gif|png|bmp)');
const delta = isGif ? 20 : 5; // return false;
const isOverSize = file.size / 1024 / 1024 < delta; // }
if (!isOverSize) { // const isGif = !['image/jpeg', 'image/png', 'image/jpeg', 'image/bmp'].includes(file.type);
this.nzMessageService.error(`${isGif ? 'Gif' : 'Image'} must smaller than ${delta}MB!`); // const delta = isGif ? 20 : 5;
return false; // const isOverSize = file.size / 1024 / 1024 < delta;
} // if (!isOverSize) {
// this.nzMessageService.error(`${isGif ? 'Gif' : 'Image'} must smaller than ${delta}MB!`);
// return false;
// }
return true; return true;
} }
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
<input type="text" nz-input [(ngModel)]="item.text" (blur)="save()"> <input type="text" nz-input [(ngModel)]="item.text" (blur)="save()">
</div> </div>
<div style="margin-top: 5px"> <div style="margin-top: 5px">
<span>音频: </span> <span>音频: </span>
<app-audio-recorder <app-audio-recorder
......
...@@ -115,7 +115,7 @@ cc.Class({ ...@@ -115,7 +115,7 @@ cc.Class({
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList); const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => { cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
this.loadEnd(); this.loadEnd();
if (window && window["air"]) { if (window && window["air"]) {
window["air"].hideAirClassLoading(); window["air"].hideAirClassLoading();
......
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