feat: 环境变量启用server

This commit is contained in:
log1997
2026-01-16 13:50:08 +08:00
parent f2832324ce
commit 20a02ce44b
5 changed files with 8 additions and 4 deletions

View File

@@ -19,8 +19,10 @@ export function useMounted(tipDialog: Ref<any>) {
const tipDesc = ref('')
const { t } = useI18n()
const route = useRoute()
const { data } = useWebsocket()
const msgListDb = new IndexDb('msgList', ['msgList'], 1, ['createTime'])
const enableWebsocket = import.meta.env.VITE_ENABLE_WEBSOCKET
const websocketData = enableWebsocket === 'true' ? useWebsocket() : { data: ref(null) }
const { data } = websocketData
// 设置当前奖列表
function setCurrentPrize() {
if (prizeList.value.length <= 0) {

View File

@@ -106,6 +106,7 @@ export const configRoutes = {
name: 'Server',
component: () => import('@/views/Config/Server/index.vue'),
meta: {
hidden: import.meta.env.VITE_ENABLE_WEBSOCKET !== 'true',
title: i18n.global.t('sidebar.server'),
icon: 'server',
},

View File

@@ -37,7 +37,7 @@ function skip(path: string) {
<div class="flex min-h-[calc(100%-280px)]">
<ul class="w-56 m-0 mr-3 min-w-56 menu bg-base-200 pt-14">
<li v-for="item in menuList" :key="item.name">
<details v-if="item.children" open>
<details v-if="item.children && !item.meta.hidden" open>
<summary>{{ item.meta.title }}</summary>
<ul>
<li v-for="subItem in item.children" :key="subItem.name">
@@ -62,9 +62,10 @@ function skip(path: string) {
</ul>
</details>
<a
v-else :style="item.name === route.name ? 'background-color:rgba(12,12,12,0.2)' : ''"
v-else-if="!item.meta.hidden" :style="item.name === route.name ? 'background-color:rgba(12,12,12,0.2)' : ''"
@click="skip(item.path)"
>{{ item.meta!.title }}</a>
<div v-else />
</li>
</ul>
<router-view class="flex-1 mt-5" />