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,
|
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) {
|
export function downloadConfigDirect(name: string) {
|
||||||
return QueryGetAPI<string>(VTSURU_API_URL + 'get-config', {
|
return QueryGetAPI<string>(VTSURU_API_URL + 'get-config', {
|
||||||
name: name,
|
name: name,
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export interface AccountInfo extends UserInfo {
|
|||||||
|
|
||||||
nextSendEmailTime?: number
|
nextSendEmailTime?: number
|
||||||
isServerFetcherOnline: boolean
|
isServerFetcherOnline: boolean
|
||||||
blackList: number[]
|
blackList: UserBasicInfo[]
|
||||||
biliBlackList: { [key: number]: string }
|
biliBlackList: { [key: number]: string }
|
||||||
streamerInfo?: StreamerModel
|
streamerInfo?: StreamerModel
|
||||||
biliUserAuthInfo?: BiliAuthModel
|
biliUserAuthInfo?: BiliAuthModel
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import {
|
||||||
DelBiliBlackList,
|
DelBiliBlackList,
|
||||||
|
DelBlackList,
|
||||||
SaveAccountSettings,
|
SaveAccountSettings,
|
||||||
SaveEnableFunctions,
|
SaveEnableFunctions,
|
||||||
downloadConfigDirect,
|
downloadConfigDirect,
|
||||||
@@ -461,7 +462,7 @@ const buttonGroup = computed(() => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
function unblockUser(id: number) {
|
function unblockBiliUser(id: number) {
|
||||||
DelBiliBlackList(id)
|
DelBiliBlackList(id)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
@@ -477,6 +478,22 @@ function unblockUser(id: number) {
|
|||||||
message.error(err)
|
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() {
|
async function getIndexInfo() {
|
||||||
try {
|
try {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
@@ -608,7 +625,20 @@ onMounted(async () => {
|
|||||||
<NText depth="3">
|
<NText depth="3">
|
||||||
{{ item[0] }}
|
{{ item[0] }}
|
||||||
</NText>
|
</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>
|
</NSpace>
|
||||||
</NListItem>
|
</NListItem>
|
||||||
</NList>
|
</NList>
|
||||||
|
|||||||
Reference in New Issue
Block a user