import{r as e,u as l,b as a,c as s,d as t,j as o,e as n,q as i,k as r,h as c,G as u,x as d,g as p,ar as v,m,l as f,Z as h,H as g,a3 as x,$ as y,Y as k,N as w,J as b,as as C}from"./index.1713442796762.js";import{a as z}from"./appSide.1713442796762.js";import{b as B}from"./defavatar.1713442796762.js";import{a as V}from"./href.1713442796762.js";import"./dialog.1713442796762.js";const j={class:"user-control space-y-2"},_={key:0,class:"space-y-3 grid-flow-dense"},Q={class:"bg-white rounded-lg py-2 px-2"},H={class:"col-span-3 bg-white rounded-lg w-full p-2 flex items-center"},L={class:"bg-white flex-shrink-0 relative"},U=["src"],q={class:"absolute opacity-0 hover:opacity-100 z-10 flex justify-center items-center inset-0 w-full h-full hover:bg-gray-950 hover:bg-opacity-80 cursor-pointer rounded-full overflow-hidden"},M=n("span",{class:"text-white text-sm pointer-events-none"},"修改",-1),I={class:"z-10 ml-4 w-full flex-col"},O={class:"flex-1 flex w-full items-center"},S={key:0,class:"flex items-center gap-2 w-full"},A={key:1,style:{"max-width":"170px"},class:"text-base overflow-ellipsis mr-4 overflow-hidden whitespace-nowrap"},J={userBox:"",class:"user-card flex-col"},N={key:0},$={key:1},F={key:0,class:"p-3 bg-gray-100 rounded-lg mt-2 flex-col"},T={class:"flex gap-2 w-full"},D={class:"flex gap-2 mt-3 w-full"},E={class:"flex gap-2 mt-3 w-full"},G={key:0,userBox:"",class:"hover user-card"},R={class:"flex items-center"},W={key:0},Y=n("img",{src:z,style:{width:"15px",display:"inline-block","margin-right":"5px"}},null,-1),Z={key:1},K={class:"bg-white rounded-lg py-2 px-2"},P=["onClick"],X=[n("div",null,[n("span",null,"添加标签")],-1)],ee={userBox:"",class:"hover relative"},le=n("div",null,[n("span",{class:"iconfont icon-daoru"}),n("span",null,"导入标签")],-1),ae=["onChange"],se=["onClick"],te=[n("div",null,[n("span",{class:"iconfont icon-daochu"}),n("span",null,"导出标签")],-1)],oe=["onClick"],ne=[n("div",null,[n("span",{class:"iconfont icon-zhongzhi"}),n("span",null,"重置标签")],-1)],ie={class:"bg-white rounded-lg py-2 px-2"},re=[n("div",null,[n("span",{class:"iconfont icon-xiugaimima"}),n("span",null,"修改密码")],-1)],ce=[n("div",null,[n("span",{class:"iconfont icon-tuichudenglu"}),n("span",null,"退出登录")],-1)],ue={key:0,class:"text-sm pl-2 text-gray-500 pt-3"},de={key:1,class:"bg-white rounded-lg py-2 px-2"},pe=["onClick"],ve=[n("div",null,[n("span",{class:"iconfont icon-yanshengguanliyuan"}),n("span",null,"进入管理后台")],-1)],me=["onClick"],fe={style:{color:"#409eff"}},he={class:"iconfont mt-1.5"},ge={style:{width:"36px",height:"36px"},t:"1705918028651",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"11853",width:"32",height:"32"},xe=[n("path",{d:"M874.666667 656.64V768a85.333333 85.333333 0 0 1-85.333334 85.333333h-128.256v-196.693333H874.666667z m-515.541334 0V853.333333H234.666667a85.333333 85.333333 0 0 1-85.333334-85.333333v-111.36h209.792z m247.594667 0V853.333333H412.501333v-196.693333h194.218667z m0-485.973333v435.456H149.333333V258.261333a85.333333 85.333333 0 0 1 84.821334-85.333333L606.72 170.666667z m265.514667 247.338666c1.365333 0 2.432 1.109333 2.432 2.474667v183.082667c0 1.408-1.066667 2.56-2.432 2.56h-211.2V418.005333h211.2zM487.68 284.330667L347.050667 423.125333 275.2 351.701333a29.354667 29.354667 0 0 0-41.941333 0 29.312 29.312 0 0 0 0 42.24l93.781333 92.202667a29.696 29.696 0 0 0 20.906667 8.789333 29.738667 29.738667 0 0 0 20.992-8.832l160.682666-159.573333a29.312 29.312 0 0 0 0-42.197333 29.354667 29.354667 0 0 0-41.941333 0zM789.333333 170.666667a85.333333 85.333333 0 0 1 85.333334 85.333333v101.888a2.389333 2.389333 0 0 1-2.432 2.474667h-211.2V170.666667H789.333333z",fill:"#4f68b0","p-id":"11854"},null,-1)],ye=n("span",null,"替换新布局为当前程序默认桌面",-1),ke={key:1,class:"space-y-2 grid grid-cols-3 gap-x-3"},we=n("div",{userBox:"",class:"col-span-3",style:{"align-items":"start"}},[n("span",{class:"text-blue-400"},[u(" 登录即可享更多功能和数据同步服务 "),n("br"),u(" 传输双重数据加密更加安全 ")])],-1),be=["onClick"],Ce=[n("div",{class:"text-yellow-500 flex-col"},[n("span",{class:"iconfont icon-zhongzhi",style:{display:"block","font-size":"25px"}}),n("span",null,"重置图标")],-1)],ze=["onClick"],Be=[n("div",{class:"text-blue-500 flex-col"},[n("span",{class:"iconfont icon-daochu",style:{display:"block","font-size":"25px"}}),n("span",null,"导出图标")],-1)],Ve=[n("div",{class:"ml-2 text-emerald-600 flex-col"},[n("span",{class:"iconfont icon-dengluzhanghu",style:{display:"block","font-size":"25px"}}),n("span",null,"立即登录")],-1)],je={__name:"user",setup(z){const je=e(""),_e=e(),Qe=e(60),He=e(!1),Le=e(!1),Ue=(e=0)=>{0===e&&(He.value=!0),1===e&&(He.value=!1,h({url:"/User/updateInfo",method:"post",data:{field:"nickname",value:Oe.state.user.nickname}}).then((e=>{1===e.code&&g.success(e.msg)})))},qe=()=>{je.value&&_e.value&&h({url:"/User/newMail",method:"post",data:{mail:je.value,code:_e.value}}).then((e=>{1===e.code?(Oe.state.user.mail=je.value,g.success(e.msg),Le.value=!1):g.warning(e.msg)}))},Me=()=>{const e=window.innerWidth/2-350,l=window.innerHeight/2-225;window.open(x+"/User/qLogin?type=bind","QQ登录",`width=700,height=450,left=${e}px,top=${l}px,menubar=0,scrollbars=1,resizable=1,status=1,titlebar=0,toolbar=0,location=1`)},Ie=e=>{if(e.target.files.length>0){const l=e.target.files[0];if(l.size>102400)return g.warning("文件大小不能超过100kb");let a=new FormData;a.append("file",l),h({url:"/Api/upload",method:"post",data:a}).then((e=>{1===e.code&&h({url:"/User/updateInfo",method:"post",data:{field:"avatar",value:e.data.url}}).then((l=>{1===l.code&&(Oe.state.user.avatar=e.data.url,g.success(l.msg))}))}))}},Oe=l(),Se=async()=>{try{await k.confirm("重置将会恢复到初始状态,是否重置图标和所有设置?","温馨提示"),await k.confirm("请再次确认是否重置?","二次确认")}catch(e){return}w.del("link").del("config").del("tabbar").del("SearchEngineLocal"),h({url:"/link/reset"}).then((e=>{1===e.code&&location.reload()}))},Ae=()=>{window.open(i("/manager"),"__blank"),b.emit("openController",!1)},Je=()=>{V("tab://addicon"),b.emit("openController",!1)},Ne=async()=>{try{await k.confirm("您确定要将您当前时间节点的标签布局和主题设置以及打开方式设为全局默认?设置后所有新用户则使用默认设置,请确保不包含您的私有内容,并点击确定来继续,","危险提示!"),await k.confirm("真的确定要设置为全局的默认配置吗?","危险操作呐!"),await k.confirm("请再次确认是否设置为全局默认配置!!!","最后一次询问!");const e=await h({url:"/Admin/export",method:"post",data:{link:{link:Oe.state.link,tabbar:Oe.state.tabbar,config:Oe.state.config}}});1===e.code?y.success("操作成功"):y.error(e.msg)}catch(e){y.info("操作已取消")}},$e=e=>{b.emit("openController",!1),b.emit("openLogin",e)},Fe=e=>{const[l=null]=e.target.files;if(l){const e=new FileReader;e.onload=e=>{const{result:l=""}=e.target;try{const e=JSON.parse(l),{link:a=!1,tabbar:s=!1}=e;a&&Oe.commit("updateLink",a),s&&Oe.commit("updateTabbar",s)}catch(a){y.error("导入失败,请检查文件内容")}},e.readAsText(l)}},Te=()=>{C("link",JSON.stringify({link:Oe.state.link,tabbar:Oe.state.tabbar}))};return(e,l)=>{const g=a("el-input"),x=a("el-button"),k=a("el-icon"),w=a("el-popover");return s(),t("div",j,[o(Oe).state.isLogin?(s(),t("div",_,[n("div",Q,[n("div",H,[n("div",L,[n("img",{class:"rounded-full",style:{width:"40px",height:"40px","object-fit":"cover"},src:o(i)(o(Oe).state.user.avatar)||o(B),alt:"头像"},null,8,U),n("div",q,[n("input",{onChange:Ie,type:"file",accept:"image/jpeg,image/png,image/jpg",class:"w-full h-full opacity-0 absolute inset-0 cursor-pointer",name:"avatar"},null,32),M])]),n("div",I,[n("div",O,[He.value?(s(),t("div",S,[r(g,{maxlength:"10",style:{height:"28px"},autofocus:"",size:"small",modelValue:o(Oe).state.user.nickname,"onUpdate:modelValue":l[0]||(l[0]=e=>o(Oe).state.user.nickname=e),class:"w-full",placeholder:"请输入昵称"},null,8,["modelValue"]),r(x,{style:{height:"28px"},onClick:l[1]||(l[1]=e=>Ue(1)),size:"small",type:"primary"},{default:c((()=>[u("保存")])),_:1})])):(s(),t("div",A,d(o(Oe).state.user.nickname||"请设置昵称"),1)),He.value?m("",!0):(s(),p(k,{key:2,onClick:l[2]||(l[2]=e=>Ue(0)),color:"rgb(115 124 140)",size:"20"},{default:c((()=>[r(o(v))])),_:1}))])])]),n("div",J,[n("div",null,[n("div",null,[u("邮箱:"),o(Oe).state.user.mail?(s(),t("span",N,d(o(Oe).state.user.mail),1)):(s(),t("span",$,"未绑定邮箱"))]),n("div",{class:"ml-auto hover text-blue-500",style:{color:"#409eff"},onClick:l[3]||(l[3]=()=>{Le.value=!Le.value})},d(Le.value?"关闭":o(Oe).state.user.mail?"修改":"绑定"),1)]),Le.value?(s(),t("div",F,[n("div",T,[r(g,{class:"w-full",modelValue:je.value,"onUpdate:modelValue":l[4]||(l[4]=e=>je.value=e),placeholder:"请输入新的邮箱"},null,8,["modelValue"])]),n("div",D,[r(g,{class:"w-full",modelValue:_e.value,"onUpdate:modelValue":l[5]||(l[5]=e=>_e.value=e),placeholder:"请输入邮件验证码"},null,8,["modelValue"]),60===Qe.value?(s(),p(x,{key:0,type:"primary",onClickOnce:l[6]||(l[6]=e=>{return l=je.value,void h({url:"/api/getMailCode",method:"post",data:{mail:l}}).then((e=>{if(1===e.code){y.success(e.msg);let l=setInterval((()=>{Qe.value-=1,Qe.value<=0&&(clearInterval(l),Qe.value=60)}),1e3)}else y.error(e.msg)}));var l})},{default:c((()=>[u(" 获取 ")])),_:1})):(s(),p(x,{key:1},{default:c((()=>[u(d(Qe.value)+"s",1)])),_:1}))]),n("div",E,[r(x,{type:"primary",class:"w-full",round:"",onClick:qe},{default:c((()=>[u("提交")])),_:1})])])):m("",!0)]),"1"===o(Oe).state.site.qq_login?(s(),t("div",G,[n("div",null,[n("div",R,[u("QQ:"),o(Oe).state.user.qqBind?(s(),t("span",W,[Y,u("已绑定QQ登录")])):(s(),t("span",Z,"未绑定QQ"))]),n("div",{onClick:Me,class:"ml-auto hover text-blue-500",style:{color:"#409eff"}},d(o(Oe).state.user.mail?"修改":"绑定"),1)])])):m("",!0)]),n("div",K,[n("div",{userBox:"",onClick:f(Je,["stop"]),class:"hover user-card"},X,8,P),n("div",ee,[le,n("input",{class:"absolute top-0 left-0 w-full h-full opacity-0 text-sm",type:"file",accept:".json",onChange:f(Fe,["stop"])},null,40,ae)]),n("div",{userBox:"",onClick:f(Te,["stop"]),class:"hover user-card"},te,8,se),n("div",{userBox:"",onClick:f(Se,["stop"]),class:"hover user-card"},ne,8,oe)]),n("div",ie,[n("div",{userBox:"",onClick:l[7]||(l[7]=f((e=>$e(3)),["stop"])),class:"hover user-card"},re),n("div",{userBox:"",onClick:l[8]||(l[8]=f((e=>o(Oe).commit("loginOut")),["stop"])),class:"hover user-card"},ce)]),1===o(Oe).state.user.manager?(s(),t("div",ue,"管理员控制区")):m("",!0),1===o(Oe).state.user.manager?(s(),t("div",de,[n("div",{userBox:"",onClick:f(Ae,["stop"]),class:"hover user-card"},ve,8,pe),n("div",{userBox:"",onClick:f(Ne,["stop"]),class:"hover user-card col-span-2"},[r(w,{placement:"left",title:"功能解释",width:300,trigger:"hover",content:"程序安装后会有默认的桌面,可能不符合您的需求,所以可以将桌面默认内容删除,添加你的想要的桌面,然后点击这个按钮设置为所有新用户的默认桌面,这样新用户进来,或者用户点击重置所有按钮后,用户桌面就是你设置的默认的内容!!!"},{reference:c((()=>[n("div",fe,[n("span",he,[(s(),t("svg",ge,xe))]),ye])])),_:1})],8,me)])):m("",!0)])):(s(),t("div",ke,[we,n("div",{userBox:"",onClick:f(Se,["stop"]),class:"hover"},Ce,8,be),n("div",{userBox:"",onClick:f(Te,["stop"]),class:"hover user-card"},Be,8,ze),n("div",{userBox:"",onClick:l[9]||(l[9]=f((e=>$e(1)),["stop"])),class:"hover"},Ve)]))])}}};export{je as default};