mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
update
This commit is contained in:
@@ -1,24 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import { NAlert, NButton, NCard, NCheckbox, NDivider, NInput, NSpace, NTab, NTabPane, NTabs, NText, NUpload, UploadFileInfo, useMessage } from 'naive-ui'
|
||||
import GraphemeSplitter from 'grapheme-splitter'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { computed, onUnmounted, ref } from 'vue'
|
||||
import { useAccount } from '@/api/account'
|
||||
import { useUser } from '@/api/user'
|
||||
import { QAInfo, UserInfo } from '@/api/api-models'
|
||||
import { QueryPostAPI, QueryPostAPIWithParams } from '@/api/query'
|
||||
import { QueryPostAPI } from '@/api/query'
|
||||
import { QUESTION_API_URL, TURNSTILE_KEY } from '@/data/constants'
|
||||
import VueTurnstile from 'vue-turnstile'
|
||||
|
||||
const { biliInfo, userInfo } = defineProps<{
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
biliInfo: any | undefined
|
||||
userInfo: UserInfo | undefined
|
||||
}>()
|
||||
|
||||
const splitter = new GraphemeSplitter()
|
||||
|
||||
const message = useMessage()
|
||||
const accountInfo = useAccount()
|
||||
const userInfo = ref<UserInfo>()
|
||||
const token = ref('')
|
||||
const turnstile = ref()
|
||||
|
||||
const isSelf = computed(() => {
|
||||
return userInfo.value?.id == accountInfo.value?.id
|
||||
return userInfo?.id == accountInfo.value?.id
|
||||
})
|
||||
|
||||
const questionMessage = ref('')
|
||||
@@ -39,7 +43,7 @@ async function SendQuestion() {
|
||||
await QueryPostAPI<QAInfo>(
|
||||
QUESTION_API_URL + 'send',
|
||||
{
|
||||
Target: userInfo.value?.id,
|
||||
Target: userInfo?.id,
|
||||
IsAnonymous: !accountInfo.value || isAnonymous.value,
|
||||
Message: questionMessage.value,
|
||||
ImageBase64: fileList.value?.length > 0 ? await getBase64(fileList.value[0].file) : undefined,
|
||||
@@ -83,8 +87,8 @@ function OnFileListChange(files: UploadFileInfo[]) {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
userInfo.value = await useUser()
|
||||
onUnmounted(() => {
|
||||
turnstile.value?.remove()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
0
src/views/view/ScheduleView.vue
Normal file
0
src/views/view/ScheduleView.vue
Normal file
@@ -4,24 +4,23 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useUser } from '@/api/user'
|
||||
import { SongListTypes, SongsInfo } from '@/api/api-models'
|
||||
import DefaultSongListTemplate from '@/views/view/songListTemplate/DefaultSongListTemplate.vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { UserInfo } from '@/api/api-models'
|
||||
import { useRouteParams } from '@vueuse/router'
|
||||
import { QueryGetAPI } from '@/api/query'
|
||||
import { SONG_API_URL } from '@/data/constants'
|
||||
import { NSpin, useMessage } from 'naive-ui'
|
||||
|
||||
defineProps<{
|
||||
const { biliInfo, userInfo } = defineProps<{
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
biliInfo: any | undefined
|
||||
userInfo: UserInfo | undefined
|
||||
}>()
|
||||
|
||||
const songListType = computed(() => {
|
||||
if (userInfo.value) {
|
||||
switch (userInfo.value.songListType) {
|
||||
if (userInfo) {
|
||||
switch (userInfo.songListType) {
|
||||
case SongListTypes.Default:
|
||||
return DefaultSongListTemplate
|
||||
|
||||
@@ -33,7 +32,6 @@ const songListType = computed(() => {
|
||||
}
|
||||
})
|
||||
const songs = ref<SongsInfo[]>()
|
||||
const uId = useRouteParams('id', '-1', { transform: Number })
|
||||
const isLoading = ref(true)
|
||||
const message = useMessage()
|
||||
|
||||
@@ -42,7 +40,7 @@ const errMessage = ref('')
|
||||
async function getSongs() {
|
||||
isLoading.value = true
|
||||
await QueryGetAPI<SongsInfo[]>(SONG_API_URL + 'get', {
|
||||
id: uId.value,
|
||||
id: userInfo?.id,
|
||||
})
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
@@ -61,10 +59,7 @@ async function getSongs() {
|
||||
})
|
||||
}
|
||||
|
||||
const userInfo = ref<UserInfo>()
|
||||
|
||||
onMounted(async () => {
|
||||
userInfo.value = await useUser()
|
||||
await getSongs()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useUser } from '@/api/user'
|
||||
import { IndexTypes } from '@/api/api-models'
|
||||
import DefaultIndexTemplate from '@/views/view/indexTemplate/DefaultIndexTemplate.vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { UserInfo } from '@/api/api-models'
|
||||
|
||||
defineProps<{
|
||||
const { biliInfo, userInfo } = defineProps<{
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
biliInfo: any | undefined
|
||||
userInfo: UserInfo | undefined
|
||||
}>()
|
||||
|
||||
const indexType = computed(() => {
|
||||
if (userInfo.value) {
|
||||
switch (userInfo.value.indexType) {
|
||||
if (userInfo) {
|
||||
switch (userInfo.indexType) {
|
||||
case IndexTypes.Default:
|
||||
return DefaultIndexTemplate
|
||||
|
||||
@@ -27,9 +27,4 @@ const indexType = computed(() => {
|
||||
return DefaultIndexTemplate
|
||||
}
|
||||
})
|
||||
const userInfo = ref<UserInfo>()
|
||||
|
||||
onMounted(async () => {
|
||||
userInfo.value = await useUser()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -17,7 +17,7 @@ function navigate(url: string) {
|
||||
<NDivider />
|
||||
<template v-if="userInfo?.biliId">
|
||||
<NSpace justify="center" align="center" vertical>
|
||||
<NAvatar :src="biliInfo?.face" :size="width > 750 ? 175 : 100" round bordered style="box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);" />
|
||||
<NAvatar v-if="biliInfo" :src="biliInfo?.face" :size="width > 750 ? 175 : 100" round bordered style="box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2)" />
|
||||
<NSpace align="baseline" justify="center">
|
||||
<NText strong style="font-size: 32px"> {{ biliInfo?.name }} </NText>
|
||||
<NText strong style="font-size: 20px" depth="3"> ({{ userInfo?.name }}) </NText>
|
||||
@@ -29,7 +29,7 @@ function navigate(url: string) {
|
||||
{{ biliInfo?.sign }}
|
||||
</NText>
|
||||
</NSpace>
|
||||
<NDivider/>
|
||||
<NDivider />
|
||||
<NSpace align="center" justify="center">
|
||||
<NButton type="primary" @click="navigate('https://space.bilibili.com/' + userInfo?.biliId)"> 个人主页 </NButton>
|
||||
<NButton type="primary" secondary @click="navigate('https://live.bilibili.com/' + userInfo?.biliRoomId)"> 直播间 </NButton>
|
||||
|
||||
@@ -6,13 +6,14 @@ import { NDivider } from 'naive-ui';
|
||||
|
||||
const accountInfo = useAccount()
|
||||
|
||||
const props = defineProps<{
|
||||
defineProps<{
|
||||
userInfo: UserInfo | undefined
|
||||
songs: SongsInfo[] | undefined
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<SongList v-if="songs" :songs="songs ?? []" :is-self="accountInfo?.id.toString() == $route.params.id?.toString()"/>
|
||||
<NDivider style="margin-top: 10px;"/>
|
||||
<SongList v-if="songs" :songs="songs ?? []" :is-self="accountInfo?.id == userInfo?.id"/>
|
||||
<NDivider/>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user