mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
update vef alert
This commit is contained in:
@@ -147,3 +147,50 @@ export async function UploadConfig(name: string, data: unknown) {
|
||||
}
|
||||
return false
|
||||
}
|
||||
export async function EnableFunction(func: FunctionTypes) {
|
||||
if (ACCOUNT.value) {
|
||||
if (ACCOUNT.value.settings.enableFunctions.includes(func)) {
|
||||
return true
|
||||
} else {
|
||||
ACCOUNT.value.settings.enableFunctions.push(func)
|
||||
if (await updateFunctionEnable()) {
|
||||
return true
|
||||
} else {
|
||||
ACCOUNT.value.settings.enableFunctions.splice(ACCOUNT.value.settings.enableFunctions.indexOf(func), 1)
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
export async function DisableFunction(func: FunctionTypes) {
|
||||
if (ACCOUNT.value) {
|
||||
if (!ACCOUNT.value.settings.enableFunctions.includes(func)) {
|
||||
return true
|
||||
} else {
|
||||
ACCOUNT.value.settings.enableFunctions.splice(ACCOUNT.value.settings.enableFunctions.indexOf(func), 1)
|
||||
if (await updateFunctionEnable()) {
|
||||
return true
|
||||
} else {
|
||||
ACCOUNT.value.settings.enableFunctions.push(func)
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
async function updateFunctionEnable() {
|
||||
if (ACCOUNT.value) {
|
||||
try {
|
||||
const data = await SaveEnableFunctions(ACCOUNT.value.settings.enableFunctions)
|
||||
if (data.code == 200) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@ export enum FunctionTypes {
|
||||
Schedule,
|
||||
SongRequest,
|
||||
Queue,
|
||||
Point
|
||||
}
|
||||
export interface SongAuthorInfo {
|
||||
name: string
|
||||
@@ -499,3 +500,29 @@ export enum FeedbackStatus {
|
||||
Reject,
|
||||
Developing,
|
||||
}
|
||||
export interface TagInfo
|
||||
{
|
||||
name: string
|
||||
color: string
|
||||
}
|
||||
export enum GoodsStatus
|
||||
{
|
||||
Normal, // 商品正常
|
||||
//OutOfStock, // 商品无货
|
||||
Discontinued // 商品下架
|
||||
}
|
||||
export enum GoodsTypes {
|
||||
Physical,
|
||||
Virtual,
|
||||
}
|
||||
export interface ResponsePointGoodModel {
|
||||
id: number
|
||||
name: string
|
||||
count: number
|
||||
price: number
|
||||
tags: TagInfo[]
|
||||
cover?: string
|
||||
images: string[]
|
||||
status: GoodsStatus
|
||||
type: GoodsTypes
|
||||
}
|
||||
@@ -10,8 +10,7 @@ const status = computed(() => {
|
||||
if (!accountInfo.value) return 'error'
|
||||
if (accountInfo.value.eventFetcherOnline == true) {
|
||||
if (accountInfo.value.eventFetcherStatus) {
|
||||
if (accountInfo.value.eventFetcherStatus == 'ok') return 'success'
|
||||
else return 'warning'
|
||||
return 'warning'
|
||||
} else if (Object.keys(accountInfo.value.eventFetcherStatusV3 ?? {}).length > 0) {
|
||||
return 'warning'
|
||||
} else {
|
||||
@@ -31,7 +30,7 @@ const status = computed(() => {
|
||||
<template #trigger>
|
||||
<NIcon :component="Info24Filled" />
|
||||
</template>
|
||||
这是一个可以持续监听直播间内的 Superchat 和上舰事件并上传到本站进行记录的 Nodejs/.Net 程序
|
||||
这是一个可以持续监听直播间内的 Superchat 和上舰事件并上传到本站进行记录的 .Net 程序
|
||||
<br />
|
||||
事件上传到本站后允许按照自定义范围进行查询, 并导出为 CSV 之类的表格
|
||||
<br />
|
||||
@@ -39,11 +38,22 @@ const status = computed(() => {
|
||||
</NTooltip>
|
||||
</template>
|
||||
<NTag :type="status">
|
||||
<template v-if="status == 'success'"> 运行中 </template>
|
||||
<template v-else-if="status == 'warning'">
|
||||
<template v-if="accountInfo?.eventFetcherStatus"> 异常: {{ accountInfo.eventFetcherStatus }} </template>
|
||||
<template v-if="accountInfo?.eventFetcherStatus">
|
||||
此版本已过期, 请更新
|
||||
<NTooltip trigger="click">
|
||||
<template #trigger>
|
||||
<NButton type="warning" size="tiny"> 关于 </NButton>
|
||||
</template>
|
||||
Node.js 版已不再更新, 如果是 Docker 的话请切换至 ghcr.io/megghy/vtsurueventfetcher.net, 其他环境请下载 https://github.com/Megghy/VtsuruEventFetcher.Net/releases/latest
|
||||
</NTooltip>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="status == 'success'"> 运行中 </template>
|
||||
<template v-else-if="status == 'warning'">
|
||||
<template v-if="accountInfo?.eventFetcherStatusV3"> 异常: {{ Object.values(accountInfo.eventFetcherStatusV3).join('; ') }} </template>
|
||||
</template>
|
||||
<template v-else-if="status == 'info'"> 未连接 </template>
|
||||
</template>
|
||||
<template v-else-if="status == 'info'"> 未连接 </template>
|
||||
</NTag>
|
||||
<template v-if="accountInfo?.eventFetcherOnline != true">
|
||||
<NDivider vertical />
|
||||
|
||||
0
src/components/PointGoodItem.vue
Normal file
0
src/components/PointGoodItem.vue
Normal file
@@ -33,6 +33,7 @@ export const LIVE_API_URL = { toString: () => `${BASE_API()}live/` }
|
||||
export const FEEDBACK_API_URL = { toString: () => `${BASE_API()}feedback/` }
|
||||
export const MUSIC_REQUEST_API_URL = { toString: () => `${BASE_API()}music-request/` }
|
||||
export const VTSURU_API_URL = { toString: () => `${BASE_API()}vtsuru/` }
|
||||
export const POINT_API_URL = { toString: () => `${BASE_API()}point/` }
|
||||
|
||||
export const ScheduleTemplateMap = {
|
||||
'': { name: '默认', compoent: defineAsyncComponent(() => import('@/views/view/scheduleTemplate/DefaultScheduleTemplate.vue')) },
|
||||
|
||||
@@ -159,5 +159,13 @@ export default //管理页面
|
||||
title: '反馈',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'point',
|
||||
name: 'manage-point',
|
||||
component: () => import('@/views/manage/PointManage.vue'),
|
||||
meta: {
|
||||
title: '积分',
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ onMounted(() => {
|
||||
listFolded
|
||||
@ended="musicRquestStore.onMusicEnd"
|
||||
@play="musicRquestStore.onMusicPlay"
|
||||
style="flex: 1;min-width: 400px;"
|
||||
style="flex: 1; min-width: 400px"
|
||||
/>
|
||||
<NSpace vertical>
|
||||
<NTag :bordered="false" type="info" size="small"> 队列: {{ musicRquestStore.waitingMusics.length }} </NTag>
|
||||
|
||||
59
src/views/manage/PointManage.vue
Normal file
59
src/views/manage/PointManage.vue
Normal file
@@ -0,0 +1,59 @@
|
||||
<script setup lang="ts">
|
||||
import { DisableFunction, EnableFunction, useAccount } from '@/api/account'
|
||||
import { ResponsePointGoodModel, FunctionTypes } from '@/api/api-models'
|
||||
import { QueryGetAPI } from '@/api/query'
|
||||
import { POINT_API_URL } from '@/data/constants'
|
||||
import { NAlert, NButton, NDivider, NModal, NSwitch, NTabPane, NTabs, NText, useMessage } from 'naive-ui'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const message = useMessage()
|
||||
const accountInfo = useAccount()
|
||||
|
||||
const goods = ref<ResponsePointGoodModel[]>(await getGoods())
|
||||
|
||||
async function getGoods() {
|
||||
try {
|
||||
var resp = await QueryGetAPI<ResponsePointGoodModel[]>(POINT_API_URL + 'get-goods')
|
||||
if (resp.code == 200) {
|
||||
return resp.data
|
||||
} else {
|
||||
message.error('无法获取数据: ' + resp.message)
|
||||
}
|
||||
} catch (err) {
|
||||
message.error('无法获取数据: ' + err)
|
||||
}
|
||||
return []
|
||||
}
|
||||
async function setFunctionEnable(enable: boolean) {
|
||||
let success = false
|
||||
if (enable) {
|
||||
success = await EnableFunction(FunctionTypes.Point)
|
||||
} else {
|
||||
success = await DisableFunction(FunctionTypes.Point)
|
||||
}
|
||||
if (success) {
|
||||
message.success('已' + (enable ? '启用' : '禁用') + '积分系统')
|
||||
} else {
|
||||
message.error('无法' + (enable ? '启用' : '禁用') + '积分系统')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NAlert type="info">
|
||||
启用积分系统
|
||||
<NSwitch :value="accountInfo?.settings.enableFunctions.includes(FunctionTypes.Point)" @update:value="setFunctionEnable" />
|
||||
<br />
|
||||
<NText depth="3">
|
||||
此功能需要部署
|
||||
<NButton text type="primary" tag="a" href="https://www.yuque.com/megghy/dez70g/vfvcyv3024xvaa1p" target="_blank"> VtsuruEventFetcher </NButton>
|
||||
</NText>
|
||||
</NAlert>
|
||||
<NTabs>
|
||||
<NTabPane name="goods" tab="商品">
|
||||
<NDivider />
|
||||
</NTabPane>
|
||||
</NTabs>
|
||||
|
||||
<NModal> </NModal>
|
||||
</template>
|
||||
Reference in New Issue
Block a user