From c635d6459e81cf1832860793ecd6cc317fb426dd Mon Sep 17 00:00:00 2001
From: mediabot-pt <295750538+mediabot-pt@users.noreply.github.com>
Date: Mon, 6 Jul 2026 00:29:02 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E9=A1=B5=E9=9D=A2=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E9=A1=B5=E5=A2=9E=E5=8A=A0=E6=8C=89=E7=AB=99=E7=82=B9=E7=B1=BB?=
=?UTF-8?q?=E5=9E=8B=E9=BB=98=E8=AE=A4=E6=A8=A1=E6=9D=BF=E7=BC=96=E8=BE=91?=
=?UTF-8?q?=E5=85=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/src/views/SitePages.vue | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/web/src/views/SitePages.vue b/web/src/views/SitePages.vue
index 3000214..9266eec 100644
--- a/web/src/views/SitePages.vue
+++ b/web/src/views/SitePages.vue
@@ -5,6 +5,21 @@
页面配置
刷新
+
+
+
+ 站点类型默认模板
+
+
+
+
@@ -73,6 +88,7 @@ import api from '../api'; import { Refresh } from '@element-plus/icons-vue'
const loading = ref(false), saving = ref(false), deleting = ref(false), sites = ref([]), pagesMap = ref({}), sitesList = ref([])
const editSiteId = ref(''), editorJson = ref('[]')
+const defaultTypes = ['nexusphp','mtorrent','gazelle','unit3d']
const fmt = (t) => t ? (t.substring(0,19)||'').replace('T',' ') : '-'
const parsed = computed(() => { try { return JSON.parse(editorJson.value) } catch { return [] } })
const resolveUrl = (url) => url?.replace('{base}', sitesList.value.find(s=>s.siteId===editSiteId.value)?.urls?.[0] || '{base}') || ''
@@ -100,7 +116,10 @@ const fetchAll = async () => {
const editPage = async (row) => {
editSiteId.value = row.siteId
- try { const r = await api.raw.get('/admin/site-pages/'+row.siteId); editorJson.value = (r?.data||r)?.entries ? JSON.stringify((r.data||r).entries, null, 2) : '[]' }
+ const url = row.siteId.startsWith('default:')
+ ? '/admin/default-pages/' + row.siteId.replace('default:','')
+ : '/admin/site-pages/' + row.siteId
+ try { const r = await api.raw.get(url); editorJson.value = (r?.data||r)?.entries ? JSON.stringify((r.data||r).entries, null, 2) : '[]' }
catch { editorJson.value = '[]' }
}
@@ -117,8 +136,13 @@ const deletePages = async () => {
const savePages = async () => {
saving.value = true
- try { await api.raw.put('/sites/'+editSiteId.value+'/pages', { entries: parsed.value }); ElMessage.success('已保存'); editSiteId.value=''; fetchAll() }
- catch { ElMessage.error('保存失败') }
+ try {
+ const url = editSiteId.value.startsWith('default:')
+ ? '/admin/default-pages/' + editSiteId.value.replace('default:','')
+ : '/sites/' + editSiteId.value + '/pages'
+ await api.raw.put(url, { entries: parsed.value })
+ ElMessage.success('已保存'); editSiteId.value=''; fetchAll()
+ } catch { ElMessage.error('保存失败') }
finally { saving.value = false }
}
onMounted(fetchAll)