mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
update url, improve queue and songrequest
This commit is contained in:
@@ -18,7 +18,7 @@ const roomId = ref()
|
||||
const timer = ref()
|
||||
|
||||
function onStartVerify() {
|
||||
QueryGetAPI(BILI_API_URL() + 'verify', {
|
||||
QueryGetAPI(BILI_API_URL + 'verify', {
|
||||
uId: uId.value,
|
||||
}).then((data) => {
|
||||
if (data.code == 200) {
|
||||
@@ -34,7 +34,7 @@ async function checkStatus() {
|
||||
uId: number
|
||||
roomId: number
|
||||
endTime: number
|
||||
}>(BILI_API_URL() + 'status')
|
||||
}>(BILI_API_URL + 'status')
|
||||
if (data.code == 200) {
|
||||
//正在进行认证
|
||||
roomId.value ??= data.data.roomId
|
||||
|
||||
@@ -11,7 +11,7 @@ import VueTurnstile from 'vue-turnstile'
|
||||
import { BiliAuthCodeStatusType } from '@/api/api-models'
|
||||
import EventFetcherStatusCard from '@/components/EventFetcherStatusCard.vue'
|
||||
|
||||
const token = ref()
|
||||
const token = ref('')
|
||||
const turnstile = ref()
|
||||
|
||||
const accountInfo = useAccount()
|
||||
@@ -38,7 +38,7 @@ function logout() {
|
||||
}
|
||||
function resetBili() {
|
||||
isLoading.value = true
|
||||
QueryGetAPI(ACCOUNT_API_URL() + 'reset-bili')
|
||||
QueryGetAPI(ACCOUNT_API_URL + 'reset-bili')
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('已解绑 Bilibili 账号')
|
||||
@@ -55,7 +55,7 @@ function resetBili() {
|
||||
}
|
||||
function resetEmail() {
|
||||
isLoading.value = true
|
||||
QueryGetAPI(ACCOUNT_API_URL() + 'reset-email', { email: newEmailAddress.value, code: newEmailVerifyCode.value })
|
||||
QueryGetAPI(ACCOUNT_API_URL + 'reset-email', { email: newEmailAddress.value, code: newEmailVerifyCode.value })
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('已将邮箱改绑为 ' + newEmailAddress.value)
|
||||
@@ -71,7 +71,7 @@ function resetEmail() {
|
||||
})
|
||||
}
|
||||
function sendEmailVerifyCode() {
|
||||
QueryGetAPI(ACCOUNT_API_URL() + 'reset-email/code', { email: newEmailAddress.value })
|
||||
QueryGetAPI(ACCOUNT_API_URL + 'reset-email/code', { email: newEmailAddress.value })
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('发送成功, 请检查目标邮箱. 如果没有收到, 请检查垃圾邮件')
|
||||
@@ -92,7 +92,7 @@ async function resetPassword() {
|
||||
message.error('两次密码不一致')
|
||||
return
|
||||
}
|
||||
await QueryGetAPI(ACCOUNT_API_URL() + 'verify/reset-password', { password: newPassword.value })
|
||||
await QueryGetAPI(ACCOUNT_API_URL + 'verify/reset-password', { password: newPassword.value })
|
||||
.then(async (data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('密码已修改')
|
||||
@@ -118,7 +118,7 @@ async function BindBili() {
|
||||
uid: number
|
||||
uface: string
|
||||
room_id: number
|
||||
}>(ACCOUNT_API_URL() + 'bind-bili', { code: biliCode.value }, [['Turnstile', token.value]])
|
||||
}>(ACCOUNT_API_URL + 'bind-bili', { code: biliCode.value }, [['Turnstile', token.value]])
|
||||
.then(async (data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('已绑定, 如无特殊情况请勿刷新身份码, 如果刷新了且还需要使用本站直播相关功能请更新身份码')
|
||||
@@ -148,7 +148,7 @@ async function ChangeBili() {
|
||||
uid: number
|
||||
uface: string
|
||||
room_id: number
|
||||
}>(ACCOUNT_API_URL() + 'change-bili', { code: biliCode.value }, [['Turnstile', token.value]])
|
||||
}>(ACCOUNT_API_URL + 'change-bili', { code: biliCode.value }, [['Turnstile', token.value]])
|
||||
.then(async (data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('已更新身份码')
|
||||
|
||||
@@ -32,7 +32,7 @@ async function getFansHistory() {
|
||||
time: number
|
||||
count: number
|
||||
}[]
|
||||
>(HISTORY_API_URL() + 'fans')
|
||||
>(HISTORY_API_URL + 'fans')
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
fansHistory.value = data.data
|
||||
@@ -50,7 +50,7 @@ async function getGuardsHistory() {
|
||||
time: number
|
||||
count: number
|
||||
}[]
|
||||
>(HISTORY_API_URL() + 'guards')
|
||||
>(HISTORY_API_URL + 'guards')
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
guardHistory.value = data.data
|
||||
@@ -71,7 +71,7 @@ async function getUpstatHistory() {
|
||||
likes: number
|
||||
}
|
||||
}[]
|
||||
>(HISTORY_API_URL() + 'upstat')
|
||||
>(HISTORY_API_URL + 'upstat')
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
upstatHistory.value = data.data
|
||||
|
||||
@@ -22,7 +22,7 @@ const liveInfo = ref<ResponseLiveDetail | undefined>(await get())
|
||||
|
||||
async function get() {
|
||||
try {
|
||||
const data = await QueryGetAPI<ResponseLiveDetail>(LIVE_API_URL() + 'get', {
|
||||
const data = await QueryGetAPI<ResponseLiveDetail>(LIVE_API_URL + 'get', {
|
||||
id: route.params.id,
|
||||
useEmoji: true,
|
||||
})
|
||||
|
||||
@@ -21,7 +21,7 @@ const defaultDanmakusCount = ref(0)
|
||||
|
||||
async function getAll() {
|
||||
try {
|
||||
const data = await QueryGetAPI<ResponseLiveInfoModel[]>(LIVE_API_URL() + 'get-all')
|
||||
const data = await QueryGetAPI<ResponseLiveInfoModel[]>(LIVE_API_URL + 'get-all')
|
||||
if (data.code == 200) {
|
||||
return data.data
|
||||
} else {
|
||||
|
||||
@@ -66,7 +66,7 @@ const shareUrl = computed(() => 'https://vtsuru.live/user/' + accountInfo.value?
|
||||
|
||||
async function GetRecieveQAInfo() {
|
||||
isLoading.value = true
|
||||
await QueryGetAPI<QAInfo[]>(QUESTION_API_URL() + 'get-recieve')
|
||||
await QueryGetAPI<QAInfo[]>(QUESTION_API_URL + 'get-recieve')
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
if (data.data.length > 0) {
|
||||
@@ -91,7 +91,7 @@ async function GetRecieveQAInfo() {
|
||||
}
|
||||
async function GetSendQAInfo() {
|
||||
isLoading.value = true
|
||||
await QueryGetAPI<QAInfo[]>(QUESTION_API_URL() + 'get-send')
|
||||
await QueryGetAPI<QAInfo[]>(QUESTION_API_URL + 'get-send')
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
sendQuestions.value = data.data
|
||||
@@ -109,7 +109,7 @@ async function GetSendQAInfo() {
|
||||
}
|
||||
async function reply() {
|
||||
isRepling.value = true
|
||||
await QueryPostAPI<QAInfo>(QUESTION_API_URL() + 'reply', {
|
||||
await QueryPostAPI<QAInfo>(QUESTION_API_URL + 'reply', {
|
||||
Id: currentQuestion.value?.id,
|
||||
Message: replyMessage.value,
|
||||
})
|
||||
@@ -134,7 +134,7 @@ async function reply() {
|
||||
})
|
||||
}
|
||||
async function read(question: QAInfo, read: boolean) {
|
||||
await QueryGetAPI(QUESTION_API_URL() + 'read', {
|
||||
await QueryGetAPI(QUESTION_API_URL + 'read', {
|
||||
id: question.id,
|
||||
read: read ? 'true' : 'false',
|
||||
})
|
||||
@@ -150,7 +150,7 @@ async function read(question: QAInfo, read: boolean) {
|
||||
})
|
||||
}
|
||||
async function favorite(question: QAInfo, fav: boolean) {
|
||||
await QueryGetAPI(QUESTION_API_URL() + 'favorite', {
|
||||
await QueryGetAPI(QUESTION_API_URL + 'favorite', {
|
||||
id: question.id,
|
||||
favorite: fav,
|
||||
})
|
||||
@@ -167,7 +167,7 @@ async function favorite(question: QAInfo, fav: boolean) {
|
||||
}
|
||||
async function setPublic(pub: boolean) {
|
||||
isChangingPublic.value = true
|
||||
await QueryGetAPI(QUESTION_API_URL() + 'public', {
|
||||
await QueryGetAPI(QUESTION_API_URL + 'public', {
|
||||
id: currentQuestion.value?.id,
|
||||
public: pub,
|
||||
})
|
||||
@@ -187,12 +187,12 @@ async function setPublic(pub: boolean) {
|
||||
})
|
||||
}
|
||||
async function blacklist(question: QAInfo) {
|
||||
await QueryGetAPI(ACCOUNT_API_URL() + 'black-list/add', {
|
||||
await QueryGetAPI(ACCOUNT_API_URL + 'black-list/add', {
|
||||
id: question.sender.id,
|
||||
})
|
||||
.then(async (data) => {
|
||||
if (data.code == 200) {
|
||||
await QueryGetAPI(QUESTION_API_URL() + 'del', {
|
||||
await QueryGetAPI(QUESTION_API_URL + 'del', {
|
||||
id: question.id,
|
||||
}).then((data) => {
|
||||
if (data.code == 200) {
|
||||
|
||||
@@ -119,7 +119,7 @@ const selectedScheduleWeek = ref(Number(format(Date.now(), 'w')) + 1)
|
||||
|
||||
async function get() {
|
||||
isLoading.value = true
|
||||
await QueryGetAPI<ScheduleWeekInfo[]>(SCHEDULE_API_URL() + 'get', {
|
||||
await QueryGetAPI<ScheduleWeekInfo[]>(SCHEDULE_API_URL + 'get', {
|
||||
id: accountInfo.value?.id ?? -1,
|
||||
})
|
||||
.then((data) => {
|
||||
@@ -137,7 +137,7 @@ async function get() {
|
||||
const isFetching = ref(false)
|
||||
async function addSchedule() {
|
||||
isFetching.value = true
|
||||
await QueryPostAPI(SCHEDULE_API_URL() + 'update', {
|
||||
await QueryPostAPI(SCHEDULE_API_URL + 'update', {
|
||||
year: selectedScheduleYear.value,
|
||||
week: selectedScheduleWeek.value,
|
||||
})
|
||||
@@ -166,7 +166,7 @@ async function onCopySchedule() {
|
||||
}
|
||||
async function onUpdateSchedule() {
|
||||
isFetching.value = true
|
||||
await QueryPostAPI(SCHEDULE_API_URL() + 'update', {
|
||||
await QueryPostAPI(SCHEDULE_API_URL + 'update', {
|
||||
year: updateScheduleModel.value.year,
|
||||
week: updateScheduleModel.value.week,
|
||||
day: selectedDay.value,
|
||||
@@ -191,7 +191,7 @@ async function onUpdateSchedule() {
|
||||
})
|
||||
}
|
||||
async function onDeleteSchedule(schedule: ScheduleWeekInfo) {
|
||||
await QueryGetAPI(SCHEDULE_API_URL() + 'del', {
|
||||
await QueryGetAPI(SCHEDULE_API_URL + 'del', {
|
||||
year: schedule.year,
|
||||
week: schedule.week,
|
||||
}).then((data) => {
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import { SaveAccountSettings, SaveEnableFunctions, useAccount } from '@/api/account'
|
||||
import { NButton, NCard, NCheckbox, NCheckboxGroup, NDivider, NForm, NModal, NSelect, NSpace, NSpin, NSwitch, NTabPane, NTabs, SelectOption, useMessage } from 'naive-ui'
|
||||
import { DelBiliBlackList, SaveAccountSettings, SaveEnableFunctions, useAccount } from '@/api/account'
|
||||
import {
|
||||
NButton,
|
||||
NCard,
|
||||
NCheckbox,
|
||||
NCheckboxGroup,
|
||||
NDivider,
|
||||
NEmpty,
|
||||
NForm,
|
||||
NList,
|
||||
NListItem,
|
||||
NModal,
|
||||
NSelect,
|
||||
NSpace,
|
||||
NSpin,
|
||||
NSwitch,
|
||||
NTabPane,
|
||||
NTabs,
|
||||
NText,
|
||||
SelectOption,
|
||||
useMessage,
|
||||
} from 'naive-ui'
|
||||
import { Ref, computed, h, onMounted, ref, defineAsyncComponent, onActivated } from 'vue'
|
||||
import { FunctionTypes, ScheduleWeekInfo, SongFrom, SongLanguage, SongRequestOption, SongsInfo } from '@/api/api-models'
|
||||
import { QueryPostAPI } from '@/api/query'
|
||||
@@ -124,7 +144,7 @@ const templates = {
|
||||
scMinPrice: 30,
|
||||
fanMedalMinLevel: 5,
|
||||
needJianzhang: true,
|
||||
} as SongRequestOption
|
||||
} as SongRequestOption,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
@@ -190,15 +210,14 @@ const biliUserInfo = ref()
|
||||
const settingModalVisiable = ref(false)
|
||||
|
||||
async function RequestBiliUserData() {
|
||||
await fetch(FETCH_API + `https://account.bilibili.com/api/member/getCardByMid?mid=10021741`)
|
||||
.then(async (respone) => {
|
||||
let data = await respone.json()
|
||||
if (data.code == 0) {
|
||||
biliUserInfo.value = data.card
|
||||
} else {
|
||||
throw new Error('Bili User API Error: ' + data.message)
|
||||
}
|
||||
})
|
||||
await fetch(FETCH_API + `https://account.bilibili.com/api/member/getCardByMid?mid=10021741`).then(async (respone) => {
|
||||
let data = await respone.json()
|
||||
if (data.code == 0) {
|
||||
biliUserInfo.value = data.card
|
||||
} else {
|
||||
throw new Error('Bili User API Error: ' + data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
async function SaveComboGroupSetting(value: (string | number)[], meta: { actionType: 'check' | 'uncheck'; value: string | number }) {
|
||||
if (accountInfo.value) {
|
||||
@@ -268,6 +287,24 @@ function onOpenTemplateSettings() {
|
||||
const buttonGroup = computed(() => {
|
||||
return h(NSpace, () => [h(NButton, { type: 'primary', onClick: () => SaveTemplateSetting() }, () => '设为展示模板'), h(NButton, { type: 'info', onClick: onOpenTemplateSettings }, () => '模板设置')])
|
||||
})
|
||||
|
||||
function unblockUser(id: number) {
|
||||
DelBiliBlackList(id)
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success(`[${id}] 已移除黑名单`)
|
||||
if (accountInfo.value) {
|
||||
delete accountInfo.value.biliBlackList[id]
|
||||
}
|
||||
} else {
|
||||
message.error(data.message)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
message.error(err)
|
||||
})
|
||||
}
|
||||
|
||||
onActivated(() => {
|
||||
if (route.query.tab) {
|
||||
selectedTab.value = route.query.tab.toString()
|
||||
@@ -304,6 +341,22 @@ onMounted(async () => {
|
||||
<NCheckbox v-model:checked="accountInfo.settings.questionBox.allowUnregistedUser" @update:checked="SaveComboSetting"> 允许未注册用户提问 </NCheckbox>
|
||||
</NSpace>
|
||||
</NTabPane>
|
||||
<NTabPane tab="黑名单" name="blacklist">
|
||||
<NList v-if="accountInfo.biliBlackList && Object.keys(accountInfo.biliBlackList).length > 0">
|
||||
<NListItem v-for="item in Object.entries(accountInfo.biliBlackList)" :key="item[0]">
|
||||
<NSpace align="center">
|
||||
<NText>
|
||||
{{ item[1] }}
|
||||
</NText>
|
||||
<NText depth="3">
|
||||
{{ item[0] }}
|
||||
</NText>
|
||||
<NButton type="error" @click="unblockUser(Number(item[0]))" size="small"> 移除 </NButton>
|
||||
</NSpace>
|
||||
</NListItem>
|
||||
</NList>
|
||||
<NEmpty v-else />
|
||||
</NTabPane>
|
||||
<NTabPane tab="模板" name="template">
|
||||
<NSpace vertical>
|
||||
<NSpace align="center"> 页面 <NSelect :options="templateOptions" v-model:value="selectedOption" style="width: 150px" /> </NSpace>
|
||||
|
||||
@@ -239,7 +239,7 @@ async function addSongs(songsShoudAdd: SongsInfo[], from: SongFrom) {
|
||||
|
||||
async function getNeteaseSongList() {
|
||||
isModalLoading.value = true
|
||||
await QueryGetAPI<SongsInfo[]>(SONG_API_URL() + 'get-netease-list', {
|
||||
await QueryGetAPI<SongsInfo[]>(SONG_API_URL + 'get-netease-list', {
|
||||
id: neteaseSongListId.value,
|
||||
})
|
||||
.then((data) => {
|
||||
@@ -329,7 +329,7 @@ async function getFivesingSongUrl(song: SongsInfo): Promise<string> {
|
||||
const isLoading = ref(true)
|
||||
async function getSongs() {
|
||||
isLoading.value = true
|
||||
await QueryGetAPI<any>(SONG_API_URL() + 'get', {
|
||||
await QueryGetAPI<any>(SONG_API_URL + 'get', {
|
||||
id: accountInfo.value?.id,
|
||||
})
|
||||
.then((data) => {
|
||||
|
||||
@@ -108,7 +108,7 @@ const acceptVideos = computed(() => {
|
||||
|
||||
async function getData() {
|
||||
try {
|
||||
const data = await QueryGetAPI<VideoCollectDetail>(VIDEO_COLLECT_API_URL() + 'get', { id: route.params.id })
|
||||
const data = await QueryGetAPI<VideoCollectDetail>(VIDEO_COLLECT_API_URL + 'get', { id: route.params.id })
|
||||
if (data.code == 200) {
|
||||
updateModel.value = {
|
||||
id: data.data.table.id,
|
||||
@@ -200,7 +200,7 @@ const rejectButtonGroup = (v: VideoInfo) =>
|
||||
])
|
||||
function setStatus(status: VideoStatus, video: VideoInfo) {
|
||||
isLoading.value = true
|
||||
QueryGetAPI(VIDEO_COLLECT_API_URL() + 'set-status', {
|
||||
QueryGetAPI(VIDEO_COLLECT_API_URL + 'set-status', {
|
||||
id: videoDetail.value.table.id,
|
||||
bvid: video.bvid,
|
||||
status: status,
|
||||
@@ -235,7 +235,7 @@ function dateDisabled(ts: number) {
|
||||
function updateTable() {
|
||||
isLoading.value = true
|
||||
updateModel.value.id = videoDetail.value.table.id
|
||||
QueryPostAPI<VideoCollectTable>(VIDEO_COLLECT_API_URL() + 'update', updateModel.value)
|
||||
QueryPostAPI<VideoCollectTable>(VIDEO_COLLECT_API_URL + 'update', updateModel.value)
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('更新成功')
|
||||
@@ -253,7 +253,7 @@ function updateTable() {
|
||||
}
|
||||
function deleteTable() {
|
||||
isLoading.value = true
|
||||
QueryGetAPI(VIDEO_COLLECT_API_URL() + 'del', {
|
||||
QueryGetAPI(VIDEO_COLLECT_API_URL + 'del', {
|
||||
id: videoDetail.value.table.id,
|
||||
})
|
||||
.then((data) => {
|
||||
@@ -275,7 +275,7 @@ function deleteTable() {
|
||||
}
|
||||
function closeTable() {
|
||||
isLoading.value = true
|
||||
QueryGetAPI(VIDEO_COLLECT_API_URL() + 'finish', {
|
||||
QueryGetAPI(VIDEO_COLLECT_API_URL + 'finish', {
|
||||
id: videoDetail.value.table.id,
|
||||
finish: !videoDetail.value.table.isFinish,
|
||||
})
|
||||
|
||||
@@ -94,7 +94,7 @@ const isLoading2 = ref(false)
|
||||
async function get() {
|
||||
try {
|
||||
isLoading.value = true
|
||||
const data = await QueryGetAPI<VideoCollectTable[]>(VIDEO_COLLECT_API_URL() + 'get-all')
|
||||
const data = await QueryGetAPI<VideoCollectTable[]>(VIDEO_COLLECT_API_URL + 'get-all')
|
||||
if (data.code == 200) {
|
||||
//videoTables.value = data.data
|
||||
return data.data
|
||||
@@ -112,7 +112,7 @@ async function get() {
|
||||
function createTable() {
|
||||
formRef.value?.validate().then(async () => {
|
||||
isLoading2.value = true
|
||||
QueryPostAPI<VideoCollectTable>(VIDEO_COLLECT_API_URL() + 'create', createVideoModel.value)
|
||||
QueryPostAPI<VideoCollectTable>(VIDEO_COLLECT_API_URL + 'create', createVideoModel.value)
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
videoTables.value.push(data.data)
|
||||
|
||||
Reference in New Issue
Block a user