mirror of
https://github.com/vastxie/99AI.git
synced 2025-09-17 09:16:38 +08:00
9 lines
10 KiB
JavaScript
9 lines
10 KiB
JavaScript
|
||
/**
|
||
* 由 Fantastic-admin 提供技术支持
|
||
* Powered by Fantastic-admin
|
||
* https://fantastic-admin.github.io
|
||
*/
|
||
|
||
import{_ as Z}from"./index.vue_vue_type_script_setup_true_lang-D6-4wUAO.js";import{d as ee,m as ae,r as N,a as le,n as c,g as r,c as h,b as e,w as a,h as S,z as _,i as g,B as A,C as P,A as U,F as te,s as oe,e as F,E as k,j as ne,_ as re,H as O,t as se,k as R}from"./index-CAe0BuuW.js";import{a as T}from"./config-CwtVyG0K.js";const ie=F("div",{class:"flex items-center gap-4"},"网站基础配置",-1),de=F("div",{class:"text-sm/6"},[F("div",null," 网站基础配置支持即时更新网站的主要视觉与功能元素。配置内容包括网站名称、备案号、版权信息、LOGO与ICO、默认AI头像与用户头像,以及首页设置等。 "),F("div",null,"请认真填写各项配置,确保提供给用户的信息准确无误。")],-1),ue=["src"],ce=["src"],me=["src"],fe=["src"],pe=ee({__name:"baseConfiguration",setup(_e){const B=[{label:"欢迎页",path:"/home"},{label:"聊天对话",path:"/chat"},{label:"应用中心",path:"/chatStore"},{label:"专业绘画",path:"/midjourney"},{label:"绘画广场",path:"/market"},{label:"思维导图",path:"/mind"}],l=ae({siteName:"",vxNumber:"",robotAvatar:"",userDefautlAvatar:"",filingNumber:"",companyName:"",buyCramiAddress:"",siteUrl:"",isShowAppCatIcon:"",clientFavoIconPath:"",clientLogoPath:"",clientHomePath:"",copyrightTitle:"",copyrightUrl:"",isHideSidebar:"",homeHtml:""}),G=N({siteName:[{required:!0,trigger:"blur",message:"请填写网站名称"}],copyrightUrl:[{trigger:"blur",message:"请填写底部版权文字内容"}],copyrightTitle:[{trigger:"blur",message:"请填写点击底部版本跳转的地址"}]}),I=N(),b=N(`/api/upload/file?dir=${encodeURIComponent("system/others")}`);async function L(){const t=await T.queryConfig({keys:["siteName","vxNumber","robotAvatar","userDefautlAvatar","filingNumber","companyName","isShowAppCatIcon","clientLogoPath","clientFavoIconPath","clientHomePath","copyrightUrl","copyrightTitle","siteUrl","isHideSidebar","homeHtml"]});Object.assign(l,t.data)}function $(){var t;(t=I.value)==null||t.validate(async o=>{if(o){try{await T.setConfig({settings:J(l)}),k.success("变更配置信息成功")}catch{}L()}else k.error("请填写完整信息")})}async function v(t){const o=await O.get(t,{responseType:"blob"});let s="downloaded_file";const f=o.headers["content-disposition"];if(f){const y=/filename="([^"]+)"/.exec(f);y!=null&&y[1]&&(s=y[1])}else s=E(t);return new File([o.data],s,{type:o.data.type})}function E(t){const s=new URL(t).pathname;return s.substring(s.lastIndexOf("/")+1)}function x(t,o){const s=new FormData;s.append("file",t),O.post(b.value,s,{headers:{"Content-Type":"multipart/form-data"}}).then(f=>{o(f.data)}).catch(f=>{console.error("上传失败",f)})}const C=(t,o)=>{console.log("response: ",t.data),l.clientLogoPath=t.data};async function q(){if(l.clientLogoPath){const t=await v(l.clientLogoPath);x(t,C)}}async function z(){if(l.clientFavoIconPath){const t=await v(l.clientFavoIconPath);x(t,D)}}async function K(){if(l.robotAvatar){const t=await v(l.robotAvatar);x(t,H)}}async function M(){if(l.userDefautlAvatar){const t=await v(l.userDefautlAvatar);x(t,j)}}const D=(t,o)=>{console.log("response: ",t.data),l.clientFavoIconPath=t.data},H=(t,o)=>{console.log("response: ",t.data),l.robotAvatar=t.data},j=(t,o)=>{console.log("response: ",t.data),l.userDefautlAvatar=t.data},w=t=>{if(["image/png","image/jpeg","image/gif","image/webp"].includes(t.type)){if(t.size/1024>300)return k.error("当前限制文件最大不超过 300KB!"),!1}else return k.error("当前系统仅支持 PNG、JPEG、GIF、和 WebP 格式的图片!"),!1};function J(t){return Object.keys(t).map(o=>({configKey:o,configVal:t[o]}))}return le(()=>{L()}),(t,o)=>{const s=ne,f=re,y=Z,m=c("el-input"),i=c("el-form-item"),d=c("el-col"),u=c("el-row"),p=c("el-icon"),V=c("el-upload"),W=c("el-radio"),Q=c("el-radio-group"),X=c("el-form"),Y=c("el-card");return r(),h("div",null,[e(y,null,{title:a(()=>[ie]),content:a(()=>[de]),default:a(()=>[e(f,{outline:"",onClick:$},{default:a(()=>[e(s,{name:"i-ri:file-text-line"}),S(" 保存设置 ")]),_:1})]),_:1}),e(Y,{style:{margin:"20px"}},{default:a(()=>[e(X,{ref_key:"formRef",ref:I,rules:G.value,model:l,"label-width":"150px"},{default:a(()=>[e(u,null,{default:a(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(i,{label:"网站名称",prop:"siteName"},{default:a(()=>[e(m,{modelValue:l.siteName,"onUpdate:modelValue":o[0]||(o[0]=n=>l.siteName=n),placeholder:"网站名称",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:a(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(i,{label:"网站地址",prop:"siteUrl"},{default:a(()=>[e(m,{modelValue:l.siteUrl,"onUpdate:modelValue":o[1]||(o[1]=n=>l.siteUrl=n),placeholder:"网站地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:a(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(i,{label:"公司/组织名称",prop:"companyName"},{default:a(()=>[e(m,{modelValue:l.companyName,"onUpdate:modelValue":o[2]||(o[2]=n=>l.companyName=n),placeholder:"填入具体的公司或组织名称",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:a(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(i,{label:"网站备案号",prop:"filingNumber"},{default:a(()=>[e(m,{modelValue:l.filingNumber,"onUpdate:modelValue":o[3]||(o[3]=n=>l.filingNumber=n),placeholder:"填写网站备案信息的备案号",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:a(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(i,{label:"用户端LOGO",prop:"clientLogoPath"},{default:a(()=>[e(m,{modelValue:l.clientLogoPath,"onUpdate:modelValue":o[4]||(o[4]=n=>l.clientLogoPath=n),placeholder:"请填写或上传网站 LOGO 图片 URL",clearable:""},{append:a(()=>[e(V,{class:"avatar-uploader",action:b.value,"show-file-list":!1,"on-success":C,"before-upload":w,style:{display:"flex","align-items":"center","justify-content":"center"}},{default:a(()=>[l.clientLogoPath?(r(),h("img",{key:0,src:l.clientLogoPath,style:{"max-width":"1.5rem","max-height":"1.5rem",margin:"5px 0","object-fit":"contain"}},null,8,ue)):(r(),_(p,{key:1,style:{width:"1rem"}},{default:a(()=>[e(g(A))]),_:1}))]),_:1},8,["action"]),l.clientLogoPath?(r(),_(p,{key:0,onClick:q,style:{"margin-left":"35px",width:"1rem"}},{default:a(()=>[e(g(P))]),_:1})):U("",!0)]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:a(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(i,{label:"网站 ico",prop:"clientFavoIconPath"},{default:a(()=>[e(m,{modelValue:l.clientFavoIconPath,"onUpdate:modelValue":o[5]||(o[5]=n=>l.clientFavoIconPath=n),placeholder:"请填写或上传网站 ico URL",clearable:""},{append:a(()=>[e(V,{class:"avatar-uploader",action:b.value,"show-file-list":!1,"on-success":D,"before-upload":w,style:{display:"flex","align-items":"center","justify-content":"center"}},{default:a(()=>[l.clientFavoIconPath?(r(),h("img",{key:0,src:l.clientFavoIconPath,style:{"max-width":"1.5rem","max-height":"1.5rem",margin:"5px 0","object-fit":"contain"}},null,8,ce)):(r(),_(p,{key:1,style:{width:"1rem"}},{default:a(()=>[e(g(A))]),_:1}))]),_:1},8,["action"]),l.clientFavoIconPath?(r(),_(p,{key:0,onClick:z,style:{"margin-left":"35px",width:"1rem"}},{default:a(()=>[e(g(P))]),_:1})):U("",!0)]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:a(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(i,{label:"AI头像",prop:"robotAvatar"},{default:a(()=>[e(m,{modelValue:l.robotAvatar,"onUpdate:modelValue":o[6]||(o[6]=n=>l.robotAvatar=n),placeholder:"请填写或上传网站 AI 头像 URL、为空将根据模型自动显示",clearable:""},{append:a(()=>[e(V,{class:"avatar-uploader",action:b.value,"show-file-list":!1,"on-success":H,"before-upload":w,style:{display:"flex","align-items":"center","justify-content":"center"}},{default:a(()=>[l.robotAvatar?(r(),h("img",{key:0,src:l.robotAvatar,style:{"max-width":"1.5rem","max-height":"1.5rem",margin:"5px 0","object-fit":"contain"}},null,8,me)):(r(),_(p,{key:1,style:{width:"1rem"}},{default:a(()=>[e(g(A))]),_:1}))]),_:1},8,["action"]),l.robotAvatar?(r(),_(p,{key:0,onClick:K,style:{"margin-left":"35px",width:"1rem"}},{default:a(()=>[e(g(P))]),_:1})):U("",!0)]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:a(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(i,{label:"用户默认头像",prop:"userDefautlAvatar"},{default:a(()=>[e(m,{modelValue:l.userDefautlAvatar,"onUpdate:modelValue":o[7]||(o[7]=n=>l.userDefautlAvatar=n),placeholder:"请填写或上传网站新用户默认的头像 URL",clearable:""},{append:a(()=>[e(V,{class:"avatar-uploader",action:b.value,"show-file-list":!1,"on-success":j,"before-upload":w,style:{display:"flex","align-items":"center","justify-content":"center"}},{default:a(()=>[l.userDefautlAvatar?(r(),h("img",{key:0,src:l.userDefautlAvatar,style:{"max-width":"1.5rem","max-height":"1.5rem",margin:"5px 0","object-fit":"contain"}},null,8,fe)):(r(),_(p,{key:1,style:{width:"1rem"}},{default:a(()=>[e(g(A))]),_:1}))]),_:1},8,["action"]),l.userDefautlAvatar?(r(),_(p,{key:0,onClick:M,style:{"margin-left":"35px",width:"1rem"}},{default:a(()=>[e(g(P))]),_:1})):U("",!0)]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:a(()=>[e(d,{xs:24,md:24,lg:24,xl:24},{default:a(()=>[e(i,{label:"设置指定首页",prop:"clientHomePath"},{default:a(()=>[e(Q,{modelValue:l.clientHomePath,"onUpdate:modelValue":o[8]||(o[8]=n=>l.clientHomePath=n)},{default:a(()=>[(r(),h(te,null,oe(B,n=>e(W,{key:n.path,size:"small",border:"",label:n.path},{default:a(()=>[S(se(n.label),1)]),_:2},1032,["label"])),64))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:a(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(i,{label:"自定义首页",prop:"homeHtml"},{default:a(()=>[e(m,{modelValue:l.homeHtml,"onUpdate:modelValue":o[9]||(o[9]=n=>l.homeHtml=n),placeholder:"自定义首页",type:"textarea",rows:10,clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof R=="function"&&R(pe);export{pe as default};
|