mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
improve point functions
This commit is contained in:
@@ -16,9 +16,12 @@ export enum IndexTypes {
|
|||||||
export enum SongListTypes {
|
export enum SongListTypes {
|
||||||
Default,
|
Default,
|
||||||
}
|
}
|
||||||
export interface UserInfo {
|
export interface UserBasicInfo {
|
||||||
name: string
|
name: string
|
||||||
id: number
|
id: number
|
||||||
|
isBiliAuthed: boolean
|
||||||
|
}
|
||||||
|
export interface UserInfo extends UserBasicInfo {
|
||||||
createAt: number
|
createAt: number
|
||||||
biliId?: number
|
biliId?: number
|
||||||
biliRoomId?: number
|
biliRoomId?: number
|
||||||
@@ -234,7 +237,7 @@ export enum FunctionTypes {
|
|||||||
SongRequest,
|
SongRequest,
|
||||||
Queue,
|
Queue,
|
||||||
Point,
|
Point,
|
||||||
VideoCollect
|
VideoCollect,
|
||||||
}
|
}
|
||||||
export interface SongAuthorInfo {
|
export interface SongAuthorInfo {
|
||||||
name: string
|
name: string
|
||||||
@@ -293,8 +296,8 @@ export interface NotifactionInfo {
|
|||||||
}
|
}
|
||||||
export interface QAInfo {
|
export interface QAInfo {
|
||||||
id: number
|
id: number
|
||||||
sender: UserInfo
|
sender: UserBasicInfo
|
||||||
target: UserInfo
|
target: UserBasicInfo
|
||||||
question: { message: string; image?: string }
|
question: { message: string; image?: string }
|
||||||
answer?: { message: string; image?: string }
|
answer?: { message: string; image?: string }
|
||||||
isReaded?: boolean
|
isReaded?: boolean
|
||||||
@@ -356,7 +359,7 @@ export interface VideoCollectTable {
|
|||||||
isFinish: boolean
|
isFinish: boolean
|
||||||
videoCount: number
|
videoCount: number
|
||||||
maxVideoCount: number
|
maxVideoCount: number
|
||||||
owner: UserInfo
|
owner: UserBasicInfo
|
||||||
}
|
}
|
||||||
export interface VideoCollectVideo {
|
export interface VideoCollectVideo {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@@ -70,7 +70,22 @@ const historyColumn: DataTableColumns<ResponsePointHisrotyModel> = [
|
|||||||
const get = () => {
|
const get = () => {
|
||||||
switch (row.from) {
|
switch (row.from) {
|
||||||
case PointFrom.Danmaku:
|
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:
|
case PointFrom.Manual:
|
||||||
return h(
|
return h(
|
||||||
NTag,
|
NTag,
|
||||||
@@ -95,17 +110,22 @@ const historyColumn: DataTableColumns<ResponsePointHisrotyModel> = [
|
|||||||
case EventDataTypes.Guard:
|
case EventDataTypes.Guard:
|
||||||
return h(NFlex, { justify: 'center', align: 'center' }, () => [
|
return h(NFlex, { justify: 'center', align: 'center' }, () => [
|
||||||
h(NTag, { type: 'error', size: 'small' }, () => '上舰'),
|
h(NTag, { type: 'error', size: 'small' }, () => '上舰'),
|
||||||
row.extra?.msg,
|
row.extra?.danmaku.msg,
|
||||||
])
|
])
|
||||||
case EventDataTypes.Gift:
|
case EventDataTypes.Gift:
|
||||||
return h(NFlex, { justify: 'center' }, () => [
|
return h(NFlex, { justify: 'center', align: 'center' }, () => [
|
||||||
h(NTag, { type: 'info', size: 'small', style: { margin: '0' } }, () => '礼物'),
|
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:
|
case EventDataTypes.SC:
|
||||||
return h(NFlex, { justify: 'center' }, () => [
|
return h(NFlex, { justify: 'center' }, () => [
|
||||||
h(NTag, { type: 'warning', size: 'small', style: { margin: '0' } }, () => 'SC'),
|
h(NTag, { type: 'warning', size: 'small', style: { margin: '0' } }, () => 'SC'),
|
||||||
row.extra?.price,
|
row.extra?.danmaku.price,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
case PointFrom.Manual:
|
case PointFrom.Manual:
|
||||||
|
|||||||
@@ -120,6 +120,12 @@ export const useAuthStore = defineStore('BiliAuth', () => {
|
|||||||
}
|
}
|
||||||
return []
|
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 {
|
return {
|
||||||
biliAuth,
|
biliAuth,
|
||||||
@@ -134,5 +140,6 @@ export const useAuthStore = defineStore('BiliAuth', () => {
|
|||||||
GetSpecificPoint,
|
GetSpecificPoint,
|
||||||
GetGoods,
|
GetGoods,
|
||||||
setCurrentAuth,
|
setCurrentAuth,
|
||||||
|
logout,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
NTimelineItem,
|
NTimelineItem,
|
||||||
NSteps,
|
NSteps,
|
||||||
NStep,
|
NStep,
|
||||||
|
NPopconfirm,
|
||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
@@ -78,8 +79,8 @@ async function checkStatus() {
|
|||||||
clearInterval(timer.value)
|
clearInterval(timer.value)
|
||||||
message.success('认证成功')
|
message.success('认证成功')
|
||||||
|
|
||||||
currentToken.value = data.data as string
|
guidKey.value = uuidv4()
|
||||||
useAuth.getAuthInfo()
|
useAuth.setCurrentAuth(data.data as string)
|
||||||
|
|
||||||
currentStep.value = 2
|
currentStep.value = 2
|
||||||
|
|
||||||
@@ -194,8 +195,8 @@ onMounted(async () => {
|
|||||||
</NInputGroup>
|
</NInputGroup>
|
||||||
<NFlex>
|
<NFlex>
|
||||||
<NButton @click="$router.push({ name: 'bili-user' })" type="primary"> 前往个人中心 </NButton>
|
<NButton @click="$router.push({ name: 'bili-user' })" type="primary"> 前往个人中心 </NButton>
|
||||||
<NButton
|
<NPopconfirm
|
||||||
@click="
|
@positive-click="
|
||||||
() => {
|
() => {
|
||||||
currentStep = 0
|
currentStep = 0
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
@@ -203,10 +204,13 @@ onMounted(async () => {
|
|||||||
guidKey = uuidv4()
|
guidKey = uuidv4()
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
type="warning"
|
positive-text="继续"
|
||||||
>
|
>
|
||||||
重新认证
|
<template #trigger>
|
||||||
</NButton>
|
<NButton type="warning"> 认证其他账号 </NButton>
|
||||||
|
</template>
|
||||||
|
这将会登出当前已认证的账号, 请先在认证其他账号前保存你的登陆链接
|
||||||
|
</NPopconfirm>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -164,11 +164,12 @@ function gotoAuthPage() {
|
|||||||
message.error('你尚未进行 Bilibili 认证, 请前往面板进行认证和绑定')
|
message.error('你尚未进行 Bilibili 认证, 请前往面板进行认证和绑定')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
useAuthStore()
|
/*useAuthStore()
|
||||||
.setCurrentAuth(accountInfo.value?.biliUserAuthInfo.token)
|
.setCurrentAuth(accountInfo.value?.biliUserAuthInfo.token)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
NavigateToNewTab('/bili-user')
|
NavigateToNewTab('/bili-user')
|
||||||
})
|
})*/
|
||||||
|
NavigateToNewTab('/bili-user')
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
@@ -212,7 +213,13 @@ onMounted(async () => {
|
|||||||
<NFlex justify="space-between" align="center">
|
<NFlex justify="space-between" align="center">
|
||||||
<NTooltip>
|
<NTooltip>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<NButton :disabled="getTooltip(item) != '开始兑换'" size="small" type="primary" @click="onBuyClick(item)">兑换</NButton>
|
<NButton
|
||||||
|
:disabled="getTooltip(item) != '开始兑换'"
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
@click="onBuyClick(item)"
|
||||||
|
>兑换</NButton
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
{{ getTooltip(item) }}
|
{{ getTooltip(item) }}
|
||||||
</NTooltip>
|
</NTooltip>
|
||||||
|
|||||||
@@ -124,8 +124,16 @@ onMounted(async () => {
|
|||||||
<template>
|
<template>
|
||||||
<NLayout>
|
<NLayout>
|
||||||
<NSpin v-if="!biliAuth.id && useAuth.currentToken" :show="useAuth.isLoading" />
|
<NSpin v-if="!biliAuth.id && useAuth.currentToken" :show="useAuth.isLoading" />
|
||||||
<NLayoutContent v-else-if="!useAuth.currentToken && useAuth.biliTokens.length > 0" style="height: 100vh">
|
<NLayoutContent
|
||||||
|
v-else-if="!useAuth.currentToken && useAuth.biliTokens.length > 0"
|
||||||
|
style="height: 100vh; padding: 50px"
|
||||||
|
>
|
||||||
<NCard title="选择B站账号" embedded>
|
<NCard title="选择B站账号" embedded>
|
||||||
|
<template #header-extra>
|
||||||
|
<NButton type="primary" @click="$router.push({ name: 'bili-auth' })" size="small" secondary
|
||||||
|
>认证其他账号</NButton
|
||||||
|
>
|
||||||
|
</template>
|
||||||
<NList clickable bordered>
|
<NList clickable bordered>
|
||||||
<NListItem v-for="item in useAuth.biliTokens" :key="item.token" @click="switchAuth(item.token)">
|
<NListItem v-for="item in useAuth.biliTokens" :key="item.token" @click="switchAuth(item.token)">
|
||||||
<NFlex align="center"> {{ item.name }} - {{ item.uId }} </NFlex>
|
<NFlex align="center"> {{ item.name }} - {{ item.uId }} </NFlex>
|
||||||
@@ -151,12 +159,15 @@ onMounted(async () => {
|
|||||||
<div style="max-width: 95vw; width: 900px">
|
<div style="max-width: 95vw; width: 900px">
|
||||||
<NCard title="我的信息">
|
<NCard title="我的信息">
|
||||||
<NDescriptions label-placement="left" bordered size="small">
|
<NDescriptions label-placement="left" bordered size="small">
|
||||||
<NDescriptionsItem label="OpenId">
|
<NDescriptionsItem label="用户名">
|
||||||
{{ biliAuth.openId }}
|
{{ biliAuth.name ?? '未知' }}
|
||||||
</NDescriptionsItem>
|
</NDescriptionsItem>
|
||||||
<NDescriptionsItem label="UserId">
|
<NDescriptionsItem label="UserId">
|
||||||
{{ biliAuth.userId }}
|
{{ biliAuth.userId }}
|
||||||
</NDescriptionsItem>
|
</NDescriptionsItem>
|
||||||
|
<NDescriptionsItem label="OpenId">
|
||||||
|
{{ biliAuth.openId }}
|
||||||
|
</NDescriptionsItem>
|
||||||
</NDescriptions>
|
</NDescriptions>
|
||||||
</NCard>
|
</NCard>
|
||||||
<NDivider />
|
<NDivider />
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ NScrollbar,
|
|||||||
NSelect,
|
NSelect,
|
||||||
NSpin,
|
NSpin,
|
||||||
NTag,
|
NTag,
|
||||||
useMessage
|
useMessage,
|
||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
//@ts-expect-error 导入有点问题
|
//@ts-expect-error 导入有点问题
|
||||||
@@ -223,6 +223,10 @@ function switchAuth(token: string) {
|
|||||||
useAuth.setCurrentAuth(token)
|
useAuth.setCurrentAuth(token)
|
||||||
message.success('已切换账号')
|
message.success('已切换账号')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function logout() {
|
||||||
|
useAuth.logout()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -261,9 +265,20 @@ function switchAuth(token: string) {
|
|||||||
</NList>
|
</NList>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</NCollapseItem>
|
</NCollapseItem>
|
||||||
|
<NCollapseItem title="登录链接" name="2">
|
||||||
|
<NInput type="textarea" :value="'https://vtsuru.live/bili-user?auth=' + useAuth.biliToken" readonly />
|
||||||
|
</NCollapseItem>
|
||||||
</NCollapse>
|
</NCollapse>
|
||||||
</NCard>
|
</NCard>
|
||||||
<NCard title="账号操作" embedded>
|
<NCard title="账号操作" embedded>
|
||||||
|
<NFlex>
|
||||||
|
<NPopconfirm @positive-click="logout">
|
||||||
|
<template #trigger>
|
||||||
|
<NButton type="warning" size="small"> 登出 </NButton>
|
||||||
|
</template>
|
||||||
|
确定要登出吗?
|
||||||
|
</NPopconfirm>
|
||||||
|
</NFlex>
|
||||||
<NDivider> 切换账号 </NDivider>
|
<NDivider> 切换账号 </NDivider>
|
||||||
<NList clickable bordered>
|
<NList clickable bordered>
|
||||||
<NListItem v-for="item in useAuth.biliTokens" :key="item.token" @click="switchAuth(item.token)">
|
<NListItem v-for="item in useAuth.biliTokens" :key="item.token" @click="switchAuth(item.token)">
|
||||||
|
|||||||
Reference in New Issue
Block a user