/** * 由 Fantastic-admin 提供技术支持 * Powered by Fantastic-admin * https://fantastic-admin.github.io */ import{_ as I}from"./index.vue_vue_type_script_setup_true_lang-BhIKqf2a.js";import{d as U,m as L,r as g,a as B,p as u,g as N,c as q,b as e,w as l,h as s,e as c,G as h,j as C,_ as j,k as b}from"./index-6QRvoxq4.js";import{a as S}from"./config-DBls5jtO.js";const $=c("div",{class:"flex items-center gap-4"},"微信登录设置[仔细阅读]",-1),E=c("div",{class:"text-sm/6"},[c("div",null," 系统微信登录通过关联公众号实现[请务必注册为服务号、个人公众号没有二维码等此类权限]。 "),c("div",null,[s(" 请前往 "),c("a",{href:"https://mp.weixin.qq.com/",target:"_blank"},"微信公众平台"),s(" ,获取开发者配置信息。 ")]),c("div",null," 如果用户对公众号发送消息,将会从下面设置的自定义回复默认信息。 "),c("div",null,[s(" 同时别忘记在微信公众号平台将自己的 ip/域名 加入白名单,配置位置为公众号后台->基本配置:服务复制参考 "),c("a",{href:"https://域名/api/official/notify",target:"_blank"},"https://域名/api/official/notify"),s(" 将域名修改为您的域名。 ")]),c("div",null,"下方Token对应自己后台设置的Token,加密秘钥随机即可。"),c("div",null,"当设置不指定首页并且配置了微信登录即可默认打开静默登录!")],-1),H=U({__name:"wechat",setup(M){const t=L({wechatRegisterStatus:"",wechatSilentLoginStatus:"",wechatOfficialName:"",wechatOfficialAppId:"",wechatOfficialToken:"",wechatOfficialAppSecret:"",officialSubscribeText:"",officialBindAccountText:"",officialScanLoginText:"",officialAutoReplyText:""}),V=g({wechatOfficialName:[{required:!1,trigger:"blur",message:"请填写微信公众号名称"}],wechatOfficialAppId:[{required:!1,trigger:"blur",message:"请填写微信公众号开发配置 AppId"}],wechatOfficialToken:[{required:!1,trigger:"blur",message:"请填写微信公众号开发配置 Token"}],wechatOfficialAppSecret:[{required:!1,trigger:"blur",message:"请填写微信公众号开发配置 AppSecret"}]}),p=g();async function m(){const d=await S.queryConfig({keys:["wechatOfficialName","wechatOfficialAppId","wechatOfficialToken","wechatOfficialAppSecret","officialSubscribeText","officialBindAccountText","officialScanLoginText","officialAutoReplyText","wechatRegisterStatus","wechatSilentLoginStatus"]});Object.assign(t,d.data)}function T(){var d;(d=p.value)==null||d.validate(async a=>{if(a){try{await S.setConfig({settings:A(t)}),h.success("变更配置信息成功")}catch{}m()}else h.error("请填写完整信息")})}function A(d){return Object.keys(d).map(a=>({configKey:a,configVal:d[a]}))}return B(()=>{m()}),(d,a)=>{const _=C,O=j,v=I,w=u("el-switch"),x=u("el-tooltip"),i=u("el-form-item"),n=u("el-col"),f=u("el-row"),r=u("el-input"),y=u("el-divider"),k=u("el-form"),R=u("el-card");return N(),q("div",null,[e(v,null,{title:l(()=>[$]),content:l(()=>[E]),default:l(()=>[e(O,{outline:"",text:"",onClick:T},{default:l(()=>[e(_,{name:"i-ri:file-text-line"}),s(" 保存设置 ")]),_:1})]),_:1}),e(R,{style:{margin:"20px"}},{default:l(()=>[e(k,{ref_key:"formRef",ref:p,rules:V.value,model:t,"label-width":"170px"},{default:l(()=>[e(f,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(i,{label:"是否开启微信登录注册",prop:"wechatRegisterStatus"},{default:l(()=>[e(x,{class:"box-item",effect:"dark",content:"如您启用微信注册、则用户端则可以通过微信扫码方式注册或登录!",placement:"right"},{default:l(()=>[e(w,{modelValue:t.wechatRegisterStatus,"onUpdate:modelValue":a[0]||(a[0]=o=>t.wechatRegisterStatus=o),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),e(f,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(i,{label:"是否开启微信静默",prop:"wechatSilentLoginStatus"},{default:l(()=>[e(x,{class:"box-item",effect:"dark",content:"如您启用静默登录、则用户在微信环境打开则直接自动登录!",placement:"right"},{default:l(()=>[e(w,{modelValue:t.wechatSilentLoginStatus,"onUpdate:modelValue":a[1]||(a[1]=o=>t.wechatSilentLoginStatus=o),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),e(f,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(i,{label:"公众号名称",prop:"wechatOfficialName"},{default:l(()=>[e(r,{modelValue:t.wechatOfficialName,"onUpdate:modelValue":a[2]||(a[2]=o=>t.wechatOfficialName=o),placeholder:"公众号名称",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(f,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(i,{label:"AppId",prop:"wechatOfficialAppId"},{default:l(()=>[e(r,{modelValue:t.wechatOfficialAppId,"onUpdate:modelValue":a[3]||(a[3]=o=>t.wechatOfficialAppId=o),placeholder:"公众号开发信息 AppId",clearable:"",type:"password","show-password":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(f,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(i,{label:"Token",prop:"wechatOfficialToken"},{default:l(()=>[e(r,{modelValue:t.wechatOfficialToken,"onUpdate:modelValue":a[4]||(a[4]=o=>t.wechatOfficialToken=o),placeholder:"公众号Token配置",clearable:"",type:"password","show-password":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(f,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(i,{label:"AppSecret",prop:"wechatOfficialAppSecret"},{default:l(()=>[e(r,{modelValue:t.wechatOfficialAppSecret,"onUpdate:modelValue":a[5]||(a[5]=o=>t.wechatOfficialAppSecret=o),placeholder:"公众号开发信息 AppSecret",clearable:"",type:"password","show-password":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(y),e(f,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(i,{label:"订阅公众号欢迎消息",prop:"officialSubscribeText"},{default:l(()=>[e(r,{modelValue:t.officialSubscribeText,"onUpdate:modelValue":a[6]||(a[6]=o=>t.officialSubscribeText=o),type:"textarea",rows:3,placeholder:"订阅你的公众号后对他的欢迎语!",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(f,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(i,{label:"绑定账号回复消息",prop:"officialBindAccountText"},{default:l(()=>[e(r,{modelValue:t.officialBindAccountText,"onUpdate:modelValue":a[7]||(a[7]=o=>t.officialBindAccountText=o),type:"textarea",rows:3,placeholder:"非微信登录用户首次绑定微信的欢迎语",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(f,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(i,{label:"扫码登录回复消息",prop:"officialScanLoginText"},{default:l(()=>[e(r,{modelValue:t.officialScanLoginText,"onUpdate:modelValue":a[8]||(a[8]=o=>t.officialScanLoginText=o),type:"textarea",rows:3,placeholder:"用户扫码登录成功时自动回复的内容",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(f,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(i,{label:"自定义回复的默认信息",prop:"officialAutoReplyText"},{default:l(()=>[e(r,{modelValue:t.officialAutoReplyText,"onUpdate:modelValue":a[9]||(a[9]=o=>t.officialAutoReplyText=o),type:"textarea",rows:3,placeholder:"当用户对公众号发了消息不在自动回复列表时回复的兜底内容",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof b=="function"&&b(H);export{H as default};