From 6121a98a78a6236dcc12abd1b2f433a79e54c873 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Thu, 4 May 2023 13:30:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E6=BA=90=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=90=8E=E5=88=97=E8=A1=A8=E5=A4=9A=E9=80=89=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #3051 --- modules/web/src/components/SourceItem.vue | 25 ++++++++++++++++---- modules/web/src/components/SourceList.vue | 28 +++++++++++++++++------ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/modules/web/src/components/SourceItem.vue b/modules/web/src/components/SourceItem.vue index 7317ee7d5..1073956c7 100644 --- a/modules/web/src/components/SourceItem.vue +++ b/modules/web/src/components/SourceItem.vue @@ -2,23 +2,35 @@ {{ source.bookSourceName || source.sourceName }} + diff --git a/modules/web/src/components/SourceList.vue b/modules/web/src/components/SourceList.vue index ba7630453..f9d6f6942 100644 --- a/modules/web/src/components/SourceList.vue +++ b/modules/web/src/components/SourceList.vue @@ -18,7 +18,7 @@ type="danger" :icon="Delete" @click="deleteSelectSources" - :disabled="sourceSelect.length === 0" + :disabled="sourceUrlSelect.length === 0" >删除 清空 - + { return /bookSource/.test(window.location.href); }); +const sourceSelect = computed(() => { + let temp = sourceUrlSelect.value, + selectUrlsLength = temp.length; + if (selectUrlsLength == 0) return []; + let searchKey = "sourceUrl"; + if (isBookSource.value) searchKey = "bookSourceUrl"; + return sources.value.filter((source) => { + let searchIndex = temp.indexOf(source[searchKey]); + if (searchIndex > -1) { + temp.splice(searchIndex, 1); + return true; + } + return false; + }); +}); const deleteSelectSources = () => { API.deleteSource(sourceSelect.value).then(({ data }) => { if (!data.isSuccess) return ElMessage.error(data.errorMsg); store.deleteSources(sourceSelect.value); - sourceSelect.value = []; + sourceUrlSelect.value = []; }); }; const clearAllSources = () => { store.clearAllSource(); - sourceSelect.value = []; + sourceUrlSelect.value = []; }; //筛选源 const sourcesFiltered = computed(() => { @@ -104,7 +119,7 @@ const importSourceFile = () => { const outExport = () => { const exportFile = document.createElement("a"); let sources = - sourceSelect.value.length === 0 + sourceUrlSelect.value.length === 0 ? sourcesFiltered.value : sourceSelect.value, sourceType = isBookSource.value ? "BookSource" : "RssSource"; @@ -131,7 +146,6 @@ const outExport = () => { #source-list { margin-top: 6px; height: calc(100vh - 112px - 7px); - :deep(.el-checkbox) { margin-bottom: 4px; width: 100%;