Skip to content

Commit

Permalink
Merge pull request #17 from mgz0227/dev_2008
Browse files Browse the repository at this point in the history
根据书单个删除
  • Loading branch information
MaoXiaoone authored May 4, 2024
2 parents 1f96d75 + 1bdea77 commit c9c0198
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 19 deletions.
6 changes: 4 additions & 2 deletions entry/src/main/ets/pages/view/bookShelf/BookInfo.ets
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export default struct BookInfo{

@State isJoin:boolean = false

@State isDel:boolean = false
onDelete: () => void = () => {

}

//弹窗
bookInfoDel: CustomDialogController | null = new CustomDialogController({
Expand All @@ -41,7 +43,7 @@ export default struct BookInfo{
}

onAccept() {
console.info('确定')
this.onDelete()
}

exitApp() {
Expand Down
18 changes: 16 additions & 2 deletions entry/src/main/ets/pages/view/bookShelf/cartoonPage.ets
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default struct cartoonPage{
@Prop searchValue:string
@Link @Watch('onIsClearChange') isClear:boolean
@Prop currentIndex:number
@State lastIndex:number = 9999
@State cartoonList:BookList[] = [
new BookList('极主夫道','会说话的肘子','更新至·第340章 镇压',$r('app.media.cover_list1')),
new BookList('极主夫道','会说话的肘子','更新至·第340章 镇压',$r('app.media.cover_list1')),
Expand All @@ -24,6 +25,18 @@ export default struct cartoonPage{
}
}

removeListByIndex(index:number){
if (this.lastIndex === index) {
return
}
this.lastIndex = index
this.cartoonList.splice(index,1)
//防止快速点击删除
setTimeout(()=>{
this.lastIndex = 9999
},500)
}

build() {
if (this.cartoonList === null || this.cartoonList.length === 0) {
Column() {
Expand All @@ -35,13 +48,14 @@ export default struct cartoonPage{
{ space: 10 }
) {

ForEach(this.cartoonList, (item: BookList) => {
ForEach(this.cartoonList, (item: BookList,index: number) => {
BookInfo({
title: item.title,
describe: item.describe,
chapter: item.chapter,
bookImage: item.bookImage,
searchValue: this.searchValue
searchValue: this.searchValue,
onDelete:(): void=>this.removeListByIndex(index)
})
})

Expand Down
40 changes: 28 additions & 12 deletions entry/src/main/ets/pages/view/bookShelf/novelPage.ets
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import { BookList } from '../../../componets/dataList/bookList'
import BookInfo from './BookInfo'
import { ifaa } from '@kit.OnlineAuthenticationKit'

@Component
export default struct novelPage{
@Prop searchValue:string
@Link @Watch('onIsClearChange') isClear:boolean
@Prop currentIndex:number
@State lastIndex:number = 9999
@State bookList:BookList[] = [
new BookList('仙人消失之后','会说话的肘子·未读过','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过','更新至·第340章 镇压',$r('app.media.cover_list'))
new BookList('仙人消失之后','会说话的肘子·未读过1','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过2','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过3','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过4','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过5','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过6','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过7','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过8','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过9','更新至·第340章 镇压',$r('app.media.cover_list'))
,new BookList('仙人消失之后','会说话的肘子·未读过10','更新至·第340章 镇压',$r('app.media.cover_list'))
]
//监听isClear变化
onIsClearChange() {
Expand All @@ -26,6 +28,19 @@ export default struct novelPage{
}
}

removeListByIndex(index:number){
if (this.lastIndex === index) {
return
}
this.lastIndex = index
this.bookList.splice(index,1)
//防止快速点击删除
setTimeout(()=>{
this.lastIndex = 9999
},500)
}


build() {
if (this.bookList === null || this.bookList.length === 0) {
Column() {
Expand All @@ -37,13 +52,14 @@ export default struct novelPage{
{ space: 10 }
) {

ForEach(this.bookList, (item: BookList) => {
ForEach(this.bookList, (item: BookList,index:number) => {
BookInfo({
title: item.title,
describe: item.describe,
chapter: item.chapter,
bookImage: item.bookImage,
searchValue: this.searchValue
searchValue: this.searchValue,
onDelete:(): void=>this.removeListByIndex(index)
})
})

Expand Down
19 changes: 16 additions & 3 deletions entry/src/main/ets/pages/view/bookShelf/soundPage.ets
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default struct soundPage{
@Prop searchValue:string
@Link @Watch('onIsClearChange') isClear:boolean
@Prop currentIndex:number

@State lastIndex:number = 9999
@State cartoonList:BookList[] = [
new BookList('三体广播据','729声工厂 · 第一季 第五集 红岸基地','共101集 · 最终季 最终集 回归大宇宙',$r('app.media.cover_list2')),
new BookList('三体广播据','729声工厂 · 第一季 第五集 红岸基地','共101集 · 最终季 最终集 回归大宇宙',$r('app.media.cover_list2')),
Expand All @@ -31,6 +31,18 @@ export default struct soundPage{
}
}

removeListByIndex(index:number){
if (this.lastIndex === index) {
return
}
this.lastIndex = index
this.cartoonList.splice(index,1)
//防止快速点击删除
setTimeout(()=>{
this.lastIndex = 9999
},500)
}

build() {
if (this.cartoonList === null || this.cartoonList.length === 0) {
Column() {
Expand All @@ -42,13 +54,14 @@ export default struct soundPage{
{ space: 10 }
) {

ForEach(this.cartoonList, (item: BookList) => {
ForEach(this.cartoonList, (item: BookList,index:number) => {
BookInfo({
title: item.title,
describe: item.describe,
chapter: item.chapter,
bookImage: item.bookImage,
searchValue: this.searchValue
searchValue: this.searchValue,
onDelete:(): void=>this.removeListByIndex(index)
})
})
Divider().vertical(false)
Expand Down

0 comments on commit c9c0198

Please sign in to comment.