Skip to content

Commit

Permalink
Merge pull request #21 from mgz0227/dev_2008
Browse files Browse the repository at this point in the history
添加文件夹标签切换
  • Loading branch information
MaoXiaoone authored May 6, 2024
2 parents b1b9600 + 388f95c commit 6ead28a
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 20 deletions.
45 changes: 45 additions & 0 deletions entry/src/main/ets/componets/dataList/folderList.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* 文件夹
*/
export class folderList {
/**
* 标题
*/
title:string

/**
* 描述
*/
describe:string

/**
* 类型
*/
bookType:string

/**
* 章节
*/
countNumber:number

/**
* 图片
*/
bookImage:Resource

/**
* 是否置顶
*/
isTop:boolean



constructor(title:string,countNumber:number,bookImage:Resource,bookType:string,isTop:boolean = false,describe:string = '') {
this.title = title
this.bookType = bookType
this.isTop = isTop
this.describe = describe
this.countNumber = countNumber
this.bookImage = bookImage
}
}
2 changes: 1 addition & 1 deletion entry/src/main/ets/pages/view/BookShelf.ets
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ReadShow from '../../componets/common/ReadShow'
import IndexShelf from '../../componets/IndexShelf'
import IndexShelf from './bookShelf/IndexShelf'

@Component
export default struct BookShelf {
Expand Down
69 changes: 69 additions & 0 deletions entry/src/main/ets/pages/view/bookShelf/BookFolder.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { folderList } from '../../../componets/dataList/folderList'
import {novelPageList} from '../../../viewData/bookData'
/**
* 文件夹
*/
@Component
export default struct BookFolder {
build() {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap,alignContent:FlexAlign.Center}){
ForEach(novelPageList, (item: folderList,index:number) => {
this.bookInfoGrid(item.title,item.bookImage,item.countNumber)
})
}
}


@Builder bookInfoGrid(title:string,bookImage:Resource,countNumer:number){
Column({
space:5
}) {
Column(){
Column(){
Stack(){
Column(){

}
.width(88).height(120)
.backgroundImage(bookImage)
.backgroundImageSize({width:88,height:120})
.zIndex(2)

Row(){
Image($r('app.media.occlusion1'))
}
.zIndex(1)
.width(95).height(110)

Row(){
Image($r('app.media.occlusion2'))
}.zIndex(0)
.width(100).height(100)
}
.align(Alignment.BottomStart)
}

Row().width(100).height(20).backgroundColor('rgba(255, 255, 255, 0.6)').borderRadius(10)
}
Text(title)
.fontSize(15)
.fontWeight(700)
.textOverflow({
overflow:TextOverflow.Ellipsis
})
.ellipsisMode(EllipsisMode.END)
.maxLines(2)
Text(`共${countNumer}本`).fontSize(12).fontColor('rgb(174,174,174)')
.textOverflow({
overflow:TextOverflow.Ellipsis
})
.ellipsisMode(EllipsisMode.END)
.fontWeight(500)
.maxLines(1)
}
.alignItems(HorizontalAlign.Start)
.width('33%')
.padding({ left:8,right:8,bottom:5,top:5 })
.backgroundColor('rgba(244,244,244,0.8)')
}
}
7 changes: 3 additions & 4 deletions entry/src/main/ets/pages/view/bookShelf/BookInfoGrid.ets
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default struct BookInfoGrid{
}
.borderRadius(10)
.backgroundColor(this.isShowCheck ?'rgba(0, 0, 0, 0.3)':'')
.width(90).height(120)
.width(100).height(120)
}
/* if (this.searchValue === '浏览历史'){
Flex({
Expand Down Expand Up @@ -111,10 +111,9 @@ export default struct BookInfoGrid{
}*/
}
.borderRadius(10)
.width(90).height(120)
.width(100).height(120)
.backgroundImage(this.bookImage)
.backgroundImageSize({width:90,height:120})

.backgroundImageSize({width:100,height:120})
Text(this.title)
.fontSize(15)
.fontWeight(700)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import cartoonPage from '../pages/view/bookShelf/cartoonPage'
import novelPage from '../pages/view/bookShelf/novelPage'
import BookMark from './head/BookMark'
import BookType from './head/BookType'
import cartoonPage from './cartoonPage'
import novelPage from './novelPage'
import BookMark from '../../../componets/head/BookMark'
import BookType from '../../../componets/head/BookType'

import soundPage from '../pages/view/bookShelf/soundPage'
import IndexSearchType from './head/IndexSearchType'
import soundPage from './soundPage'
import IndexSearchType from '../../../componets/head/IndexSearchType'
import router from '@ohos.router'; // 引入路由管理器
import delDialogExample from './common/delDialog'
import delDialogExample from '../../../componets/common/delDialog'
import BookFolder from './BookFolder'

@Component
export default struct IndexShelf {
Expand Down Expand Up @@ -41,7 +42,7 @@ export default struct IndexShelf {
EXHIBIT_NAMES: string[] = ['列表', '宫格']
GROUP_NAMES:string[] = ['标签', '文件夹']
@State EXHIBIT:string = '宫格'
@State GROUP:string = '标签'
@State GROUP:string = '文件夹'
@State searchValue:string = '最近阅读'
@State bookType:string = '全部'
@State title:string = '最近阅读'
Expand All @@ -50,7 +51,6 @@ export default struct IndexShelf {
@State counter: number = 0
@State RefreshingTitle:string = '松开刷新'
@State isShowCheck:boolean = false

build() {
Column() {
Flex({
Expand Down Expand Up @@ -132,6 +132,7 @@ export default struct IndexShelf {
IndexSearchType({title:this.title,searchValue:this.searchValue})
IndexSearchType({title:'浏览历史',searchValue:this.searchValue})
.onClick(()=> {
this.GROUP = '标签'
this.searchValue = '浏览历史'
this.isShowCheck = false
})
Expand Down Expand Up @@ -228,12 +229,16 @@ export default struct IndexShelf {
Refresh({ refreshing: $$this.isRefreshing,builder:this.refreshComponent}) {
Scroll(){
Stack({alignContent:Alignment.Center}) {
if (this.currentIndex === 0){
novelPage({searchValue:this.searchValue,currentIndex:0,isClear:this.isClear,EXHIBIT:this.EXHIBIT,isShowCheck:this.isShowCheck}).zIndex(0)
} else if(this.currentIndex === 1) {
cartoonPage({searchValue:this.searchValue,currentIndex:1,isClear:this.isClear,EXHIBIT:this.EXHIBIT,isShowCheck:this.isShowCheck}).zIndex(1)
} else if(this.currentIndex === 2) {
soundPage({searchValue:this.searchValue,currentIndex:2,isClear:this.isClear,EXHIBIT:this.EXHIBIT,isShowCheck:this.isShowCheck}).zIndex(2)
if (this.GROUP === '标签'){
if (this.currentIndex === 0){
novelPage({searchValue:this.searchValue,currentIndex:0,isClear:this.isClear,EXHIBIT:this.EXHIBIT,isShowCheck:this.isShowCheck}).zIndex(0)
} else if(this.currentIndex === 1) {
cartoonPage({searchValue:this.searchValue,currentIndex:1,isClear:this.isClear,EXHIBIT:this.EXHIBIT,isShowCheck:this.isShowCheck}).zIndex(1)
} else if(this.currentIndex === 2) {
soundPage({searchValue:this.searchValue,currentIndex:2,isClear:this.isClear,EXHIBIT:this.EXHIBIT,isShowCheck:this.isShowCheck}).zIndex(2)
}
} else {
BookFolder()
}
}
.padding({left:10,right:10})
Expand Down
13 changes: 13 additions & 0 deletions entry/src/main/ets/viewData/bookData.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { folderList } from '../componets/dataList/folderList'

export const novelPageList:folderList[] = [
new folderList('玄幻',12,$r('app.media.folder_test'),'玄幻'),
new folderList('都市',13,$r('app.media.folder_test'),'都市'),
new folderList('仙侠',12,$r('app.media.folder_test'),'仙侠'),
new folderList('武侠',12,$r('app.media.folder_test'),'武侠'),
new folderList('奇幻',12,$r('app.media.folder_test'),'奇幻'),
new folderList('科幻',12,$r('app.media.folder_test'),'科幻'),
new folderList('历史',12,$r('app.media.folder_test'),'历史'),
new folderList('游戏',12,$r('app.media.folder_test'),'游戏'),
new folderList('悬疑',12,$r('app.media.folder_test'),'悬疑')
]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added entry/src/main/resources/base/media/occlusion1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added entry/src/main/resources/base/media/occlusion2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added entry/src/main/resources/base/media/partition.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6ead28a

Please sign in to comment.