diff --git a/src/api/api-models.ts b/src/api/api-models.ts index 4677d9b..17a567a 100644 --- a/src/api/api-models.ts +++ b/src/api/api-models.ts @@ -16,9 +16,12 @@ export enum IndexTypes { export enum SongListTypes { Default, } -export interface UserInfo { +export interface UserBasicInfo { name: string id: number + isBiliAuthed: boolean +} +export interface UserInfo extends UserBasicInfo { createAt: number biliId?: number biliRoomId?: number @@ -234,7 +237,7 @@ export enum FunctionTypes { SongRequest, Queue, Point, - VideoCollect + VideoCollect, } export interface SongAuthorInfo { name: string @@ -293,8 +296,8 @@ export interface NotifactionInfo { } export interface QAInfo { id: number - sender: UserInfo - target: UserInfo + sender: UserBasicInfo + target: UserBasicInfo question: { message: string; image?: string } answer?: { message: string; image?: string } isReaded?: boolean @@ -356,7 +359,7 @@ export interface VideoCollectTable { isFinish: boolean videoCount: number maxVideoCount: number - owner: UserInfo + owner: UserBasicInfo } export interface VideoCollectVideo { id: string diff --git a/src/components/manage/PointHistoryCard.vue b/src/components/manage/PointHistoryCard.vue index f6b9754..82a1cb2 100644 --- a/src/components/manage/PointHistoryCard.vue +++ b/src/components/manage/PointHistoryCard.vue @@ -70,7 +70,22 @@ const historyColumn: DataTableColumns = [ const get = () => { switch (row.from) { case PointFrom.Danmaku: - return h(NTag, { type: 'info', bordered: false, size: 'small' }, () => '直播间') + return h(NFlex, { align: 'center' }, () => [ + h(NTag, { type: 'info', bordered: false, size: 'small' }, () => '直播间'), + row.extra?.user + ? h( + NButton, + { + tag: 'a', + href: '/@' + row.extra.user?.name, + target: '_blank', + text: true, + type: 'success', + }, + () => row.extra.user?.name, + ) + : null, + ]) case PointFrom.Manual: return h( NTag, @@ -95,17 +110,22 @@ const historyColumn: DataTableColumns = [ case EventDataTypes.Guard: return h(NFlex, { justify: 'center', align: 'center' }, () => [ h(NTag, { type: 'error', size: 'small' }, () => '上舰'), - row.extra?.msg, + row.extra?.danmaku.msg, ]) case EventDataTypes.Gift: - return h(NFlex, { justify: 'center' }, () => [ + return h(NFlex, { justify: 'center', align: 'center' }, () => [ h(NTag, { type: 'info', size: 'small', style: { margin: '0' } }, () => '礼物'), - row.extra?.msg, + row.extra?.danmaku.msg, + h( + NTag, + { type: 'warning', size: 'tiny', style: { margin: '0' }, bordered: false }, + () => (row.extra?.danmaku.num ?? 1) + '个', + ), ]) case EventDataTypes.SC: return h(NFlex, { justify: 'center' }, () => [ h(NTag, { type: 'warning', size: 'small', style: { margin: '0' } }, () => 'SC'), - row.extra?.price, + row.extra?.danmaku.price, ]) } case PointFrom.Manual: diff --git a/src/store/useAuthStore.ts b/src/store/useAuthStore.ts index 718f58d..2a1d056 100644 --- a/src/store/useAuthStore.ts +++ b/src/store/useAuthStore.ts @@ -120,6 +120,12 @@ export const useAuthStore = defineStore('BiliAuth', () => { } return [] } + function logout() { + biliAuth.value = {} as BiliAuthModel + biliTokens.value = biliTokens.value.filter((t) => t.token != currentToken.value) + currentToken.value = '' + console.log('[bili-auth] 已登出 Bilibili 认证') + } return { biliAuth, @@ -134,5 +140,6 @@ export const useAuthStore = defineStore('BiliAuth', () => { GetSpecificPoint, GetGoods, setCurrentAuth, + logout, } }) diff --git a/src/views/BiliAuthView.vue b/src/views/BiliAuthView.vue index 7a8f9fd..f925496 100644 --- a/src/views/BiliAuthView.vue +++ b/src/views/BiliAuthView.vue @@ -21,6 +21,7 @@ import { NTimelineItem, NSteps, NStep, + NPopconfirm, } from 'naive-ui' import { computed, onMounted, ref } from 'vue' import { v4 as uuidv4 } from 'uuid' @@ -78,8 +79,8 @@ async function checkStatus() { clearInterval(timer.value) message.success('认证成功') - currentToken.value = data.data as string - useAuth.getAuthInfo() + guidKey.value = uuidv4() + useAuth.setCurrentAuth(data.data as string) currentStep.value = 2 @@ -194,8 +195,8 @@ onMounted(async () => { 前往个人中心 - { currentStep = 0 //@ts-ignore @@ -203,10 +204,13 @@ onMounted(async () => { guidKey = uuidv4() } " - type="warning" + positive-text="继续" > - 重新认证 - + + 这将会登出当前已认证的账号, 请先在认证其他账号前保存你的登陆链接 + diff --git a/src/views/pointViews/PointGoodsView.vue b/src/views/pointViews/PointGoodsView.vue index 51b0c4d..a20067d 100644 --- a/src/views/pointViews/PointGoodsView.vue +++ b/src/views/pointViews/PointGoodsView.vue @@ -164,11 +164,12 @@ function gotoAuthPage() { message.error('你尚未进行 Bilibili 认证, 请前往面板进行认证和绑定') return } - useAuthStore() + /*useAuthStore() .setCurrentAuth(accountInfo.value?.biliUserAuthInfo.token) .then(() => { NavigateToNewTab('/bili-user') - }) + })*/ + NavigateToNewTab('/bili-user') } onMounted(async () => { @@ -212,7 +213,13 @@ onMounted(async () => { {{ getTooltip(item) }} diff --git a/src/views/pointViews/PointUserLayout.vue b/src/views/pointViews/PointUserLayout.vue index 70e63c3..1df0757 100644 --- a/src/views/pointViews/PointUserLayout.vue +++ b/src/views/pointViews/PointUserLayout.vue @@ -124,8 +124,16 @@ onMounted(async () => {