diff --git a/entry/src/main/ets/common/constants/CommonConstants.ets b/entry/src/main/ets/common/constants/CommonConstants.ets index 6aefd748..71fef264 100644 --- a/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/entry/src/main/ets/common/constants/CommonConstants.ets @@ -218,6 +218,7 @@ export default class CommonConstants { static readonly SPACE_6: number = 6; static readonly SPACE_10: number = 10; static readonly SPACE_12: number = 12; + static readonly SPACE_16: number = 16; static readonly SPACE_20: number = 20; /** diff --git a/entry/src/main/ets/pages/view/BookDetailPage.ets b/entry/src/main/ets/pages/view/BookDetailPage.ets index 3f8c9367..56124da9 100644 --- a/entry/src/main/ets/pages/view/BookDetailPage.ets +++ b/entry/src/main/ets/pages/view/BookDetailPage.ets @@ -82,17 +82,19 @@ struct BookDetailPage { }) @State txtFiles: chaptersItem[] = []; @State txtFile: ChaptersDataSource = new ChaptersDataSource() + onPageShow() { this.isShow = true + } + + async aboutToAppear() { console.log('router BookDetailPage:' + JSON.stringify(router.getParams())) if (router.getParams() as BookList) { this.bookData = router.getParams() as BookList - setTimeout(async () => { - let temp = await FileHandler.readFile(this.bookData.fileLink) //txt小说 - this.txtFile.pushAllData(temp) - this.txtFiles = this.txtFile.getListData() - },0) } + let temp = await FileHandler.readFile(this.bookData.fileLink) //txt小说 + this.txtFile.pushAllData(temp) + this.txtFiles = this.txtFile.getListData() } // 加入书架函数 @@ -118,7 +120,7 @@ struct BookDetailPage { Tabs({ barPosition: BarPosition.Start }) { TabContent() { Column() { - if (this.txtFiles.length=== 0 || undefined) { + if (this.txtFiles.length === 0 || undefined) { SwipeRefresher({ content: '目录加载中...', isLoading: true @@ -218,7 +220,7 @@ struct BookDetailPage { .width(150) .height(40) .borderRadius(200) - .backgroundColor(this.txtFile.totalCount() ? '#FF6600' : 'gray') + .backgroundColor(this.txtFile.totalCount() > 0 ? '#FF6600' : 'gray') .fontColor('#FFFFFF') .enabled(this.txtFile.totalCount() > 0) .onClick(() => { @@ -395,10 +397,11 @@ struct BookDetailPage { // 书籍简介 Flex() { - Text(this.bookData.describe ?? '《大奉打更人》(第一卷)实体书已在天猫、当当、京东等全平台,以及各个实体书店发售。 这个世界,有儒;有道;有佛;有妖;有术士。 警校毕业的许七安幽幽醒来,发现自己身处牢狱之中,三日后流放边陲..... ' + - '\n他起初的目的只是自保,顺便在这个没有人权的社会里当个富家翁悠闲度日。 ...... 多年后,许七安回首前尘,身后是早已逝去的敌人,以及累累白骨。 ' + - '\n滚滚长江东逝水,浪花淘尽英雄,是非成败转头空。 ' + - '\n青山依旧在,几度夕阳红。') + Text(this.bookData.describe ?? + '《大奉打更人》(第一卷)实体书已在天猫、当当、京东等全平台,以及各个实体书店发售。 这个世界,有儒;有道;有佛;有妖;有术士。 警校毕业的许七安幽幽醒来,发现自己身处牢狱之中,三日后流放边陲..... ' + + '\n他起初的目的只是自保,顺便在这个没有人权的社会里当个富家翁悠闲度日。 ...... 多年后,许七安回首前尘,身后是早已逝去的敌人,以及累累白骨。 ' + + '\n滚滚长江东逝水,浪花淘尽英雄,是非成败转头空。 ' + + '\n青山依旧在,几度夕阳红。') .fontColor('#FFFFFF') .fontSize(14) .fontWeight(400) diff --git a/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets b/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets index 39edccb7..eec94bc9 100644 --- a/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets +++ b/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets @@ -40,6 +40,7 @@ export default struct SubscriptionIndex { @State subscriptionList: rssSources[] = [] @State rssSourcesList: rssSources[] = [] @State groupList: rssGroupList[] = [] + @State batchEdit: boolean = false //刷新 refresh = () => { this.resetState() @@ -104,36 +105,49 @@ export default struct SubscriptionIndex { } ) { Row({ - space: CommonConstants.SPACE_20 + space: CommonConstants.SPACE_16 }) { - Image($r('app.media.icon_subscription_index')) - .width(CommonConstants.COMMON_WIDTH_45_36) - .height(CommonConstants.COMMON_HEIGHT_21_6) - Search({ placeholder: '搜索订阅', icon: "/common/images/search.svg" }) - .layoutWeight(1) - .height(CommonConstants.COMMON_HEIGHT_40) - .backgroundColor(Color.White) - .onClick(() => { - router.pushUrl({ - url: 'pages/view/Subscription/components/SubscriptionSearch' + if (this.batchEdit === false) { + Image($r('app.media.icon_subscription_index')) + .width(CommonConstants.COMMON_WIDTH_45_36) + .height(CommonConstants.COMMON_HEIGHT_21_6) + Search({ placeholder: '搜索订阅', icon: "/common/images/search.svg" }) + .layoutWeight(1) + .height(CommonConstants.COMMON_HEIGHT_40) + .backgroundColor(Color.White) + .onClick(() => { + router.pushUrl({ + url: 'pages/view/Subscription/components/SubscriptionSearch' + }) }) + .focusOnTouch(false) //不可获取焦点 + + Image($r('app.media.addSubscription')) + .width(ImageConstants.IMG_WIDTH_24) + .height(ImageConstants.IMG_HEIGHT_24) + .bindMenu(this.MenuBuilder) + } else { + Text('全选') + Blank(1) + Text(`已选2项`) + Blank(1) + Text('完成').onClick(() => { + this.batchEdit = false }) - .focusOnTouch(false) //不可获取焦点 + } } - .padding({ right: PaddingConstants.PADDING_16 }) - - Image($r('app.media.addSubscription')) - .width(ImageConstants.IMG_WIDTH_24) - .height(ImageConstants.IMG_HEIGHT_24) - .bindMenu(this.MenuBuilder) + .width('100%') } .height('8%') //搜索End //最近使用Start - RssSourcesHistory({ - RecentlyUsed: this.RecentlyUsed - }) + if (this.batchEdit === false) { + RssSourcesHistory({ + RecentlyUsed: this.RecentlyUsed + }) + } + if (this.loading) { Column() { LoadingProgress() @@ -275,6 +289,7 @@ export default struct SubscriptionIndex { this.isShowNewSources = true break; case 3: + this.batchEdit = true break case 4: break