diff --git a/src/api/account.ts b/src/api/account.ts index 8ab864f..3b31c4e 100644 --- a/src/api/account.ts +++ b/src/api/account.ts @@ -63,6 +63,38 @@ export async function SaveAccountSettings() { export async function SaveEnableFunctions(functions: FunctionTypes[]) { return await QueryPostAPI(ACCOUNT_API_URL + 'update-enable-functions', functions) } +export async function UpdateFunctionEnable(func: FunctionTypes) { + if (ACCOUNT.value) { + const oldValue = JSON.parse(JSON.stringify(ACCOUNT.value.settings.enableFunctions)) + if (ACCOUNT.value?.settings.enableFunctions.includes(func)) { + ACCOUNT.value.settings.enableFunctions = ACCOUNT.value.settings.enableFunctions.filter( + (f) => f != func, + ) + } else { + ACCOUNT.value.settings.enableFunctions.push(func) + } + await SaveEnableFunctions(ACCOUNT.value?.settings.enableFunctions) + .then((data) => { + if (data.code == 200) { + message.success( + `已${ACCOUNT.value?.settings.enableFunctions.includes(func) ? '启用' : '禁用'}`, + ) + } else { + if (ACCOUNT.value) { + ACCOUNT.value.settings.enableFunctions = oldValue + } + message.error( + `${ACCOUNT.value?.settings.enableFunctions.includes(func) ? '启用' : '禁用'}失败: ${data.message}`, + ) + } + }) + .catch((err) => { + message.error( + `${ACCOUNT.value?.settings.enableFunctions.includes(func) ? '启用' : '禁用'}失败: ${err}`, + ) + }) + } +} export function useAccount() { return ACCOUNT } diff --git a/src/api/api-models.ts b/src/api/api-models.ts index ede1c39..4677d9b 100644 --- a/src/api/api-models.ts +++ b/src/api/api-models.ts @@ -234,6 +234,7 @@ export enum FunctionTypes { SongRequest, Queue, Point, + VideoCollect } export interface SongAuthorInfo { name: string diff --git a/src/components/VideoCollectInfoCard.vue b/src/components/VideoCollectInfoCard.vue index df22656..b5f0b9d 100644 --- a/src/components/VideoCollectInfoCard.vue +++ b/src/components/VideoCollectInfoCard.vue @@ -19,19 +19,25 @@ import { const props = defineProps<{ item: VideoCollectTable canClick?: boolean + from: 'user' | 'owner' + bordered?: boolean }>() const renderCountdown: CountdownProps['render'] = (info: { hours: number; minutes: number; seconds: number }) => { return `${String(info.hours).padStart(2, '0')}时 ${String(info.minutes).padStart(2, '0')}分 ${String(info.seconds).padStart(2, '0')}秒` } function onClick() { if (props.canClick == true) { - router.push({ name: 'manage-videoCollect-Detail', params: { id: props.item.id } }) + if (props.from == 'user') { + window.open('https://vtsuru.live/video-collect/' + props.item.shortId, '_blank') + } else { + router.push({ name: 'manage-videoCollect-Detail', params: { id: props.item.id } }) + } } } - +