mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
add obs checker
This commit is contained in:
@@ -44,14 +44,25 @@ async function getUsers() {
|
||||
} as UpdateLiveLotteryUsersModel
|
||||
}
|
||||
|
||||
const visiable = ref(true)
|
||||
const active = ref(true)
|
||||
let timer: any
|
||||
onMounted(() => {
|
||||
timer = setInterval(async () => {
|
||||
if (!visiable.value || !active.value) return
|
||||
const r = await getUsers()
|
||||
if (r) {
|
||||
result.value = r
|
||||
}
|
||||
}, 2000)
|
||||
//@ts-expect-error 这里获取不了
|
||||
window.obsstudio.onVisibilityChange = function (visibility: boolean) {
|
||||
visiable.value = visibility
|
||||
}
|
||||
//@ts-expect-error 这里获取不了
|
||||
window.obsstudio.onActiveChange = function (a: boolean) {
|
||||
active.value = a
|
||||
}
|
||||
})
|
||||
onUnmounted(() => {
|
||||
clearInterval(timer)
|
||||
|
||||
@@ -55,16 +55,27 @@ const isMoreThanContainer = computed(() => {
|
||||
return originSongs.value.waiting.length * itemHeight > height.value
|
||||
})
|
||||
async function update() {
|
||||
if (!visiable.value || !active.value) return
|
||||
const r = await get()
|
||||
if (r) {
|
||||
originSongs.value = r
|
||||
}
|
||||
}
|
||||
|
||||
const visiable = ref(true)
|
||||
const active = ref(true)
|
||||
let timer: any
|
||||
onMounted(() => {
|
||||
update()
|
||||
timer = setInterval(update, 2000)
|
||||
|
||||
//@ts-expect-error 这里获取不了
|
||||
window.obsstudio.onVisibilityChange = function (visibility: boolean) {
|
||||
visiable.value = visibility
|
||||
}
|
||||
//@ts-expect-error 这里获取不了
|
||||
window.obsstudio.onActiveChange = function (a: boolean) {
|
||||
active.value = a
|
||||
}
|
||||
})
|
||||
onUnmounted(() => {
|
||||
clearInterval(timer)
|
||||
|
||||
@@ -3,7 +3,7 @@ import { QAInfo, Setting_QuestionDisplay } from '@/api/api-models'
|
||||
import { QueryGetAPI } from '@/api/query'
|
||||
import { QUESTION_API_URL } from '@/data/constants'
|
||||
import { useRouteQuery } from '@vueuse/router'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { onMounted, onUnmounted, ref } from 'vue'
|
||||
import QuestionDisplayCard from '../manage/QuestionDisplayCard.vue'
|
||||
|
||||
const hash = ref('')
|
||||
@@ -44,10 +44,26 @@ async function getQuestionAndSetting() {
|
||||
}
|
||||
}
|
||||
|
||||
const visiable = ref(true)
|
||||
const active = ref(true)
|
||||
let timer: any
|
||||
onMounted(() => {
|
||||
setInterval(() => {
|
||||
timer = setInterval(() => {
|
||||
if (!visiable.value || !active.value) return
|
||||
checkIfChanged()
|
||||
}, 1000)
|
||||
|
||||
//@ts-expect-error 这里获取不了
|
||||
window.obsstudio.onVisibilityChange = function (visibility: boolean) {
|
||||
visiable.value = visibility
|
||||
}
|
||||
//@ts-expect-error 这里获取不了
|
||||
window.obsstudio.onActiveChange = function (a: boolean) {
|
||||
active.value = a
|
||||
}
|
||||
})
|
||||
onUnmounted(() => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ const allowGuardTypes = computed(() => {
|
||||
return types
|
||||
})
|
||||
async function update() {
|
||||
if (!visiable.value || !active.value) return
|
||||
const r = await get()
|
||||
if (r) {
|
||||
queue.value = r.queue.sort((a, b) => {
|
||||
@@ -106,10 +107,21 @@ async function update() {
|
||||
}
|
||||
}
|
||||
|
||||
const visiable = ref(true)
|
||||
const active = ref(true)
|
||||
let timer: any
|
||||
onMounted(() => {
|
||||
update()
|
||||
timer = setInterval(update, 2000)
|
||||
|
||||
//@ts-expect-error 这里获取不了
|
||||
window.obsstudio.onVisibilityChange = function (visibility: boolean) {
|
||||
visiable.value = visibility
|
||||
}
|
||||
//@ts-expect-error 这里获取不了
|
||||
window.obsstudio.onActiveChange = function (a: boolean) {
|
||||
active.value = a
|
||||
}
|
||||
})
|
||||
onUnmounted(() => {
|
||||
clearInterval(timer)
|
||||
|
||||
@@ -76,6 +76,7 @@ const allowGuardTypes = computed(() => {
|
||||
return types
|
||||
})
|
||||
async function update() {
|
||||
if (!visiable.value || !active.value) return
|
||||
const r = await get()
|
||||
if (r) {
|
||||
originSongs.value = r.songs.sort((a, b) => {
|
||||
@@ -85,10 +86,21 @@ async function update() {
|
||||
}
|
||||
}
|
||||
|
||||
const visiable = ref(true)
|
||||
const active = ref(true)
|
||||
let timer: any
|
||||
onMounted(() => {
|
||||
update()
|
||||
timer = setInterval(update, 2000)
|
||||
|
||||
//@ts-expect-error 这里获取不了
|
||||
window.obsstudio.onVisibilityChange = function (visibility: boolean) {
|
||||
visiable.value = visibility
|
||||
}
|
||||
//@ts-expect-error 这里获取不了
|
||||
window.obsstudio.onActiveChange = function (a: boolean) {
|
||||
active.value = a
|
||||
}
|
||||
})
|
||||
onUnmounted(() => {
|
||||
clearInterval(timer)
|
||||
|
||||
Reference in New Issue
Block a user