mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-08 11:26:56 +08:00
fix obs components display
This commit is contained in:
@@ -2,12 +2,14 @@ import { QueryGetAPI } from '@/api/query'
|
||||
import { NOTIFACTION_API_URL } from '@/data/constants'
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
export type NotificationData = {
|
||||
title: string
|
||||
}
|
||||
|
||||
export const useNotificationStore = defineStore('notification', () => {
|
||||
const route = useRoute()
|
||||
const unread = ref<NotificationData[]>([])
|
||||
const all = ref<NotificationData[]>([])
|
||||
|
||||
@@ -28,6 +30,9 @@ export const useNotificationStore = defineStore('notification', () => {
|
||||
return
|
||||
}
|
||||
setInterval(() => {
|
||||
if (route?.name?.toString().startsWith('obs-')) {
|
||||
return
|
||||
}
|
||||
updateUnread()
|
||||
}, 10 * 1000)
|
||||
isInited.value = true
|
||||
|
||||
@@ -306,6 +306,34 @@ export const useQuestionBox = defineStore('QuestionBox', () => {
|
||||
message.error('修改失败: ' + err)
|
||||
})
|
||||
}
|
||||
async function approve(question: QAInfo, approve: boolean) {
|
||||
if (!approve) {
|
||||
message.error('暂时不支持取消审核')
|
||||
return
|
||||
}
|
||||
await QueryGetAPI(QUESTION_API_URL + 'approve', {
|
||||
id: question.id,
|
||||
approve: approve ? 'true' : 'false'
|
||||
})
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
question.reviewResult = undefined
|
||||
const trashIndex = trashQuestions.value.findIndex(
|
||||
(q) => q.id == question.id
|
||||
)
|
||||
if (trashIndex > -1) {
|
||||
trashQuestions.value.splice(trashIndex, 1)
|
||||
}
|
||||
recieveQuestions.value.unshift(question)
|
||||
message.success('已标记为审核通过')
|
||||
} else {
|
||||
message.error('修改失败: ' + data.message)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
message.error('修改失败: ' + err)
|
||||
})
|
||||
}
|
||||
async function setPublic(pub: boolean) {
|
||||
isChangingPublic.value = true
|
||||
await QueryGetAPI(QUESTION_API_URL + 'public', {
|
||||
|
||||
@@ -4,9 +4,12 @@ import {
|
||||
MasterRTCClient,
|
||||
SlaveRTCClient
|
||||
} from '@/data/RTCClient'
|
||||
import { Router24Regular } from '@vicons/fluent'
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import { nonFunctionArgSeparator } from 'html2canvas/dist/types/css/syntax/parser'
|
||||
import { acceptHMRUpdate, defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
export const useWebRTC = defineStore('WebRTC', () => {
|
||||
const client = ref<BaseRTCClient>()
|
||||
@@ -24,7 +27,8 @@ export const useWebRTC = defineStore('WebRTC', () => {
|
||||
function send(event: string, data: any) {
|
||||
client.value?.send(event, data)
|
||||
}
|
||||
|
||||
const cookie = useStorage('JWT_Token', '')
|
||||
const route = useRoute()
|
||||
async function Init(type: 'master' | 'slave') {
|
||||
if (isInitializing) {
|
||||
return useWebRTC()
|
||||
@@ -33,11 +37,13 @@ export const useWebRTC = defineStore('WebRTC', () => {
|
||||
isInitializing = true
|
||||
await navigator.locks.request(
|
||||
'rtcClientInit',
|
||||
{
|
||||
ifAvailable: true
|
||||
},
|
||||
{ ifAvailable: true },
|
||||
async (lock) => {
|
||||
if (lock) {
|
||||
if (!cookie.value && !route.query.token) {
|
||||
console.log('[RTC] 未登录, 跳过RTC初始化')
|
||||
return
|
||||
}
|
||||
while (!accountInfo.value.id) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 500))
|
||||
}
|
||||
@@ -71,12 +77,7 @@ export const useWebRTC = defineStore('WebRTC', () => {
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
Init,
|
||||
send,
|
||||
on,
|
||||
off
|
||||
}
|
||||
return { Init, send, on, off }
|
||||
})
|
||||
|
||||
if (import.meta.hot) {
|
||||
|
||||
Reference in New Issue
Block a user