mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
optimize layout
This commit is contained in:
@@ -7,15 +7,15 @@
|
|||||||
<NLoadingBarProvider>
|
<NLoadingBarProvider>
|
||||||
<Suspense>
|
<Suspense>
|
||||||
<TempComponent>
|
<TempComponent>
|
||||||
<NElement>
|
<NLayoutContent>
|
||||||
<ViewerLayout v-if="layout == 'viewer'" />
|
<ViewerLayout v-if="layout == 'viewer'" />
|
||||||
<ManageLayout v-else-if="layout == 'manage'" />
|
<ManageLayout v-else-if="layout == 'manage'" />
|
||||||
<OpenLiveLayout v-else-if="layout == 'open-live'" />
|
<OpenLiveLayout v-else-if="layout == 'open-live'" />
|
||||||
<OBSLayout v-else-if="layout == 'obs'" />
|
<OBSLayout v-else-if="layout == 'obs'" />
|
||||||
<template v-else-if="layout == ''">
|
<template v-else>
|
||||||
<RouterView />
|
<RouterView />
|
||||||
</template>
|
</template>
|
||||||
</NElement>
|
</NLayoutContent>
|
||||||
</TempComponent>
|
</TempComponent>
|
||||||
<template #fallback>
|
<template #fallback>
|
||||||
<NSpin size="large" show />
|
<NSpin size="large" show />
|
||||||
|
|||||||
@@ -16,15 +16,13 @@ export const IMGUR_URL = FILE_BASE_URL + '/imgur/'
|
|||||||
export const THINGS_URL = FILE_BASE_URL + '/things/'
|
export const THINGS_URL = FILE_BASE_URL + '/things/'
|
||||||
export const apiFail = ref(false)
|
export const apiFail = ref(false)
|
||||||
|
|
||||||
export const BASE_URL = {
|
export const BASE_URL =
|
||||||
toString: () =>
|
process.env.NODE_ENV === 'development'
|
||||||
process.env.NODE_ENV === 'development'
|
? debugAPI
|
||||||
? debugAPI
|
: apiFail.value
|
||||||
: apiFail.value
|
? failoverAPI
|
||||||
? failoverAPI
|
: releseAPI
|
||||||
: releseAPI
|
export const BASE_API_URL = BASE_URL + 'api/'
|
||||||
}
|
|
||||||
export const BASE_API_URL = BASE_URL.toString() + 'api/'
|
|
||||||
export const FETCH_API = 'https://fetch.vtsuru.live/'
|
export const FETCH_API = 'https://fetch.vtsuru.live/'
|
||||||
export const BASE_HUB_URL =
|
export const BASE_HUB_URL =
|
||||||
(process.env.NODE_ENV === 'development'
|
(process.env.NODE_ENV === 'development'
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ QueryGetAPI<string>(BASE_API_URL + 'vtsuru/version')
|
|||||||
}
|
}
|
||||||
HyperDX.setGlobalAttributes({
|
HyperDX.setGlobalAttributes({
|
||||||
userId: account.value.id.toString(),
|
userId: account.value.id.toString(),
|
||||||
userName: account.value.name
|
userName: account.value.name,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
useAuth.getAuthInfo()
|
useAuth.getAuthInfo()
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export const useNotificationStore = defineStore('notification', () => {
|
|||||||
const isInited = ref(false)
|
const isInited = ref(false)
|
||||||
|
|
||||||
async function updateUnread() {
|
async function updateUnread() {
|
||||||
|
return // 暂时没写这部分相关逻辑
|
||||||
try {
|
try {
|
||||||
const result = await QueryGetAPI<NotificationData[]>(
|
const result = await QueryGetAPI<NotificationData[]>(
|
||||||
NOTIFACTION_API_URL + 'get-unread'
|
NOTIFACTION_API_URL + 'get-unread'
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import {
|
|||||||
NButton,
|
NButton,
|
||||||
NCountdown,
|
NCountdown,
|
||||||
NDivider,
|
NDivider,
|
||||||
|
NElement,
|
||||||
NFlex,
|
NFlex,
|
||||||
NIcon,
|
NIcon,
|
||||||
NLayout,
|
NLayout,
|
||||||
@@ -483,7 +484,7 @@ onMounted(() => {
|
|||||||
<template #extra>
|
<template #extra>
|
||||||
<NSpace align="center" justify="center">
|
<NSpace align="center" justify="center">
|
||||||
<NSwitch :default-value="!isDarkMode" @update:value="(value: string & number & boolean) => (themeType = value ? ThemeType.Light : ThemeType.Dark)
|
<NSwitch :default-value="!isDarkMode" @update:value="(value: string & number & boolean) => (themeType = value ? ThemeType.Light : ThemeType.Dark)
|
||||||
">
|
">
|
||||||
<template #checked>
|
<template #checked>
|
||||||
<NIcon :component="Sunny" />
|
<NIcon :component="Sunny" />
|
||||||
</template>
|
</template>
|
||||||
@@ -550,39 +551,40 @@ onMounted(() => {
|
|||||||
</NLayoutSider>
|
</NLayoutSider>
|
||||||
<NLayout>
|
<NLayout>
|
||||||
<NScrollbar :style="`height: calc(100vh - 50px - ${aplayerHeight}px)`">
|
<NScrollbar :style="`height: calc(100vh - 50px - ${aplayerHeight}px)`">
|
||||||
<NLayoutContent
|
<NLayoutContent content-style="margin: 12px">
|
||||||
:style="`box-sizing: border-box; padding: 20px; min-width: 300px; height: calc(100vh - 50px - ${aplayerHeight}px);`">
|
<NElement>
|
||||||
<RouterView v-if="accountInfo?.isEmailVerified" v-slot="{ Component, route }">
|
<RouterView v-if="accountInfo?.isEmailVerified" v-slot="{ Component, route }">
|
||||||
<KeepAlive>
|
<KeepAlive>
|
||||||
<Suspense>
|
<Suspense>
|
||||||
<component :is="Component" />
|
<component :is="Component" />
|
||||||
<template #fallback>
|
<template #fallback>
|
||||||
<NSpin show />
|
<NSpin show />
|
||||||
</template>
|
|
||||||
</Suspense>
|
|
||||||
</KeepAlive>
|
|
||||||
</RouterView>
|
|
||||||
<template v-else>
|
|
||||||
<NAlert type="info">
|
|
||||||
请进行邮箱验证
|
|
||||||
<br /><br />
|
|
||||||
<NSpace>
|
|
||||||
<NButton size="small" type="info" :disabled="!canResendEmail" @click="resendEmail">
|
|
||||||
重新发送验证邮件
|
|
||||||
</NButton>
|
|
||||||
<NCountdown v-if="!canResendEmail" :duration="(accountInfo?.nextSendEmailTime ?? 0) - Date.now()"
|
|
||||||
@finish="canResendEmail = true" />
|
|
||||||
|
|
||||||
<NPopconfirm @positive-click="logout" size="small">
|
|
||||||
<template #trigger>
|
|
||||||
<NButton type="error"> 登出 </NButton>
|
|
||||||
</template>
|
</template>
|
||||||
确定登出?
|
</Suspense>
|
||||||
</NPopconfirm>
|
</KeepAlive>
|
||||||
</NSpace>
|
</RouterView>
|
||||||
</NAlert>
|
<template v-else>
|
||||||
</template>
|
<NAlert type="info">
|
||||||
<NBackTop />
|
请进行邮箱验证
|
||||||
|
<br /><br />
|
||||||
|
<NSpace>
|
||||||
|
<NButton size="small" type="info" :disabled="!canResendEmail" @click="resendEmail">
|
||||||
|
重新发送验证邮件
|
||||||
|
</NButton>
|
||||||
|
<NCountdown v-if="!canResendEmail" :duration="(accountInfo?.nextSendEmailTime ?? 0) - Date.now()"
|
||||||
|
@finish="canResendEmail = true" />
|
||||||
|
|
||||||
|
<NPopconfirm @positive-click="logout" size="small">
|
||||||
|
<template #trigger>
|
||||||
|
<NButton type="error"> 登出 </NButton>
|
||||||
|
</template>
|
||||||
|
确定登出?
|
||||||
|
</NPopconfirm>
|
||||||
|
</NSpace>
|
||||||
|
</NAlert>
|
||||||
|
</template>
|
||||||
|
<NBackTop />
|
||||||
|
</NElement>
|
||||||
</NLayoutContent>
|
</NLayoutContent>
|
||||||
</NScrollbar>
|
</NScrollbar>
|
||||||
<NLayoutFooter :style="`height: ${aplayerHeight}px;overflow: auto`">
|
<NLayoutFooter :style="`height: ${aplayerHeight}px;overflow: auto`">
|
||||||
|
|||||||
@@ -273,10 +273,10 @@ onMounted(async () => {
|
|||||||
style="height: 100%"
|
style="height: 100%"
|
||||||
>
|
>
|
||||||
<Transition>
|
<Transition>
|
||||||
<div v-if="biliUserInfo" style="margin-top: 8px">
|
<div v-if="accountInfo.streamerInfo" style="margin-top: 8px">
|
||||||
<NSpace vertical justify="center" align="center">
|
<NSpace vertical justify="center" align="center">
|
||||||
<NAvatar
|
<NAvatar
|
||||||
:src="biliUserInfo.face"
|
:src="accountInfo.streamerInfo.faceUrl"
|
||||||
:img-props="{ referrerpolicy: 'no-referrer' }"
|
:img-props="{ referrerpolicy: 'no-referrer' }"
|
||||||
round
|
round
|
||||||
bordered
|
bordered
|
||||||
@@ -286,7 +286,7 @@ onMounted(async () => {
|
|||||||
/>
|
/>
|
||||||
<NEllipsis v-if="width > 100" style="max-width: 100%">
|
<NEllipsis v-if="width > 100" style="max-width: 100%">
|
||||||
<NText strong>
|
<NText strong>
|
||||||
{{ biliUserInfo.name }}
|
{{ accountInfo.streamerInfo.name }}
|
||||||
</NText>
|
</NText>
|
||||||
</NEllipsis>
|
</NEllipsis>
|
||||||
</NSpace>
|
</NSpace>
|
||||||
|
|||||||
6
src/views/client/ClientLayout.vue
Normal file
6
src/views/client/ClientLayout.vue
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
1
|
||||||
|
</template>
|
||||||
@@ -284,7 +284,7 @@ onMounted(() => {
|
|||||||
<QuestionItems :questions="pagedQuestions">
|
<QuestionItems :questions="pagedQuestions">
|
||||||
<template #footer="{ item }">
|
<template #footer="{ item }">
|
||||||
<NSpace>
|
<NSpace>
|
||||||
<NButton v-if="!item.isReaded" size="small" @click="useQB.read(item, true)" type="success">
|
<NButton v-if="!item.isReaded" size="small" @click="useQB.read(item, true)" type="info">
|
||||||
设为已读
|
设为已读
|
||||||
</NButton>
|
</NButton>
|
||||||
<NButton v-else size="small" @click="useQB.read(item, false)" type="warning">重设为未读</NButton>
|
<NButton v-else size="small" @click="useQB.read(item, false)" type="warning">重设为未读</NButton>
|
||||||
|
|||||||
@@ -80,11 +80,11 @@ async function getSongs() {
|
|||||||
currentData.value = data.data
|
currentData.value = data.data
|
||||||
} else {
|
} else {
|
||||||
errMessage.value = data.message
|
errMessage.value = data.message
|
||||||
message.error('加载失败: ' + data.message)
|
message.error('加载歌单失败: ' + data.message)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
message.error('加载失败')
|
message.error('加载失败: ' + err)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
@@ -102,7 +102,7 @@ async function getConfig() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
message.error('加载失败')
|
message.error('加载失败: ' + err)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
@@ -154,9 +154,11 @@ onMounted(async () => {
|
|||||||
songsActive.value = r.songs
|
songsActive.value = r.songs
|
||||||
settings.value = r.setting
|
settings.value = r.setting
|
||||||
}
|
}
|
||||||
}, 1000)
|
await getConfig()
|
||||||
|
}, 300)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
message.error('加载失败')
|
message.error('加载失败: ' + err)
|
||||||
|
console.error(err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currentData.value = props.fakeData
|
currentData.value = props.fakeData
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Setting_LiveRequest, SongRequestInfo, SongsInfo, UserInfo } from '@/api/api-models';
|
import { SongListConfigTypeWithConfig } from '@/data/TemplateTypes';
|
||||||
import { SongListConfigType, SongListConfigTypeWithConfig } from '@/data/TemplateTypes';
|
|
||||||
import { TemplateConfig } from '@/data/VTsuruTypes';
|
import { TemplateConfig } from '@/data/VTsuruTypes';
|
||||||
import { FILE_BASE_URL } from '@/data/constants';
|
import { FILE_BASE_URL } from '@/data/constants';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user