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