PageSourceSearch

https://sz-ac56.com/assets/index-CaFWDvre.js

js sz-ac56.com collected 2026-09-25 18:18:02 UTC 4,838 bytes, 1 lines download raw bytes

1var e=Object.defineProperty,s=Object.defineProperties,a=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable,o=(s,a,l)=>a in s?e(s,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):s[a]=l;import{d as n,v as i,x as d,a as c,c as m,e as u,f as p,h as v,p as f,z as b,m as y,l as x,k as g,P as w,T as h,y as _,i as k,I as R,J as N,K as j,O as E}from"./index-CA--wBCS.js";/* empty css                  */import{E as P}from"./el-card-B_Q0xpak.js";/* empty css               */import{E as O}from"./index-DXOsZame.js";const S={class:"py-2"},U={class:"mb-6"},A={class:"flex items-start mb-3 last:mb-0"},I={class:"flex items-start mb-3 last:mb-0"},C={class:"flex items-start mb-3 last:mb-0"},D={class:"flex flex-wrap gap-2"},T={key:0,class:"italic text-g-500"},F={class:"mb-6"},M={class:"grid grid-cols-[repeat(auto-fit,minmax(300px,1fr))] gap-4"},z={class:"mb-4"},q={class:"m-0 mb-2 text-base font-semibold"},J={class:"m-0 mb-2 leading-[1.5] text-g-700"},K={class:"flex flex-col gap-1"},L={class:"text-xs text-g-600"},B={class:"text-xs text-g-600"},G={class:"text-right"},H=n((Q=((e,s)=>{for(var a in s||(s={}))r.call(s,a)&&o(e,a,s[a]);if(l)for(var a of l(s))t.call(s,a)&&o(e,a,s[a]);return e})({},{name:"PermissionSwitchRole"}),s(Q,a({__name:"index",setup(e){const{t:s}=i(),a=d(),l=c(!1),r=m(()=>a.info),t=m(()=>[{key:"super",label:s("login.roles.super"),userName:"Super",password:"123456",roles:["R_SUPER"],color:"#E6A23C",description:"拥有系统最高权限,可以访问所有功能模块"},{key:"admin",label:s("login.roles.admin"),userName:"Admin",password:"123456",roles:["R_ADMIN"],color:"#409EFF",description:"拥有管理权限,可以管理用户和部分系统设置"},{key:"user",label:s("login.roles.user"),userName:"User",password:"123456",roles:["R_USER"],color:"#67C23A",description:"普通用户权限,只能访问基础功能模块"}]),o=e=>e&&{R_SUPER:"warning",R_ADMIN:"primary",R_USER:"success"}[e]||"info",n=e=>e&&{R_SUPER:"超级管理员",R_ADMIN:"管理员",R_USER:"普通用户"}[e]||"未知角色",H=e=>{return s=null,r=null,t=function*(){try{l.value=!0;const{token:s,refreshToken:r}=yield N({userName:e.userName,password:e.password});if(!s)throw new Error("Login failed - no token received");a.setToken(s,r);const t=yield j();a.setUserInfo(t),setTimeout(()=>{window.location.reload()},100)}catch(s){"cancel"!==s&&E.error("切换用户身份失败,请稍后重试")}finally{l.value=!1}},new Promise((e,a)=>{var l=e=>{try{n(t.next(e))}catch(s){a(s)}},o=e=>{try{n(t.throw(e))}catch(s){a(s)}},n=s=>s.done?e(s.value):Promise.resolve(s.value).then(l,o);n((t=t.apply(s,r)).next())});var s,r,t};return(e,s)=>{const a=O,i=P,d=R;return p(),u("div",S,[s[7]||(s[7]=v("div",{class:"mb-6"},[v("h2",{class:"m-0 mb-2 text-xl font-medium"},"权限切换演示"),v("p",{class:"m-0 leading-[1.6] text-g-700"}," 点击下方按钮切换不同用户身份,模拟不同用户登录系统的效果。切换后会影响整个系统的菜单显示和按钮权限。 ")],-1)),v("div",U,[f(i,{shadow:"never"},{header:b(()=>[...s[0]||(s[0]=[v("div",{class:"font-semibold"},[v("span",null,"当前登录用户")],-1)])]),default:b(()=>{var e,l;return[v("div",null,[v("div",null,[v("div",A,[s[1]||(s[1]=v("span",{class:"min-w-30 font-semibold"},"用户名:",-1)),v("span",null,y(r.value.userName||"未登录"),1)]),v("div",I,[s[2]||(s[2]=v("span",{class:"min-w-30 font-semibold"},"角色:",-1)),f(a,{type:o(null==(e=r.value.roles)?void 0:e[0])},{default:b(()=>{var e;return[x(y(n(null==(e=r.value.roles)?void 0:e[0])),1)]}),_:1},8,["type"])]),v("div",C,[s[3]||(s[3]=v("span",{class:"min-w-30 font-semibold"},"权限码:",-1)),v("div",D,[(p(!0),u(w,null,h(r.value.buttons,e=>(p(),_(a,{key:e,size:"small",type:"info"},{default:b(()=>[x(y(e),1)]),_:2},1024))),128)),(null==(l=r.value.buttons)?void 0:l.length)?g("",!0):(p(),u("span",T,"无权限码"))])])])])]}),_:1})]),v("div",F,[f(i,{shadow:"never"},{header:b(()=>[...s[4]||(s[4]=[v("div",{class:"font-semibold"},[v("span",null,"账号切换")],-1)])]),default:b(()=>[v("div",M,[(p(!0),u(w,null,h(t.value,e=>(p(),u("div",{key:e.key,class:k(["p-5 border border-g-400 rounded-lg tad-300",{"bg-theme/12 !border-theme":r.value.userName===e.userName}])},[v("div",z,[v("div",null,[v("h4",q,y(e.label),1),v("p",J,y(e.description),1),v("div",K,[v("span",L,"用户名: "+y(e.userName),1),v("span",B,"角色: "+y(e.roles.join(", ")),1)])])]),v("div",G,[r.value.userName!==e.userName?(p(),_(d,{key:0,t
1ype:"primary",onClick:s=>H(e),loading:l.value},{default:b(()=>[...s[5]||(s[5]=[x(" 切换到此角色 ",-1)])]),_:1},8,["onClick","loading"])):(p(),_(a,{key:1,type:"success"},{default:b(()=>[...s[6]||(s[6]=[x("当前用户",-1)])]),_:1}))])],2))),128))])]),_:1})])])}}}))));var Q;export{H as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.