diff --git a/entry/src/main/ets/database/dao/SubscriptionDao.ets b/entry/src/main/ets/database/dao/SubscriptionDao.ets index 98f1f65..3840e9b 100644 --- a/entry/src/main/ets/database/dao/SubscriptionDao.ets +++ b/entry/src/main/ets/database/dao/SubscriptionDao.ets @@ -13,7 +13,7 @@ import { rssSourcesTypeParams } from '../types/rssSourcesType'; import rssSourcesHistoryDao from './RssSourcesHistoryDao'; interface delParams { - url: string, + url?: string, id:number } diff --git a/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets b/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets index a32371c..b395e4d 100644 --- a/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets +++ b/entry/src/main/ets/pages/view/Subscription/SubscriptionIndex.ets @@ -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 }) @@ -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); }) } @@ -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('删除成功!') }) } }