仰望星辰工作室

better-staridc-MNBT

Z zfhsh first commit 2 个月前
1<template>
2 <div class="td-page">
3 <div class="td-page-head">
4 <div>
5 <h3 class="td-page-title"><i class="mdi mdi-view-dashboard-outline"></i>控制面板设置</h3>
6 <p class="td-page-subtitle">面板名称、FTP 模块、版权与开关</p>
7 </div>
8 </div>
9
10 <div class="td-set-card">
11 <div class="td-set-card-hd">
12 <div class="td-set-icon"><i class="mdi mdi-view-dashboard-outline"></i></div>
13 <div>
14 <h4>控制面板</h4>
15 <p>名称、FTP 面板、Logo 与开关</p>
16 </div>
17 </div>
18 <div class="td-set-card-bd">
19 <t-loading :loading="loading" text="保存中…" size="small">
20 <div class="td-form">
21 <div class="td-form-row">
22 <label>控制面板名称 <span class="td-text-danger">*</span></label>
23 <t-input v-model="form.name" placeholder="请在这填写控制面板的名称" clearable>
24 <template #prefix-icon><i class="mdi mdi-rename-box"></i></template>
25 </t-input>
26 </div>
27
28 <div class="td-form-row">
29 <label>FTP 操作面板</label>
30 <t-select v-model="form.hxw">
31 <t-option value="amftp" label="AMFTP 操作面板" />
32 <t-option value="mnftp" label="MN 操作面板(推荐)" />
33 </t-select>
34 <div class="td-form-hint">AMFTP 仅支持本机宝塔;MN 面板支持本地与远程</div>
35 </div>
36
37 <div class="td-form-row">
38 <label>显示版权</label>
39 <t-input v-model="form.hxp" placeholder="可以使用HTML标签">
40 <template #prefix-icon><i class="mdi mdi-copyright"></i></template>
41 </t-input>
42 <div class="td-form-hint">例如:Copyright © 梦奈云 2026</div>
43 </div>
44
45 <div class="td-form-switch">
46 <div class="td-form-switch-txt">
47 <strong>用户登录验证码</strong>
48 <span>控制面板登录是否需要验证码</span>
49 </div>
50 <t-switch v-model="form.yzme" />
51 </div>
52
53 <div class="td-form-switch">
54 <div class="td-form-switch-txt">
55 <strong>控制面板开关</strong>
56 <span>关闭后用户无法进入控制面板</span>
57 </div>
58 <t-switch v-model="form.kzmbqk" />
59 </div>
60
61 <div class="td-form-note">
62 <b>Logo 上传:</b> 登录页 / 侧栏 / 用户头像 Logo 上传请使用 <code>default</code> 主题的
63 <a href="./set.php?gn=kzmb">控制面板设置</a> 页面。本页仅保存核心字段。
64 </div>
65
66 <div class="td-form-actions">
67 <t-button theme="primary" :loading="loading" @click="save">
68 <i class="mdi mdi-content-save-outline"></i> 保存修改
69 </t-button>
70 </div>
71 </div>
72 </t-loading>
73 </div>
74 </div>
75 </div>
76</template>
77
78<script setup>
79import { reactive, ref } from 'vue'
80import { MessagePlugin } from 'tdesign-vue-next'
81import { setPanel } from '@/admin/api/settings'
82
83const boot = window.__TD_BOOT__ || {}
84const conf = boot.conf || {}
85const loading = ref(false)
86
87const form = reactive({
88 name: conf.name || '',
89 hxw: conf.hxw || 'amftp',
90 hxp: conf.hxp || '',
91 yzme: conf.yzme === 'true',
92 kzmbqk: conf.kzmbqk === 'true',
93})
94
95async function save() {
96 if (!form.name) {
97 MessagePlugin.warning('请填写控制面板名称')
98 return
99 }
100 loading.value = true
101 const r = await setPanel({
102 name: form.name,
103 ftp: form.hxw,
104 yzm: form.yzme ? 'true' : 'false',
105 kg: form.kzmbqk ? 'true' : 'false',
106 bq: form.hxp,
107 })
108 loading.value = false
109 if (r.ok) MessagePlugin.success('保存成功')
110}
111</script>
112
113<style scoped>
114code {
115 background: #f3f3f3;
116 padding: 1px 6px;
117 border-radius: 4px;
118 font-family: Consolas, Monaco, monospace;
119 font-size: 12px;
120 color: #d63384;
121}
122</style>