Skip to content

Commit

Permalink
优化书籍详情页,订阅批量编辑1 (#223)
Browse files Browse the repository at this point in the history
* git-test

* 订阅源-本地导入1

* 优化书籍详情页,订阅批量编辑1
  • Loading branch information
yindushenwen authored Jul 23, 2024
1 parent 24501f2 commit 22eda56
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 32 deletions.
1 change: 1 addition & 0 deletions entry/src/main/ets/common/constants/CommonConstants.ets
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
25 changes: 14 additions & 11 deletions entry/src/main/ets/pages/view/BookDetailPage.ets
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

// 加入书架函数
Expand All @@ -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
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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)
Expand Down
57 changes: 36 additions & 21 deletions entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default struct SubscriptionIndex {
@State subscriptionList: rssSources[] = []
@State rssSourcesList: rssSources[] = []
@State groupList: rssGroupList[] = []
@State batchEdit: boolean = false
//刷新
refresh = () => {
this.resetState()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -275,6 +289,7 @@ export default struct SubscriptionIndex {
this.isShowNewSources = true
break;
case 3:
this.batchEdit = true
break
case 4:
break
Expand Down

0 comments on commit 22eda56

Please sign in to comment.