
/**
 * 由 Fantastic-admin 提供技术支持
 * Powered by Fantastic-admin
 * https://fantastic-admin.github.io
 */

import{_ as I}from"./index.vue_vue_type_script_setup_true_lang-BTce45WY.js";import{d as k,m as N,r as g,a as q,p as s,g as T,c as L,b as e,w as l,h as m,e as d,G as h,j as U,_ as B,k as y}from"./index-nGFMSQGw.js";import{a as P}from"./config-CYXO1pNF.js";const j=d("div",{class:"flex items-center gap-4"},"手机验证码登录设置",-1),D=d("div",{class:"text-sm/6"},[d("div",null,[m(" 手机验证使用"),d("a",{href:"https://dysms.console.aliyun.com/overview",target:"_blank"},"阿里云短信服务"),m("，请先申请好签名模板以及获取到您的秘钥信息。 ")]),d("div",null,"当您配置并开启后则表示开启用户端手机号注册的行为！")],-1),$=k({__name:"phone",setup(E){const a=N({phoneLoginStatus:"",aliPhoneAccessKeyId:"",aliPhoneAccessKeySecret:"",aliPhoneSignName:"",aliPhoneTemplateCode:""}),S=g({phoneLoginStatus:[{required:!1,trigger:"blur",message:"请选择是否开启手机号登录"}],aliPhoneAccessKeyId:[{required:!1,trigger:"blur",message:"请填写阿里云短信服务accessKeyId"}],aliPhoneAccessKeySecret:[{required:!1,trigger:"blur",message:"请填写阿里云短信服务accessKeySecret"}],aliPhoneSignName:[{required:!1,trigger:"blur",message:"请填写阿里云短信服务的模板签名"}],aliPhoneTemplateCode:[{required:!1,trigger:"blur",message:"请填写阿里云短信服务的模板ID"}]}),p=g();async function f(){const n=await P.queryConfig({keys:["phoneLoginStatus","aliPhoneAccessKeyId","aliPhoneAccessKeySecret","aliPhoneSignName","aliPhoneTemplateCode"]});Object.assign(a,n.data)}function b(){var n;(n=p.value)==null||n.validate(async o=>{if(o){try{await P.setConfig({settings:x(a)}),h.success("变更配置信息成功")}catch{}f()}else h.error("请填写完整信息")})}function x(n){return Object.keys(n).map(o=>({configKey:o,configVal:n[o]}))}return q(()=>{f()}),(n,o)=>{const _=U,K=B,V=I,v=s("el-switch"),A=s("el-tooltip"),c=s("el-form-item"),r=s("el-col"),i=s("el-row"),u=s("el-input"),w=s("el-form"),C=s("el-card");return T(),L("div",null,[e(V,null,{title:l(()=>[j]),content:l(()=>[D]),default:l(()=>[e(K,{text:"",outline:"",onClick:b},{default:l(()=>[e(_,{name:"i-ri:file-text-line"}),m(" 保存设置 ")]),_:1})]),_:1}),e(C,{style:{margin:"20px"}},{default:l(()=>[e(w,{ref_key:"formRef",ref:p,rules:S.value,model:a,"label-width":"170px"},{default:l(()=>[e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"开启手机号注册/登录",prop:"phoneLoginStatus"},{default:l(()=>[e(A,{class:"box-item",effect:"dark",content:"如您启用短信登录、则用户端则可以通过手机号的方式登录！",placement:"right"},{default:l(()=>[e(v,{modelValue:a.phoneLoginStatus,"onUpdate:modelValue":o[0]||(o[0]=t=>a.phoneLoginStatus=t),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"AccessKeyId",prop:"aliPhoneAccessKeyId"},{default:l(()=>[e(u,{modelValue:a.aliPhoneAccessKeyId,"onUpdate:modelValue":o[1]||(o[1]=t=>a.aliPhoneAccessKeyId=t),placeholder:"请填写AccessKeyId",clearable:"",type:"password","show-password":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"AccessKeySecret",prop:"aliPhoneAccessKeySecret"},{default:l(()=>[e(u,{modelValue:a.aliPhoneAccessKeySecret,"onUpdate:modelValue":o[2]||(o[2]=t=>a.aliPhoneAccessKeySecret=t),placeholder:"请填写AccessKeySecret",clearable:"",type:"password","show-password":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"短信签名",prop:"aliPhoneSignName"},{default:l(()=>[e(u,{modelValue:a.aliPhoneSignName,"onUpdate:modelValue":o[3]||(o[3]=t=>a.aliPhoneSignName=t),placeholder:"请填写您申请的短信签名",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"短信模板ID",prop:"aliPhoneTemplateCode"},{default:l(()=>[e(u,{modelValue:a.aliPhoneTemplateCode,"onUpdate:modelValue":o[4]||(o[4]=t=>a.aliPhoneTemplateCode=t),placeholder:"请填写短信模板ID",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof y=="function"&&y($);export{$ as default};
