From 9bed5f31837c9c7799a6592648a7c9ca8e536533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E4=BB=99=E9=83=BD=E6=B2=A1=E7=94=A8?= <615206459@qq.com> Date: Wed, 27 Mar 2024 17:34:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/helper/views/plugins/serve.vue | 34 ++++++++++++++-------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/modules/helper/views/plugins/serve.vue b/src/modules/helper/views/plugins/serve.vue index 6678a0d..fc7d9c0 100644 --- a/src/modules/helper/views/plugins/serve.vue +++ b/src/modules/helper/views/plugins/serve.vue @@ -114,7 +114,7 @@ import { ElMessage, ElMessageBox } from "element-plus"; import { Plus, Setting } from "@element-plus/icons-vue"; import { marked } from "marked"; import { useForm } from "@cool-vue/crud"; -import { merge, template } from "lodash-es"; +import { isString, merge, template } from "lodash-es"; const { service, refs, setRefs } = useCool(); const Form = useForm(); @@ -190,17 +190,27 @@ function toSet(item: Eps.PluginInfoEntity) { on: { submit(data, { done, close }) { - service.plugin.info - .update(data) - .then(() => { - ElMessage.success("修改成功"); - merge(item, data); - close(); - }) - .catch((err) => { - ElMessage.error(err.message); - done(); - }); + try { + const config = JSON.parse(data.config); + + service.plugin.info + .update({ + ...data, + config + }) + .then(() => { + ElMessage.success("修改成功"); + merge(item, data); + close(); + }) + .catch((err) => { + ElMessage.error(err.message); + done(); + }); + } catch (e) { + ElMessage.error("参数格式错误,请检查"); + done(); + } } } });