Skip to content

Commit

Permalink
添加弹窗提示,新增小说书架状态
Browse files Browse the repository at this point in the history
添加弹窗提示,新增小说书架状态
  • Loading branch information
MaoXiaoone committed May 4, 2024
1 parent c9c0198 commit c3fffd4
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 5 deletions.
9 changes: 7 additions & 2 deletions entry/src/main/ets/componets/dataList/bookList.ets
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export class BookList {
*/
describe:string

/**
* 是否加入书架
*/
isJoin:boolean

/**
* 章节
*/
Expand All @@ -21,9 +26,9 @@ export class BookList {




constructor( title:string,describe:string , chapter:string, bookImage:Resource) {
constructor( title:string,describe:string , chapter:string, bookImage:Resource,isJoin:boolean = false) {
this.title = title
this.isJoin = isJoin
this.describe = describe
this.chapter = chapter
this.bookImage = bookImage
Expand Down
12 changes: 10 additions & 2 deletions entry/src/main/ets/pages/view/bookShelf/BookInfo.ets
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import delDialogExample from '../../../componets/common/delDialog'
import router from '@ohos.router'
import { promptAction } from '@kit.ArkUI'

@Component
/**
Expand All @@ -17,7 +18,7 @@ export default struct BookInfo{

@Prop searchValue:string

@State isJoin:boolean = false
@Prop isJoin:boolean

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

Expand Down Expand Up @@ -119,12 +120,19 @@ export default struct BookInfo{
Image(this.isJoin?$r("app.media.add_check"):$r("app.media.add_shelf")).width(this.isJoin?15:10).height(this.isJoin?15:10)
.fillColor('rgba(0, 0, 0, 0.9)')
Text('书架').fontSize(10).fontColor('rgba(0, 0, 0, 0.45)')
} .padding({ left:15,right:15,bottom:5,top:5 })
}.padding({ left:15,right:15,bottom:5,top:5 })
}
.backgroundColor(this.isJoin?'rgba(174,174,174,0.2)':'')
.borderColor('rgb(174,174,174)')
.borderWidth(this.isJoin?0:1)
.borderRadius(50)
.onClick(()=>{
this.isJoin = !this.isJoin
promptAction.showToast({
message: this.isJoin?'已加入书架':'已移出书架',
duration: 1000,
})
})
}
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.End)
Expand Down
10 changes: 10 additions & 0 deletions entry/src/main/ets/pages/view/bookShelf/cartoonPage.ets
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { BookList } from '../../../componets/dataList/bookList'
import BookInfo from './BookInfo'
import { promptAction } from '@kit.ArkUI'

/**
* 漫画
*/
Expand All @@ -22,6 +24,10 @@ export default struct cartoonPage{
if (this.currentIndex === 1 && this.isClear) {
this.cartoonList = []
this.isClear = false
promptAction.showToast({
message: '清空成功',
duration: 1000,
})
}
}

Expand All @@ -31,6 +37,10 @@ export default struct cartoonPage{
}
this.lastIndex = index
this.cartoonList.splice(index,1)
promptAction.showToast({
message: '删除成功',
duration: 1000,
})
//防止快速点击删除
setTimeout(()=>{
this.lastIndex = 9999
Expand Down
12 changes: 11 additions & 1 deletion entry/src/main/ets/pages/view/bookShelf/novelPage.ets
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BookList } from '../../../componets/dataList/bookList'
import BookInfo from './BookInfo'
import { ifaa } from '@kit.OnlineAuthenticationKit'
import { promptAction } from '@kit.ArkUI'

@Component
export default struct novelPage{
Expand All @@ -9,7 +10,7 @@ export default struct novelPage{
@Prop currentIndex:number
@State lastIndex:number = 9999
@State bookList:BookList[] = [
new BookList('仙人消失之后','会说话的肘子·未读过1','更新至·第340章 镇压',$r('app.media.cover_list'))
new BookList('仙人消失之后','会说话的肘子·未读过1','更新至·第340章 镇压',$r('app.media.cover_list'),true)
,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'))
Expand All @@ -25,6 +26,10 @@ export default struct novelPage{
if (this.currentIndex === 0 && this.isClear) {
this.bookList = []
this.isClear = false
promptAction.showToast({
message: '清空成功',
duration: 1000,
})
}
}

Expand All @@ -34,6 +39,10 @@ export default struct novelPage{
}
this.lastIndex = index
this.bookList.splice(index,1)
promptAction.showToast({
message: '删除成功',
duration: 1000,
})
//防止快速点击删除
setTimeout(()=>{
this.lastIndex = 9999
Expand All @@ -58,6 +67,7 @@ export default struct novelPage{
describe: item.describe,
chapter: item.chapter,
bookImage: item.bookImage,
isJoin:item.isJoin,
searchValue: this.searchValue,
onDelete:(): void=>this.removeListByIndex(index)
})
Expand Down
10 changes: 10 additions & 0 deletions entry/src/main/ets/pages/view/bookShelf/soundPage.ets
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { BookList } from '../../../componets/dataList/bookList'
import BookInfo from './BookInfo'
import { promptAction } from '@kit.ArkUI'

/**
* 漫画
*/
Expand Down Expand Up @@ -28,6 +30,10 @@ export default struct soundPage{
if (this.currentIndex === 2 && this.isClear) {
this.cartoonList = []
this.isClear = false
promptAction.showToast({
message: '清空成功',
duration: 1000,
})
}
}

Expand All @@ -37,6 +43,10 @@ export default struct soundPage{
}
this.lastIndex = index
this.cartoonList.splice(index,1)
promptAction.showToast({
message: '删除成功',
duration: 1000,
})
//防止快速点击删除
setTimeout(()=>{
this.lastIndex = 9999
Expand Down

0 comments on commit c3fffd4

Please sign in to comment.