diff --git a/entry/src/main/ets/componets/dataList/folderList.ets b/entry/src/main/ets/componets/dataList/folderList.ets new file mode 100644 index 00000000..3ca980e6 --- /dev/null +++ b/entry/src/main/ets/componets/dataList/folderList.ets @@ -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 + } +} diff --git a/entry/src/main/ets/pages/view/BookShelf.ets b/entry/src/main/ets/pages/view/BookShelf.ets index 8be8242d..cd41c80b 100644 --- a/entry/src/main/ets/pages/view/BookShelf.ets +++ b/entry/src/main/ets/pages/view/BookShelf.ets @@ -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 { diff --git a/entry/src/main/ets/pages/view/bookShelf/BookFolder.ets b/entry/src/main/ets/pages/view/bookShelf/BookFolder.ets new file mode 100644 index 00000000..f11bcb29 --- /dev/null +++ b/entry/src/main/ets/pages/view/bookShelf/BookFolder.ets @@ -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)') + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/view/bookShelf/BookInfoGrid.ets b/entry/src/main/ets/pages/view/bookShelf/BookInfoGrid.ets index 30fe44d9..448f66ea 100644 --- a/entry/src/main/ets/pages/view/bookShelf/BookInfoGrid.ets +++ b/entry/src/main/ets/pages/view/bookShelf/BookInfoGrid.ets @@ -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({ @@ -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) diff --git a/entry/src/main/ets/componets/IndexShelf.ets b/entry/src/main/ets/pages/view/bookShelf/IndexShelf.ets similarity index 88% rename from entry/src/main/ets/componets/IndexShelf.ets rename to entry/src/main/ets/pages/view/bookShelf/IndexShelf.ets index a593c8f3..96030f92 100644 --- a/entry/src/main/ets/componets/IndexShelf.ets +++ b/entry/src/main/ets/pages/view/bookShelf/IndexShelf.ets @@ -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 { @@ -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 = '最近阅读' @@ -50,7 +51,6 @@ export default struct IndexShelf { @State counter: number = 0 @State RefreshingTitle:string = '松开刷新' @State isShowCheck:boolean = false - build() { Column() { Flex({ @@ -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 }) @@ -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}) diff --git a/entry/src/main/ets/viewData/bookData.ets b/entry/src/main/ets/viewData/bookData.ets new file mode 100644 index 00000000..1de6fe95 --- /dev/null +++ b/entry/src/main/ets/viewData/bookData.ets @@ -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'),'悬疑') +] \ No newline at end of file diff --git a/entry/src/main/resources/base/media/folder_test.png b/entry/src/main/resources/base/media/folder_test.png new file mode 100644 index 00000000..7dcee051 Binary files /dev/null and b/entry/src/main/resources/base/media/folder_test.png differ diff --git a/entry/src/main/resources/base/media/occlusion1.png b/entry/src/main/resources/base/media/occlusion1.png new file mode 100644 index 00000000..61ee0a5a Binary files /dev/null and b/entry/src/main/resources/base/media/occlusion1.png differ diff --git a/entry/src/main/resources/base/media/occlusion2.png b/entry/src/main/resources/base/media/occlusion2.png new file mode 100644 index 00000000..948adc15 Binary files /dev/null and b/entry/src/main/resources/base/media/occlusion2.png differ diff --git a/entry/src/main/resources/base/media/partition.png b/entry/src/main/resources/base/media/partition.png new file mode 100644 index 00000000..8fcba39a Binary files /dev/null and b/entry/src/main/resources/base/media/partition.png differ