userInfo.0308cef3.js 2.5 KB

123
  1. import{am as l}from"./vue.e266cb73.js";import{S as d}from"./storage.acfc8920.js";function u(e){for(var o=1;o<arguments.length;o++){var i=arguments[o];for(var a in i)e[a]=i[a]}return e}var h={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function m(e,o){function i(n,f,t){if(!(typeof document>"u")){t=u({},o,t),typeof t.expires=="number"&&(t.expires=new Date(Date.now()+t.expires*864e5)),t.expires&&(t.expires=t.expires.toUTCString()),n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var s in t)!t[s]||(r+="; "+s,t[s]!==!0&&(r+="="+t[s].split(";")[0]));return document.cookie=n+"="+e.write(f,n)+r}}function a(n){if(!(typeof document>"u"||arguments.length&&!n)){for(var f=document.cookie?document.cookie.split("; "):[],t={},r=0;r<f.length;r++){var s=f[r].split("="),p=s.slice(1).join("=");try{var c=decodeURIComponent(s[0]);if(t[c]=e.read(p,c),n===c)break}catch{}}return n?t[n]:t}}return Object.create({set:i,get:a,remove:function(n,f){i(n,"",u({},f,{expires:-1}))},withAttributes:function(n){return m(this.converter,u({},this.attributes,n))},withConverter:function(n){return m(u({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(e)}})}var g=m(h,{path:"/"});const C=l("userInfo",{state:()=>({userInfos:{userName:"",photo:"",time:0,roles:[],authBtnList:[]}}),actions:{async setUserInfos(){if(d.get("userInfo")){let e=d.get("userInfo");this.userInfos={userName:e.name,photo:"https://img2.baidu.com/it/u=1978192862,2048448374&fm=253&fmt=auto&app=138&f=JPEG?w=504&h=500",time:new Date().getTime(),roles:["admin"],authBtnList:["btn.add","btn.del","btn.edit","btn.link"]}}else{const e=await this.getApiUserInfo();this.userInfos=e}},async getApiUserInfo(){return new Promise(e=>{setTimeout(()=>{const o=g.get("userName");let i=[],a=[],n=["admin"],f=["btn.add","btn.del","btn.edit","btn.link"],t=["common"],r=["btn.add","btn.link"];o==="admin"?(i=n,a=f):(i=t,a=r);const s={userName:o,photo:o==="admin"?"https://img2.baidu.com/it/u=1978192862,2048448374&fm=253&fmt=auto&app=138&f=JPEG?w=504&h=500":"https://img2.baidu.com/it/u=2370931438,70387529&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",time:new Date().getTime(),roles:i,authBtnList:a};e(s)},0)})}}});export{g as a,C as u};
  2. //# sourceMappingURL=userInfo.0308cef3.js.map