From 14dcd34688dc826f1968a3470cd17d324cff0938 Mon Sep 17 00:00:00 2001 From: leejinho Date: Fri, 14 Feb 2020 17:28:38 +0900 Subject: [PATCH] =?UTF-8?q?weblink=20=EA=B4=80=EB=A0=A8=20=ED=8C=9D?= =?UTF-8?q?=EC=97=85=20=EC=98=A4=ED=94=88=EB=A1=9C=EC=A7=81=20=EC=88=98?= =?UTF-8?q?=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../native/components/top-bar.component.ts | 73 ++++++++++++++++--- .../src/lib/utils/window.util.ts | 17 +++++ .../ucap-webmessenger-core/src/public-api.ts | 1 + .../src/lib/utils/SmsUtils.ts | 8 +- 4 files changed, 86 insertions(+), 13 deletions(-) create mode 100644 projects/ucap-webmessenger-core/src/lib/utils/window.util.ts diff --git a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts index 012a49b2..80159b4c 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts @@ -64,7 +64,7 @@ import { import { DialogService } from '@ucap-webmessenger/ui'; import { DOCUMENT } from '@angular/common'; import { MatMenu, MatRadioChange, MatMenuTrigger } from '@angular/material'; -import { StatusCode, StatusType } from '@ucap-webmessenger/core'; +import { StatusCode, StatusType, WindowUtil } from '@ucap-webmessenger/core'; import { StatusInfo, MessageIndexType, @@ -411,16 +411,69 @@ export class TopBarComponent implements OnInit, OnDestroy { .replace(/(\(%USER_ID%\))/g, loginId) .replace(/(\(%USER_PASS%\))/g, loginPw); - // this.nativeService.openDefaultBrowser(url, { - // features: - // 'menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=400,height=400' - // }); + let width = 1160; + let height = 800; + let openType = 'INNER-POPUP'; + switch (link.key) { + case WebLinkType.Sms: + /** SMS URL */ + { + width = 685; + height = 640; + } + break; + // case WebLinkType.Itsvcdesk: + // /** IT서비스데스크 URL */ + // { + // width = 1400; + // height = 1000; + // } + // break; + case WebLinkType.Itsvcdesk: + /** IT서비스데스크 URL */ + case WebLinkType.Dsp: + /** DSP URL */ + { + openType = 'DEFAULT-BROWSER'; + } + break; + case WebLinkType.Webhard: + /** 웹하드 URL */ + case WebLinkType.Conf: + /** 화상회의 URL */ + case WebLinkType.Ep: + /** EP URL */ + case WebLinkType.Sop: + /** S&OP회의 URL */ + case WebLinkType.Som: + /** S&OM회의 URL */ + case WebLinkType.Elephant: + /** 코끼리 URL */ + case WebLinkType.UrgntNews: + /** 개인속보 URL */ + case WebLinkType.MailCnt: + /** 메일Count URL */ + case WebLinkType.Mail: + /** 메일 링크 URL */ + case WebLinkType.PaymentCnt: + /** 결재Count URL */ + case WebLinkType.Payment: + /** 결재링크 URL */ + case WebLinkType.ChgPassword: + /** 비밀번호변경 URL ; PC 메신저만 해당 비밀번호 만료시 */ + break; + } - open( - url, - link.title, - 'frame=true,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=1000,height=800' - ); + if (openType === 'DEFAULT-BROWSER') { + // // Old popup open.. >> default browser open. + // this.nativeService.openDefaultBrowser(url, { + // features: + // 'menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=400,height=400' + // }); + this.nativeService.openDefaultBrowser(url); + } else { + WindowUtil.popupOpen(url, link.title, width, height); + } } onClosedProfileMenu() { diff --git a/projects/ucap-webmessenger-core/src/lib/utils/window.util.ts b/projects/ucap-webmessenger-core/src/lib/utils/window.util.ts new file mode 100644 index 00000000..7093b004 --- /dev/null +++ b/projects/ucap-webmessenger-core/src/lib/utils/window.util.ts @@ -0,0 +1,17 @@ +export class WindowUtil { + public static popupOpen( + url: string, + title: string = 'Messenger', + width: number, + height: number + ): void { + let optionStr = `frame=true,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no`; + if (width > 0) { + optionStr += `,width=${width}`; + } + if (width > 0) { + optionStr += `,height=${height + 15}`; + } + open(url, title, optionStr); + } +} diff --git a/projects/ucap-webmessenger-core/src/public-api.ts b/projects/ucap-webmessenger-core/src/public-api.ts index 6ac6bb66..d02bcbe7 100644 --- a/projects/ucap-webmessenger-core/src/public-api.ts +++ b/projects/ucap-webmessenger-core/src/public-api.ts @@ -25,6 +25,7 @@ export * from './lib/utils/mime.util'; export * from './lib/utils/object.util'; export * from './lib/utils/sticker.util'; export * from './lib/utils/string.util'; +export * from './lib/utils/window.util'; export * from './lib/config/host.config'; export * from './lib/config/url.config'; diff --git a/projects/ucap-webmessenger-daesang/src/lib/utils/SmsUtils.ts b/projects/ucap-webmessenger-daesang/src/lib/utils/SmsUtils.ts index 925b69a8..cc178219 100644 --- a/projects/ucap-webmessenger-daesang/src/lib/utils/SmsUtils.ts +++ b/projects/ucap-webmessenger-daesang/src/lib/utils/SmsUtils.ts @@ -3,6 +3,7 @@ import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { KEY_URL_INFO } from '@app/types'; import { NativeService } from '@ucap-webmessenger/native'; import { WebLinkType } from '../types/web-link.type'; +import { WindowUtil } from '@ucap-webmessenger/core'; export class SmsUtils { constructor( @@ -39,10 +40,11 @@ export class SmsUtils { const url = this.url.replace(/(\(%USER_TOKEN%\))/g, token); // this.nativeService.openDefaultBrowser(url); - open( - url + `&ruser=${employeeNum},`, // ruser 파라미터에 ','가 마지막에 꼭 붙어야 한다. + WindowUtil.popupOpen( + url + `&ruser=${employeeNum},`, 'DaesangSMS', - 'frame=true,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=685,height=700' + 685, + 640 ); } }