diff --git a/entry/src/main/ets/pages/ContactAddAndEditPage.ets b/entry/src/main/ets/pages/ContactAddAndEditPage.ets index 55791b141792056c5a030d9dbb4f2836625d5846..84f0fb7cf93baeeb7f92e438ada4f16d9af679a0 100644 --- a/entry/src/main/ets/pages/ContactAddAndEditPage.ets +++ b/entry/src/main/ets/pages/ContactAddAndEditPage.ets @@ -169,10 +169,20 @@ struct ContactAddAndEditPage { let contactsKey = CommonConstants.CONTACTS_DATABASE_KEY + contactData.name; // Save the contact information. this.kvManager.addAndSave(contactsKey, JSON.stringify(contactData)); - this.getUIContext().getRouter().replaceUrl({ - url: CommonConstants.PAGE_DETAIL_URL, - params: { key: contactsKey } - }); + if (!this.isEdit) { + this.getUIContext().getRouter().replaceUrl({ + url: CommonConstants.PAGE_DETAIL_URL, + params: { key: contactsKey } + }); + } else { + let params = this.getUIContext().getRouter().getParams() as Record; + this.getUIContext().getRouter().back({ + url: CommonConstants.PAGE_DETAIL_URL, + params: { + key: params.key + } + }) + } } else { this.getUIContext().getPromptAction().showToast({ message: $r('app.string.contact_name'), diff --git a/entry/src/main/ets/pages/ContactDeletePage.ets b/entry/src/main/ets/pages/ContactDeletePage.ets index ac990b8e732190dda67979ed2054bb055293e4d0..ae972707e030f83a94a6fe74a010e59ba40dfce0 100644 --- a/entry/src/main/ets/pages/ContactDeletePage.ets +++ b/entry/src/main/ets/pages/ContactDeletePage.ets @@ -155,9 +155,7 @@ struct ContactDeletePage { item.checked = isAll ? true : false; return item; }); - let result = this.checkList.filter((item) => { - item.checked; - }); + let result = this.checkList.filter((item) => item.checked); this.count = this.checkList.length === 0 ? 0 : result.length; }, rightClickEvent: () => { diff --git a/entry/src/main/ets/pages/ContactDetailPage.ets b/entry/src/main/ets/pages/ContactDetailPage.ets index eebde10cce079fc497f34cd1645cdec738cafbe2..24249f43d63d642196356f91c9c2f0a8bf3d48b8 100644 --- a/entry/src/main/ets/pages/ContactDetailPage.ets +++ b/entry/src/main/ets/pages/ContactDetailPage.ets @@ -82,17 +82,17 @@ struct ContractDetailPage { this.dialogController.close(); } - aboutToAppear() { - this.initializeData(); + onPageShow(): void { + let params = this.getUIContext().getRouter().getParams() as Record; + this.initializeData(params.key as string); } /** * Initialize detail page data. */ - initializeData(): void { - let params = this.getUIContext().getRouter().getParams() as Record; + initializeData(key: string): void { // Get contact details. - this.kvManager.getDetails(params.key as string, (err: BusinessError, data) => { + this.kvManager.getDetails(key, (err: BusinessError, data) => { if (err) { hilog.error(0x0000, 'hilog', TAG, `DetailPage.ets Fail to get, error message is ${JSON.stringify(err)}`); return; @@ -167,9 +167,11 @@ struct ContractDetailPage { .borderRadius(40) .margin({ right: 8 }) .onClick(() => { + let params = this.getUIContext().getRouter().getParams() as Record; this.getUIContext().getRouter().pushUrl({ url: 'pages/ContactAddAndEditPage', params: { + key: params.key as string, isEdit: true, name: this.name, address: this.address, diff --git a/entry/src/main/ets/pages/ContactHomePage.ets b/entry/src/main/ets/pages/ContactHomePage.ets index 663b8ce0e0f59dfa4f2779fe1f0ef0fc22e25af9..662da26fd9450649e589b6a9b7e99d5d045f0dfb 100644 --- a/entry/src/main/ets/pages/ContactHomePage.ets +++ b/entry/src/main/ets/pages/ContactHomePage.ets @@ -147,7 +147,7 @@ struct ContactHomePage { } build() { - Column() { + Flex({ direction: FlexDirection.Column }) { this.NavigationTitle(); this.ContactList(); } @@ -214,6 +214,7 @@ struct ContactHomePage { }) } .height(56) + .flexShrink(0) } @Builder @@ -243,10 +244,11 @@ struct ContactHomePage { @Builder dataView() { - Column() { + Flex({ direction: FlexDirection.Column }) { Search({ value: $$this.searchValue, placeholder: Object($r('app.string.search_contact')) }) .width('100%') .height(40) + .flexShrink(0) .borderRadius(24) .placeholderColor('rgba(0, 0, 0, 0.6)') .placeholderFont({ @@ -301,11 +303,14 @@ struct ContactHomePage { } .scrollBar(BarState.Off) .width('100%') + .height('100%') .margin({ bottom: $r('app.float.list_area_height') }) } .width('100%') + .flexGrow(1) } .width('100%') + .flexGrow(1) .margin({ top: 8 }) }