mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
fix blacklist display
This commit is contained in:
@@ -140,6 +140,11 @@ export async function DelBiliBlackList(id: number): Promise<APIRoot<unknown>> {
|
||||
id: id,
|
||||
})
|
||||
}
|
||||
export async function DelBlackList(id: number): Promise<APIRoot<unknown>> {
|
||||
return QueryGetAPI<AccountInfo>(`${ACCOUNT_API_URL}black-list/del`, {
|
||||
id: id,
|
||||
})
|
||||
}
|
||||
export function downloadConfigDirect(name: string) {
|
||||
return QueryGetAPI<string>(VTSURU_API_URL + 'get-config', {
|
||||
name: name,
|
||||
|
||||
@@ -67,7 +67,7 @@ export interface AccountInfo extends UserInfo {
|
||||
|
||||
nextSendEmailTime?: number
|
||||
isServerFetcherOnline: boolean
|
||||
blackList: number[]
|
||||
blackList: UserBasicInfo[]
|
||||
biliBlackList: { [key: number]: string }
|
||||
streamerInfo?: StreamerModel
|
||||
biliUserAuthInfo?: BiliAuthModel
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
DelBiliBlackList,
|
||||
DelBlackList,
|
||||
SaveAccountSettings,
|
||||
SaveEnableFunctions,
|
||||
downloadConfigDirect,
|
||||
@@ -461,7 +462,7 @@ const buttonGroup = computed(() => {
|
||||
])
|
||||
})
|
||||
|
||||
function unblockUser(id: number) {
|
||||
function unblockBiliUser(id: number) {
|
||||
DelBiliBlackList(id)
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
@@ -477,6 +478,22 @@ function unblockUser(id: number) {
|
||||
message.error(err)
|
||||
})
|
||||
}
|
||||
function unblockUser(id: number) {
|
||||
DelBlackList(id)
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success(`[${id}] 已移除黑名单`)
|
||||
if (accountInfo.value) {
|
||||
accountInfo.value.blackList = accountInfo.value.blackList.filter((u) => u.id != id)
|
||||
}
|
||||
} else {
|
||||
message.error(data.message)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
message.error(err)
|
||||
})
|
||||
}
|
||||
async function getIndexInfo() {
|
||||
try {
|
||||
isLoading.value = true
|
||||
@@ -608,7 +625,20 @@ onMounted(async () => {
|
||||
<NText depth="3">
|
||||
{{ item[0] }}
|
||||
</NText>
|
||||
<NButton type="error" @click="unblockUser(Number(item[0]))" size="small"> 移除 </NButton>
|
||||
<NButton type="error" @click="unblockBiliUser(Number(item[0]))" size="small"> 移除 </NButton>
|
||||
</NSpace>
|
||||
</NListItem>
|
||||
</NList>
|
||||
<NList v-if="accountInfo.blackList && accountInfo.blackList.length > 0">
|
||||
<NListItem v-for="item in accountInfo.blackList" :key="item.id">
|
||||
<NSpace align="center">
|
||||
<NText>
|
||||
{{ item.name }}
|
||||
</NText>
|
||||
<NText depth="3">
|
||||
{{ item.id }}
|
||||
</NText>
|
||||
<NButton type="error" @click="unblockUser(Number(item.id))" size="small"> 移除 </NButton>
|
||||
</NSpace>
|
||||
</NListItem>
|
||||
</NList>
|
||||
|
||||
Reference in New Issue
Block a user