This commit is contained in:
sprov
2021-06-06 22:37:10 +08:00
parent 810dad53d5
commit 3d7192d0f6
29 changed files with 1131 additions and 199 deletions

View File

@@ -31,7 +31,10 @@
<a-layout-content>
<a-spin :spinning="spinning" :delay="500" tip="loading">
<a-space direction="vertical">
<a-button type="primary" :disabled="saveBtnDisable" @click="updateAllSetting">保存配置</a-button>
<a-space direction="horizontal">
<a-button type="primary" :disabled="saveBtnDisable" @click="updateAllSetting">保存配置</a-button>
<a-button type="danger" :disabled="!saveBtnDisable" @click="restartPanel">重启面板</a-button>
</a-space>
<a-tabs default-active-key="1">
<a-tab-pane key="1" tab="面板配置">
<a-list item-layout="horizontal" style="background: white">
@@ -45,16 +48,21 @@
<a-tab-pane key="2" tab="用户设置">
<a-form style="background: white; padding: 20px">
<a-form-item label="原用户名">
<a-input></a-input>
<a-input v-model="user.oldUsername" style="max-width: 300px"></a-input>
</a-form-item>
<a-form-item label="原密码">
<a-input></a-input>
<a-input type="password" v-model="user.oldPassword"
style="max-width: 300px"></a-input>
</a-form-item>
<a-form-item label="新用户名">
<a-input></a-input>
<a-input v-model="user.newUsername" style="max-width: 300px"></a-input>
</a-form-item>
<a-form-item label="新密码">
<a-input></a-input>
<a-input type="password" v-model="user.newPassword"
style="max-width: 300px"></a-input>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="updateUser">修改</a-button>
</a-form-item>
</a-form>
</a-tab-pane>
@@ -87,6 +95,7 @@
oldAllSetting: new AllSetting(),
allSetting: new AllSetting(),
saveBtnDisable: true,
user: {},
},
methods: {
loading(spinning = true) {
@@ -109,6 +118,33 @@
if (msg.success) {
await this.getAllSetting();
}
},
async updateUser() {
this.loading(true);
const msg = await HttpUtil.post("/xui/setting/updateUser", this.user);
this.loading(false);
if (msg.success) {
this.user = {};
}
},
async restartPanel() {
await new Promise(resolve => {
this.$confirm({
title: '重启面板',
content: '确定要重启面板吗?点击确定将于 3 秒后重启,若重启后无法访问面板,请前往服务器查看面板日志信息',
okText: '确定',
cancelText: '取消',
onOk: () => resolve(),
});
});
this.loading(true);
const msg = await HttpUtil.post("/xui/setting/restartPanel");
this.loading(false);
if (msg.success) {
this.loading(true);
await PromiseUtil.sleep(5000);
location.reload();
}
}
},
async mounted() {