import{r as e,u as s,w as a,c as o,d as l,j as n,e as t,t as r,l as i,m as c,Y as u,Z as d,H as p,S as v,p as f,U as h,af as g}from"./index.1702580971041.js";const b={class:"user-control space-y-2"},x={key:0,class:"space-y-3 grid grid-cols-3 gap-x-3"},m={class:"col-span-3"},k={class:"group before:hover:scale-95 before:hover:h-72 before:hover:w-full before:hover:h-full before:hover:rounded-b-2xl before:transition-all before:duration-500 before:content-[''] before:w-full before:h-24 before:rounded-t-2xl before:bg-gradient-to-bl from-sky-200 via-orange-200 to-orange-700 before:absolute before:top-0 w-full h-64 relative bg-white flex flex-col items-center justify-center gap-2 text-center rounded-xl overflow-hidden"},y={class:"w-28 h-28 bg-white mt-8 overflow-hidden rounded-full border-4 border-slate-50 z-10 group-hover:scale-150 group-hover:-translate-x-24 group-hover:-translate-y-20 transition-all duration-500"},C=["src"],w={class:"z-10 group-hover:-translate-y-10 transition-all duration-500"},B=t("span",{class:"text-2xl font-semibold"},"我的账号",-1),z={style:{height:"20px"}},L=[t("div",{class:"text-black"},[t("span",{class:"iconfont icon-xiugaimima"}),t("span",null,"修改密码")],-1)],j={userBox:"",class:"hover user-card relative"},O=t("div",{class:"text-green-500"},[t("span",{class:"iconfont icon-daoru"}),t("span",null,"导入标签")],-1),S=["onChange"],_=["onClick"],J=[t("div",{class:"text-blue-500"},[t("span",{class:"iconfont icon-daochu"}),t("span",null,"导出标签")],-1)],N=["onClick"],T=[t("div",{class:"text-yellow-500"},[t("span",{class:"iconfont icon-zhongzhi"}),t("span",null,"重置标签")],-1)],A=["onClick"],F=[t("div",{class:"text-cyan-500"},[t("span",{class:"iconfont icon-yanshengguanliyuan"}),t("span",null,"管理后台")],-1)],H=[t("div",{class:"text-red-500"},[t("span",{class:"iconfont icon-tuichudenglu"}),t("span",null,"退出登录")],-1)],M={key:1,class:"space-y-2 grid grid-cols-3 gap-x-3"},R=t("div",{userBox:"",class:"col-span-3",style:{"align-items":"start"}},[t("span",{class:"text-blue-400"},[u(" 登录即可享更多功能和数据同步 "),t("br"),u(" 传输双重数据加密更加安全 ")])],-1),U=["onClick"],Y=[t("div",{class:"text-yellow-500"},[t("span",{class:"iconfont icon-zhongzhi"}),t("span",null,"重置图标")],-1)],Z=["onClick"],q=[t("div",{class:"text-blue-500"},[t("span",{class:"iconfont icon-daochu"}),t("span",null,"导出图标")],-1)],D=[t("div",{class:"ml-2 text-emerald-600"},[t("span",{class:"iconfont icon-dengluzhanghu"}),t("span",null,"立即登录")],-1)],E={__name:"user",setup(u){const E=e({}),G=s(),I=async()=>{try{await d.confirm("重置将会恢复到初始状态，是否重置图标？","温馨提示")}catch(e){return}p.del("link").del("config").del("tabbar"),v({url:"/link/reset"}).then((e=>{1===e.code&&f.emit("reload")}))},K=()=>{location.href="/Manager"},P=()=>{v({url:"/user/get"}).then((e=>{1===e.code?E.value=e.data:(G.state.isLogin=!1,p.del("token").del("user_id"))}))},Q=e=>{f.emit("openController",!1),f.emit("openLogin",e)},V=e=>{const[s=null]=e.target.files;if(s){const e=new FileReader;e.onload=e=>{const{result:s=""}=e.target;try{const e=JSON.parse(s),{link:a=!1,tabbar:o=!1}=e;a&&G.commit("updateLink",a),o&&G.commit("updateTabbar",o)}catch(a){h.error("导入失败，请检查文件内容")}},e.readAsText(s)}},W=()=>{g("link",JSON.stringify({link:G.state.link,tabbar:G.state.tabbar}))};return a((()=>G.state.isLogin),(e=>{e&&P()})),P(),(e,s)=>{var a;return o(),l("div",b,[n(G).state.isLogin?(o(),l("div",x,[t("div",m,[t("div",k,[t("div",y,[t("img",{style:{width:"80%",margin:"auto"},src:n("/dist/assets/avatar.1702580971041.png"),alt:"头像"},null,8,C)]),t("div",w,[B,t("p",z,r(null==(a=E.value)?void 0:a.mail),1)])])]),t("div",{userBox:"",onClick:s[0]||(s[0]=i((e=>Q(3)),["stop"])),class:"hover user-card"},L),t("div",j,[O,t("input",{class:"absolute top-0 left-0 w-full h-full opacity-0 text-sm",type:"file",accept:".json",onChange:i(V,["stop"])},null,40,S)]),t("div",{userBox:"",onClick:i(W,["stop"]),class:"hover user-card"},J,8,_),t("div",{userBox:"",onClick:i(I,["stop"]),class:"hover user-card"},T,8,N),1===E.value.manager?(o(),l("div",{key:0,userBox:"",onClick:i(K,["stop"]),class:"hover user-card"},F,8,A)):c("",!0),t("div",{userBox:"",onClick:s[1]||(s[1]=i((e=>n(G).commit("loginOut")),["stop"])),class:"hover user-card"},H)])):(o(),l("div",M,[R,t("div",{userBox:"",onClick:i(I,["stop"]),class:"hover"},Y,8,U),t("div",{userBox:"",onClick:i(W,["stop"]),class:"hover user-card"},q,8,Z),t("div",{userBox:"",onClick:s[2]||(s[2]=i((e=>Q(1)),["stop"])),class:"hover"},D)]))])}}};export{E as default};
