From cbdcaafca542c2323d493027a5d74ec697dbb35d Mon Sep 17 00:00:00 2001 From: ZoeLeeFZ Date: Fri, 29 May 2020 11:14:17 +0800 Subject: [PATCH] =?UTF-8?q?!1066=20=E4=BC=98=E5=8C=96:=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=94=BE=E5=BC=83=E4=BF=9D=E5=AD=98=E6=97=B6=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E7=BB=98=E5=9B=BE=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DatabaseServices/FileServer.ts | 11 +++++++++-- src/UI/Components/MainContent/Content.tsx | 12 +++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/DatabaseServices/FileServer.ts b/src/DatabaseServices/FileServer.ts index c94b98038..86c06c501 100644 --- a/src/DatabaseServices/FileServer.ts +++ b/src/DatabaseServices/FileServer.ts @@ -70,8 +70,15 @@ export class FileServer extends Singleton { if (this.m_CurFileId !== fid) { - if (!app.Saved && !confirm("您当前图纸还未保存,是否放弃保存?")) - return; + if (!app.Saved) + { + + let status = await AppConfirm.show({ + message: "您当前图纸还未保存,是否放弃保存?" + }); + if (!status) + return false; + } try { let info = await this.GetFileInfo(fid); diff --git a/src/UI/Components/MainContent/Content.tsx b/src/UI/Components/MainContent/Content.tsx index 78e33c4e0..84f82eca8 100644 --- a/src/UI/Components/MainContent/Content.tsx +++ b/src/UI/Components/MainContent/Content.tsx @@ -16,18 +16,16 @@ export class ContentComponent extends React.Component<{ store?: TopPanelStore; } //添加新文件 handleAddNewFile = async () => { - let res = await (FileServer.GetInstance() as FileServer).AddNewFile(); - if (res) - { - this.props.store.openMain = false; - this.props.store.editoring = true; - } + await (FileServer.GetInstance() as FileServer).AddNewFile(); + this.props.store.openMain = false; + this.props.store.editoring = true; + }; handleOpenFile = async (fid: string) => { + await (FileServer.GetInstance() as FileServer).OpenFile(fid); this.props.store.openMain = false; this.props.store.editoring = true; - (FileServer.GetInstance() as FileServer).OpenFile(fid); }; async componentDidMount() {