fix attribute name

This commit is contained in:
2024-10-25 21:35:59 +08:00
parent c07257bb44
commit ae14fa3078
8 changed files with 98 additions and 142 deletions

View File

@@ -658,7 +658,7 @@ onMounted(async () => {
<Transition name="fade" mode="out-in">
<div v-if="selectedComponent" :key="selectedTemplateData.Selected">
<component ref="dynamicConfigRef" @vue:mounted="getTemplateConfig" :is="selectedComponent"
:user-info="accountInfo" :bili-info="biliUserInfo" :current-data="selectedTemplateData.Data"
:user-info="accountInfo" :bili-info="biliUserInfo" :data="selectedTemplateData.Data"
:config="selectedTemplateData.Config" />
</div>
</Transition>

View File

@@ -5,7 +5,7 @@
:is="ScheduleTemplateMap[componentType ?? ''].compoent"
:bili-info="biliInfo"
:user-info="userInfo"
:currentData="currentData"
:data="currentData"
v-bind="$attrs"
/>
</template>

View File

@@ -1,9 +1,9 @@
<template>
<NSpin v-if="isLoading" show />
<component v-else ref="dynamicConfigRef" :config="currentConfig"
<component v-else ref="dynamicConfigRef" :config="selectedTemplateConfig?.name ? currentConfig : undefined"
:is="SongListTemplateMap[componentType ?? '']?.compoent" :user-info="userInfo" :bili-info="biliInfo"
:currentData="currentData" :live-request-settings="settings" :live-request-active="songsActive"
@request-song="requestSong" v-bind="$attrs" />
:data="currentData" :live-request-settings="settings" :live-request-active="songsActive" @request-song="requestSong"
v-bind="$attrs" />
</template>
<script lang="ts" setup>
@@ -87,6 +87,7 @@ async function getSongs() {
}
async function getConfig() {
isLoading.value = true
console.log(selectedTemplateConfig.value!.name)
await DownloadConfig(selectedTemplateConfig.value!.name)
.then((data) => {
if (data.msg) {

View File

@@ -26,8 +26,9 @@ export const Config: TemplateConfig<ConfigType> = {
name: '封面',
type: 'image',
imageLimit: 1,
key: 'cover',
onUploaded: (url, config) => {
config.cover = url instanceof String ? (url as string) : url[0]
config.cover = url[0]
},
},
{

View File

@@ -20,49 +20,44 @@ const message = useMessage()
const buttons = (song: SongsInfo) => [
accountInfo.value?.id != props.userInfo?.id
? h(
NTooltip,
{ trigger: 'hover' },
{
trigger: () =>
h(
NButton,
{
type: 'warning',
size: 'small',
circle: true,
loading: isLoading.value == song.key,
disabled: !accountInfo,
onClick: () => {
isLoading.value = song.key
emits('requestSong', song)
isLoading.value = ''
},
NTooltip,
{ trigger: 'hover' },
{
trigger: () =>
h(
NButton,
{
type: 'warning',
size: 'small',
circle: true,
loading: isLoading.value == song.key,
disabled: !accountInfo,
onClick: () => {
isLoading.value = song.key
emits('requestSong', song)
isLoading.value = ''
},
{
icon: () => h(NIcon, { component: CloudAdd20Filled }),
},
),
default: () =>
!props.songRequestSettings.allowFromWeb || song.options
? '点歌 | 用户不允许从网页点歌, 点击后将复制点歌内容到剪切板'
: !accountInfo
? '点歌 | 你需要登录后才能点歌'
: '点歌',
},
)
},
{
icon: () => h(NIcon, { component: CloudAdd20Filled }),
},
),
default: () =>
!props.liveRequestSettings.allowFromWeb || song.options
? '点歌 | 用户不允许从网页点歌, 点击后将复制点歌内容到剪切板'
: !accountInfo
? '点歌 | 你需要登录后才能点歌'
: '点歌',
},
)
: undefined,
]
</script>
<template>
<NDivider style="margin-top: 10px" />
<SongList
v-if="data"
:songs="data ?? []"
:is-self="accountInfo?.id == userInfo?.id"
:extraButton="buttons"
v-bind="$attrs"
/>
<SongList v-if="data" :songs="data ?? []" :is-self="accountInfo?.id == userInfo?.id" :extraButton="buttons"
v-bind="$attrs" />
<NCollapse v-if="userInfo?.canRequestSong">
<NCollapseItem title="点歌列表">
<NCard size="small" embedded>

View File

@@ -100,72 +100,52 @@ function loadMore() {
}
</script>
<template>
<div
:style="{
display: 'flex',
justifyContent: 'center',
flexDirection: windowSize.width.value > 900 ? 'row' : 'column',
gap: '10px',
width: '100%',
}"
>
<div :style="{
display: 'flex',
justifyContent: 'center',
flexDirection: windowSize.width.value > 900 ? 'row' : 'column',
gap: '10px',
width: '100%',
}">
<NCard size="small" :style="{ width: windowSize.width.value > 900 ? '400px' : '100%' }">
<NCollapseTransition>
<SongPlayer v-if="selectedSong" :song="selectedSong" v-model:is-lrc-loading="isLrcLoading" />
</NCollapseTransition>
<NDivider> 标签 </NDivider>
<NSpace>
<NButton
v-for="tag in tags"
:key="tag"
size="small"
secondary
<NButton v-for="tag in tags" :key="tag" size="small" secondary
:type="selectedTag == tag ? 'primary' : 'default'"
@click="selectedTag == tag ? (selectedTag = '') : (selectedTag = tag)"
>
@click="selectedTag == tag ? (selectedTag = '') : (selectedTag = tag)">
{{ tag }}
</NButton>
</NSpace>
<NDivider> 搜索歌曲 </NDivider>
<NSpace vertical>
<NInput v-model:value="searchKeyword" placeholder="歌名" clearable />
<NSelect
v-model:value="selectedAuthor"
:options="
authors.map((a) => {
return { label: a, value: a }
})
"
placeholder="选择歌手"
clearable
/>
<NSelect v-model:value="selectedAuthor" :options="authors.map((a) => {
return { label: a, value: a }
})
" placeholder="选择歌手" clearable />
<NDivider />
<LiveRequestOBS
v-if="userInfo?.extra?.enableFunctions.includes(FunctionTypes.SongRequest)"
:id="userInfo?.id"
/>
<LiveRequestOBS v-if="userInfo?.extra?.enableFunctions.includes(FunctionTypes.SongRequest)"
:id="userInfo?.id" />
</NSpace>
</NCard>
<NEmpty v-if="!data || songs?.length == 0" description="暂无曲目" style="max-width: 0 auto" />
<NScrollbar
v-else
ref="container"
:style="{
flexGrow: 1,
height: windowSize.width.value > 900 ? '90vh' : '800px',
overflowY: 'auto',
overflowX: 'hidden',
}"
@scroll="onScroll"
>
<NScrollbar v-else ref="container" :style="{
flexGrow: 1,
height: windowSize.width.value > 900 ? '90vh' : '800px',
overflowY: 'auto',
overflowX: 'hidden',
}" @scroll="onScroll">
<NGrid cols="1 600:2 900:3 1200:4" x-gap="10" y-gap="10" responsive="self">
<NGridItem v-for="item in songs" :key="item.key">
<NCard size="small" style="height: 200px; min-width: 300px">
<template #header>
<NSpace :wrap="false" align="center">
<div
:style="`border-radius: 4px; background-color: ${item.options ? '#bd5757' : '#577fb8'}; width: 7px; height: 20px`"
></div>
:style="`border-radius: 4px; background-color: ${item.options ? '#bd5757' : '#577fb8'}; width: 7px; height: 20px`">
</div>
<NEllipsis>
{{ item.name }}
</NEllipsis>
@@ -174,11 +154,8 @@ function loadMore() {
<NSpace vertical>
<NSpace v-if="(item.author?.length ?? 0) > 0" :size="0">
<div v-for="(author, index) in item.author" v-bind:key="author">
<NButton
size="small"
text
@click="selectedAuthor == author ? (selectedAuthor = undefined) : (selectedAuthor = author)"
>
<NButton size="small" text
@click="selectedAuthor == author ? (selectedAuthor = undefined) : (selectedAuthor = author)">
<NText depth="3" :style="{ color: selectedAuthor == author ? '#82bcd3' : '' }">
{{ author }}
</NText>
@@ -195,11 +172,9 @@ function loadMore() {
<template v-if="item.options">
<NSpace>
<NTag v-if="item.options?.scMinPrice" size="small" type="error" :bordered="false">
SC | {{ item.options?.scMinPrice }}</NTag
>
SC | {{ item.options?.scMinPrice }}</NTag>
<NTag v-if="item.options?.fanMedalMinLevel" size="small" type="info" :bordered="false">
粉丝牌 | {{ item.options?.fanMedalMinLevel }}</NTag
>
粉丝牌 | {{ item.options?.fanMedalMinLevel }}</NTag>
<NTag v-if="item.options?.needZongdu" size="small" :color="{ color: GetGuardColor(1) }">
总督
</NTag>
@@ -215,12 +190,8 @@ function loadMore() {
<NSpace align="center" :wrap="false">
<NTooltip v-if="item.url">
<template #trigger>
<NButton
size="small"
@click="selectedSong = item"
type="success"
:loading="isLrcLoading == item.key"
>
<NButton size="small" @click="selectedSong = item" type="success"
:loading="isLrcLoading == item.key">
<template #icon>
<NIcon :component="Play24Filled" />
</template>
@@ -230,25 +201,20 @@ function loadMore() {
</NTooltip>
<NTooltip>
<template #trigger>
<NButton
size="small"
@click="
() => {
isLoading = item.key
emits('requestSong', item)
isLoading = ''
}
"
:type="songRequestSettings?.allowFromWeb == false || item.options ? 'warning' : 'info'"
:loading="isLoading == item.key"
>
<NButton size="small" @click="() => {
isLoading = item.key
emits('requestSong', item)
isLoading = ''
}
" :type="liveRequestSettings?.allowFromWeb == false || item.options ? 'warning' : 'info'"
:loading="isLoading == item.key">
<template #icon>
<NIcon :component="CloudAdd20Filled" />
</template>
</NButton>
</template>
{{
songRequestSettings?.allowFromWeb == false || item.options
liveRequestSettings?.allowFromWeb == false || item.options
? '点歌 | 用户或此歌曲不允许从网页点歌, 点击后将复制点歌内容到剪切板'
: !accountInfo
? '点歌 | 你需要登录后才能点歌'
@@ -263,13 +229,9 @@ function loadMore() {
</NButton>
</template>
<NSpace :wrap="false">
<NButton
v-for="tag in item.tags"
size="tiny"
:key="tag"
<NButton v-for="tag in item.tags" size="tiny" :key="tag"
@click="() => (selectedTag == tag ? (selectedTag = '') : (selectedTag = tag))"
:type="selectedTag == tag ? 'primary' : 'default'"
>
:type="selectedTag == tag ? 'primary' : 'default'">
<NEllipsis style="max-width: 50px">
{{ tag }}
</NEllipsis>
@@ -277,13 +239,9 @@ function loadMore() {
</NSpace>
</NPopover>
<NSpace v-else :wrap="false">
<NButton
v-for="tag in item.tags"
size="tiny"
:key="tag"
<NButton v-for="tag in item.tags" size="tiny" :key="tag"
@click="() => (selectedTag == tag ? (selectedTag = '') : (selectedTag = tag))"
:type="selectedTag == tag ? 'primary' : 'default'"
>
:type="selectedTag == tag ? 'primary' : 'default'">
<NEllipsis style="max-width: 50px">
{{ tag }}
</NEllipsis>

View File

@@ -46,26 +46,26 @@ export const Config: TemplateConfig<ConfigType> = {
alignItems: 'center',
position: 'relative',
}">
<div style="{
height: 100%;
width: 100%;
min-height: 400px;
backdrop-filter: blur(10px);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
<div :style="{
height: '100%',
width: '100%',
minHeight: '400px',
backdropFilter: 'blur(10px)',
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
}">
<div style="{
<div style="
border-radius: 20px;
border: 3px solid var(--pinky-border-color-dark);
height: 50px;
width: 400px;
}">
<div v-for="song in props.data" :key="song.id">
{{song.name}}
">
<div v-for="song in props.data" :key="song.id">
{{ song.name }}
</div>
</div>
</div>
</div>
</div>
</div>
</template>