mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
add video-collect display, improve index layout
This commit is contained in:
@@ -63,6 +63,38 @@ export async function SaveAccountSettings() {
|
|||||||
export async function SaveEnableFunctions(functions: FunctionTypes[]) {
|
export async function SaveEnableFunctions(functions: FunctionTypes[]) {
|
||||||
return await QueryPostAPI(ACCOUNT_API_URL + 'update-enable-functions', functions)
|
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() {
|
export function useAccount() {
|
||||||
return ACCOUNT
|
return ACCOUNT
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,6 +234,7 @@ export enum FunctionTypes {
|
|||||||
SongRequest,
|
SongRequest,
|
||||||
Queue,
|
Queue,
|
||||||
Point,
|
Point,
|
||||||
|
VideoCollect
|
||||||
}
|
}
|
||||||
export interface SongAuthorInfo {
|
export interface SongAuthorInfo {
|
||||||
name: string
|
name: string
|
||||||
|
|||||||
@@ -19,19 +19,25 @@ import {
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
item: VideoCollectTable
|
item: VideoCollectTable
|
||||||
canClick?: boolean
|
canClick?: boolean
|
||||||
|
from: 'user' | 'owner'
|
||||||
|
bordered?: boolean
|
||||||
}>()
|
}>()
|
||||||
const renderCountdown: CountdownProps['render'] = (info: { hours: number; minutes: number; seconds: number }) => {
|
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')}秒`
|
return `${String(info.hours).padStart(2, '0')}时 ${String(info.minutes).padStart(2, '0')}分 ${String(info.seconds).padStart(2, '0')}秒`
|
||||||
}
|
}
|
||||||
function onClick() {
|
function onClick() {
|
||||||
if (props.canClick == true) {
|
if (props.canClick == true) {
|
||||||
|
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 } })
|
router.push({ name: 'manage-videoCollect-Detail', params: { id: props.item.id } })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NCard size="small" style="width: 100%; max-width: 70vw; cursor: pointer" @click="onClick" embedded hoverable>
|
<NCard size="small" style="width: 100%; max-width: 70vw; cursor: pointer" @click="onClick" embedded hoverable :bordered="bordered">
|
||||||
<template #header>
|
<template #header>
|
||||||
<NSpace :size="5">
|
<NSpace :size="5">
|
||||||
<NTag v-if="item.isFinish" size="small"> 已结束 </NTag>
|
<NTag v-if="item.isFinish" size="small"> 已结束 </NTag>
|
||||||
|
|||||||
@@ -55,4 +55,13 @@ export default [
|
|||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'video-collect',
|
||||||
|
name: 'user-video-collect',
|
||||||
|
component: () => import('@/views/view/VideoCollectView.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '视频征集',
|
||||||
|
keepAlive: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -120,8 +120,21 @@ const iconColor = 'white'
|
|||||||
</NGradientText>
|
</NGradientText>
|
||||||
<NText style="font-size: 1.5em; font-weight: 500; color: white"> 一个给主播提供便利功能的网站 😊 </NText>
|
<NText style="font-size: 1.5em; font-weight: 500; color: white"> 一个给主播提供便利功能的网站 😊 </NText>
|
||||||
<span></span>
|
<span></span>
|
||||||
<NSpace justify="center">
|
<NSpace justify="center" align="center">
|
||||||
<NButton type="primary" size="large" @click="$router.push({ name: 'manage-index' })"> 开始使用 </NButton>
|
<NSpace align="center">
|
||||||
|
<NSpace vertical justify="end">
|
||||||
|
<NText style="font-size: medium" italic> 我是主播 </NText>
|
||||||
|
<NButton type="primary" size="small" @click="$router.push({ name: 'manage-index' })">
|
||||||
|
开始使用
|
||||||
|
</NButton>
|
||||||
|
</NSpace>
|
||||||
|
<NSpace vertical>
|
||||||
|
<NText style="font-size: medium" italic> 我是观众 </NText>
|
||||||
|
<NButton type="primary" size="small" secondary @click="$router.push({ name: 'bili-user' })" bordered>
|
||||||
|
用户主页
|
||||||
|
</NButton>
|
||||||
|
</NSpace>
|
||||||
|
</NSpace>
|
||||||
<NButton size="large" @click="$router.push('/user/Megghy')"> 展示 </NButton>
|
<NButton size="large" @click="$router.push('/user/Megghy')"> 展示 </NButton>
|
||||||
<NButton
|
<NButton
|
||||||
size="large"
|
size="large"
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ onUnmounted(() => {
|
|||||||
<NText depth="3" style="font-size: 14px">{{ table.owner?.name }}</NText>
|
<NText depth="3" style="font-size: 14px">{{ table.owner?.name }}</NText>
|
||||||
</NButton>
|
</NButton>
|
||||||
</template>
|
</template>
|
||||||
<VideoCollectInfoCard :item="table" />
|
<VideoCollectInfoCard :item="table" :canClick="false" from="user" />
|
||||||
<NDivider />
|
<NDivider />
|
||||||
<NAlert v-if="table.isFinish" type="error" title="该征集表已截止" />
|
<NAlert v-if="table.isFinish" type="error" title="该征集表已截止" />
|
||||||
<NSpace v-else vertical>
|
<NSpace v-else vertical>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { useUser } from '@/api/user'
|
|||||||
import RegisterAndLogin from '@/components/RegisterAndLogin.vue'
|
import RegisterAndLogin from '@/components/RegisterAndLogin.vue'
|
||||||
import { FETCH_API } from '@/data/constants'
|
import { FETCH_API } from '@/data/constants'
|
||||||
import { useAuthStore } from '@/store/useAuthStore'
|
import { useAuthStore } from '@/store/useAuthStore'
|
||||||
import { BookCoins20Filled, CalendarClock24Filled } from '@vicons/fluent'
|
import { BookCoins20Filled, CalendarClock24Filled, VideoAdd20Filled } from '@vicons/fluent'
|
||||||
import { Chatbox, Home, Moon, MusicalNote, Sunny } from '@vicons/ionicons5'
|
import { Chatbox, Home, Moon, MusicalNote, Sunny } from '@vicons/ionicons5'
|
||||||
import { useElementSize, useStorage } from '@vueuse/core'
|
import { useElementSize, useStorage } from '@vueuse/core'
|
||||||
import {
|
import {
|
||||||
@@ -145,6 +145,21 @@ onMounted(async () => {
|
|||||||
key: 'user-questionBox',
|
key: 'user-questionBox',
|
||||||
icon: renderIcon(Chatbox),
|
icon: renderIcon(Chatbox),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: () =>
|
||||||
|
h(
|
||||||
|
RouterLink,
|
||||||
|
{
|
||||||
|
to: {
|
||||||
|
name: 'user-video-collect',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '视频征集' },
|
||||||
|
),
|
||||||
|
show: (userInfo.value?.extra?.enableFunctions.indexOf(FunctionTypes.VideoCollect) ?? -1) > -1,
|
||||||
|
key: 'user-video-collect',
|
||||||
|
icon: renderIcon(VideoAdd20Filled),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: () =>
|
label: () =>
|
||||||
h(
|
h(
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ onActivated(async () => {
|
|||||||
</NPopconfirm>
|
</NPopconfirm>
|
||||||
</template>
|
</template>
|
||||||
</NSpace>
|
</NSpace>
|
||||||
<VideoCollectInfoCard :item="videoDetail.table" style="width: 100%; max-width: 90vw">
|
<VideoCollectInfoCard :item="videoDetail.table" style="width: 100%; max-width: 90vw" from="owner">
|
||||||
<template v-if="width > 1000" #header-extra>
|
<template v-if="width > 1000" #header-extra>
|
||||||
<NSpace>
|
<NSpace>
|
||||||
<NButton type="success" size="small" @click="shareModalVisiable = true"> 分享 </NButton>
|
<NButton type="success" size="small" @click="shareModalVisiable = true"> 分享 </NButton>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useAccount } from '@/api/account'
|
import { UpdateFunctionEnable, useAccount } from '@/api/account'
|
||||||
import { VideoCollectTable } from '@/api/api-models'
|
import { FunctionTypes, VideoCollectTable } from '@/api/api-models'
|
||||||
import { QueryGetAPI, QueryPostAPI } from '@/api/query'
|
import { QueryGetAPI, QueryPostAPI } from '@/api/query'
|
||||||
import VideoCollectInfoCard from '@/components/VideoCollectInfoCard.vue'
|
import VideoCollectInfoCard from '@/components/VideoCollectInfoCard.vue'
|
||||||
import { VIDEO_COLLECT_API_URL } from '@/data/constants'
|
import { VIDEO_COLLECT_API_URL } from '@/data/constants'
|
||||||
import {
|
import {
|
||||||
FormRules,
|
FormRules,
|
||||||
|
NAlert,
|
||||||
NButton,
|
NButton,
|
||||||
NDatePicker,
|
NDatePicker,
|
||||||
NDivider,
|
NDivider,
|
||||||
@@ -19,6 +20,7 @@ import {
|
|||||||
NModal,
|
NModal,
|
||||||
NSpace,
|
NSpace,
|
||||||
NSpin,
|
NSpin,
|
||||||
|
NSwitch,
|
||||||
NText,
|
NText,
|
||||||
useMessage,
|
useMessage,
|
||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
@@ -125,6 +127,14 @@ function createTable() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<NAlert type="info" v-if="accountInfo.id">
|
||||||
|
在个人主页展示进行中的征集表
|
||||||
|
<NSwitch
|
||||||
|
:value="accountInfo.settings.enableFunctions.includes(FunctionTypes.VideoCollect)"
|
||||||
|
@update:value="UpdateFunctionEnable(FunctionTypes.VideoCollect)"
|
||||||
|
/>
|
||||||
|
</NAlert>
|
||||||
|
<NDivider />
|
||||||
<NSpace>
|
<NSpace>
|
||||||
<NButton @click="createModalVisible = true" type="primary"> 新建征集表 </NButton>
|
<NButton @click="createModalVisible = true" type="primary"> 新建征集表 </NButton>
|
||||||
</NSpace>
|
</NSpace>
|
||||||
@@ -132,9 +142,9 @@ function createTable() {
|
|||||||
<NSpin :show="isLoading">
|
<NSpin :show="isLoading">
|
||||||
<NSpace justify="center">
|
<NSpace justify="center">
|
||||||
<NEmpty v-if="videoTables.length == 0" />
|
<NEmpty v-if="videoTables.length == 0" />
|
||||||
<NList v-else>
|
<NList v-else bordered>
|
||||||
<NListItem v-for="item in videoTables" :key="item.id">
|
<NListItem v-for="item in videoTables" :key="item.id" style="padding: 0">
|
||||||
<VideoCollectInfoCard :item="item" canClick style="width: 500px; max-width: 70vw" />
|
<VideoCollectInfoCard :item="item" canClick style="width: 500px; max-width: 70vw" from="owner" />
|
||||||
</NListItem>
|
</NListItem>
|
||||||
</NList>
|
</NList>
|
||||||
</NSpace>
|
</NSpace>
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ const filterSongNameContains = ref(false)
|
|||||||
const filterName = ref('')
|
const filterName = ref('')
|
||||||
const filterNameContains = ref(false)
|
const filterNameContains = ref(false)
|
||||||
|
|
||||||
const defaultPrefix = useStorage('Settings.SongRequest.DefaultPrefix', '点歌')
|
const defaultPrefix = useStorage('Settings.SongRequest.DefaultPrefix', '点播')
|
||||||
const configCanEdit = computed(() => {
|
const configCanEdit = computed(() => {
|
||||||
return accountInfo.value != null && accountInfo.value != undefined
|
return accountInfo.value != null && accountInfo.value != undefined
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,15 +1,53 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { UserInfo } from '@/api/api-models'
|
import { UserInfo, VideoCollectTable } from '@/api/api-models'
|
||||||
|
import { QueryGetAPI } from '@/api/query'
|
||||||
|
import VideoCollectInfoCard from '@/components/VideoCollectInfoCard.vue'
|
||||||
|
import { VIDEO_COLLECT_API_URL } from '@/data/constants'
|
||||||
|
import { NEmpty, NFlex, NList, NListItem, NSpin, useMessage } from 'naive-ui'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
biliInfo: any | undefined
|
biliInfo: any | undefined
|
||||||
userInfo: UserInfo | undefined
|
userInfo: UserInfo
|
||||||
template?: string | undefined
|
template?: string | undefined
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const isLoading = ref(true)
|
||||||
|
const message = useMessage()
|
||||||
|
|
||||||
|
const videoTables = ref<VideoCollectTable[]>(await get())
|
||||||
|
async function get() {
|
||||||
|
try {
|
||||||
|
isLoading.value = true
|
||||||
|
const data = await QueryGetAPI<VideoCollectTable[]>(VIDEO_COLLECT_API_URL + 'get-active', {
|
||||||
|
id: props.userInfo.id,
|
||||||
|
})
|
||||||
|
if (data.code == 200) {
|
||||||
|
//videoTables.value = data.data
|
||||||
|
return data.data
|
||||||
|
} else {
|
||||||
|
message.error('获取失败: ' + data.message)
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
message.error('获取失败')
|
||||||
|
return []
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
1
|
<NSpin :show="isLoading">
|
||||||
|
<NFlex justify="center">
|
||||||
|
<NEmpty v-if="videoTables.length == 0" description="没有正在进行的征集表" />
|
||||||
|
<NList v-else>
|
||||||
|
<NListItem v-for="item in videoTables" :key="item.id">
|
||||||
|
<VideoCollectInfoCard :item="item" canClick style="width: 500px; max-width: 70vw" from="user" />
|
||||||
|
</NListItem>
|
||||||
|
</NList>
|
||||||
|
</NFlex>
|
||||||
|
</NSpin>
|
||||||
</template>
|
</template>
|
||||||
Reference in New Issue
Block a user