mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-08 11:26:56 +08:00
songlist add import from file, partically complete point system
This commit is contained in:
@@ -1,26 +1,49 @@
|
||||
<script setup lang="ts">
|
||||
import { useAccount } from '@/api/account'
|
||||
import { BiliAuthCodeStatusType } from '@/api/api-models'
|
||||
import { BiliAuthCodeStatusType, BiliAuthModel } from '@/api/api-models'
|
||||
import { QueryGetAPI } from '@/api/query'
|
||||
import EventFetcherStatusCard from '@/components/EventFetcherStatusCard.vue'
|
||||
import { ACCOUNT_API_URL, TURNSTILE_KEY } from '@/data/constants'
|
||||
import { Mic24Filled, Question24Regular } from '@vicons/fluent'
|
||||
import { Info24Filled, Mic24Filled, Question24Regular } from '@vicons/fluent'
|
||||
import { useLocalStorage } from '@vueuse/core'
|
||||
import { NAlert, NButton, NCard, NCountdown, NDivider, NEllipsis, NIcon, NInput, NInputGroup, NModal, NPopconfirm, NSpace, NTag, NText, NTime, NTooltip, useLoadingBar, useMessage } from 'naive-ui'
|
||||
import {
|
||||
NAlert,
|
||||
NButton,
|
||||
NCard,
|
||||
NCode,
|
||||
NCountdown,
|
||||
NDivider,
|
||||
NEllipsis,
|
||||
NIcon,
|
||||
NInput,
|
||||
NInputGroup,
|
||||
NModal,
|
||||
NPopconfirm,
|
||||
NSpace,
|
||||
NTag,
|
||||
NText,
|
||||
NTime,
|
||||
NTooltip,
|
||||
useLoadingBar,
|
||||
useMessage,
|
||||
} from 'naive-ui'
|
||||
import { onUnmounted, ref } from 'vue'
|
||||
import VueTurnstile from 'vue-turnstile'
|
||||
import SettingsManageView from './SettingsManageView.vue'
|
||||
import { useAuthStore } from '@/store/useAuthStore'
|
||||
|
||||
const token = ref('')
|
||||
const turnstile = ref()
|
||||
|
||||
const accountInfo = useAccount()
|
||||
const useAuth = useAuthStore()
|
||||
const cookie = useLocalStorage('JWT_Token', '')
|
||||
const message = useMessage()
|
||||
|
||||
const resetEmailModalVisiable = ref(false)
|
||||
const resetPasswordModalVisiable = ref(false)
|
||||
const bindBiliCodeModalVisiable = ref(false)
|
||||
const bindBiliAuthModalVisiable = ref(false)
|
||||
const resetNameModalVisiable = ref(false)
|
||||
|
||||
const newEmailAddress = ref('')
|
||||
@@ -32,6 +55,7 @@ const newName = ref('')
|
||||
const newPassword = ref('')
|
||||
const newPassword2 = ref('')
|
||||
const biliCode = ref('')
|
||||
const biliAuthText = ref('')
|
||||
const isLoading = ref(false)
|
||||
|
||||
function logout() {
|
||||
@@ -43,7 +67,24 @@ function resetBili() {
|
||||
QueryGetAPI(ACCOUNT_API_URL + 'reset-bili')
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('已解绑 Bilibili 账号')
|
||||
message.success('已解绑 Bilibili 主播账号')
|
||||
setTimeout(() => {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
} else {
|
||||
message.error(data.message)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
message.error('发生错误')
|
||||
})
|
||||
}
|
||||
function resetBiliAuthBind() {
|
||||
isLoading.value = true
|
||||
QueryGetAPI(ACCOUNT_API_URL + 'reset-bili-auth')
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('已解绑 Bilibili 用户账号')
|
||||
setTimeout(() => {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
@@ -163,6 +204,30 @@ async function BindBili() {
|
||||
isLoading.value = false
|
||||
})
|
||||
}
|
||||
async function BindBiliAuth() {
|
||||
if (!biliAuthText.value) {
|
||||
message.error('认证链接不能为空')
|
||||
return
|
||||
}
|
||||
isLoading.value = true
|
||||
await QueryGetAPI<BiliAuthModel>(ACCOUNT_API_URL + 'bind-bili-auth', { token: biliAuthText.value })
|
||||
.then(async (data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('已绑定用户: ' + data.data.userId)
|
||||
setTimeout(() => {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
} else {
|
||||
message.error(data.message)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
message.error('发生错误')
|
||||
})
|
||||
.finally(() => {
|
||||
isLoading.value = false
|
||||
})
|
||||
}
|
||||
async function ChangeBili() {
|
||||
if (!biliCode.value) {
|
||||
message.error('身份码不能为空')
|
||||
@@ -235,13 +300,17 @@ onUnmounted(() => {
|
||||
</NSpace>
|
||||
</NCard>
|
||||
<NCard size="small">
|
||||
Bilibili 账户:
|
||||
主播 Bilibili 账户:
|
||||
<NEllipsis v-if="accountInfo?.isBiliVerified" style="max-width: 100%">
|
||||
<NText style="color: var(--primary-color)">
|
||||
<NSpace :size="5" align="center">
|
||||
已认证 | {{ accountInfo?.biliId }}
|
||||
<NTag v-if="accountInfo.biliAuthCodeStatus == BiliAuthCodeStatusType.Active" type="success" size="small" :bordered="false"> 身份码: 有效 </NTag>
|
||||
<NTag v-else-if="accountInfo.biliAuthCodeStatus == BiliAuthCodeStatusType.Inactive" type="error" size="small" :bordered="false"> 身份码: 需更新 </NTag>
|
||||
<NTag v-if="accountInfo.biliAuthCodeStatus == BiliAuthCodeStatusType.Active" type="success" size="small" :bordered="false">
|
||||
身份码: 有效
|
||||
</NTag>
|
||||
<NTag v-else-if="accountInfo.biliAuthCodeStatus == BiliAuthCodeStatusType.Inactive" type="error" size="small" :bordered="false">
|
||||
身份码: 需更新
|
||||
</NTag>
|
||||
<NTag v-else-if="accountInfo.biliAuthCodeStatus == BiliAuthCodeStatusType.Notfound" type="warning" size="small" :bordered="false">
|
||||
身份码: 需绑定
|
||||
<NTooltip>
|
||||
@@ -254,19 +323,56 @@ onUnmounted(() => {
|
||||
<NButton size="tiny" type="info" @click="bindBiliCodeModalVisiable = true"> 更新身份码 </NButton>
|
||||
<NPopconfirm @positive-click="resetBili">
|
||||
<template #trigger>
|
||||
<NButton size="tiny" type="error"> 解除绑定 </NButton>
|
||||
<NButton size="tiny" type="error"> 解除认证 </NButton>
|
||||
</template>
|
||||
确定解除绑定吗? 解绑后现有的数据跟踪数据将被删除并且无法恢复
|
||||
确定解除认证吗? 解除后现有的数据跟踪数据将被删除并且无法恢复
|
||||
</NPopconfirm>
|
||||
</NSpace>
|
||||
</NText>
|
||||
</NEllipsis>
|
||||
<template v-else>
|
||||
<NTag type="error" size="small"> 未认证 </NTag>
|
||||
<NTag type="error" size="small">
|
||||
未认证
|
||||
<NTooltip>
|
||||
<template #trigger>
|
||||
<NIcon :component="Info24Filled" />
|
||||
</template>
|
||||
如果你不是主播的话则不需要在意这个
|
||||
</NTooltip>
|
||||
</NTag>
|
||||
<NDivider vertical />
|
||||
<NButton size="small" @click="bindBiliCodeModalVisiable = true" type="info"> 进行绑定 </NButton>
|
||||
</template>
|
||||
</NCard>
|
||||
<NCard size="small" v-if="false">
|
||||
用户 Bilibili 账户:
|
||||
<NEllipsis v-if="accountInfo?.biliUserAuthInfo" style="max-width: 100%">
|
||||
<NText style="color: var(--primary-color)">
|
||||
<NSpace :size="5" align="center">
|
||||
已绑定 | {{ accountInfo?.biliUserAuthInfo?.name }} [{{ accountInfo?.biliUserAuthInfo?.userId }}]
|
||||
<NPopconfirm @positive-click="resetBiliAuthBind">
|
||||
<template #trigger>
|
||||
<NButton size="tiny" type="error"> 解除绑定 </NButton>
|
||||
</template>
|
||||
确定解除绑定吗?
|
||||
</NPopconfirm>
|
||||
</NSpace>
|
||||
</NText>
|
||||
</NEllipsis>
|
||||
<template v-else>
|
||||
<NTag type="error" size="small">
|
||||
未认证
|
||||
<NTooltip>
|
||||
<template #trigger>
|
||||
<NIcon :component="Info24Filled" />
|
||||
</template>
|
||||
用于进行积分兑换等操作
|
||||
</NTooltip>
|
||||
</NTag>
|
||||
<NDivider vertical />
|
||||
<NButton size="small" @click="bindBiliAuthModalVisiable = true" type="info"> 进行绑定 </NButton>
|
||||
</template>
|
||||
</NCard>
|
||||
<EventFetcherStatusCard />
|
||||
<NAlert title="Token" type="info">
|
||||
请注意保管, 这个东西可以完全操作你的账号
|
||||
@@ -345,5 +451,33 @@ onUnmounted(() => {
|
||||
<NButton @click="accountInfo?.isBiliVerified ? ChangeBili() : BindBili()" type="success" :loading="!token || isLoading"> 确定 </NButton>
|
||||
</template>
|
||||
</NModal>
|
||||
<NModal v-model:show="bindBiliAuthModalVisiable" preset="card" title="绑定用户账户" style="width: 700px; max-width: 90%">
|
||||
<NSpace vertical>
|
||||
<NAlert title="获取认证链接" type="info">
|
||||
因为部分功能如积分兑换等也需要对没有注册本站账户的用户开放, 所以需要现在另一个页面获取认证链接, 然后再回到这里绑定
|
||||
</NAlert>
|
||||
<NInputGroup>
|
||||
<NInput v-model:value="biliAuthText" placeholder="认证链接, 或者 Token" />
|
||||
<NTooltip>
|
||||
<template #trigger>
|
||||
<NButton type="primary" tag="a" href="/bili-auth" target="_blank">
|
||||
<template #icon>
|
||||
<NIcon>
|
||||
<Question24Regular />
|
||||
</NIcon>
|
||||
</template>
|
||||
前往获取
|
||||
</NButton>
|
||||
</template>
|
||||
直接粘贴认证完成后给出的类似
|
||||
<NCode> https://vtsuru.live/bili-user?auth=abcdefghijklmnopqrstuvwxyz== </NCode>
|
||||
的链接即可
|
||||
</NTooltip>
|
||||
</NInputGroup>
|
||||
</NSpace>
|
||||
<template #footer>
|
||||
<NButton @click="BindBiliAuth()" type="success" :loading="isLoading" :disabled="!biliAuthText"> 确定 </NButton>
|
||||
</template>
|
||||
</NModal>
|
||||
<VueTurnstile ref="turnstile" :site-key="TURNSTILE_KEY" v-model="token" theme="auto" style="text-align: center" />
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user