diff --git a/src/data/Initializer.ts b/src/data/Initializer.ts index 1d2cf0b..11bc9b2 100644 --- a/src/data/Initializer.ts +++ b/src/data/Initializer.ts @@ -1,6 +1,6 @@ import { GetSelfAccount, useAccount, UpdateAccountLoop } from "@/api/account"; import { QueryGetAPI } from "@/api/query"; -import { useAuthStore } from "@/store/useAuthStore"; +import { useBiliAuth } from "@/store/useBiliAuth"; import { useNotificationStore } from "@/store/useNotificationStore"; import { createDiscreteApi, NText, NFlex, NButton } from "naive-ui"; import { BASE_API_URL, isTauri, apiFail } from "./constants"; @@ -64,7 +64,7 @@ async function InitOther() { InitTTS() await GetSelfAccount() const account = useAccount() - const useAuth = useAuthStore() + const useAuth = useBiliAuth() if (account.value.id) { if (account.value.biliUserAuthInfo && !useAuth.currentToken) { useAuth.currentToken = account.value.biliUserAuthInfo.token diff --git a/src/store/useAuthStore.ts b/src/store/useBiliAuth.ts similarity index 98% rename from src/store/useAuthStore.ts rename to src/store/useBiliAuth.ts index 3212ba0..b6bc02a 100644 --- a/src/store/useAuthStore.ts +++ b/src/store/useBiliAuth.ts @@ -6,7 +6,7 @@ import { MessageApiInjection } from 'naive-ui/es/message/src/MessageProvider' import { defineStore } from 'pinia' import { computed, ref } from 'vue' -export const useAuthStore = defineStore('BiliAuth', () => { +export const useBiliAuth = defineStore('BiliAuth', () => { const biliAuth = ref({} as BiliAuthModel) const biliTokens = useStorage< diff --git a/src/store/usePointStore.ts b/src/store/usePointStore.ts index e046006..0eddd51 100644 --- a/src/store/usePointStore.ts +++ b/src/store/usePointStore.ts @@ -3,11 +3,11 @@ import { QueryGetAPI } from "@/api/query"; import { POINT_API_URL } from "@/data/constants"; import { MessageApiInjection } from "naive-ui/es/message/src/MessageProvider"; import { defineStore } from "pinia"; -import { useAuthStore } from "./useAuthStore"; +import { useBiliAuth } from "./useBiliAuth"; import { GuidUtils } from "@/Utils"; export const usePointStore = defineStore('point', () => { - const useAuth = useAuthStore() + const useAuth = useBiliAuth() async function GetSpecificPoint(id: number) { try { diff --git a/src/views/BiliAuthView.vue b/src/views/BiliAuthView.vue index eb00c26..43c33ae 100644 --- a/src/views/BiliAuthView.vue +++ b/src/views/BiliAuthView.vue @@ -1,7 +1,7 @@ diff --git a/src/views/view/songListTemplate/DefaultSongListTemplate.vue b/src/views/view/songListTemplate/DefaultSongListTemplate.vue index 4b53199..d44bba6 100644 --- a/src/views/view/songListTemplate/DefaultSongListTemplate.vue +++ b/src/views/view/songListTemplate/DefaultSongListTemplate.vue @@ -4,11 +4,14 @@ import { SongsInfo } from '@/api/api-models' import SongList from '@/components/SongList.vue' import { SongListConfigType } from '@/data/TemplateTypes' import LiveRequestOBS from '@/views/obs/LiveRequestOBS.vue' +import { getSongRequestTooltip } from './utils/songRequestUtils' import { CloudAdd20Filled, ChevronLeft24Filled, ChevronRight24Filled } from '@vicons/fluent' import { NButton, NCard, NCollapse, NCollapseItem, NDivider, NIcon, NTooltip, useMessage } from 'naive-ui' import { h, ref, onMounted, onUnmounted } from 'vue' +import { useBiliAuth } from '@/store/useBiliAuth' const accountInfo = useAccount() +const biliAuth = useBiliAuth() //所有模板都应该有这些 const props = defineProps() @@ -75,7 +78,7 @@ const buttons = (song: SongsInfo) => [ size: 'small', circle: true, loading: isLoading.value == song.key, - disabled: !accountInfo, + disabled: !accountInfo.value, onClick: () => { isLoading.value = song.key emits('requestSong', song) @@ -86,12 +89,7 @@ const buttons = (song: SongsInfo) => [ icon: () => h(NIcon, { component: CloudAdd20Filled }), }, ), - default: () => - !props.liveRequestSettings?.allowFromWeb || song.options - ? '点歌 | 用户不允许从网页点歌, 点击后将复制点歌内容到剪切板' - : !accountInfo - ? '点歌 | 你需要登录后才能点歌' - : '点歌', + default: () => getSongRequestTooltip(song, props.liveRequestSettings) }, ) : undefined, diff --git a/src/views/view/songListTemplate/SimpleSongListTemplate.vue b/src/views/view/songListTemplate/SimpleSongListTemplate.vue index c86e825..2a669d2 100644 --- a/src/views/view/songListTemplate/SimpleSongListTemplate.vue +++ b/src/views/view/songListTemplate/SimpleSongListTemplate.vue @@ -5,9 +5,11 @@ import { FunctionTypes, SongsInfo } from '@/api/api-models' import SongPlayer from '@/components/SongPlayer.vue' import { SongListConfigType } from '@/data/TemplateTypes' import LiveRequestOBS from '@/views/obs/LiveRequestOBS.vue' +import { getSongRequestTooltip, getSongRequestButtonType } from './utils/songRequestUtils' import { CloudAdd20Filled, Play24Filled } from '@vicons/fluent' import { useWindowSize } from '@vueuse/core' import { throttle } from 'lodash' +import { useBiliAuth } from '@/store/useBiliAuth' import { NButton, NCard, @@ -36,6 +38,7 @@ const container = ref() const index = ref(20) const accountInfo = useAccount() +const biliAuth = useBiliAuth() const selectedTag = ref('') const selectedSong = ref() @@ -296,7 +299,7 @@ function loadMore() {