앨범함 썸네일 이미지 안나오는 부분 수정.

This commit is contained in:
leejinho 2019-12-06 18:08:01 +09:00
parent 82b7f070a2
commit b7927e3fa4
2 changed files with 42 additions and 2 deletions

View File

@ -99,7 +99,13 @@
> >
<span class="mdi mdi-spin mdi-loading mdi-48px"></span> <span class="mdi mdi-spin mdi-loading mdi-48px"></span>
</div> </div>
<div <img
#thumbImg
[src]="getThumbnailUrl(fileInfo)"
[matTooltip]="fileInfo.info.name"
(error)="onErrorThumbnail(thumbImg, fileInfo)"
/>
<!-- <div
*ngIf=" *ngIf="
!!fileInfo.eventInfo && !!fileInfo.eventInfo &&
!!fileInfo.eventInfo.sentMessageJson && !!fileInfo.eventInfo.sentMessageJson &&
@ -124,7 +130,7 @@
> >
<div class="ico"></div> <div class="ico"></div>
</div> </div>
</ng-template> </ng-template> -->
</dt> </dt>
<dd> <dd>
<span class="checkbox"> <span class="checkbox">

View File

@ -22,6 +22,8 @@ import { UCAP_NATIVE_SERVICE, NativeService } from '@ucap-webmessenger/native';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { SnackBarService } from '@ucap-webmessenger/ui'; import { SnackBarService } from '@ucap-webmessenger/ui';
import { FileDownloadItem } from '@ucap-webmessenger/api'; import { FileDownloadItem } from '@ucap-webmessenger/api';
import { ModuleConfig } from '@ucap-webmessenger/api-common';
import { _MODULE_CONFIG } from 'projects/ucap-webmessenger-api-common/src/lib/config/token';
export interface FileInfoTotal { export interface FileInfoTotal {
info: FileInfo; info: FileInfo;
@ -51,12 +53,15 @@ export class AlbumBoxComponent implements OnInit, OnDestroy {
FileType = FileType; FileType = FileType;
currentTabIndex = 0; currentTabIndex = 0;
thumbBaseUrl: string;
constructor( constructor(
private store: Store<any>, private store: Store<any>,
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
private commonApiService: CommonApiService, private commonApiService: CommonApiService,
private snackBarService: SnackBarService, private snackBarService: SnackBarService,
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
@Inject(_MODULE_CONFIG) private moduleConfig: ModuleConfig,
private logger: NGXLogger private logger: NGXLogger
) { ) {
this.loginRes = this.sessionStorageService.get<LoginResponse>( this.loginRes = this.sessionStorageService.get<LoginResponse>(
@ -68,6 +73,10 @@ export class AlbumBoxComponent implements OnInit, OnDestroy {
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>( this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
KEY_VER_INFO KEY_VER_INFO
); );
this.thumbBaseUrl = `${this.moduleConfig.hostConfig.protocol}://${
this.moduleConfig.hostConfig.domain
}:${String(this.moduleConfig.hostConfig.port)}`;
} }
ngOnInit() { ngOnInit() {
@ -144,6 +153,31 @@ export class AlbumBoxComponent implements OnInit, OnDestroy {
); );
} }
getThumbnailUrl(fileInfo: FileInfoTotal): string {
if (
!!fileInfo.eventInfo &&
!!fileInfo.eventInfo.sentMessageJson &&
!!fileInfo.eventInfo.sentMessageJson.thumbUrl
) {
return fileInfo.eventInfo.sentMessageJson.thumbUrl;
} else {
return `${this.thumbBaseUrl}${fileInfo.info.url.replace(
'/AttFile/',
'/WebFile/'
)}.thumb.jpg`;
}
}
onErrorThumbnail(el: HTMLElement, fileInfo: FileInfoTotal): void {
const iconEl = document.createElement('div');
iconEl.setAttribute(
'class',
'mime-icon light ico-' + this.getExtention(fileInfo.info.name)
);
iconEl.innerHTML = `<div class="ico"></div>`;
el.replaceWith(iconEl);
}
onSelectedIndexChange(index: number) { onSelectedIndexChange(index: number) {
this.selectedFile = null; this.selectedFile = null;
this.currentTabIndex = index; this.currentTabIndex = index;