From 01ef6c09e536b7aa8c96ad5e3fd39290cd8fe4fc Mon Sep 17 00:00:00 2001 From: Megghy Date: Sat, 2 Mar 2024 19:20:38 +0800 Subject: [PATCH] add batch del song --- src/api/query.ts | 5 ----- src/components/SongList.vue | 21 +++++++++++++++++++++ src/main.ts | 33 +++++++++++++++++++-------------- src/views/manage/EventView.vue | 14 ++++++++------ 4 files changed, 48 insertions(+), 25 deletions(-) diff --git a/src/api/query.ts b/src/api/query.ts index 977cbc0..fe9fe1c 100644 --- a/src/api/query.ts +++ b/src/api/query.ts @@ -4,7 +4,6 @@ import { APIRoot, PaginationResponse } from './api-models' import { apiFail } from '@/data/constants' const cookie = useLocalStorage('JWT_Token', '') -let failCount = 0 export async function QueryPostAPI( urlString: string, @@ -34,11 +33,9 @@ export async function QueryPostAPIWithParams( body: typeof body === 'string' ? body : JSON.stringify(body), }) const result = (await data.json()) as APIRoot - failCount = 0 return result } catch (e) { console.error(`[POST] API调用失败: ${e}`) - failCount++ if (!apiFail.value) { apiFail.value = true console.log('默认API异常, 切换至故障转移节点') @@ -63,11 +60,9 @@ export async function QueryGetAPI( headers: headers, }) const result = (await data.json()) as APIRoot - failCount = 0 return result } catch (e) { console.error(`[GET] API调用失败: ${e}`) - failCount++ if (!apiFail.value) { apiFail.value = true console.log('默认API异常, 切换至故障转移节点') diff --git a/src/components/SongList.vue b/src/components/SongList.vue index 9387cb4..7c74004 100644 --- a/src/components/SongList.vue +++ b/src/components/SongList.vue @@ -477,6 +477,19 @@ async function delSong(song: SongsInfo) { } }) } +async function delBatchSong() { + const ids = selectedColumn.value.map((s) => s.toString()) + await QueryPostAPI(SONG_API_URL + 'del-batch', ids).then((data) => { + if (data.code == 200) { + songsInternal.value = songsInternal.value.filter((s) => !ids.includes(s.key)) + message.success('已删除 ' + ids.length + ' 首歌曲') + showBatchModal.value = false + selectedColumn.value = [] + } else { + message.error('未能删除歌曲: ' + data.message) + } + }) +} function GetSCColor(price: number): string { if (price === 0) return `#2a60b2` if (price > 0 && price < 30) return `#2a60b2` @@ -797,6 +810,14 @@ onMounted(() => { style="max-width: 600px" > + + + + 确定删除 {{ selectedColumn.length }} 首曲目吗? + + (BASE_API + 'vtsuru/version') currentVersion = version.data localStorage.setItem('Version', currentVersion) - const n = notification.info({ - title: '发现新的版本更新', - content: '是否现在刷新?', - meta: () => h(NText, { depth: 3 }, () => currentVersion), - action: () => - h(NFlex, null, () => [ - h( - NButton, - { text: true, type: 'primary', onClick: () => location.reload(), size: 'small' }, - { default: () => '刷新' }, - ), - h(NButton, { text: true, onClick: () => n.destroy(), size: 'small' }, { default: () => '稍后' }), - ]), - }) + if (!route.path.startsWith('/obs')) { + const n = notification.info({ + title: '发现新的版本更新', + content: '是否现在刷新?', + meta: () => h(NText, { depth: 3 }, () => currentVersion), + action: () => + h(NFlex, null, () => [ + h( + NButton, + { text: true, type: 'primary', onClick: () => location.reload(), size: 'small' }, + { default: () => '刷新' }, + ), + h(NButton, { text: true, onClick: () => n.destroy(), size: 'small' }, { default: () => '稍后' }), + ]), + }) + } } }) }, 60 * 1000) diff --git a/src/views/manage/EventView.vue b/src/views/manage/EventView.vue index 71e6437..adb0c71 100644 --- a/src/views/manage/EventView.vue +++ b/src/views/manage/EventView.vue @@ -172,15 +172,17 @@ function objectsToCSV(arr: any[]) { >认证Bilibili账号 - - 当前本站正在测试为粉丝数大于 1000 或至少拥有一位舰长的主播直接从服务端记录并储存弹幕数据, - 不过并不清楚B站的风控策略, 此功能不一定会长期启用 -
- 在我们被限制连接之前满足以上条件的主播无需部署 + + 近期逸站对开放平台直播弹幕流进行了极为严格的限制, 目前本站服务器只能连接个位数的直播间, 这使得在不使用 + + VtsuruEventFetcher + + 的情况下获取弹幕数据几乎不可能实现. +
+ 在这种情况下如果你还需要记录上舰, SC等事件请跟随链接里的教程部署 VtsuruEventFetcher - 即可使用相关功能 (如记录上舰和SC, 直播场记录等) 😊