99AI/AIWebQuickDeploy/public/admin/assets/notice-Dl9A1sfn.js
2025-03-04 17:36:53 +08:00

9 lines
3.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 由 Fantastic-admin 提供技术支持
* Powered by Fantastic-admin
* https://fantastic-admin.github.io
*/
import{_ as S}from"./index.vue_vue_type_script_setup_true_lang-BhIKqf2a.js";import{d as $,u as q,m as B,n as E,r as _,a as H,p as s,g as M,c as j,b as e,w as o,h as P,i as R,e as g,G as f,H as D,j as F,_ as G,k as x}from"./index-6QRvoxq4.js";import{a as h}from"./config-DBls5jtO.js";import{E as K}from"./style-CSuzBWCF.js";const L=g("div",{class:"flex items-center gap-4"},"公告设置说明",-1),z=g("div",{class:"text-sm/6"},[g("div",null," 公告设置用于配置用户端显示的公告页面。支持使用Markdown语法或HTML标签来创建内容为灵活的内容格式提供便利。 ")],-1),J=$({__name:"notice",setup(Q){const V=q(),a=B({isAutoOpenNotice:"",noticeInfo:"",noticeTitle:""});E(()=>V.settings.app.colorScheme);const C=_({noticeTitle:[{required:!0,trigger:"blur",message:"请填写公告标题"}],noticeInfo:[{required:!0,trigger:"blur",message:"请填写公告具体信息"}]}),y=_();async function v(){const n=await h.queryConfig({keys:["noticeInfo","noticeTitle","isAutoOpenNotice"]}),{noticeInfo:t,noticeTitle:c,isAutoOpenNotice:i}=n.data;t&&Object.assign(a,{noticeInfo:t,noticeTitle:c,isAutoOpenNotice:i})}function I(){var n;(n=y.value)==null||n.validate(async t=>{if(t){try{await h.setConfig({settings:O(a)}),f.success("变更配置信息成功")}catch{}v()}else f.error("请填写完整信息")})}const b=_(`/api/upload/file?dir=${encodeURIComponent("system/others")}`);function O(n){return Object.keys(n).map(t=>({configKey:t,configVal:n[t]}))}function T(n){}async function N(n,t){const c=await Promise.all(Array.from(n).map(i=>new Promise(async(d,p)=>{var r;const u=new FormData;u.append("file",i);try{const l=await D.post(b.value,u,{headers:{"Content-Type":"multipart/form-data"}});(r=l==null?void 0:l.data)!=null&&r.data||f.error("图片上传失败、请检查您的配置信息!"),d(l.data.data)}catch(l){f.error(l||"图片上传失败、请检查您的配置信息!"),p(l)}})));t(c.map(i=>i)),f({message:"图片上传成功!",type:"success"})}return H(()=>{v()}),(n,t)=>{const c=F,i=G,d=S,p=s("el-input"),u=s("el-form-item"),r=s("el-col"),l=s("el-switch"),k=s("el-tooltip"),w=s("el-row"),A=s("el-form"),U=s("el-card");return M(),j("div",null,[e(d,null,{title:o(()=>[L]),content:o(()=>[z]),default:o(()=>[e(i,{outline:"",onClick:I},{default:o(()=>[e(c,{name:"i-ri:file-text-line"}),P(" 保存设置 ")]),_:1})]),_:1}),e(U,{style:{margin:"20px"}},{default:o(()=>[e(A,{ref_key:"formRef",ref:y,rules:C.value,model:a,"label-width":"120px"},{default:o(()=>[e(w,null,{default:o(()=>[e(r,{xs:24,md:20,lg:15,xl:10},{default:o(()=>[e(u,{label:"公告标题",prop:"noticeTitle"},{default:o(()=>[e(p,{modelValue:a.noticeTitle,"onUpdate:modelValue":t[0]||(t[0]=m=>a.noticeTitle=m),rows:1,placeholder:"公告标题",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),e(r,{offset:2,xs:24,md:20,lg:15,xl:10},{default:o(()=>[e(u,{label:"自动打开公告",prop:"isAutoOpenNotice"},{default:o(()=>[e(k,{content:"设为自动打开则网站初始化会打开、用户仍可以选择24小时不再查看、选择关闭则不会主动打开",placement:"top","show-after":500},{default:o(()=>[e(l,{modelValue:a.isAutoOpenNotice,"onUpdate:modelValue":t[1]||(t[1]=m=>a.isAutoOpenNotice=m),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1}),e(r,{xs:24,md:20,lg:15,xl:12})]),_:1})]),_:1}),e(w,null,{default:o(()=>[e(r,{span:24},{default:o(()=>[e(u,{label:"公告信息",prop:"noticeInfo"},{default:o(()=>[e(R(K),{modelValue:a.noticeInfo,"onUpdate:modelValue":t[2]||(t[2]=m=>a.noticeInfo=m),style:{"min-height":"80vh"},onOnChange:T,onOnUploadImg:N},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof x=="function"&&x(J);export{J as default};