Skip to content

Commit

Permalink
Merge pull request #60 from mgz0227/dev_2008
Browse files Browse the repository at this point in the history
管理页隐藏文件、隐藏弹窗
  • Loading branch information
MaoXiaoone authored May 16, 2024
2 parents 4d49267 + 4c60b72 commit 4c46ea2
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 29 deletions.
44 changes: 44 additions & 0 deletions entry/src/main/ets/componets/common/hideDialog.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

@CustomDialog
export default struct hideDialogExample {

controller?: CustomDialogController
// 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在所有controller的后面
cancel: () => void = () => {
}
confirm: () => void = () => {
}
@Prop title:string

build() {
Column() {
Text(`确定隐藏吗?` ).fontWeight(600).maxLines(1).minFontSize(12).maxFontSize(20).margin({ top: 20, bottom: 10 })
Text('隐藏后可点击分组标签栏右侧分组管理入口查看隐藏分组并进入').width('70%').textAlign(TextAlign.Center)
.fontColor('rgba(0, 0, 0, 0.45)').fontSize(14).fontWeight(400).lineHeight(22)
Row({space:24}) {
Text('取消')
.onClick(() => {
if (this.controller != undefined) {
this.controller.close()
this.cancel()
}
})
.borderRadius(15)
.padding({left:30,right:30,top:10,bottom:10})
.fontColor($r('app.color.theme_color'))
.backgroundColor('rgba(255,120,0,0.12)')
Text('确认')
.onClick(() => {
if (this.controller != undefined) {
this.controller.close()
this.confirm()
}
})
.borderRadius(15)
.padding({left:30,right:30,top:10,bottom:10})
.fontColor(Color.White)
.backgroundColor($r('app.color.theme_color'))
}.padding({top:20,bottom:20})
}
}
}
5 changes: 4 additions & 1 deletion entry/src/main/ets/componets/dataList/folderList.ets
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ export class folderList {
*/
isTop:boolean

isShow:boolean

newUpdateBook:string

topUpdateTime:Date



constructor(id:number,title:string,countNumber:number,bookImage:Resource,bookType:string,newUpdateBook:string = '',isTop:boolean = false,describe:string = '', topUpdateTime:Date = new Date()) {
constructor(id:number,title:string,countNumber:number,bookImage:Resource,bookType:string,newUpdateBook:string = '',isShow:boolean = false,isTop:boolean = false,describe:string = '', topUpdateTime:Date = new Date()) {
this.id = id
this.title = title
this.bookType = bookType
Expand All @@ -50,5 +52,6 @@ export class folderList {
this.bookImage = bookImage
this.newUpdateBook = newUpdateBook
this.topUpdateTime = topUpdateTime
this.isShow = isShow
}
}
76 changes: 62 additions & 14 deletions entry/src/main/ets/pages/view/bookShelf/Manage/BookManagePage.ets
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { folderList } from '../../../../componets/dataList/folderList';
import BookFolderManages from './bookManage/BookFolderManages';
import newBookShelf from './bookManage/newBookShelf';
import newAddShelf from './bookManage/newAddShelf';
import hideDialogExample from '../../../../componets/common/hideDialog';

class routerParams {
currentIndex:number
Expand Down Expand Up @@ -345,7 +346,11 @@ struct BookManagePage {
Text('隐藏分组').fontSize(14).fontWeight(500)
}
.onClick(()=>{

if (this.folderCheckList.length === 0) {
showMessage('请选择要隐藏的选项')
return
}
this.clickHideDialog?.open()
})
}

Expand All @@ -361,6 +366,48 @@ struct BookManagePage {
.height('10%')
.padding(20)
}
showFolderType(){
console.log(JSON.stringify(this.folderCheckList))
for (let i = 0; i < this.folderCheckList.length; i++) {
for (let j = 0; j < this.novelPageList.length; j++) {
if (this.folderCheckList[i].id === this.novelPageList[j].id) {
this.novelPageList[j].isShow = true
console.log(JSON.stringify(this.novelPageList[j]))
break
}
}
}
this.allCheck = false
this.folderCheckList = []
this.showFolderSort()
showMessage('隐藏成功')
}

//是否确认移动分组
clickBookTypeDialog: CustomDialogController | null = new CustomDialogController({
builder: hideDialogExample({
cancel: ()=> { this.clickBookCancel() },
confirm: ()=> { this.clickBookAccept() }
}),
cancel: this.clickExitDialog,
autoCancel: true,
alignment: DialogAlignment.Center,
gridCount: 4,
customStyle: false,
cornerRadius: 25,
})

clickBookCancel() {
this.clickBookType = ''
}

clickBookAccept() {
this.mobileBookType()
}

clickExitDialog() {
this.clickBookType = ''
}

cancelShowTop(){
//循环遍历checkBookList当bookId和showBookList中的bookId相同时,将showBookList isTop改为false
Expand Down Expand Up @@ -570,31 +617,32 @@ struct BookManagePage {
})
}

//是否确认移动分组
clickBookTypeDialog: CustomDialogController | null = new CustomDialogController({
builder: confirmDialogExample({
cancel: ()=> { this.clickBookCancel() },
confirm: ()=> { this.clickBookAccept() },
title:`移动到${this.clickBookType}`
//是否隐藏分组
clickHideDialog: CustomDialogController | null = new CustomDialogController({
builder: hideDialogExample({
cancel: ()=> { this.clickHideCancel() },
confirm: ()=> { this.clickHideAccept() },
title:``
}),
cancel: this.clickExitDialog,
cancel: this.hideDialog,
autoCancel: true,
alignment: DialogAlignment.Center,
gridCount: 4,
customStyle: false,
cornerRadius: 25,
})

clickBookCancel() {
this.clickBookType = ''
clickHideCancel() {

}

clickBookAccept() {
this.mobileBookType()
clickHideAccept() {
this.showFolderType()

}

clickExitDialog() {
this.clickBookType = ''
hideDialog() {

}

mobileBookType(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,25 @@ export default struct BookFolderManages {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap,alignContent:FlexAlign.Center}){
if (this.EXHIBIT === '列表') {
ForEach(this.folderList, (item: folderList) => {
BookFolderInfoManage({
folderList:item,
changeTop:this.changeTop,
allCheck:this.allCheck,
folderCheckList:this.folderCheckList
})
if (!item.isShow) {
BookFolderInfoManage({
folderList:item,
changeTop:this.changeTop,
allCheck:this.allCheck,
folderCheckList:this.folderCheckList
})
}
})

} else {
ForEach(this.folderList, (item: folderList) => {
BookFolderGridManage({
folderList:item,
changeTop:this.changeTop,
allCheck:this.allCheck,
folderCheckList:this.folderCheckList
}).width('33%')
if (!item.isShow) {
BookFolderGridManage({
folderList:item,
changeTop:this.changeTop,
allCheck:this.allCheck,
folderCheckList:this.folderCheckList
}).width('33%')
}
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion entry/src/main/ets/viewData/bookData.ets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { folderList } from '../componets/dataList/folderList'

export const novelPageList:folderList[] = [
new folderList(1,'玄幻',12,$r('app.media.folder_test'),'玄幻','宿命之环等3本有更新'),
new folderList(1,'玄幻',12,$r('app.media.folder_test'),'玄幻','宿命之环等3本有更新',true),
new folderList(2,'都市',13,$r('app.media.folder_test'),'都市'),
new folderList(3,'仙侠',12,$r('app.media.folder_test'),'仙侠'),
new folderList(4,'武侠',12,$r('app.media.folder_test'),'武侠'),
Expand Down

0 comments on commit 4c46ea2

Please sign in to comment.