import{r as s,u as a,w as n,b as l,c as e,d as o,j as t,e as c,k as i,t as r,l as u,m as d,X as p,Y as v,H as g,S as h,p as x,U as k,ae as m}from"./index.1701946211972.js";const f={class:"user-control space-y-2"},y={key:0,class:"space-y-2 grid grid-cols-3 gap-x-3"},b={userBox:"",class:"col-span-3",style:{height:"60px"}},C={class:"ml-2"},B=[c("div",{class:"text-black"},[c("span",{class:"iconfont icon-xiugaimima"}),c("span",null,"修改密码")],-1)],w={userBox:"",class:"hover user-card relative"},z=c("div",{class:"text-green-500"},[c("span",{class:"iconfont icon-daoru"}),c("span",null,"导入标签")],-1),L=["onChange"],j=["onClick"],O=[c("div",{class:"text-blue-500"},[c("span",{class:"iconfont icon-daochu"}),c("span",null,"导出标签")],-1)],S=["onClick"],_=[c("div",{class:"text-yellow-500"},[c("span",{class:"iconfont icon-zhongzhi"}),c("span",null,"重置标签")],-1)],J=["onClick"],N=[c("div",{class:"text-cyan-500"},[c("span",{class:"iconfont icon-yanshengguanliyuan"}),c("span",null,"管理后台")],-1)],T=[c("div",{class:"text-red-500"},[c("span",{class:"iconfont icon-tuichudenglu"}),c("span",null,"退出登录")],-1)],A={key:1,class:"space-y-2 grid grid-cols-3 gap-x-3"},F=c("div",{userBox:"",class:"col-span-3"},[c("span",{class:"text-blue-400"},[p(" 登录即可享更多功能和数据同步 "),c("br"),p(" 传输双重数据加密更加安全 ")])],-1),H=["onClick"],M=[c("div",{class:"text-yellow-500"},[c("span",{class:"iconfont icon-zhongzhi"}),c("span",null,"重置图标")],-1)],R=["onClick"],U=[c("div",{class:"text-blue-500"},[c("span",{class:"iconfont icon-daochu"}),c("span",null,"导出图标")],-1)],X=[c("div",{class:"ml-2 text-emerald-600"},[c("span",{class:"iconfont icon-dengluzhanghu"}),c("span",null,"立即登录")],-1)],Y={__name:"user",setup(p){const Y=s({}),q=a(),D=async()=>{try{await v.confirm("重置将会恢复到初始状态，是否重置图标？","温馨提示")}catch(s){return}g.del("link").del("config").del("tabbar"),h({url:"/link/reset"}).then((s=>{1===s.code&&x.emit("reload")}))},E=()=>{location.href="/Manager"},G=()=>{h({url:"/user/get"}).then((s=>{1===s.code?Y.value=s.data:(q.state.isLogin=!1,g.del("token").del("user_id"))}))},I=s=>{x.emit("openController",!1),x.emit("openLogin",s)},K=s=>{const[a=null]=s.target.files;if(a){const s=new FileReader;s.onload=s=>{const{result:a=""}=s.target;try{const s=JSON.parse(a),{link:n=!1,tabbar:l=!1}=s;n&&q.commit("updateLink",n),l&&q.commit("updateTabbar",l)}catch(n){k.error("导入失败，请检查文件内容")}},s.readAsText(a)}},P=()=>{m("link",JSON.stringify({link:q.state.link,tabbar:q.state.tabbar}))};return n((()=>q.state.isLogin),(s=>{s&&G()})),G(),(s,a)=>{var n;const p=l("el-avatar");return e(),o("div",f,[t(q).state.isLogin?(e(),o("div",y,[c("div",b,[i(p,{size:30,src:t("/dist/assets/boy.1701946211972.svg")},null,8,["src"]),c("span",C,r(null==(n=Y.value)?void 0:n.mail),1)]),c("div",{userBox:"",onClick:a[0]||(a[0]=u((s=>I(3)),["stop"])),class:"hover user-card"},B),c("div",w,[z,c("input",{class:"absolute top-0 left-0 w-full h-full opacity-0 text-sm",type:"file",accept:".json",onChange:u(K,["stop"])},null,40,L)]),c("div",{userBox:"",onClick:u(P,["stop"]),class:"hover user-card"},O,8,j),c("div",{userBox:"",onClick:u(D,["stop"]),class:"hover user-card"},_,8,S),1===Y.value.manager?(e(),o("div",{key:0,userBox:"",onClick:u(E,["stop"]),class:"hover user-card"},N,8,J)):d("",!0),c("div",{userBox:"",onClick:a[1]||(a[1]=u((s=>t(q).commit("loginOut")),["stop"])),class:"hover user-card"},T)])):(e(),o("div",A,[F,c("div",{userBox:"",onClick:u(D,["stop"]),class:"hover"},M,8,H),c("div",{userBox:"",onClick:u(P,["stop"]),class:"hover user-card"},U,8,R),c("div",{userBox:"",onClick:a[2]||(a[2]=u((s=>I(1)),["stop"])),class:"hover"},X)]))])}}};export{Y as default};
