fix wrong langue value when adding songs

This commit is contained in:
2024-11-21 00:53:15 +08:00
parent 45bc8485b3
commit 537ea7bbe6
52 changed files with 46594 additions and 394 deletions

View File

@@ -1,64 +0,0 @@
<script setup lang="ts">
import { useAccount } from '@/api/account'
import DanmakuClient from '@/data/DanmakuClient'
import { NAlert, NSpin, useMessage } from 'naive-ui'
import { VNode, onMounted, onUnmounted, ref } from 'vue'
const props = defineProps<{
component: VNode
}>()
const accountInfo = useAccount()
const message = useMessage()
const client = new DanmakuClient(null)
const isClientLoading = ref(true)
let bc: BroadcastChannel
onMounted(async () => {
if (window.BroadcastChannel) {
bc = new BroadcastChannel('vtsuru.danmaku')
let isCreated = false
bc.onmessage = (event) => {
switch (event.data) {
case 'ping':
bc.postMessage('pong')
break
case 'pong': //已存在其他客户端
if (!isCreated) {
isCreated = true
}
break
case 'danmaku':
props.component.props?.onDanmaku?.(event.type)
break
}
}
bc.postMessage('ping')
setTimeout(() => {
}, 50);
}
const result = await client.Start()
if (!result.success) {
message.error('无法启动弹幕客户端: ' + result.message)
}
isClientLoading.value = false
})
onUnmounted(() => {
client.Stop()
})
</script>
<template>
<NAlert v-if="accountInfo?.isBiliVerified != true" type="info"> 尚未进行Bilibili认证 </NAlert>
<NSpin v-else-if="isClientLoading" show />
<KeepAlive v-else>
<component
:is="component"
:client="client"
:room-info="client.roomAuthInfo?.value"
:code="accountInfo?.biliAuthCode"
/>
</KeepAlive>
</template>

View File

@@ -1,22 +1,15 @@
<script setup lang="ts">
import { useAccount } from '@/api/account'
import DanmakuClient from '@/data/DanmakuClient'
import { useDanmakuClient } from '@/store/useDanmakuClient'
import { NAlert } from 'naive-ui'
import { onMounted, onUnmounted } from 'vue'
import OpenLottery from '../open_live/OpenLottery.vue'
const accountInfo = useAccount()
const client = new DanmakuClient(null)
const client = await useDanmakuClient().initClient()
onMounted(() => {
client.Start()
})
onUnmounted(() => {
client.Stop()
})
</script>
<template>
<NAlert v-if="accountInfo?.isBiliVerified != true" type="info"> 尚未进行Bilibili认证 </NAlert>
<OpenLottery v-else :client="client" :room-info="client.roomAuthInfo.value" :code="accountInfo?.biliAuthCode" />
<OpenLottery v-else :room-info="client.authInfo!" :code="accountInfo?.biliAuthCode" />
</template>

View File

@@ -260,7 +260,7 @@ const addLinkUrl = ref('')
const linkKey = ref(0)
async function RequestBiliUserData() {
await fetch(FETCH_API + `https://account.bilibili.com/api/member/getCardByMid?mid=10021741`).then(async (respone) => {
await fetch(FETCH_API + `https://workers.vrp.moe/api/bilibili/user-info/10021741`).then(async (respone) => {
const data = await respone.json()
if (data.code == 0) {
biliUserInfo.value = data.card
@@ -657,7 +657,7 @@ onMounted(async () => {
<NDivider />
<Transition name="fade" mode="out-in">
<div v-if="selectedComponent" :key="selectedTemplateData.Selected">
<component ref="dynamicConfigRef" @vue:mounted="getTemplateConfig" :is="selectedComponent"
<component ref="dynamicConfigRef" @vue:mounted="getTemplateConfig" :is="selectedComponent"
:user-info="accountInfo" :bili-info="biliUserInfo" :data="selectedTemplateData.Data"
:config="selectedTemplateData.Config" />
</div>

View File

@@ -8,6 +8,7 @@ import { FETCH_API, SONG_API_URL } from '@/data/constants'
import { Info24Filled } from '@vicons/fluent'
import { ArchiveOutline } from '@vicons/ionicons5'
import { format } from 'date-fns'
// @ts-ignore
import { saveAs } from 'file-saver'
import { List } from 'linqts'
import {
@@ -129,27 +130,27 @@ const addSongRules: FormRules = {
const songSelectOption = [
{
label: '中文',
value: SongLanguage.Chinese,
value: '中文',
},
{
label: '日语',
value: SongLanguage.Japanese,
value: '日语',
},
{
label: '英语',
value: SongLanguage.English,
value: '英语',
},
{
label: '法语',
value: SongLanguage.French,
value: '法语',
},
{
label: '西语',
value: SongLanguage.Spanish,
value: '西语',
},
{
label: '其他',
value: SongLanguage.Other,
value: '其他',
},
]
const languageSelectOption = computed(() => {

View File

@@ -1,22 +1,14 @@
<script setup lang="ts">
import { useAccount } from '@/api/account'
import DanmakuClient from '@/data/DanmakuClient'
import { useDanmakuClient } from '@/store/useDanmakuClient'
import { NAlert } from 'naive-ui'
import { onMounted, onUnmounted } from 'vue'
import MusicRequest from '../open_live/MusicRequest.vue'
const accountInfo = useAccount()
const client = new DanmakuClient(null)
onMounted(() => {
client.Start()
})
onUnmounted(() => {
client.Stop()
})
const client = await useDanmakuClient().initClient()
</script>
<template>
<NAlert v-if="accountInfo?.isBiliVerified != true" type="info"> 尚未进行Bilibili认证 </NAlert>
<MusicRequest v-else :client="client" :room-info="client.roomAuthInfo.value" :code="accountInfo?.biliAuthCode" />
<MusicRequest v-else :client="client" :room-info="client.authInfo!" :code="accountInfo?.biliAuthCode" />
</template>