From f4a3e3535b3b90a9f758e8060c9b271bfddb1632 Mon Sep 17 00:00:00 2001 From: liugang9704 <2745340733@qq.com> Date: Tue, 10 Jun 2025 20:45:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=97=A5=E6=9C=9F=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E6=89=93=E5=BC=80=E9=BB=98=E8=AE=A4=E6=98=BE=E7=A4=BA=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/PersonalInformation.ets | 5 ++++- entry/src/main/ets/view/TextInputComponent.ets | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/entry/src/main/ets/pages/PersonalInformation.ets b/entry/src/main/ets/pages/PersonalInformation.ets index a8e4ff3..2539e19 100644 --- a/entry/src/main/ets/pages/PersonalInformation.ets +++ b/entry/src/main/ets/pages/PersonalInformation.ets @@ -203,6 +203,7 @@ export struct PersonalInformation { let month = date.getMonth() + 1; let day = date.getDate(); this.currentDate = year + '-' + month + '-' + day; + this.selectTime = new Date(`${this.currentDate}T08:30:00`); if (!this.birthDate) { this.birthDate = CommonUtils.getBirthDateValue(year, month, day); } @@ -361,7 +362,8 @@ export struct PersonalInformation { .padding(16) } .onBackPressed(() => { - if (!this.isSaved && this.isEdit) { + let inputIsEdit: boolean | undefined = AppStorage.get('inputIsEdit'); + if (!this.isSaved && (this.isEdit || inputIsEdit)) { this.getUIContext().showAlertDialog({ message: $r('app.string.tips'), autoCancel: true, @@ -384,6 +386,7 @@ export struct PersonalInformation { this.signature = ''; this.hobbies = ''; AppStorage.setOrCreate('isEdit', false); + AppStorage.setOrCreate('inputIsEdit', false); this.pathStack.pop(); } } diff --git a/entry/src/main/ets/view/TextInputComponent.ets b/entry/src/main/ets/view/TextInputComponent.ets index 1d586ba..cea74d7 100644 --- a/entry/src/main/ets/view/TextInputComponent.ets +++ b/entry/src/main/ets/view/TextInputComponent.ets @@ -38,7 +38,13 @@ export default struct TextInputComponent { .height(48) .enableKeyboardOnFocus(false) .onChange((value: string) => { - this.text = value; + if (this.text !== value) { + this.text = value; + AppStorage.setOrCreate('inputIsEdit', true); + } + if (!value) { + AppStorage.setOrCreate('inputIsEdit', false); + } }) } .margin({ top: 12 }) -- Gitee From fd35800728654560430c7aa2168071f4456e6e60 Mon Sep 17 00:00:00 2001 From: liugang9704 <2745340733@qq.com> Date: Wed, 11 Jun 2025 09:43:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=97=A5=E6=9C=9F=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/PersonalInformation.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entry/src/main/ets/pages/PersonalInformation.ets b/entry/src/main/ets/pages/PersonalInformation.ets index 2539e19..39d79af 100644 --- a/entry/src/main/ets/pages/PersonalInformation.ets +++ b/entry/src/main/ets/pages/PersonalInformation.ets @@ -277,7 +277,7 @@ export struct PersonalInformation { onItemClick: () => { this.getUIContext().showDatePickerDialog({ start: new Date('1925-1-1'), - end: new Date(this.currentDate), + end: new Date('2055-1-1'), selected: this.selectTime, lunarSwitch: true, showTime: false, -- Gitee