add batch del song

This commit is contained in:
2024-03-02 19:20:38 +08:00
parent 8152522659
commit 01ef6c09e5
4 changed files with 48 additions and 25 deletions

View File

@@ -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<T>(
urlString: string,
@@ -34,11 +33,9 @@ export async function QueryPostAPIWithParams<T>(
body: typeof body === 'string' ? body : JSON.stringify(body),
})
const result = (await data.json()) as APIRoot<T>
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<T>(
headers: headers,
})
const result = (await data.json()) as APIRoot<T>
failCount = 0
return result
} catch (e) {
console.error(`[GET] API调用失败: ${e}`)
failCount++
if (!apiFail.value) {
apiFail.value = true
console.log('默认API异常, 切换至故障转移节点')

View File

@@ -477,6 +477,19 @@ async function delSong(song: SongsInfo) {
}
})
}
async function delBatchSong() {
const ids = selectedColumn.value.map((s) => s.toString())
await QueryPostAPI<SongsInfo>(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"
>
<NTabs>
<NTabPane name="delete" tab="删除">
<NPopconfirm @positive-click="delBatchSong">
<template #trigger>
<NButton type="error"> 批量删除 </NButton>
</template>
<span> 确定删除 {{ selectedColumn.length }} 首曲目吗 </span>
</NPopconfirm>
</NTabPane>
<NTabPane name="author" tab="作者">
<NSelect
v-model:value="batchUpdate_Author"

View File

@@ -9,12 +9,15 @@ import { GetSelfAccount, UpdateAccountLoop } from './api/account'
import { GetNotifactions } from './data/notifactions'
import router from './router'
import { useAuthStore } from './store/useAuthStore'
import { useRoute } from 'vue-router'
const pinia = createPinia()
const app = createApp(App)
app.use(router).use(pinia).mount('#app')
const route = useRoute()
let currentVersion: string
let isHaveNewVersion = false
@@ -48,20 +51,22 @@ QueryGetAPI<string>(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)

View File

@@ -172,15 +172,17 @@ function objectsToCSV(arr: any[]) {
>认证Bilibili账号</NButton
>
</NAlert>
<NAlert type="info">
当前本站正在测试为粉丝数大于 1000 或至少拥有一位舰长的主播直接从服务端记录并储存弹幕数据,
不过并不清楚B站的风控策略, 此功能不一定会长期启用
<br />
在我们被限制连接之前满足以上条件的主播无需部署
<NAlert type="error" title="2024.2.26">
近期逸站对开放平台直播弹幕流进行了极为严格的限制, 目前本站服务器只能连接个位数的直播间, 这使得在不使用
<NButton tag="a" href="https://www.yuque.com/megghy/dez70g/vfvcyv3024xvaa1p" target="_blank" type="primary" text>
VtsuruEventFetcher
</NButton>
的情况下获取弹幕数据几乎不可能实现.
<br />
在这种情况下如果你还需要记录上舰, SC等事件请跟随链接里的教程部署
<NButton tag="a" href="https://www.yuque.com/megghy/dez70g/vfvcyv3024xvaa1p" target="_blank" type="primary" text>
VtsuruEventFetcher
</NButton>
即可使用相关功能 (如记录上舰和SC, 直播场记录等) 😊
</NAlert>
<EventFetcherStatusCard />
</NSpace>