From 8638494462e7f53ac42ebd846092131efa4eb1a6 Mon Sep 17 00:00:00 2001 From: liujuan Date: Wed, 17 Apr 2024 07:51:08 +0000 Subject: [PATCH] update product/phone/src/main/ets/pages/index.ets. Signed-off-by: liujuan --- product/phone/src/main/ets/pages/index.ets | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/product/phone/src/main/ets/pages/index.ets b/product/phone/src/main/ets/pages/index.ets index 38b84382..e5ca54e4 100644 --- a/product/phone/src/main/ets/pages/index.ets +++ b/product/phone/src/main/ets/pages/index.ets @@ -130,12 +130,13 @@ struct IndexPage { initPhotosStore() { this.photosPreferences = AppStorage.get(Constants.PHOTOS_STORE_KEY) as Preferences; if (this.photosPreferences) { - this.photosPreferences.get('lastPage', 0).then((data: data_preferences.ValueType) => { + try { + const data: data_preferences.ValueType = this.photosPreferences.getSync('lastPage', 0) this.preIndex = data as number; this.currentIndex = this.preIndex; - }).catch((err: Error) => { + } catch (err) { this.updatePhotosStore('lastPage', 0); - }); + } } else { Log.info(TAG, 'photosPreferences is undefined'); } @@ -291,7 +292,6 @@ struct IndexPage { } .width('100%') .height('100%') - .visibility(this.currentIndex === Constants.TIMELINE_PAGE_INDEX ? Visibility.Visible : Visibility.Hidden) } TabContent() { @@ -302,7 +302,6 @@ struct IndexPage { isShowSelectPhotoBrowser: $isShowSelectPhotoBrowser, pageStatus: this.pageStatus }) - .visibility(this.currentIndex === Constants.ALBUM_PAGE_INDEX ? Visibility.Visible : Visibility.Hidden) } } .animationDuration(Constants.NUMBER_0)