From 3dec8128b00fbb46de55a3a259ca39afcf46240d Mon Sep 17 00:00:00 2001 From: franktrue Date: Thu, 4 May 2023 12:10:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=8C=96=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/config.js | 9 ++++ src/views/user/developer/index.vue | 72 ++++++++++++++++++++++-------- 2 files changed, 62 insertions(+), 19 deletions(-) diff --git a/src/api/system/config.js b/src/api/system/config.js index 7858c69..4daeed9 100644 --- a/src/api/system/config.js +++ b/src/api/system/config.js @@ -43,6 +43,15 @@ export function updateConfig(data) { }) } +// 修改参数配置 +export function updateConfigByKey(data) { + return request({ + url: '/system/config/byKey', + method: 'put', + data: data + }) +} + // 删除参数配置 export function delConfig(configId) { return request({ diff --git a/src/views/user/developer/index.vue b/src/views/user/developer/index.vue index 3523bbf..3dad7d0 100644 --- a/src/views/user/developer/index.vue +++ b/src/views/user/developer/index.vue @@ -7,32 +7,66 @@ -
- - - -
-
- - - -
-
- - - -
+ + + + + + + + + + + + 确 定 + +
+function getConfig () { + getConfigKey("api2gpt.server.url").then(response => { + form.value.apiServer = response.msg + }) + getConfigKey("api2gpt.server.key").then(response => { + form.value.apiKey = response.msg + }) + getConfigKey("api2gpt.server.backup").then(response => { + form.value.apiServer2 = response.msg + }) +} + +function submitForm() { + proxy.$refs["configRef"].validate(valid => { + if (valid) { + updateConfigByKey({ + "api2gpt.server.url": form.value.apiServer, + "api2gpt.server.key": form.value.apiKey, + "api2gpt.server.backup": form.value.apiServer2 + }).then(response => { + proxy.$modal.msgSuccess("修改成功"); + }); + } + }) +} + +getConfig() +