This commit is contained in:
82
plugins/addon/theme_configurator/template/admin/index.php
Normal file
82
plugins/addon/theme_configurator/template/admin/index.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>主题配置</title>
|
||||
<style>
|
||||
body {
|
||||
padding: 24px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
|
||||
background: #f5f6fa;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 24px;
|
||||
box-shadow: 0 5px 16px rgba(0, 0, 0, 0.08);
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
min-height: 280px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #dfe3ec;
|
||||
padding: 12px;
|
||||
font-family: "JetBrains Mono", Consolas, monospace;
|
||||
font-size: 13px;
|
||||
background: #0f172a;
|
||||
color: #e2e8f0;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-top: 16px;
|
||||
padding: 10px 24px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background-color: #2563eb;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="card">
|
||||
<h2>主题配置 JSON</h2>
|
||||
<p>此页面演示如何通过插件快速调整 BlackFruit-UI 的导航、页脚、SEO、轮播、侧边栏以及企业信息。直接编辑下方 JSON 提交即可。</p>
|
||||
<textarea id="themeConfig"></textarea>
|
||||
<button id="saveBtn">保存配置</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const input = document.getElementById("themeConfig");
|
||||
const request = (url, options = {}) =>
|
||||
fetch(url, Object.assign({ headers: { "Content-Type": "application/json" } }, options))
|
||||
.then((res) => res.json());
|
||||
|
||||
request("/<?= DIR_ADMIN ?>/v1/theme/config").then((res) => {
|
||||
input.value = JSON.stringify(res.data, null, 2);
|
||||
});
|
||||
|
||||
document.getElementById("saveBtn").addEventListener("click", () => {
|
||||
try {
|
||||
const payload = JSON.parse(input.value);
|
||||
request("/<?= DIR_ADMIN ?>/v1/theme/config", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload),
|
||||
}).then((res) => {
|
||||
alert(res.msg || "保存成功");
|
||||
});
|
||||
} catch (err) {
|
||||
alert("JSON 解析失败: " + err.message);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user