feat: ✨ 环境变量启用server
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -75,7 +75,6 @@ web_modules/
|
|||||||
.yarn-integrity
|
.yarn-integrity
|
||||||
|
|
||||||
# dotenv environment variable files
|
# dotenv environment variable files
|
||||||
.env
|
|
||||||
.env.development.local
|
.env.development.local
|
||||||
.env.test.local
|
.env.test.local
|
||||||
.env.production.local
|
.env.production.local
|
||||||
|
|||||||
@@ -19,8 +19,10 @@ export function useMounted(tipDialog: Ref<any>) {
|
|||||||
const tipDesc = ref('')
|
const tipDesc = ref('')
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { data } = useWebsocket()
|
|
||||||
const msgListDb = new IndexDb('msgList', ['msgList'], 1, ['createTime'])
|
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() {
|
function setCurrentPrize() {
|
||||||
if (prizeList.value.length <= 0) {
|
if (prizeList.value.length <= 0) {
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ export const configRoutes = {
|
|||||||
name: 'Server',
|
name: 'Server',
|
||||||
component: () => import('@/views/Config/Server/index.vue'),
|
component: () => import('@/views/Config/Server/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
|
hidden: import.meta.env.VITE_ENABLE_WEBSOCKET !== 'true',
|
||||||
title: i18n.global.t('sidebar.server'),
|
title: i18n.global.t('sidebar.server'),
|
||||||
icon: 'server',
|
icon: 'server',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function skip(path: string) {
|
|||||||
<div class="flex min-h-[calc(100%-280px)]">
|
<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">
|
<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">
|
<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>
|
<summary>{{ item.meta.title }}</summary>
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="subItem in item.children" :key="subItem.name">
|
<li v-for="subItem in item.children" :key="subItem.name">
|
||||||
@@ -62,9 +62,10 @@ function skip(path: string) {
|
|||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
<a
|
<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)"
|
@click="skip(item.path)"
|
||||||
>{{ item.meta!.title }}</a>
|
>{{ item.meta!.title }}</a>
|
||||||
|
<div v-else />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<router-view class="flex-1 mt-5" />
|
<router-view class="flex-1 mt-5" />
|
||||||
|
|||||||
Reference in New Issue
Block a user