Skip to content

Commit

Permalink
Merge pull request #22 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 6ead28a + 2c437a4 commit 1a3c4ae
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 10 deletions.
151 changes: 151 additions & 0 deletions entry/src/main/ets/pages/view/BookManagePage.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import router from '@ohos.router';
import cartoonPage from './bookShelf/cartoonPage';
import novelPage from './bookShelf/novelPage';
import soundPage from './bookShelf/soundPage';
class routerParams {
currentIndex:number
EXHIBIT:string
constructor(currentIndex:number,EXHIBIT:string) {
this.currentIndex = currentIndex
this.EXHIBIT = EXHIBIT
}
}
/**
* 管理跳转页面
*/
@Entry
@Component
struct BookManagePage {
@State currentIndex: number = (router.getParams() as routerParams).currentIndex
@State EXHIBIT: string = (router.getParams() as routerParams).EXHIBIT

@State isClear:boolean = false
@State isManage:boolean = true

@State allCheck:boolean = false

@State manageDelete:boolean = false

onPageShow(): void {
console.log(this.currentIndex + '')
console.log(this.EXHIBIT + '')
}
build() {
Column() {
Blank(20)
Row({ space: 15 }) {
Image($r('app.media.return_left'))
.width(25)
.height(25)
.onClick(()=>{
router.back()
})
}
.margin({left:5})
.width("100%")

this.headTitle()
Flex(){
Scroll(){
if (this.currentIndex === 0){
novelPage({
searchValue:'最近阅读',
currentIndex:0,
isClear:this.isClear,
EXHIBIT:this.EXHIBIT,
isShowCheck:true,
allCheck:this.allCheck,
// manageDelete:this.manageDelete
})
} else if(this.currentIndex === 1) {
cartoonPage({searchValue:'最近阅读',
currentIndex:1,
isClear:this.isClear,
EXHIBIT:this.EXHIBIT,
isShowCheck:true})
} else if(this.currentIndex === 2) {
soundPage({searchValue:'最近阅读',
currentIndex:2,
isClear:this.isClear,
EXHIBIT:this.EXHIBIT,
isShowCheck:true})
}
}
.height('80%')
.align(Alignment.TopStart)
.scrollBar(BarState.Off)
}
this.footerTitle()
}
.padding(10)
.backgroundColor("rgb(245, 245, 245)")
.linearGradient({
direction: GradientDirection.Bottom, // 渐变方向
colors: [["rgb(254, 203, 169)", 0.0], ["RGB(245, 245, 245)", 0.2]] // 数组末尾元素占比小于1时满足重复着色效果
})
}

@Builder headTitle(){
Flex(
{

alignItems:ItemAlign.Center
}
){
Column(){
Text(!this.allCheck?'全选':'取消全选').fontSize(16).onClick(()=>{
this.allCheck = !this.allCheck
})
}
.alignItems(HorizontalAlign.Start)
.width('33%')
Column(){
Text(`已选1项目`).fontSize(20).fontWeight(600)
}.width('33%')
Column(){
Text('完成').fontSize(16)
}
.alignItems(HorizontalAlign.End)
.width('33%')
}
.padding(10)
}

@Builder footerTitle(){
Flex(
{
justifyContent:FlexAlign.SpaceBetween,
alignItems:ItemAlign.Center
}
){
Column({
space:5
}){
Image($r('app.media.pip_to_top')).width(14)
Text('置顶').fontSize(14).fontWeight(500)
}
Column({
space:5
}){
Image($r('app.media.move')).width(21)
Text('移动至').fontSize(14).fontWeight(500)
}
Column({
space:5
}){
Image($r('app.media.add_shelf_book')).width(17)
Text('加入书单').fontSize(14).fontWeight(500)
}
Column({
space:5
}){
Image($r('app.media.delete_svg')).width(20)
Text('删除').fontSize(14).fontWeight(500)
}.onClick(()=>{
this.manageDelete = true
})
}
.height('10%')
.padding(20)
}
}
20 changes: 18 additions & 2 deletions entry/src/main/ets/pages/view/bookShelf/BookInfo.ets
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import delDialogExample from '../../../componets/common/delDialog'
import router from '@ohos.router'
import { promptAction } from '@kit.ArkUI'
import { MarginType, promptAction } from '@kit.ArkUI'
import { BookList } from '../../../componets/dataList/bookList'

@Component
/**
Expand All @@ -22,6 +23,10 @@ export default struct BookInfo{

@Prop isShowCheck:boolean

@Prop allCheck:boolean = false

@Link checkBookList:BookList[]

onDelete: () => void = () => {

}
Expand Down Expand Up @@ -53,6 +58,10 @@ export default struct BookInfo{
console.info('点外围取消')
}

inputBookList(){
this.checkBookList.push(new BookList(this.title,this.describe,this.chapter,this.bookImage,this.isJoin))
console.log(JSON.stringify(this.checkBookList))
}

build() {

Expand Down Expand Up @@ -110,6 +119,14 @@ export default struct BookInfo{
Checkbox({
name: this.title
})
.selectedColor($r('app.color.theme_color'))
.select(this.allCheck)
.onClick(()=>{
this.allCheck = !this.allCheck
if (this.allCheck) {
this.inputBookList()
}
})
}
.padding({ left: 15, right: 15, bottom: 5, top: 5 })
}
Expand Down Expand Up @@ -149,6 +166,5 @@ export default struct BookInfo{
}
.padding(10)
.borderRadius(10)
.backgroundColor('rgba(244,244,244,0.8)')
}
}
2 changes: 1 addition & 1 deletion entry/src/main/ets/pages/view/bookShelf/BookInfoGrid.ets
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default struct BookInfoGrid{
Checkbox({
name: this.title
})
.selectedColor($r('app.color.theme_color'))
.unselectedColor('rgba(255, 255, 255, 0.6)')
}
.borderRadius(10)
Expand Down Expand Up @@ -139,7 +140,6 @@ export default struct BookInfoGrid{
.maxLines(1)
}
.padding({ left:8,right:8,bottom:5,top:5 })
.backgroundColor('rgba(244,244,244,0.8)')
.onClick(()=>{
router.pushUrl({
url: 'pages/view/BookDetailPage',
Expand Down
24 changes: 18 additions & 6 deletions entry/src/main/ets/pages/view/bookShelf/IndexShelf.ets
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export default struct IndexShelf {
THEME_NAMES: string[] = ['书籍导入', '下载管理', '导入书单','批量管理']
EXHIBIT_NAMES: string[] = ['列表', '宫格']
GROUP_NAMES:string[] = ['标签', '文件夹']
@State EXHIBIT:string = '宫格'
@State GROUP:string = '文件夹'
@State EXHIBIT:string = '列表'
@State GROUP:string = '标签'
@State searchValue:string = '最近阅读'
@State bookType:string = '全部'
@State title:string = '最近阅读'
Expand Down Expand Up @@ -140,12 +140,18 @@ export default struct IndexShelf {
this.GroupBuilder()
this.ExhibitBuilder()
Text('管理')
.onClick(()=>{
router.pushUrl({
url:'pages/view/BookManagePage',
params: {
currentIndex:this.currentIndex,
EXHIBIT:this.EXHIBIT
}
})
})
.fontColor('rgba(0,0,0,0.5)')
.fontSize(15)
.fontWeight(400)
.onClick(()=>{
this.isShowCheck = !this.isShowCheck
})
}
}
}
Expand Down Expand Up @@ -231,7 +237,13 @@ export default struct IndexShelf {
Stack({alignContent:Alignment.Center}) {
if (this.GROUP === '标签'){
if (this.currentIndex === 0){
novelPage({searchValue:this.searchValue,currentIndex:0,isClear:this.isClear,EXHIBIT:this.EXHIBIT,isShowCheck:this.isShowCheck}).zIndex(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) {
Expand Down
1 change: 1 addition & 0 deletions entry/src/main/ets/pages/view/bookShelf/cartoonPage.ets
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export default struct cartoonPage{
isJoin:item.isJoin,
searchValue: this.searchValue,
isShowCheck:this.isShowCheck,
checkBookList:[],
onDelete:(): void=>this.removeListByIndex(index)
})
})
Expand Down
25 changes: 25 additions & 0 deletions entry/src/main/ets/pages/view/bookShelf/novelPage.ets
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export default struct novelPage{
@Link @Watch('onIsClearChange') isClear:boolean
@Prop currentIndex:number
@State lastIndex:number = 9999
@Prop allCheck:boolean = false
// @Link @Watch('isChangeManageDelete') manageDelete:boolean
@Prop @Watch('onIsEXHIBITChange') EXHIBIT:string
@State checkBookList:BookList[] = []
@State bookList:BookList[] = [
new BookList('仙人消失之后','会说话的肘子·未读过1','更新至·第340章 镇压',$r('app.media.cover_list'),true)
,new BookList('仙人消失之后','会说话的肘子·未读过2','更新至·第340章 镇压',$r('app.media.cover_list'))
Expand All @@ -35,6 +38,25 @@ export default struct novelPage{
}
}

// isChangeManageDelete() {
// if (this.manageDelete) {
// if (this.checkBookList === null || this.checkBookList.length === 0) {
// promptAction.showToast({
// message: '请选择要删除的内容',
// duration: 1000,
// })
// this.manageDelete = false
// return
// }
// this.bookList = []
// console.log('删除')
// this.manageDelete = false
// }
// }
// isChangeBookList() {
// console.log(this.checkBookList + '')
// }

//监听EXHIBIT变化
onIsEXHIBITChange() {
console.log(this.EXHIBIT)
Expand Down Expand Up @@ -63,6 +85,7 @@ export default struct novelPage{
Image($r('app.media.no_record')).width(200).height(200)
Text('暂无浏览记录').fontSize(12).fontColor('rgba(96, 96, 96, 0.6)').fontWeight(500).padding(5)
}.margin({ top: 120 })

} else {
Column(
{space:10}
Expand Down Expand Up @@ -95,6 +118,8 @@ export default struct novelPage{
isJoin:item.isJoin,
searchValue: this.searchValue,
isShowCheck:this.isShowCheck,
allCheck:this.allCheck,
checkBookList:this.checkBookList,
onDelete:(): void=>this.removeListByIndex(index)
})
})
Expand Down
1 change: 1 addition & 0 deletions entry/src/main/ets/pages/view/bookShelf/soundPage.ets
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export default struct soundPage{
isJoin:item.isJoin,
searchValue: this.searchValue,
isShowCheck:this.isShowCheck,
checkBookList:[],
onDelete:(): void=>this.removeListByIndex(index)
})
})
Expand Down
6 changes: 6 additions & 0 deletions entry/src/main/resources/base/media/add_shelf_book.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions entry/src/main/resources/base/media/move.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions entry/src/main/resources/base/media/pip_to_top.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion entry/src/main/resources/base/profile/main_pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"pages/welcomePage",
"pages/search/SearchBook",
"pages/view/myCenter/WebDav",
"pages/view/BookDetailPage"
"pages/view/BookDetailPage",
"pages/view/BookManagePage"
]
}

0 comments on commit 1a3c4ae

Please sign in to comment.