UnisKB/static/chat/assets/index-BiW442Xq.js

2 lines
4.6 KiB
JavaScript

import{bl as A,bk as H,bj as M,ay as F,aB as f,bd as L,aC as m,br as G,aD as i,bs as S,aE as w,bf as k,aH as s,aG as t,aK as _,aJ as p,bn as c,aI as g,bt as U,aF as J,bZ as O,bY as j,b_ as K,bo as C,ce as Y}from"./chat-u6cKkSMp.js";const y="/email_setting",Z=n=>M(`${y}`,void 0,n),z=(n,e)=>A(`${y}`,n,void 0,e),Q=(n,e)=>H(`${y}`,n,void 0,e),h={getEmailSetting:Z,postTestEmail:z,putEmailSetting:Q},W={class:"email-setting p-16-24"},X={class:"ml-4 color-text-primary"},x={class:"email-setting__main p-16"},ee={class:"mr-12"},le=F({__name:"index",setup(n){const e=f({email_host:"",email_port:"",email_host_user:"",email_host_password:"",email_use_tls:!1,email_use_ssl:!1,from_email:""}),b=f(),u=f(!1),T=L({email_host:[{required:!0,message:m("views.system.email.smtpHostPlaceholder"),trigger:"blur"}],email_port:[{required:!0,message:m("views.system.email.smtpPortPlaceholder"),trigger:"blur"}],email_host_user:[{required:!0,message:m("views.system.email.smtpUserPlaceholder"),trigger:"blur"}],email_host_password:[{required:!0,message:m("views.system.email.smtpPasswordPlaceholder"),trigger:"blur"}],from_email:[{required:!0,message:m("views.system.email.sendEmailPlaceholder"),trigger:"blur"}]}),V=async(l,a)=>{l&&await l.validate((v,$)=>{v&&(a?h.postTestEmail(e.value,u).then(r=>{C(m("views.system.testSuccess"))}):h.putEmailSetting(e.value,u).then(r=>{C(m("common.saveSuccess"))}))})};function D(){h.getEmailSetting(u).then(l=>{l.data&&JSON.stringify(l.data)!=="{}"&&(e.value=l.data)})}return G(()=>{D()}),(l,a)=>{const v=i("el-breadcrumb-item"),$=i("el-breadcrumb"),r=i("el-input"),d=i("el-form-item"),P=i("el-checkbox"),E=i("el-button"),q=i("el-form"),I=i("el-scrollbar"),N=i("el-card"),B=S("hasPermission"),R=S("loading");return w(),k("div",W,[s($,{"separator-icon":"ArrowRight",class:"mb-16"},{default:t(()=>[s(v,null,{default:t(()=>[_(p(c(m)("views.system.subTitle")),1)]),_:1}),s(v,null,{default:t(()=>[g("h5",X,p(l.$t("views.system.email.title")),1)]),_:1})]),_:1}),U((w(),J(N,{style:{"--el-card-padding":"16px"}},{default:t(()=>[s(I,null,{default:t(()=>[g("div",x,[s(q,{ref_key:"emailFormRef",ref:b,rules:T,model:e.value,"label-position":"top","require-asterisk-position":"right"},{default:t(()=>[s(d,{label:l.$t("views.system.email.smtpHost"),prop:"email_host"},{default:t(()=>[s(r,{modelValue:e.value.email_host,"onUpdate:modelValue":a[0]||(a[0]=o=>e.value.email_host=o),placeholder:l.$t("views.system.email.smtpHostPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(d,{label:l.$t("views.system.email.smtpPort"),prop:"email_port"},{default:t(()=>[s(r,{modelValue:e.value.email_port,"onUpdate:modelValue":a[1]||(a[1]=o=>e.value.email_port=o),placeholder:l.$t("views.system.email.smtpPortPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(d,{label:l.$t("views.system.email.smtpUser"),prop:"email_host_user"},{default:t(()=>[s(r,{modelValue:e.value.email_host_user,"onUpdate:modelValue":a[2]||(a[2]=o=>e.value.email_host_user=o),placeholder:l.$t("views.system.email.smtpUserPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(d,{label:l.$t("views.system.email.sendEmail"),prop:"from_email"},{default:t(()=>[s(r,{modelValue:e.value.from_email,"onUpdate:modelValue":a[3]||(a[3]=o=>e.value.from_email=o),placeholder:l.$t("views.system.email.sendEmailPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(d,{label:l.$t("views.system.password"),prop:"email_host_password"},{default:t(()=>[s(r,{modelValue:e.value.email_host_password,"onUpdate:modelValue":a[4]||(a[4]=o=>e.value.email_host_password=o),placeholder:l.$t("views.system.email.smtpPasswordPlaceholder"),"show-password":""},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(d,null,{default:t(()=>[s(P,{modelValue:e.value.email_use_ssl,"onUpdate:modelValue":a[5]||(a[5]=o=>e.value.email_use_ssl=o)},{default:t(()=>[_(p(l.$t("views.system.email.enableSSL")),1)]),_:1},8,["modelValue"])]),_:1}),s(d,null,{default:t(()=>[s(P,{modelValue:e.value.email_use_tls,"onUpdate:modelValue":a[6]||(a[6]=o=>e.value.email_use_tls=o)},{default:t(()=>[_(p(l.$t("views.system.email.enableTLS")),1)]),_:1},8,["modelValue"])]),_:1}),U((w(),k("span",ee,[s(E,{onClick:a[7]||(a[7]=o=>V(b.value)),type:"primary",disabled:u.value},{default:t(()=>[_(p(l.$t("common.save")),1)]),_:1},8,["disabled"])])),[[B,new(c(O))([c(j).ADMIN],[c(K).EMAIL_SETTING_EDIT],[],"OR")]]),g("span",null,[s(E,{onClick:a[8]||(a[8]=o=>V(b.value,"test")),disabled:u.value},{default:t(()=>[_(p(l.$t("views.system.test")),1)]),_:1},8,["disabled"])])]),_:1},8,["rules","model"])])]),_:1})]),_:1})),[[R,u.value]])])}}}),ae=Y(le,[["__scopeId","data-v-e059225d"]]);export{ae as default};