Compare commits

...

4 Commits

7 changed files with 1116 additions and 1233 deletions

View File

@@ -49,7 +49,7 @@
public: 'true', public: 'true',
}); });
if (resp.code == 200) { if (resp.code == 200) {
message.success('已保存至服务器'); message.success('已保存设置');
props.config?.forEach(item => { props.config?.forEach(item => {
if (item.type === 'render') { if (item.type === 'render') {
item.onUploaded?.(props.configData[item.key], props.configData); item.onUploaded?.(props.configData[item.key], props.configData);

View File

@@ -645,7 +645,9 @@ onMounted(() => {
<NDivider style="margin: 15px 0 15px 0" /> <NDivider style="margin: 15px 0 15px 0" />
</div> </div>
</Transition> </Transition>
<template v-if="isSelf">
<NButton <NButton
:disabled="selectedColumn.length <= 1 && isSelf" :disabled="selectedColumn.length <= 1 && isSelf"
type="info" type="info"
size="small" size="small"
@@ -654,6 +656,7 @@ onMounted(() => {
批量编辑 批量编辑
</NButton> </NButton>
<NDivider style="margin: 5px 0 5px 0" /> <NDivider style="margin: 5px 0 5px 0" />
</template>
<NDataTable <NDataTable
v-model:checked-row-keys="selectedColumn" v-model:checked-row-keys="selectedColumn"
size="small" size="small"

View File

@@ -195,7 +195,7 @@ export type ExtractConfigData<
* @param items 一个只读的配置项定义数组。 * @param items 一个只读的配置项定义数组。
* @returns 类型被保留的同一个只读数组。 * @returns 类型被保留的同一个只读数组。
*/ */
export function defineItems< export function defineTemplateConfig<
const Items extends readonly ConfigItemDefinition[] // 使用 'const' 泛型进行推断 const Items extends readonly ConfigItemDefinition[] // 使用 'const' 泛型进行推断
>(items: Items): Items { >(items: Items): Items {
// 如果需要,可以在此处添加基本的运行时验证。 // 如果需要,可以在此处添加基本的运行时验证。

View File

@@ -611,6 +611,13 @@ onMounted(async () => {
> >
添加歌曲 添加歌曲
</NButton> </NButton>
<NButton
secondary
type="primary"
@click="$router.push({ name: 'manage-index', query: { tab: 'setting', setting: 'template', template: 'songlist' } })"
>
修改展示模板
</NButton>
<NButton <NButton
type="primary" type="primary"
secondary secondary
@@ -640,11 +647,6 @@ onMounted(async () => {
> >
刷新 刷新
</NButton> </NButton>
<NButton
@click="$router.push({ name: 'manage-index', query: { tab: 'setting', setting: 'template', template: 'songlist' } })"
>
修改模板
</NButton>
</NSpace> </NSpace>
<NDivider <NDivider
style="margin: 16px 0 16px 0" style="margin: 16px 0 16px 0"

View File

@@ -78,7 +78,7 @@ import { computed, onMounted, ref, watch } from 'vue';
if (componentType.value) { if (componentType.value) {
return SongListTemplateMap[componentType.value]; return SongListTemplateMap[componentType.value];
} }
return undefined; return SongListTemplateMap[''];
}); });
const currentConfig = ref(); const currentConfig = ref();
watch( watch(

View File

@@ -1,13 +1,13 @@
<script lang="ts" setup> <script lang="ts" setup>
import { isDarkMode } from '@/Utils' import { isDarkMode } from '@/Utils';
import { useAccount } from '@/api/account' import { useAccount } from '@/api/account';
import { ResponseUserIndexModel, UserInfo } from '@/api/api-models' import { ResponseUserIndexModel, UserInfo } from '@/api/api-models';
import { QueryGetAPI } from '@/api/query' import { QueryGetAPI } from '@/api/query';
import SimpleVideoCard from '@/components/SimpleVideoCard.vue' import SimpleVideoCard from '@/components/SimpleVideoCard.vue';
import { TemplateConfig } from '@/data/VTsuruTypes' import { defineTemplateConfig, ExtractConfigData } from '@/data/VTsuruTypes';
import { USER_INDEX_API_URL } from '@/data/constants' import { USER_INDEX_API_URL } from '@/data/constants';
import { NAlert, NAvatar, NButton, NCard, NDivider, NFlex, NSpace, NText, useMessage } from 'naive-ui' import { NAvatar, NButton, NCard, NDivider, NFlex, NSpace, NText, useMessage } from 'naive-ui';
import { ref } from 'vue' import { ref } from 'vue';
defineExpose({ Config, DefaultConfig }) defineExpose({ Config, DefaultConfig })
const width = window.innerWidth const width = window.innerWidth
@@ -46,13 +46,9 @@ function navigate(url: string) {
</script> </script>
<script lang="ts"> <script lang="ts">
export type ConfigType = { export type ConfigType = ExtractConfigData<typeof Config>
test: string
}
export const DefaultConfig = {} as ConfigType export const DefaultConfig = {} as ConfigType
export const Config: TemplateConfig<ConfigType> = { export const Config = defineTemplateConfig([
name: 'Template.Index.Simple',
items: [
{ {
name: '封面', name: '封面',
type: 'image', type: 'image',
@@ -64,8 +60,7 @@ export const Config: TemplateConfig<ConfigType> = {
type: 'string', type: 'string',
key: 'test', key: 'test',
}, },
], ])
}
</script> </script>
<template> <template>
@@ -96,8 +91,8 @@ export const Config: TemplateConfig<ConfigType> = {
vertical vertical
> >
<NAvatar <NAvatar
v-if="accountInfo.streamerInfo" v-if="userInfo.streamerInfo"
:src="accountInfo.streamerInfo.faceUrl" :src="userInfo.streamerInfo.faceUrl"
:size="width > 750 ? 175 : 100" :size="width > 750 ? 175 : 100"
round round
bordered bordered

File diff suppressed because it is too large Load Diff