add live lottery

This commit is contained in:
2023-11-02 21:48:49 +08:00
parent 0a98aad749
commit 6d625b3ddc
4 changed files with 33 additions and 4 deletions

View File

@@ -180,6 +180,15 @@ const routes: Array<RouteRecordRaw> = [
parent: 'manage-videoCollect', parent: 'manage-videoCollect',
}, },
}, },
{
path: 'live-lottery',
name: 'manage-liveLottery',
component: () => import('@/views/open_live/OpenLottery.vue'),
meta: {
title: '直播抽奖',
keepAlive: true,
},
},
], ],
}, },
{ {

View File

@@ -151,6 +151,21 @@ const menuOptions = [
icon: renderIcon(Lottery24Filled), icon: renderIcon(Lottery24Filled),
//disabled: accountInfo.value?.isEmailVerified == false, //disabled: accountInfo.value?.isEmailVerified == false,
}, },
{
label: () =>
h(
RouterLink,
{
to: {
name: 'manage-liveLottery',
},
},
{ default: () => '直播抽奖' }
),
key: 'manage-liveLottery',
icon: renderIcon(Lottery24Filled),
//disabled: accountInfo.value?.isEmailVerified == false,
},
] ]
async function resendEmail() { async function resendEmail() {

View File

@@ -321,7 +321,7 @@ function getLevelColor(level: number) {
</script> </script>
<template> <template>
<NCard size="medium" embedded title="抽奖"> <NCard size="medium" embedded title="动态抽奖">
<template #header-extra> <template #header-extra>
<NButton @click="showModal = true"> 历史记录 </NButton> <NButton @click="showModal = true"> 历史记录 </NButton>
</template> </template>

View File

@@ -5,6 +5,7 @@ import { QueryPostAPI } from '@/api/query'
import { OPEN_LIVE_API_URL } from '@/data/constants' import { OPEN_LIVE_API_URL } from '@/data/constants'
import { LotteryUserInfo, OpenLiveInfo } from '@/api/api-models' import { LotteryUserInfo, OpenLiveInfo } from '@/api/api-models'
import { import {
NAlert,
NAvatar, NAvatar,
NButton, NButton,
NCard, NCard,
@@ -115,7 +116,7 @@ let chatClient: any
async function get() { async function get() {
try { try {
const data = await QueryPostAPI<OpenLiveInfo>(OPEN_LIVE_API_URL + 'start', authInfo.value) const data = await QueryPostAPI<OpenLiveInfo>(OPEN_LIVE_API_URL + 'start', authInfo.value?.Code ? authInfo.value : undefined)
if (data.code == 200) { if (data.code == 200) {
console.log('[OPEN-LIVE] 已获取场次信息') console.log('[OPEN-LIVE] 已获取场次信息')
return data.data return data.data
@@ -330,7 +331,7 @@ onMounted(() => {
<template> <template>
<NLayoutContent style="height: 100vh"> <NLayoutContent style="height: 100vh">
<NResult v-if="false" status="403" title="403" description="该页面只能从饭贩访问" /> <NResult v-if="!authInfo?.Code && !accountInfo" status="403" title="403" description="该页面只能从饭贩访问或者注册用户使用" />
<template v-else> <template v-else>
<NCard style="margin: 20px"> <NCard style="margin: 20px">
<template #header> <template #header>
@@ -338,11 +339,15 @@ onMounted(() => {
<NDivider vertical /> <NDivider vertical />
<NButton text type="primary" tag="a" href="https://vtsuru.live" target="_blank"> 前往 VTsuru.live 主站 </NButton> <NButton text type="primary" tag="a" href="https://vtsuru.live" target="_blank"> 前往 VTsuru.live 主站 </NButton>
</template> </template>
<NAlert v-if="!authInfo?.Code && accountInfo && !accountInfo.isBiliVerified" type="error"> 请先绑定B站账号 </NAlert>
<NAlert v-else-if="!authInfo?.Code && accountInfo && accountInfo.biliAuthCodeStatus != 1" type="error"> 身份码状态异常, 请重新绑定 </NAlert>
<NCard> <NCard>
<NSpace align="center"> <NSpace align="center">
连接状态: 连接状态:
<NTag :type="isConnected ? 'success' : 'warning'"> {{ isConnected ? `已连接 | ${authResult?.anchor_info.uname}` : '未连接' }} </NTag> <NTag :type="isConnected ? 'success' : 'warning'"> {{ isConnected ? `已连接 | ${authResult?.anchor_info.uname}` : '未连接' }} </NTag>
<NButton v-if="!isConnected" type="primary" @click="start" size="small"> 连接直播间 </NButton> <NButton v-if="!isConnected" type="primary" @click="start" size="small" :disabled="!authInfo?.Code && (!accountInfo?.isBiliVerified || accountInfo.biliAuthCodeStatus != 1)">
连接直播间
</NButton>
<NButton type="info" @click="showModal = true" size="small"> 抽奖历史</NButton> <NButton type="info" @click="showModal = true" size="small"> 抽奖历史</NButton>
</NSpace> </NSpace>
</NCard> </NCard>