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

import{_ as N}from"./index.vue_vue_type_script_setup_true_lang-BTce45WY.js";import{d as S,m as M,r as f,a as T,p as n,g as p,c as j,b as e,w as t,h as v,z as q,A as U,e as s,G as g,j as $,_ as A,k as h}from"./index-nGFMSQGw.js";import{a as x}from"./config-CYXO1pNF.js";const E=s("div",{class:"flex items-center gap-4"},"欢迎页设置",-1),I=s("div",{class:"text-sm/6"},[s("div",null," 欢迎页设置支持配置访问首页时的默认显示内容。可以启用欢迎页，或直接跳转到聊天页面。 "),s("div",null,"若启用欢迎页，可以在此处自定义欢迎页面内容。"),s("div",{class:"mt-2 text-gray-500"},[s("strong",null,"推荐："),v(" 您可以在其他专业的 HTML 编辑器（如 VS Code、Sublime Text）中编辑欢迎页面内容并复制粘贴到此处，以获得更好的编辑体验。 ")])],-1),L=["srcdoc"],O=S({__name:"welcomePageSettings",setup(R){const o=M({clientHomePath:"",homeHtml:""}),y=f({siteName:[{required:!0,trigger:"blur",message:"请填写网站名称"}]}),i=f();async function d(){const a=await x.queryConfig({keys:["clientHomePath","homeHtml"]});Object.assign(o,a.data)}function H(){var a;(a=i.value)==null||a.validate(async l=>{if(l){try{await x.setConfig({settings:b(o)}),g.success("变更欢迎页设置成功")}catch{}d()}else g.error("请填写完整信息")})}function b(a){return Object.keys(a).map(l=>({configKey:l,configVal:a[l]}))}return T(()=>{d()}),(a,l)=>{const u=$,w=A,V=N,C=n("el-switch"),c=n("el-form-item"),r=n("el-col"),_=n("el-row"),k=n("el-input"),P=n("el-form"),B=n("el-card");return p(),j("div",null,[e(V,null,{title:t(()=>[E]),content:t(()=>[I]),default:t(()=>[e(w,{outline:"",onClick:H},{default:t(()=>[e(u,{name:"i-ri:file-text-line"}),v(" 保存设置 ")]),_:1})]),_:1}),e(B,{style:{margin:"20px"}},{default:t(()=>[e(P,{ref_key:"formRef",ref:i,rules:y.value,model:o,"label-width":"150px"},{default:t(()=>[e(_,null,{default:t(()=>[e(r,{xs:24,md:24,lg:24,xl:24},{default:t(()=>[e(c,{label:"开启欢迎页",prop:"clientHomePath"},{default:t(()=>[e(C,{modelValue:o.clientHomePath,"onUpdate:modelValue":l[0]||(l[0]=m=>o.clientHomePath=m),"active-value":"/home","inactive-value":"/chat"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),o.clientHomePath==="/home"?(p(),q(_,{key:0},{default:t(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(c,{label:"欢迎页（HTML）",prop:"homeHtml"},{default:t(()=>[e(k,{modelValue:o.homeHtml,"onUpdate:modelValue":l[1]||(l[1]=m=>o.homeHtml=m),placeholder:"请输入自定义欢迎页内容",type:"textarea",rows:10,clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):U("",!0),e(r,{xs:28,md:24,lg:20,xl:12,style:{"margin-top":"20px"}},{default:t(()=>[e(c,{label:"预览"},{default:t(()=>[s("iframe",{class:"w-full h-100 border border-gray-200 rounded-md bg-gray-100",srcdoc:o.homeHtml,sandbox:"allow-same-origin allow-scripts"},null,8,L)]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof h=="function"&&h(O);export{O as default};
