2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-05 06:57:19 +08:00

fix: 优化网站列表获取

This commit is contained in:
耗子
2024-10-23 15:26:23 +08:00
parent 817e86466c
commit 6101bedee3
3 changed files with 24 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ defineOptions({
import { NButton, NDataTable, NInput, NPopconfirm, NSwitch } from 'naive-ui'
import fail2ban from '@/api/apps/fail2ban'
import app from '@/api/panel/app'
import systemctl from '@/api/panel/systemctl'
import website from '@/api/panel/website'
import { renderIcon } from '@/utils'
@@ -303,7 +304,11 @@ onMounted(() => {
getIsEnabled()
getWhiteList()
onPageChange(1)
getWebsiteList(1, 10000)
app.isInstalled('nginx').then((res) => {
if (res.data.installed) {
getWebsiteList(1, 10000)
}
})
})
</script>

View File

@@ -2,6 +2,7 @@
import Editor from '@guolao/vue-monaco-editor'
import { NButton, NDataTable, NPopconfirm, NSpace, NSwitch, NTable, NTag } from 'naive-ui'
import app from '@/api/panel/app'
import cert from '@/api/panel/cert'
import website from '@/api/panel/website'
import type { Cert } from '@/views/cert/types'
@@ -438,18 +439,22 @@ const getAsyncData = async () => {
const { data: algorithmData } = await cert.algorithms()
algorithms.value = algorithmData
const { data: websiteData } = await website.list(1, 10000)
websites.value = []
websites.value.push({
label: '无',
value: 0
})
for (const item of websiteData.items) {
websites.value.push({
label: item.name,
value: item.id
})
}
app.isInstalled('nginx').then(async (res) => {
if (res.data.installed) {
const { data: websiteData } = await website.list(1, 10000)
for (const item of websiteData.items) {
websites.value.push({
label: item.name,
value: item.id
})
}
}
})
const { data: dnsData } = await cert.dns(1, 10000)
dns.value = []

View File

@@ -1,4 +1,5 @@
<script setup lang="ts">
import app from '@/api/panel/app'
import cron from '@/api/panel/cron'
import dashboard from '@/api/panel/dashboard'
import website from '@/api/panel/website'
@@ -84,7 +85,11 @@ watch(createModel, (value) => {
onMounted(() => {
getPhpAndDb()
getWebsiteList(1, 10000)
app.isInstalled('nginx').then((res) => {
if (res.data.installed) {
getWebsiteList(1, 10000)
}
})
})
</script>