user.5620a3a8.js 1.4 KB

1
  1. import{q as f,au as h,X as l,al as d,bd as r,be as m,bf as E,l as p,bg as T,bh as i,bi as y,bj as g,as as k,a3 as S,ak as _,bk as A,s as b}from"./index.41f763da.js";var L=f({name:"Motion",props:{delay:{type:Number,default:50}},render(){const{delay:e}=this,t=h("motion");return l(d("div",{},{default:()=>[this.$slots.default()]}),[[t,{initial:{opacity:0,y:100},enter:{opacity:1,y:0,transition:{delay:e}}}]])}});const{VITE_PROXY_DOMAIN_REAL:I,VITE_PROXY_USER_REAL:R}=m(),M=I,P=R+"/admin/",U=e=>r.request("post",`${M}/Api/login`,{data:e}),v=e=>r.request("post",`${P}/Admin/menu`,{data:e}),O=e=>r.request("post","/refreshToken",{data:e}),N=E(),q=p({id:"pure-user",state:()=>({token:T(),name:"admin",verifyCode:"",currentPage:0,userInfo:N||null}),actions:{SET_TOKEN(e){this.token=e},SET_NAME(e){this.name=e},SET_VERIFYCODE(e){this.verifyCode=e},SET_CURRENTPAGE(e){this.currentPage=e},SET_USERINFO(e){this.userInfo=e},async loginByUsername(e){return new Promise((t,n)=>{U(e).then(s=>{const{code:o,data:a}=s;if(o===0){const{token:u,userinfo:c}=a;i(u),y(c),t(s)}else t(s)}).catch(s=>{n(s)})})},async postMenuList(e){return new Promise((t,n)=>{v(e).then(s=>{const{code:o,data:a}=s;t(s)}).catch(s=>{n(s)})})},logOut(){this.token="",this.name="",g(),k.clear(),S().handleTags("equal",_),A.push("/login")},async refreshToken(e){return O(e).then(t=>{if(t)return i(t),t})}}});function w(){return q(b)}export{L as M,w as u};