mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
fix route tab select
This commit is contained in:
@@ -49,6 +49,7 @@ import {
|
|||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
import { computed, h, onMounted, ref, watch } from 'vue'
|
import { computed, h, onMounted, ref, watch } from 'vue'
|
||||||
import { RouterLink, useRoute } from 'vue-router'
|
import { RouterLink, useRoute } from 'vue-router'
|
||||||
|
// @ts-ignore
|
||||||
import APlayer from 'vue3-aplayer'
|
import APlayer from 'vue3-aplayer'
|
||||||
import DanmakuLayout from './manage/DanmakuLayout.vue'
|
import DanmakuLayout from './manage/DanmakuLayout.vue'
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NFlex justify="center" align="center" vertical>
|
<NFlex justify="center" align="center" vertical>
|
||||||
<NTabs type="segment" animated v-if="accountInfo" style="width: 100%;">
|
<NTabs type="segment" animated v-if="accountInfo" style="width: 100%;" :default-value="$route.query.tab?.toString() ?? 'info'">
|
||||||
<NTabPane name="info" tab="个人信息" style="width: 100%;" display-directive="show:lazy">
|
<NTabPane name="info" tab="个人信息" style="width: 100%;" display-directive="show:lazy">
|
||||||
<NFlex justify="center" align="center">
|
<NFlex justify="center" align="center">
|
||||||
<NCard embedded style="width: 100%;max-width: 800px;">
|
<NCard embedded style="width: 100%;max-width: 800px;">
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ const templateOptions = [
|
|||||||
},
|
},
|
||||||
] as SelectOption[]
|
] as SelectOption[]
|
||||||
const selectedOption = ref(route.query.template?.toString() ?? 'index')
|
const selectedOption = ref(route.query.template?.toString() ?? 'index')
|
||||||
const selectedTab = ref(route.query.tab?.toString() ?? 'general')
|
const selectedTab = ref(route.query.setting?.toString() ?? 'general')
|
||||||
|
|
||||||
const dynamicConfigRef = ref()
|
const dynamicConfigRef = ref()
|
||||||
const selectedTemplateData = computed(() => templates.value[selectedOption.value])
|
const selectedTemplateData = computed(() => templates.value[selectedOption.value])
|
||||||
@@ -513,7 +513,7 @@ async function getIndexInfo() {
|
|||||||
|
|
||||||
onActivated(() => {
|
onActivated(() => {
|
||||||
if (route.query.tab) {
|
if (route.query.tab) {
|
||||||
selectedTab.value = route.query.tab.toString()
|
selectedTab.value = route.query.setting?.toString() ?? 'general'
|
||||||
}
|
}
|
||||||
if (route.query.template) {
|
if (route.query.template) {
|
||||||
selectedOption.value = route.query.template.toString()
|
selectedOption.value = route.query.template.toString()
|
||||||
@@ -522,17 +522,14 @@ onActivated(() => {
|
|||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await RequestBiliUserData()
|
await RequestBiliUserData()
|
||||||
indexDisplayInfo.value = await getIndexInfo()
|
indexDisplayInfo.value = await getIndexInfo()
|
||||||
if (route.query.tab) {
|
|
||||||
message.info('已切换到指定面板, 在页面下方')
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NCard title="设置" :style="`${selectedTab === 'general' ? '' : 'min-height: 800px;'}`">
|
<NCard title="设置" :style="`${selectedTab === 'general' ? '' : 'min-height: 800px;'}`">
|
||||||
<NSpin :show="isSaving">
|
<NSpin :show="isSaving">
|
||||||
<NTabs v-model:value="selectedTab">
|
<NTabs v-model:value="selectedTab" :default-value="$route.query.setting?.toString() ?? 'general'">
|
||||||
<NTabPane tab="常规" name="general">
|
<NTabPane tab="常规" name="general" display-directive="show:lazy">
|
||||||
<NDivider style="margin: 0"> 启用功能 </NDivider>
|
<NDivider style="margin: 0"> 启用功能 </NDivider>
|
||||||
<NCheckboxGroup v-model:value="accountInfo.settings.enableFunctions" @update:value="SaveComboGroupSetting">
|
<NCheckboxGroup v-model:value="accountInfo.settings.enableFunctions" @update:value="SaveComboGroupSetting">
|
||||||
<NCheckbox :value="FunctionTypes.SongList"> 歌单 </NCheckbox>
|
<NCheckbox :value="FunctionTypes.SongList"> 歌单 </NCheckbox>
|
||||||
@@ -559,7 +556,7 @@ onMounted(async () => {
|
|||||||
</NCheckbox>
|
</NCheckbox>
|
||||||
</NSpace>
|
</NSpace>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<NTabPane tab="主页" name="index">
|
<NTabPane tab="主页" name="index" display-directive="show:lazy">
|
||||||
<NDivider> 通知 </NDivider>
|
<NDivider> 通知 </NDivider>
|
||||||
<NInput v-model:value="accountInfo.settings.index.notification" type="textarea" />
|
<NInput v-model:value="accountInfo.settings.index.notification" type="textarea" />
|
||||||
<br /><br />
|
<br /><br />
|
||||||
@@ -610,7 +607,7 @@ onMounted(async () => {
|
|||||||
</NFlex>
|
</NFlex>
|
||||||
</NModal>
|
</NModal>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<NTabPane tab="黑名单" name="blacklist">
|
<NTabPane tab="黑名单" name="blacklist" display-directive="show:lazy">
|
||||||
<NList v-if="accountInfo.biliBlackList && Object.keys(accountInfo.biliBlackList).length > 0">
|
<NList v-if="accountInfo.biliBlackList && Object.keys(accountInfo.biliBlackList).length > 0">
|
||||||
<NListItem v-for="item in Object.entries(accountInfo.biliBlackList)" :key="item[0]">
|
<NListItem v-for="item in Object.entries(accountInfo.biliBlackList)" :key="item[0]">
|
||||||
<NSpace align="center">
|
<NSpace align="center">
|
||||||
@@ -639,7 +636,7 @@ onMounted(async () => {
|
|||||||
</NList>
|
</NList>
|
||||||
<NEmpty v-else />
|
<NEmpty v-else />
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<NTabPane tab="模板" name="template">
|
<NTabPane tab="模板" name="template" display-directive="show:lazy">
|
||||||
<NAlert type="success"> 如果有合适的设计稿或者想法可以给我说然后做成模板捏 </NAlert>
|
<NAlert type="success"> 如果有合适的设计稿或者想法可以给我说然后做成模板捏 </NAlert>
|
||||||
<br />
|
<br />
|
||||||
<NSpace vertical>
|
<NSpace vertical>
|
||||||
@@ -657,7 +654,7 @@ onMounted(async () => {
|
|||||||
<NDivider />
|
<NDivider />
|
||||||
<Transition name="fade" mode="out-in">
|
<Transition name="fade" mode="out-in">
|
||||||
<div v-if="selectedComponent" :key="selectedTemplateData.Selected">
|
<div v-if="selectedComponent" :key="selectedTemplateData.Selected">
|
||||||
<component ref="dynamicConfigRef" @vue:mounted="getTemplateConfig" :is="selectedComponent"
|
<component ref="dynamicConfigRef" @vue:mounted="getTemplateConfig" :is="selectedComponent"
|
||||||
:user-info="accountInfo" :bili-info="biliUserInfo" :data="selectedTemplateData.Data"
|
:user-info="accountInfo" :bili-info="biliUserInfo" :data="selectedTemplateData.Data"
|
||||||
:config="selectedTemplateData.Config" />
|
:config="selectedTemplateData.Config" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ onMounted(async () => {
|
|||||||
>
|
>
|
||||||
刷新
|
刷新
|
||||||
</NButton>
|
</NButton>
|
||||||
<NButton @click="$router.push({ name: 'manage-index', query: { tab: 'template', template: 'songlist' } })">
|
<NButton @click="$router.push({ name: 'manage-index', query: { tab: 'setting', setting: 'template', template: 'songlist' } })">
|
||||||
修改模板
|
修改模板
|
||||||
</NButton>
|
</NButton>
|
||||||
</NSpace>
|
</NSpace>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export const Config: TemplateConfig<ConfigType> = {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
WIP...
|
||||||
<div :style="{
|
<div :style="{
|
||||||
backgroundImage: `${props.config?.background ? 'url(' + FILE_BASE_URL + props.config?.background[0] + ')' : ''}`,
|
backgroundImage: `${props.config?.background ? 'url(' + FILE_BASE_URL + props.config?.background[0] + ')' : ''}`,
|
||||||
height: '100%', 'max-width': '100%',
|
height: '100%', 'max-width': '100%',
|
||||||
|
|||||||
Reference in New Issue
Block a user