import{g as M,e as T,c as k}from"./config-3b189d83.js";import{M as d,I as w,F as P,B as U,S as q,e as h,b as x}from"./ui-ba7aaa7e.js";import{e as B,l as E,r as i,P as f,a3 as b,a4 as t,f as a,a9 as F,H as p}from"./vue-bf422dc1.js";import"./index-8db2df2c.js";import"./libs-51817cd7.js";import"./plugins-ca970193.js";import"./others-9f318174.js";import"./echarts-bf9d612c.js";import"./icons-a8498fb6.js";const R={name:"WebEmail"},J=B({...R,setup(I){const l=E({email_name:"",email_smtp:"",email_port:"",email_user:"",email_pass:""});(async()=>{const{data:s}=await M({field:Object.keys(l)});for(const e in s)l[e]=s[e]})();const _=i(),V=async()=>{const s=await _.value.validate();if(typeof s!="object"&&s){const e=await T({data:l});e.code===1?d.success("操作成功"):d.error(e.msg)}},g={email_name:[{required:!0,message:"请输入发件人"}],email_smtp:[{required:!0,message:"请输入SMTP服务器"}],email_port:[{required:!0,message:"请输入邮箱SMTP服务器端口"}],email_user:[{required:!0,message:"请输入邮箱账号"}],email_pass:[{required:!0,message:"请输入邮箱密码"}]},n=i(""),c=i(!1),y=async()=>{if(c.value=!0,!n.value){d.error("请输入测试邮箱");return}const{msg:s}=await k({address:n.value});d.success(s)};return(s,e)=>{const r=w,m=P,u=U,v=q,C=h,S=x;return f(),b(S,{title:"邮箱配置",class:"basic-container",bordered:!1},{default:t(()=>[a(C,{ref_key:"formRef",ref:_,"label-align":"left",data:l,rules:g,"label-width":150},{default:t(()=>[a(m,{label:"发件人",name:"email_name"},{default:t(()=>[a(r,{modelValue:l.email_name,"onUpdate:modelValue":e[0]||(e[0]=o=>l.email_name=o),clearable:"",placeholder:"请输入发件人"},null,8,["modelValue"])]),_:1}),a(m,{label:"SMTP服务器",name:"email_smtp"},{default:t(()=>[a(r,{modelValue:l.email_smtp,"onUpdate:modelValue":e[1]||(e[1]=o=>l.email_smtp=o),clearable:"",placeholder:"请输入SMTP服务器"},null,8,["modelValue"])]),_:1}),a(m,{label:"SMTP端口",name:"email_port"},{default:t(()=>[a(r,{modelValue:l.email_port,"onUpdate:modelValue":e[2]||(e[2]=o=>l.email_port=o),clearable:"",placeholder:"请输入邮箱SMTP服务器端口"},null,8,["modelValue"])]),_:1}),a(m,{label:"邮箱账号",name:"email_user"},{default:t(()=>[a(r,{modelValue:l.email_user,"onUpdate:modelValue":e[3]||(e[3]=o=>l.email_user=o),clearable:"",placeholder:"请输入邮箱账号"},null,8,["modelValue"])]),_:1}),a(m,{label:"邮箱密码",name:"email_pass"},{default:t(()=>[a(r,{modelValue:l.email_pass,"onUpdate:modelValue":e[4]||(e[4]=o=>l.email_pass=o),clearable:"",placeholder:"请输入邮箱密码",type:"password"},null,8,["modelValue"])]),_:1}),c.value?(f(),b(m,{key:0,label:"测试邮箱",name:"address"},{default:t(()=>[a(r,{modelValue:n.value,"onUpdate:modelValue":e[5]||(e[5]=o=>n.value=o),clearable:"",placeholder:"请输入测试邮箱"},null,8,["modelValue"])]),_:1})):F("",!0),a(m,null,{default:t(()=>[a(v,{size:"small"},{default:t(()=>[a(u,{theme:"primary",onClick:V},{default:t(()=>[p("提交")]),_:1}),a(u,{theme:"primary",onClick:y},{default:t(()=>[p("发信测试")]),_:1}),a(u,{theme:"default",variant:"base",type:"reset"},{default:t(()=>[p("重置")]),_:1})]),_:1})]),_:1})]),_:1},8,["data"])]),_:1})}}});export{J as default};
