From 6e520a30720c418b7484f37c1736f189613e83ce Mon Sep 17 00:00:00 2001
From: KAI <1373639299@qq.com>
Date: Mon, 27 May 2024 13:38:36 +0000
Subject: [PATCH] =?UTF-8?q?chore:=20=E9=82=AE=E4=BB=B6=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=AD=97=E6=AE=B5=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/apis/system/type.ts | 7 +-
.../system/config/components/MailSetting.vue | 72 +++++++++++--------
2 files changed, 46 insertions(+), 33 deletions(-)
diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts
index 889c9f1..48da04b 100644
--- a/src/apis/system/type.ts
+++ b/src/apis/system/type.ts
@@ -283,13 +283,14 @@ export interface BasicConfig {
/** 邮箱配置类型 */
export interface MailConfig {
- MAIL_SEND_TYPE: string
- MAIL_SMTP_SERVER: string
+ MAIL_PROTOCOL: string
+ MAIL_HOST: string
MAIL_SMTP_PORT: string
MAIL_SMTP_USERNAME: string
MAIL_SMTP_PASSWORD: string
- MAIL_SMTP_VERIFY_TYPE: string
MAIL_FROM: string
+ MAIL_SSL_ENABLE: string
+ MAIL_SSL_PORT: string
}
/** 安全配置类型 */
diff --git a/src/views/system/config/components/MailSetting.vue b/src/views/system/config/components/MailSetting.vue
index b4d1098..25dbbfb 100644
--- a/src/views/system/config/components/MailSetting.vue
+++ b/src/views/system/config/components/MailSetting.vue
@@ -11,17 +11,17 @@
:disabled="!isUpdate">
-
-
-
+
+
+
-
-
+
+
@@ -48,10 +48,18 @@
-
-
-
-
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
@@ -109,27 +117,29 @@ defineOptions({ name: 'MailSetting' })
const formRef = ref()
const { form } = useForm({
- MAIL_SEND_TYPE: '',
- MAIL_SMTP_SERVER: '',
+ MAIL_PROTOCOL: '',
+ MAIL_HOST: '',
MAIL_SMTP_PORT: '',
MAIL_SMTP_USERNAME: '',
MAIL_SMTP_PASSWORD: '',
- MAIL_SMTP_VERIFY_TYPE: '',
- MAIL_FROM: ''
+ MAIL_FROM: '',
+ MAIL_SSL_ENABLE: '',
+ MAIL_SSL_PORT: ''
})
// 表单初始化
onMounted(() => {
- getDataList()
+ getDataList() // 获取配置
})
const { width } = useWindowSize()
-const mailSendType = ref()
-const mailServer = ref()
+const mailProtocol = ref()
+const mailHost = ref()
const mailPort = ref()
const mailUsername = ref()
const mailPassword = ref()
-const mailVerifyType = ref()
const mailFrom = ref()
+const mailSslEnable = ref()
+const mailSslPort = ref()
// 参数校验规则
const rules: FormInstance['rules'] = {
SITE_TITLE: [{ required: true, message: '请输入系统标题' }],
@@ -150,12 +160,12 @@ const handleSave = async () => {
const isInvalid = await formRef.value?.validate()
if (isInvalid) return false
await updateOption(
- Object.entries(form).map((item) => {
- return {
- code: item[0],
- value: item[1]
- }
- })
+ Object.entries(form).map((item) => {
+ return {
+ code: item[0],
+ value: item[1]
+ }
+ })
)
// appStore.setSiteConfig(form)
await getDataList()
@@ -163,7 +173,7 @@ const handleSave = async () => {
}
// 查询参数
const queryForm = reactive({
- code: ['MAIL_FROM', 'MAIL_SMTP_PASSWORD', 'MAIL_SMTP_PORT', 'MAIL_SEND_TYPE', 'MAIL_SMTP_SERVER', 'MAIL_SMTP_USERNAME', 'MAIL_SMTP_VERIFY_TYPE']
+ code: ['MAIL_FROM', 'MAIL_SMTP_PASSWORD', 'MAIL_SMTP_PORT', 'MAIL_PROTOCOL', 'MAIL_HOST', 'MAIL_SMTP_USERNAME', 'MAIL_SSL_ENABLE', 'MAIL_SSL_PORT']
})
// 接收参数类型
const dataList = ref([])
@@ -171,13 +181,14 @@ const dataList = ref([])
const getDataList = async () => {
const res = await listOption(queryForm)
dataList.value = res.data
- mailSendType.value = dataList.value.find((option) => option.code === 'MAIL_SEND_TYPE')
- mailServer.value = dataList.value.find((option) => option.code === 'MAIL_SMTP_SERVER')
+ mailProtocol.value = dataList.value.find((option) => option.code === 'MAIL_PROTOCOL')
+ mailHost.value = dataList.value.find((option) => option.code === 'MAIL_HOST')
mailPort.value = dataList.value.find((option) => option.code === 'MAIL_SMTP_PORT')
mailUsername.value = dataList.value.find((option) => option.code === 'MAIL_SMTP_USERNAME')
mailPassword.value = dataList.value.find((option) => option.code === 'MAIL_SMTP_PASSWORD')
- mailVerifyType.value = dataList.value.find((option) => option.code === 'MAIL_SMTP_VERIFY_TYPE')
mailFrom.value = dataList.value.find((option) => option.code === 'MAIL_FROM')
+ mailSslEnable.value = dataList.value.find((option) => option.code === 'MAIL_SSL_ENABLE')
+ mailSslPort.value = dataList.value.find((option) => option.code === 'MAIL_SSL_PORT')
reset()
}
@@ -197,13 +208,14 @@ const onResetValue = () => {
})
}
const reset = () => {
- form.MAIL_SEND_TYPE = mailSendType.value?.value || ''
- form.MAIL_SMTP_SERVER = mailServer.value?.value || ''
+ form.MAIL_PROTOCOL = mailProtocol.value?.value || ''
+ form.MAIL_HOST = mailHost.value?.value || ''
form.MAIL_SMTP_PORT = mailPort.value?.value || ''
form.MAIL_SMTP_USERNAME = mailUsername.value?.value || ''
form.MAIL_SMTP_PASSWORD = mailPassword.value?.value || ''
- form.MAIL_SMTP_VERIFY_TYPE = mailVerifyType.value?.value || ''
form.MAIL_FROM = mailFrom.value?.value || ''
+ form.MAIL_SSL_ENABLE = mailSslEnable.value?.value || ''
+ form.MAIL_SSL_PORT = mailSslPort.value?.value || ''
}