From 732debd9083f1aa06c5e8066507471e4c4ac9fe1 Mon Sep 17 00:00:00 2001 From: 2008 <59199830@qq.com> Date: Fri, 6 Dec 2024 00:09:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=BA=90->=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E7=AE=A1=E7=90=86->=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 订阅源->批量管理->删除功能 --- .../main/ets/database/dao/SubscriptionDao.ets | 2 +- .../view/Subscription/SubscriptionIndex.ets | 23 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/entry/src/main/ets/database/dao/SubscriptionDao.ets b/entry/src/main/ets/database/dao/SubscriptionDao.ets index 98f1f65d..3840e9b8 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 a32371c3..b395e4d7 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('删除成功!') }) } }