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/cert/usageRecord/index.vue b/src/views/cert/usageRecord/index.vue index f30d635..3477a66 100644 --- a/src/views/cert/usageRecord/index.vue +++ b/src/views/cert/usageRecord/index.vue @@ -93,7 +93,7 @@ - + +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() +