diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index b925116..c2678fd 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -293,13 +293,13 @@ export interface SiteConfig { /** 邮箱配置类型 */ export interface MailConfig { - MAIL_SMTP_HOST: OptionResp - MAIL_SMTP_PORT: OptionResp - MAIL_SMTP_USERNAME: OptionResp - MAIL_SMTP_PASSWORD: OptionResp + MAIL_PROTOCOL: OptionResp + MAIL_HOST: OptionResp + MAIL_PORT: OptionResp + MAIL_USERNAME: OptionResp + MAIL_PASSWORD: OptionResp MAIL_SSL_ENABLED: OptionResp MAIL_SSL_PORT: OptionResp - MAIL_FROM: OptionResp } /** 安全配置类型 */ diff --git a/src/views/system/config/components/MailSetting.vue b/src/views/system/config/components/MailSetting.vue index 67f934c..b99cd36 100644 --- a/src/views/system/config/components/MailSetting.vue +++ b/src/views/system/config/components/MailSetting.vue @@ -11,17 +11,22 @@ scroll-to-first-error class="form" > - - + + + + - - + + - - + + - - + + + + + @@ -32,9 +37,6 @@ - - - 修改 @@ -73,43 +75,42 @@ const { width } = useWindowSize() const formRef = ref() const { form } = useForm({ - MAIL_SMTP_HOST: '', - MAIL_SMTP_PORT: 0, - MAIL_SMTP_USERNAME: '', - MAIL_SMTP_PASSWORD: '', + MAIL_PROTOCOL: '', + MAIL_HOST: '', + MAIL_PORT: 0, + MAIL_USERNAME: '', + MAIL_PASSWORD: '', MAIL_SSL_ENABLED: '', - MAIL_SSL_PORT: 0, - MAIL_FROM: '' + MAIL_SSL_PORT: 0 }) const rules: FormInstance['rules'] = { - MAIL_SMTP_HOST: [{ required: true, message: '请输入值' }], - MAIL_SMTP_PORT: [{ required: true, message: '请输入值' }], - MAIL_SMTP_USERNAME: [{ required: true, message: '请输入值' }], - MAIL_SMTP_PASSWORD: [{ required: true, message: '请输入值' }], - MAIL_SSL_PORT: [{ required: true, message: '请输入值' }], - MAIL_FROM: [{ required: true, message: '请输入值' }] + MAIL_HOST: [{ required: true, message: '请输入值' }], + MAIL_PORT: [{ required: true, message: '请输入值' }], + MAIL_USERNAME: [{ required: true, message: '请输入值' }], + MAIL_PASSWORD: [{ required: true, message: '请输入值' }], + MAIL_SSL_PORT: [{ required: true, message: '请输入值' }] } const mailConfig = ref({ - MAIL_SMTP_HOST: {}, - MAIL_SMTP_PORT: {}, - MAIL_SMTP_USERNAME: {}, - MAIL_SMTP_PASSWORD: {}, + MAIL_PROTOCOL: {}, + MAIL_HOST: {}, + MAIL_PORT: {}, + MAIL_USERNAME: {}, + MAIL_PASSWORD: {}, MAIL_SSL_ENABLED: {}, - MAIL_SSL_PORT: {}, - MAIL_FROM: {} + MAIL_SSL_PORT: {} }) // 重置 const reset = () => { formRef.value?.resetFields() - form.MAIL_SMTP_HOST = mailConfig.value.MAIL_SMTP_HOST.value || '' - form.MAIL_SMTP_PORT = mailConfig.value.MAIL_SMTP_PORT.value || 0 - form.MAIL_SMTP_USERNAME = mailConfig.value.MAIL_SMTP_USERNAME.value || '' - form.MAIL_SMTP_PASSWORD = mailConfig.value.MAIL_SMTP_PASSWORD?.value || '' + form.MAIL_PROTOCOL = mailConfig.value.MAIL_PROTOCOL.value || '' + form.MAIL_HOST = mailConfig.value.MAIL_HOST.value || '' + form.MAIL_PORT = mailConfig.value.MAIL_PORT.value || 0 + form.MAIL_USERNAME = mailConfig.value.MAIL_USERNAME.value || '' + form.MAIL_PASSWORD = mailConfig.value.MAIL_PASSWORD?.value || '' form.MAIL_SSL_ENABLED = mailConfig.value.MAIL_SSL_ENABLED.value || '' form.MAIL_SSL_PORT = mailConfig.value.MAIL_SSL_PORT.value || 0 - form.MAIL_FROM = mailConfig.value.MAIL_FROM.value || '' } const isUpdate = ref(false) @@ -131,7 +132,7 @@ const queryForm = { const getDataList = async () => { const { data } = await listOption(queryForm) mailConfig.value = data.reduce((obj: MailConfig, option: OptionResp) => { - obj[option.code] = { ...option, value: ['MAIL_SMTP_PORT', 'MAIL_SSL_PORT'].includes(option.code) ? Number.parseInt(option.value) : option.value } + obj[option.code] = { ...option, value: ['MAIL_PORT', 'MAIL_SSL_PORT'].includes(option.code) ? Number.parseInt(option.value) : option.value } return obj }, {}) handleCancel()