import{r as l,u as e,a,b as t,c as s,d as o,F as c,e as i,f as u,g as r,n,t as d,T as m,j as f,i as v,J as p,m as g,p as b,l as y,ax as h,aP as x,L as k,a4 as w,N as _,B as j}from"./index.8821dc9f.1766672520393.js";const C={class:"background-addBox"},W={class:"bg-left flex flex-col relative"},z={class:"netBG space-y-3 pr-1 pl-4 pb-4 overflow-y-scroll relative h-full w-full"},B=["onClick"],F={key:0,class:"flex-1 p-4 pt-0 grid grid-cols-1 xs:grid-cols-4 gap-3",style:{"grid-template-rows":"max-content"}},I={style:{"aspect-ratio":"16 / 10"},class:"relative overflow-hidden rounded-md"},L=["onLoad","src"],V={class:"absolute rounded-lg opacity-0 transition-all hover:opacity-100 inset-0 w-full h-full flex justify-center items-center",style:{"background-color":"rgba(0, 0, 0, 0.178)"}},H=["onClick"],S={key:0,class:"absolute z-10 right-0 bottom-0 w-full h-8 flex"},T=["href"],G={key:2,class:"absolute inset-0 w-full h-full z-10 bg-white bg-opacity-20 flex justify-center items-center text-white"},J={key:1,class:"flex align-center justify-center"},M={class:"p-4 pt-0"},N={class:"flex gap-x-4 msm:flex-col msm:gap-y-3"},P={key:0,class:"mt-4"},U=["src"],q={__name:"index",setup(q){const A=l(""),D=l(!1),E=l([]),K=e(),O=l([]),Q=l(),R=l=>{D.value=!1,Q.value=l.id,Z=0,X=!1,O.value=[],tl()};let X=!1;const Y=l=>{K.state.config.theme.backgroundImage=l.url,K.state.config.theme.backgroundMime=l.mime,K.commit("updateConfig")};let Z=0;const $=l=>{const{target:e}=l;X||e.scrollTop+e.clientHeight>=e.scrollHeight-100&&(X=!0,Z+=1,tl())},ll=l=>{1===l.code?A.value=l.data.url:_.warning(l.msg)},el=()=>{Y({url:A.value,mime:0})},al=l(!1),tl=async()=>{al.value=!0;try{const l=await j({url:"/Wallpaper/getFolderWallpaperClient",method:"post",data:{id:Q.value,offset:Z}});if(al.value=!1,1===l.code){if(0===l.data.length)return void(X=!0);O.value.push(...l.data)}}catch(l){}X=!1};return(async()=>{const l=await j({url:"/Wallpaper/getFolderClient"});1===l.code&&(E.value=l.data,E.value.length>0&&R(E.value[0]))})(),(l,e)=>{const _=a("el-icon"),j=a("el-empty"),q=a("el-input"),X=a("el-button"),Z=a("el-upload");return t(),s("div",C,[o("div",W,[e[3]||(e[3]=o("div",{class:"mt-3 mb-1"},null,-1)),o("div",z,[(t(!0),s(c,null,i(E.value,((l,e)=>(t(),u(m,{key:e},{default:r((()=>[o("div",{onClick:e=>R(l),class:n({selectWallpaperItem:Q.value===l.id&&!D.value})},[o("span",null,d(l.name),1)],10,B)])),_:2},1024)))),128))]),o("div",{class:n(["custom absolute text-black flex items-center cursor-pointer bottom-4 left-4",{selectWallpaperItem:D.value}]),onClick:e[0]||(e[0]=l=>D.value=!0)},[f(_,null,{default:r((()=>[f(v(p))])),_:1}),e[2]||(e[2]=o("span",{class:"ml-1 text-xs"},"自定义壁纸",-1))],2)]),D.value?y("",!0):(t(),s("div",{key:0,class:"bg-right overflow-scroll",onScroll:$},[O.value.length?(t(),s("div",F,[(t(!0),s(c,null,i(O.value,(l=>(t(),u(m,null,{default:r((()=>[o("div",I,[[0,1].includes(l.mime)?(t(),s("img",{key:0,style:g({opacity:l.load?1:0,transition:"opacity 0.5s"}),class:"rounded-md w-full h-full object-cover",onLoad:e=>l.load=!0,src:v(b)(l.cover),alt:""},null,44,L)):y("",!0),2===l.mime?(t(),s("div",{key:1,class:"rounded-lg object-cover w-full h-full bg-gray-200",style:g({background:l.url})},null,4)):y("",!0),o("div",V,[o("div",{onClick:e=>Y(l),class:"transition-all cursor-pointer bg-black bg-opacity-40 hover:opacity-100 hover:bg-blue-500 rounded-full flex justify-center items-center w-10 h-10"},[f(_,{size:"28px",color:"#fff"},{default:r((()=>[f(v(h))])),_:1})],8,H),[0,1].includes(l.mime)?(t(),s("div",S,[o("a",{target:"_blank",download:"background",href:v(b)(l.url),class:"ml-auto transition-all cursor-pointer mr-2 hover:bg-blue-500 rounded-full w-6 mb-2 flex justify-center items-center"},[f(_,{size:"18px",color:"#fff"},{default:r((()=>[f(v(x))])),_:1})],8,T)])):y("",!0)]),!l.load&&[0,1].includes(l.mime)?(t(),s("div",G," 加载中 ")):y("",!0)])])),_:2},1024)))),256))])):y("",!0),al.value||0!==O.value.length?y("",!0):(t(),s("div",J,[f(j,{class:"m-20"})]))],32)),D.value?(t(),s("div",{key:1,class:"bg-right overflow-scroll",onScroll:$},[o("div",M,[e[7]||(e[7]=o("div",{class:"text-base text-black"},"使用在线图片链接地址",-1)),e[8]||(e[8]=o("div",{class:"text-sm mt-2 mb-4"},"没有登录或有条件的用户请选择使用图床作为壁纸储存",-1)),o("div",N,[f(q,{modelValue:A.value,"onUpdate:modelValue":e[1]||(e[1]=l=>A.value=l),placeholder:"请粘贴/填写网络图片地址"},null,8,["modelValue"]),f(Z,{class:"upload-demo msm:w-full","show-file-list":!1,"on-success":ll,headers:l.head,action:v(w)+v(K).state.site.upload},{default:r((()=>[f(X,{type:"danger",class:"msm:w-full"},{default:r((()=>e[4]||(e[4]=[k("手动上传")]))),_:1})])),_:1},8,["headers","action"])]),f(X,{class:"mt-4 w-full",type:"primary",onClick:el},{default:r((()=>e[5]||(e[5]=[k("保存")]))),_:1}),A.value?(t(),s("div",P,[e[6]||(e[6]=o("div",null,"壁纸预览",-1)),o("img",{class:"mt-2",src:v(b)(A.value),style:{"max-height":"400px","max-width":"500px","border-radius":"12px","object-fit":"cover"}},null,8,U)])):y("",!0)])],32)):y("",!0)])}}};export{q as default};
