From 2f9d9366c8bcc91c815b873fd595418614bcab9d Mon Sep 17 00:00:00 2001 From: Megghy Date: Fri, 17 Nov 2023 22:18:27 +0800 Subject: [PATCH] add not connect alert --- index.html | 4 +- src/api/account.ts | 3 + src/api/api-models.ts | 53 +++- src/data/constants.ts | 2 + src/data/notifactions.ts | 4 +- src/views/OpenLiveLayout.vue | 16 +- src/views/manage/SettingsManageView.vue | 6 +- src/views/open_live/MusicRequest.vue | 225 ++++++++++++++- src/views/open_live/OpenLottery.vue | 361 ++++++++++++------------ 9 files changed, 468 insertions(+), 206 deletions(-) diff --git a/index.html b/index.html index f6e5246..ccec625 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,9 @@ vtsuru.live - + + + diff --git a/src/api/account.ts b/src/api/account.ts index 6680014..28fb99a 100644 --- a/src/api/account.ts +++ b/src/api/account.ts @@ -47,6 +47,9 @@ function refreshCookie() { } }) } +export async function SaveAccountSettings() { + return await QueryPostAPI(ACCOUNT_API_URL + 'update-setting', ACCOUNT.value?.settings) +} export function useAccount() { return ACCOUNT } diff --git a/src/api/api-models.ts b/src/api/api-models.ts index 32e56de..5f0dee3 100644 --- a/src/api/api-models.ts +++ b/src/api/api-models.ts @@ -60,16 +60,38 @@ export interface Setting_QuestionBox { export interface UserSetting { sendEmail: Setting_SendEmail questionBox: Setting_QuestionBox + songRequest: Setting_SongRequest enableFunctions: FunctionTypes[] indexTemplate: string | null, songListTemplate: string | null scheduleTemplate: string | null } +export interface Setting_SongRequest { + orderPrefix: string + onlyAllowSongList: boolean + queueMaxSize: number + allowAllDanmaku: boolean + allowFromWeb: boolean + needWearFanMedal: boolean + needJianzhang: boolean + needTidu: boolean + needZongdu: boolean + allowSC: boolean + sCIgnoreLimit: boolean + sCMinPrice: number + fanMedalMinLevel: number + allowReorderSong: boolean + cooldownSecond: number + zongduCooldownSecond: number + tiduCooldownSecond: number + jianzhangCooldownSecond: number +} export enum FunctionTypes { SongList, QuestionBox, Schedule, + SongRequest, } export interface SongAuthorInfo { name: string @@ -257,6 +279,7 @@ export interface UpdateLiveLotteryUsersModel { type: OpenLiveLotteryType } export interface SongRequestInfo { + id: number songName: string song?: SongsInfo status: SongRequestStatus @@ -267,11 +290,11 @@ export interface SongRequestInfo { } export interface SongRequestUserInfo { name: string - uId: number - guardLevel: number - fansMedalLevel: number - fansMedalName: string - fansMedalWearingStatus: boolean + uid: number + guard_level: number + fans_medal_level: number + fans_medal_name: string + fans_medal_wearing_status: boolean } export enum SongRequestFrom { @@ -286,4 +309,24 @@ export enum SongRequestStatus { Singing, Finish, Cancel, +} +export interface EventModel { + type: EventDataTypes + name: string + avatar: string + uid: number + msg: string + time: number + num: number + price: number + guard_level: number + fans_medal_level: number + fans_medal_name: string + fans_medal_wearing_status: boolean +} +export enum EventDataTypes { + Guard, + SC, + Gift, + Message, } \ No newline at end of file diff --git a/src/data/constants.ts b/src/data/constants.ts index e541e04..1a5027f 100644 --- a/src/data/constants.ts +++ b/src/data/constants.ts @@ -23,6 +23,8 @@ export const HISTORY_API_URL = `${BASE_API}history/` export const SCHEDULE_API_URL = `${BASE_API}schedule/` export const VIDEO_COLLECT_API_URL = `${BASE_API}video-collect/` export const OPEN_LIVE_API_URL = `${BASE_API}open-live/` +export const SONG_REQUEST_API_URL = `${BASE_API}song-request/` +export const EVENT_API_URL = `${BASE_API}event/` export const ScheduleTemplateMap = { '': { name: '默认', compoent: defineAsyncComponent(() => import('@/views/view/scheduleTemplate/DefaultScheduleTemplate.vue')) }, diff --git a/src/data/notifactions.ts b/src/data/notifactions.ts index 4f36b45..21eba69 100644 --- a/src/data/notifactions.ts +++ b/src/data/notifactions.ts @@ -1,6 +1,6 @@ import { QueryGetAPI } from '@/api/query' import { useRequest } from 'vue-request' -import { NOTIFACTION_API_URL, isBackendUsable } from './constants' +import { NOTIFACTION_API_URL, SONG_REQUEST_API_URL, isBackendUsable } from './constants' import { NotifactionInfo } from '@/api/api-models' import { useAccount } from '@/api/account' import { ref } from 'vue' @@ -10,7 +10,7 @@ const n = ref() let isLoading = false function get() { if (isLoading) return - QueryGetAPI(NOTIFACTION_API_URL + 'get') + QueryGetAPI(SONG_REQUEST_API_URL + 'get-active') .then((data) => { if (data.code == 200) { n.value = data.data diff --git a/src/views/OpenLiveLayout.vue b/src/views/OpenLiveLayout.vue index 48ea756..77dbd35 100644 --- a/src/views/OpenLiveLayout.vue +++ b/src/views/OpenLiveLayout.vue @@ -29,8 +29,9 @@ import { useMessage, NDivider, NTag, +NAlert, } from 'naive-ui' -import { ref, onMounted, h } from 'vue' +import { ref, onMounted, h, onUnmounted } from 'vue' import { RouterLink, useRoute } from 'vue-router' const route = useRoute() @@ -89,6 +90,9 @@ onMounted(async () => { message.error('你不是从幻星平台访问此页面, 或未提供对应参数, 无法使用此功能') } }) +onUnmounted(() => { + client.value?.Stop() +})