删除 template/admin/index.php
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
yiqiu
2025-11-21 00:13:38 +08:00
parent 98e046c160
commit 919d376835

View File

@@ -0,0 +1,96 @@
<link rel="stylesheet" href="/plugins/addon/theme_configurator/template/admin/theme.css" />
<div id="theme-config-app" class="template" v-cloak>
<com-config>
<t-card class="theme-card">
<div class="theme-card__header">
<div>
<h3>主题配置</h3>
<p class="theme-desc">
在此集中维护 BlackFruit-UI 的导航、页脚、SEO、企业信息、轮播和侧边浮窗等配置。
</p>
</div>
<div>
<t-button variant="outline" @click="loadConfig" :loading="loading">
刷新
</t-button>
<t-button theme="primary" class="ml-10" @click="saveConfig" :loading="saving">
保存
</t-button>
</div>
</div>
<t-textarea v-model="configText" :autosize="{ minRows: 18, maxRows: 22 }" class="theme-textarea"
:placeholder="langPlaceholder"></t-textarea>
<p class="theme-tip">
JSON 结构与 `/console/v1/common` 返回值保持一致,保存后即可供前台调用。
</p>
</t-card>
</com-config>
</div>
<script src="/plugins/addon/theme_configurator/template/admin/lang/index.js"></script>
<script>
(function () {
const host = location.origin;
const adminPath = location.pathname.split("/")[1];
const base = `${host}/${adminPath}/v1/theme/config`;
new Vue({
el: "#theme-config-app",
data() {
return {
configText: "",
loading: false,
saving: false,
langPlaceholder: "请严格按照 JSON 格式填写主题配置...",
};
},
created() {
this.loadConfig();
},
methods: {
loadConfig() {
this.loading = true;
axios
.get(base, {
headers: {
Authorization: "Bearer " + localStorage.getItem("backJwt"),
},
})
.then((res) => {
const data = (res.data && res.data.data) || {};
this.configText = JSON.stringify(data, null, 2);
})
.finally(() => {
this.loading = false;
});
},
saveConfig() {
if (!this.configText.trim()) {
return this.$message.warning("内容不能为空");
}
let payload;
try {
payload = JSON.parse(this.configText);
} catch (err) {
return this.$message.error("JSON 解析失败:" + err.message);
}
this.saving = true;
axios
.post(base, payload, {
headers: {
Authorization: "Bearer " + localStorage.getItem("backJwt"),
},
})
.then((res) => {
this.$message.success(res.data.msg || "保存成功");
this.configText = JSON.stringify(res.data.data, null, 2);
})
.finally(() => {
this.saving = false;
});
},
},
});
})();
</script>