mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
fix reverse in obs
This commit is contained in:
@@ -114,6 +114,7 @@ export interface Setting_SongRequest {
|
|||||||
jianzhangCooldownSecond: number
|
jianzhangCooldownSecond: number
|
||||||
|
|
||||||
showRequireInfo: boolean
|
showRequireInfo: boolean
|
||||||
|
isReverse: boolean
|
||||||
}
|
}
|
||||||
export interface Setting_Queue {
|
export interface Setting_Queue {
|
||||||
keyword: string
|
keyword: string
|
||||||
@@ -143,6 +144,7 @@ export interface Setting_Queue {
|
|||||||
jianzhangCooldownSecond: number
|
jianzhangCooldownSecond: number
|
||||||
|
|
||||||
showRequireInfo: boolean
|
showRequireInfo: boolean
|
||||||
|
isReverse: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum KeywordMatchType {
|
export enum KeywordMatchType {
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ const activeItems = computed(() => {
|
|||||||
list = list.OrderByDescending((q) => q.giftPrice ?? 0).ThenByDescending((q) => q.createAt)
|
list = list.OrderByDescending((q) => q.giftPrice ?? 0).ThenByDescending((q) => q.createAt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(settings.value.isReverse){
|
||||||
|
list = list.Reverse()
|
||||||
|
}
|
||||||
return list.ToArray()
|
return list.ToArray()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,20 @@ const itemHeight = 40
|
|||||||
|
|
||||||
const key = ref(Date.now())
|
const key = ref(Date.now())
|
||||||
|
|
||||||
const songs = ref<SongRequestInfo[]>([])
|
const originSongs = ref<SongRequestInfo[]>([])
|
||||||
|
const songs = computed(() => {
|
||||||
|
if (settings.value.isReverse) {
|
||||||
|
return originSongs.value.reverse()
|
||||||
|
} else {
|
||||||
|
return originSongs.value
|
||||||
|
}
|
||||||
|
})
|
||||||
const settings = ref<Setting_SongRequest>({} as Setting_SongRequest)
|
const settings = ref<Setting_SongRequest>({} as Setting_SongRequest)
|
||||||
const singing = computed(() => {
|
const singing = computed(() => {
|
||||||
return songs.value.find((s) => s.status == SongRequestStatus.Singing)
|
return originSongs.value.find((s) => s.status == SongRequestStatus.Singing)
|
||||||
})
|
})
|
||||||
const activeSongs = computed(() => {
|
const activeSongs = computed(() => {
|
||||||
return songs.value.filter((s) => s.status == SongRequestStatus.Waiting)
|
return originSongs.value.filter((s) => s.status == SongRequestStatus.Waiting)
|
||||||
})
|
})
|
||||||
|
|
||||||
async function get() {
|
async function get() {
|
||||||
@@ -49,7 +56,7 @@ async function get() {
|
|||||||
return {} as { songs: SongRequestInfo[]; setting: Setting_SongRequest }
|
return {} as { songs: SongRequestInfo[]; setting: Setting_SongRequest }
|
||||||
}
|
}
|
||||||
const isMoreThanContainer = computed(() => {
|
const isMoreThanContainer = computed(() => {
|
||||||
return songs.value.length * itemHeight > height.value
|
return originSongs.value.length * itemHeight > height.value
|
||||||
})
|
})
|
||||||
const allowGuardTypes = computed(() => {
|
const allowGuardTypes = computed(() => {
|
||||||
const types = []
|
const types = []
|
||||||
@@ -67,7 +74,7 @@ const allowGuardTypes = computed(() => {
|
|||||||
async function update() {
|
async function update() {
|
||||||
const r = await get()
|
const r = await get()
|
||||||
if (r) {
|
if (r) {
|
||||||
songs.value = r.songs.sort((a, b) => {
|
originSongs.value = r.songs.sort((a, b) => {
|
||||||
return b.createAt - a.createAt
|
return b.createAt - a.createAt
|
||||||
})
|
})
|
||||||
settings.value = r.setting
|
settings.value = r.setting
|
||||||
@@ -90,7 +97,12 @@ onUnmounted(() => {
|
|||||||
<NDivider class="song-request-divider">
|
<NDivider class="song-request-divider">
|
||||||
<p class="song-request-header-count">已有 {{ activeSongs.length ?? 0 }} 首</p>
|
<p class="song-request-header-count">已有 {{ activeSongs.length ?? 0 }} 首</p>
|
||||||
</NDivider>
|
</NDivider>
|
||||||
<div class="song-request-singing-container" :singing="songs.findIndex((s) => s.status == SongRequestStatus.Singing) > -1" :from="(singing?.from as number)" :status="(singing?.status as number)">
|
<div
|
||||||
|
class="song-request-singing-container"
|
||||||
|
:singing="songs.findIndex((s) => s.status == SongRequestStatus.Singing) > -1"
|
||||||
|
:from="(singing?.from as number)"
|
||||||
|
:status="(singing?.status as number)"
|
||||||
|
>
|
||||||
<div class="song-request-singing-prefix"></div>
|
<div class="song-request-singing-prefix"></div>
|
||||||
<template v-if="singing">
|
<template v-if="singing">
|
||||||
<img class="song-request-singing-avatar" :src="AVATAR_URL + singing?.user?.uid" referrerpolicy="no-referrer" />
|
<img class="song-request-singing-avatar" :src="AVATAR_URL + singing?.user?.uid" referrerpolicy="no-referrer" />
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ const defaultSettings = {
|
|||||||
zongduCooldownSecond: 300,
|
zongduCooldownSecond: 300,
|
||||||
tiduCooldownSecond: 600,
|
tiduCooldownSecond: 600,
|
||||||
jianzhangCooldownSecond: 900,
|
jianzhangCooldownSecond: 900,
|
||||||
|
isReverse: false,
|
||||||
} as Setting_SongRequest
|
} as Setting_SongRequest
|
||||||
const STATUS_MAP = {
|
const STATUS_MAP = {
|
||||||
[SongRequestStatus.Waiting]: '等待中',
|
[SongRequestStatus.Waiting]: '等待中',
|
||||||
@@ -160,7 +161,7 @@ const songs = computed(() => {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
if (isReverse.value) {
|
if (configCanEdit.value ? settings.value.isReverse : isReverse.value) {
|
||||||
return result.reverse()
|
return result.reverse()
|
||||||
} else {
|
} else {
|
||||||
return result
|
return result
|
||||||
@@ -800,7 +801,8 @@ onUnmounted(() => {
|
|||||||
<NInput placeholder="手动添加" v-model:value="newSongName" />
|
<NInput placeholder="手动添加" v-model:value="newSongName" />
|
||||||
<NButton type="primary" @click="addSongManual"> 添加 </NButton>
|
<NButton type="primary" @click="addSongManual"> 添加 </NButton>
|
||||||
</NInputGroup>
|
</NInputGroup>
|
||||||
<NCheckbox v-model:checked="isReverse"> 倒序 </NCheckbox>
|
<NCheckbox v-if="configCanEdit" v-model:checked="settings.isReverse" @update:checked="updateSettings"> 倒序 </NCheckbox>
|
||||||
|
<NCheckbox v-else v-model:checked="isReverse"> 倒序 </NCheckbox>
|
||||||
<NPopconfirm @positive-click="deactiveAllSongs">
|
<NPopconfirm @positive-click="deactiveAllSongs">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<NButton type="error"> 全部取消 </NButton>
|
<NButton type="error"> 全部取消 </NButton>
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ const defaultSettings = {
|
|||||||
sortType: QueueSortType.TimeFirst,
|
sortType: QueueSortType.TimeFirst,
|
||||||
giftFilterType: QueueGiftFilterType.Or,
|
giftFilterType: QueueGiftFilterType.Or,
|
||||||
showRequireInfo: true,
|
showRequireInfo: true,
|
||||||
|
isReverse: false,
|
||||||
} as Setting_Queue
|
} as Setting_Queue
|
||||||
const STATUS_MAP = {
|
const STATUS_MAP = {
|
||||||
[QueueStatus.Waiting]: '等待中',
|
[QueueStatus.Waiting]: '等待中',
|
||||||
@@ -173,7 +174,7 @@ const queue = computed(() => {
|
|||||||
list = list.OrderByDescending((q) => q.giftPrice ?? 0).ThenByDescending((q) => q.createAt)
|
list = list.OrderByDescending((q) => q.giftPrice ?? 0).ThenByDescending((q) => q.createAt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isReverse.value) {
|
if (configCanEdit.value ? settings.value.isReverse : isReverse.value) {
|
||||||
list = list.Reverse()
|
list = list.Reverse()
|
||||||
}
|
}
|
||||||
return list.ToArray()
|
return list.ToArray()
|
||||||
@@ -815,7 +816,8 @@ onUnmounted(() => {
|
|||||||
<NRadioButton :value="QueueSortType.PaymentFist"> 付费价格优先 </NRadioButton>
|
<NRadioButton :value="QueueSortType.PaymentFist"> 付费价格优先 </NRadioButton>
|
||||||
<NRadioButton :value="QueueSortType.GuardFirst"> 舰长优先 (按等级) </NRadioButton>
|
<NRadioButton :value="QueueSortType.GuardFirst"> 舰长优先 (按等级) </NRadioButton>
|
||||||
</NRadioGroup>
|
</NRadioGroup>
|
||||||
<NCheckbox v-model:checked="isReverse"> 倒序 </NCheckbox>
|
<NCheckbox v-if="configCanEdit" v-model:checked="settings.isReverse" @update:checked="updateSettings"> 倒序 </NCheckbox>
|
||||||
|
<NCheckbox v-else v-model:checked="isReverse"> 倒序 </NCheckbox>
|
||||||
</NSpace>
|
</NSpace>
|
||||||
</NCard>
|
</NCard>
|
||||||
<NDivider> 共 {{ queue.length }} 人 </NDivider>
|
<NDivider> 共 {{ queue.length }} 人 </NDivider>
|
||||||
@@ -1030,7 +1032,7 @@ onUnmounted(() => {
|
|||||||
<NCheckbox v-model:checked="settings.allowIncreasePaymentBySendGift" @update:checked="updateSettings" :disabled="!configCanEdit">
|
<NCheckbox v-model:checked="settings.allowIncreasePaymentBySendGift" @update:checked="updateSettings" :disabled="!configCanEdit">
|
||||||
在队列中时允许继续发送礼物累计付费量 (仅限上方设定的礼物)
|
在队列中时允许继续发送礼物累计付费量 (仅限上方设定的礼物)
|
||||||
</NCheckbox>
|
</NCheckbox>
|
||||||
<NCheckbox v-model:checked="settings.allowIncreasePaymentBySendGift" @update:checked="updateSettings" :disabled="!configCanEdit"> 允许发送任意礼物来叠加付费量 </NCheckbox>
|
<NCheckbox v-if="settings.allowIncreasePaymentBySendGift" v-model:checked="settings.allowIncreaseByAnyPayment" @update:checked="updateSettings" :disabled="!configCanEdit"> 允许发送任意礼物来叠加付费量 </NCheckbox>
|
||||||
</NSpace>
|
</NSpace>
|
||||||
<NDivider> 冷却 (单位: 秒) </NDivider>
|
<NDivider> 冷却 (单位: 秒) </NDivider>
|
||||||
<NCheckbox v-model:checked="settings.enableCooldown" @update:checked="updateSettings" :disabled="!configCanEdit"> 启用排队冷却 </NCheckbox>
|
<NCheckbox v-model:checked="settings.enableCooldown" @update:checked="updateSettings" :disabled="!configCanEdit"> 启用排队冷却 </NCheckbox>
|
||||||
|
|||||||
Reference in New Issue
Block a user