Skip to content

Commit

Permalink
订阅源->批量管理->删除功能
Browse files Browse the repository at this point in the history
订阅源->批量管理->删除功能
  • Loading branch information
MaoXiaoone committed Dec 5, 2024
1 parent 418699a commit 732debd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion entry/src/main/ets/database/dao/SubscriptionDao.ets
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { rssSourcesTypeParams } from '../types/rssSourcesType';
import rssSourcesHistoryDao from './RssSourcesHistoryDao';

interface delParams {
url: string,
url?: string,
id:number
}

Expand Down
23 changes: 20 additions & 3 deletions entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ export default struct SubscriptionIndex {
.width('33%')
.onClick(()=>{
this.batchAll = !this.batchAll

Object.keys(this.batchList).forEach((key: string) => {
this.batchList[key] = this.batchAll
})
Expand All @@ -154,8 +153,11 @@ export default struct SubscriptionIndex {
Text('完成')
.width('33%')
.onClick(() => {
this.batchList = {}
this.batchAll = false
this.batchEdit = false
Object.keys(this.batchList).forEach((key: string) => {
this.batchList[key] = false
})
getContext(this).eventHub.emit('SubscriptionBatchEdit', true);
})
}
Expand Down Expand Up @@ -276,7 +278,22 @@ export default struct SubscriptionIndex {
.fontColor('rgba(0, 0, 0, 0.88)')
}
.onClick(() => {
showMessage('功能开发中,暂未开放')
let checkRssSources = Object.values(this.batchList).filter(value => value === true).length
if (checkRssSources <= 0){
showMessage('请选择要删除的订阅源');
return;
}

Object.keys(this.batchList).forEach((key: string) => {
if (this.batchList[key]) {
subscriptionDao.deleteRssSourcesById({
id: Number(key)
})
this.batchList[key] = false
}
})
setTimeout(()=>{this.refresh()},200)
showMessage('删除成功!')
})
}
}
Expand Down

0 comments on commit 732debd

Please sign in to comment.