mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
add obs checker
This commit is contained in:
@@ -20,7 +20,6 @@ interface LoginModel {
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const isRegister = ref(false)
|
||||
const isLoading = ref(false)
|
||||
|
||||
const registerModel = ref<RegisterModel>({} as RegisterModel)
|
||||
@@ -148,7 +147,7 @@ function onLoginButtonClick() {
|
||||
message.error(data.message)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
.catch(() => {
|
||||
message.error('登陆失败')
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -166,7 +165,7 @@ async function onForgetPassword() {
|
||||
message.error(data.message)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
.catch(() => {
|
||||
message.error('发生错误')
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
@@ -3,14 +3,13 @@ import { SongFrom, SongsInfo } from '@/api/api-models'
|
||||
import { QueryGetAPI } from '@/api/query'
|
||||
import { SONG_API_URL } from '@/data/constants'
|
||||
import { NEmpty } from 'naive-ui'
|
||||
import { computed, ref, toRef, watch } from 'vue'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import APlayer from 'vue3-aplayer'
|
||||
|
||||
const props = defineProps<{
|
||||
song: SongsInfo | undefined
|
||||
isLrcLoading?: string
|
||||
}>()
|
||||
const currentSong = toRef(props, 'song')
|
||||
const emits = defineEmits(['update:isLrcLoading'])
|
||||
|
||||
const aplayerMusic = ref({
|
||||
|
||||
@@ -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