From c17187f39e66d6fb474d91b3764e333b0c00c7c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=99=E7=A0=81=E7=94=9F=E8=8A=B1?= <18523774412@qq.com> Date: Tue, 6 Dec 2022 12:08:07 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=97=B6=E5=8F=AA=E6=95=88=E9=AA=8C=E5=92=8C?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=BD=93=E5=89=8D=E9=A1=B5=E7=9A=84=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/routine/Config.php | 2 +- app/admin/lang/zh-cn/routine/config.php | 1 + .../views/backend/routine/config/index.vue | 127 +++++++++++------- 3 files changed, 80 insertions(+), 50 deletions(-) diff --git a/app/admin/controller/routine/Config.php b/app/admin/controller/routine/Config.php index 805813ea..7f0e9451 100644 --- a/app/admin/controller/routine/Config.php +++ b/app/admin/controller/routine/Config.php @@ -102,7 +102,7 @@ class Config extends Backend $this->error($e->getMessage()); } if ($result !== false) { - $this->success(__('Update successful')); + $this->success(__('The current page configuration item was updated successfully')); } else { $this->error(__('No rows updated')); } diff --git a/app/admin/lang/zh-cn/routine/config.php b/app/admin/lang/zh-cn/routine/config.php index 6daa6f01..7c437385 100644 --- a/app/admin/lang/zh-cn/routine/config.php +++ b/app/admin/lang/zh-cn/routine/config.php @@ -19,4 +19,5 @@ return [ 'Test mail sent successfully~' => '测试邮件发送成功~', 'This is a test email' => '这是一封测试邮件', 'Congratulations, receiving this email means that your email service has been configured correctly' => '恭喜您,收到此邮件代表您的邮件服务已配置正确;这是邮件主体 在主体中可以使用Html!', + 'The current page configuration item was updated successfully' => '当前页配置项更新成功!', ]; \ No newline at end of file diff --git a/web/src/views/backend/routine/config/index.vue b/web/src/views/backend/routine/config/index.vue index 3e37df82..95b028a3 100644 --- a/web/src/views/backend/routine/config/index.vue +++ b/web/src/views/backend/routine/config/index.vue @@ -14,52 +14,71 @@
- - - - -
${{ item.name }}
-
- - - -
+
{{ t('routine.config.Test mail sending') }} @@ -184,10 +203,20 @@ const onSubmit = (formEl: InstanceType | undefined) => { if (!formEl) return formEl.validate((valid) => { if (valid) { - postData('edit', state.form).then(() => { + // 只提交当前tab的表单数据 + const formData: anyObj = {} + for (const key in state.config) { + if (key != state.activeTab) { + continue + } + for (const lKey in state.config[key].list) { + formData[state.config[key].list[lKey].name] = state.form[state.config[key].list[lKey].name] ?? '' + } + } + postData('edit', formData).then(() => { for (const key in siteConfig.$state) { - if (siteConfig.$state[key as keyof SiteConfig] != state.form[key]) { - siteConfig.$state[key as keyof SiteConfig] = state.form[key] + if (formData[key] && siteConfig.$state[key as keyof SiteConfig] != formData[key]) { + siteConfig.$state[key as keyof SiteConfig] = formData[key] } } })