uniugm/admin/ui/static/static/js/index-Hfw2Oxe7.js
2025-05-16 17:29:05 +08:00

3 lines
12 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["static/js/project_op-Dxk0ObAk.js","static/js/table-B5qQXuqU.js","static/js/vendor-DM-0sFCW.js","static/css/vendor-xHoP3d6v.css","static/js/empty-BmAiqKcE.js","static/js/string-C8RKaQUb.js","static/css/table-DkjoppVw.css","static/js/project_cdkey-BtgSH_Ay.js","static/css/project_cdkey-BX3fYD8x.css","static/js/project-BFx6JD-k.js","static/js/user-Dk1aLYV6.js","static/js/tableUser-M8raL4T3.js","static/css/tableUser-j5jzBTdc.css","static/js/character-swN-iIB1.js","static/js/welcome-CusT05GU.js","static/js/Login-C9FInl8Y.js","static/css/Login-BwJ0jPRV.css"])))=>i.map(i=>d[i]);
import{c as e,o as t,u as o,R as n,a as s,b as a,w as r,d as c,t as i,E as l,e as u,f as d,h as p,g as h,i as m,j as f,k as g,r as _,l as y,m as I,n as j,p as k,F as v,q as w,s as C,v as b,x as E,y as x,z as R,A as D,B as P,C as L,D as O,G as T,H as U,I as A,J as M,K as S,L as z,M as N,N as B,O as G,P as V}from"./vendor-DM-0sFCW.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const $={__name:"App",setup:s=>(s,a)=>(t(),e(o(n)))},q={},H=function(e,t,o){let n=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),o=(null==e?void 0:e.nonce)||(null==e?void 0:e.getAttribute("nonce"));n=Promise.allSettled(t.map((e=>{if((e=function(e){return"/"+e}(e))in q)return;q[e]=!0;const t=e.endsWith(".css"),n=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${n}`))return;const s=document.createElement("link");return s.rel=t?"stylesheet":"modulepreload",t||(s.as="script"),s.crossOrigin="",s.href=e,o&&s.setAttribute("nonce",o),document.head.appendChild(s),t?new Promise(((t,o)=>{s.addEventListener("load",t),s.addEventListener("error",(()=>o(new Error(`Unable to preload CSS for ${e}`))))})):void 0})))}function s(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return n.then((t=>{for(const e of t||[])"rejected"===e.status&&s(e.reason);return e().catch(s)}))};const J=new class{setCache(e,t){window.localStorage.setItem(e,JSON.stringify(t))}getCache(e){const t=window.localStorage.getItem(e);if(t)return JSON.parse(t)}deleteCache(e){window.localStorage.removeItem(e)}clearCache(){}},F={style:{"font-size":"20px"}},K={__name:"errcodeDetail",props:{data:{}},setup(e){const n=e;console.log("打开errcodeDetaildata:",n.data);let u="<span style='font-size: 20px;color: red'>错误详情:</span><span style='font-size: 20px'>";return u+=n.data.detail_msg,u+="<br/>",u+="<span style='font-size: 20px;color: red'>出错代码:</span>",u+=n.data.stack,u+="</span>",(n,d)=>{const p=l;return t(),s("div",null,[a(p,{content:o(u),"raw-content":"",placement:"bottom",effect:"light",style:{"font-size":"20px"}},{default:r((()=>[c("span",F,"原因:"+i(e.data.msg),1)])),_:1},8,["content"])])}}},W=u.create({baseURL:"/api",timeout:15e3,headers:{"Content-type":"application/json;charset=utf-8","Cache-Control":"no-cache",UserId:0,Token:""}});W.interceptors.request.use((e=>{let t=Q().userInfo,o=Q().tokenInfo,n=t?parseInt(t.user_id,10):0;const s=o?o.token:"";return e.headers=e.headers||{},e.headers.UserId=n,e.headers.Token=s,console.log("获取缓存token:",o," 获取缓存用户数据:",t," 发送http头",e.headers),e})),W.interceptors.response.use((e=>{console.log("res:",e.data);const t=e.headers["content-disposition"],o=/filename\*?=(?:UTF-8'')?"?([^";]+)"?/i;if(t){if(t.match(o))return e}const n=e.data.code;return 200!=n?5===n?(console.log("token无效重新登录"),Q().logout(),location.href="/login",Promise.reject()):(7==n?d.alert("用户名或密码错误!",{type:"warning",confirmButtonText:"知道了"}):(console.log("interceptor err code",e),d({title:"服务器错误码["+n+"]",message:()=>p(K,{data:e.data}),type:"warning",confirmButtonText:"知道了"}).then((e=>{}))),Promise.reject(e.data)):e.data}),(e=>{console.log(e);const t=e.response&&e.response.status||-1,o=e.response&&e.response.data.message||e;return d.alert(o,"请求服务器返回http错误码-"+t,{type:"error",confirmButtonText:"知道了"}),Promise.reject(e)}));const Q=h("user",{state:()=>({tokenInfo:X(),userInfo:ee(),projects:ne(),dynamicMenuItems:[],dynamicRouteChildren:[],isGetUserInfo:!1}),actions:{hasGetUserInfo(){return this.generateDynamicRoutes(),this.isGetUserInfo},getDynamicRouteChildren(){return this.dynamicRouteChildren},pushDynamicRouteChildren(e){this.dynamicRouteChildren.push(e)},pushDynamicMenuItems(e){this.dynamicMenuItems.push(e)},clearDynamicRouteChildren(e){this.dynamicRouteChildren=[]},clearDynamicMenuItems(e){this.dynamicMenuItems=[]},login(e,t){return new Promise(((o,n)=>{var s;(s={user:e,password:t},W({url:"/user/login",method:"post",data:s})).then((e=>{this.userInfo=e.data.user_info,this.tokenInfo=e.data.token_info,this.projects=e.data.projects,Y(this.tokenInfo),oe(this.userInfo),ae(this.projects),this.generateDynamicRoutes(),this.isGetUserInfo=!0,o()})).catch((e=>{n(e)}))}))},getUserInfo(){return new Promise(((e,t)=>{var o;W({url:"/user/info",method:"get",data:o}).then((t=>{this.userInfo=t.data.user_info,this.tokenInfo=t.data.token_info,this.projects=t.data.projects,Y(this.tokenInfo),oe(this.userInfo),ae(this.projects),this.generateDynamicRoutes(),this.isGetUserInfo=!0,e()})).catch((e=>{t(e)}))}))},logout(){console.log("走logout清理缓存。。"),this.userInfo=null,this.tokenInfo=null,this.projects=null,te(),Z(),se()},generateDynamicRoutes(){this.clearDynamicRouteChildren(),this.clearDynamicMenuItems();const e=this.projects;for(let t=0;t<e.length;t++){const o=e[t];let n=!1;const s={path:"/project/"+o.project_id,name:o.project_id,meta:{projectId:o.project_id,projectName:o.project_name},children:[],props:!0};o.resource_list.forEach((e=>{const t=s.path+"/"+e.resource,a={path:t,name:s.name+"_"+e.resource,meta:{desc:e.desc,projectId:o.project_id,resource:e.resource,resource_url:t,methods:{},global_click_btns:e.global_btns,row_click_btns:e.row_btns},component:()=>H((()=>import("./project_op-Dxk0ObAk.js")),__vite__mapDeps([0,1,2,3,4,5,6])),props:!0};"cdkey"===e.resource&&(a.component=()=>H((()=>import("./project_cdkey-BtgSH_Ay.js")),__vite__mapDeps([7,2,3,4,5,8]))),e.show_methods.forEach((e=>{"get"==e&&(n=!0),a.meta.methods[e]=!0})),s.children.push(a),this.pushDynamicRouteChildren(a)})),n&&this.pushDynamicMenuItems(s)}console.log("pinia重新生成路由。。"),ge.children=fe.concat(this.getDynamicRouteChildren()),_e.addRoute(ge)}}}),X=()=>J.getCache("tokenInfo"),Y=e=>{J.setCache("tokenInfo",e)},Z=()=>{J.deleteCache("tokenInfo")},ee=()=>J.getCache("userInfo"),te=()=>{J.deleteCache("userInfo")},oe=e=>{J.setCache("userInfo",e)},ne=()=>J.getCache("projects"),se=()=>{J.deleteCache("projects")},ae=e=>{J.setCache("projects",e)},re=(e,t)=>{const o=e.__vccOpts||e;for(const[n,s]of t)o[n]=s;return o},ce={class:"sidebar-content"},ie={style:{"border-bottom":"1px whitesmoke solid"}},le={class:"header-content"},ue={class:"avatar-container"},de={style:{"font-size":"20px"}},pe={__name:"Home",setup(n){const l=m(),u=f(),p=Q().userInfo.nick_name,h=g((()=>u.path)),U=Q().dynamicMenuItems,A=_(!1),M=()=>{l.push("/welcome")};function S(e){if("logout"===e)d.confirm("确定注销并退出系统吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{Q().logout(),l.push("/login")})).catch((()=>{}))}return(n,u)=>{const d=b,m=C,f=k,g=j,_=I,z=y("arrow-down"),N=O,B=L,G=P,V=D,$=y("router-view"),q=T,H=R;return t(),s("main",null,[c("div",null,[a(H,{class:"app-container"},{default:r((()=>[a(_,{class:"app-sidebar"},{default:r((()=>[c("div",ce,[c("div",{class:"sidebar-logo",onClick:M},u[1]||(u[1]=[c("img",{src:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20261.76%20226.69'%3e%3cpath%20d='M161.096.001l-30.225%2052.351L100.647.001H-.005l130.877%20226.688L261.749.001z'%20fill='%2341b883'/%3e%3cpath%20d='M161.096.001l-30.225%2052.351L100.647.001H52.346l78.526%20136.01L209.398.001z'%20fill='%2334495e'/%3e%3c/svg%3e",class:"logo",alt:"Logo"},null,-1),c("span",{class:"system-name"},"游戏后台管理系统",-1)])),a(g,{"default-active":h.value,class:"el-menu-vertical-demo",collapse:!1},{default:r((()=>[c("div",ie,[a(f,{index:"/user"},{title:r((()=>u[2]||(u[2]=[c("span",null,"用户管理",-1)]))),default:r((()=>[(t(!0),s(v,null,w(o(me),(o=>(t(),e(m,{index:o.path,onClick:e=>n.$router.push(o.path)},{default:r((()=>[a(d,null,{default:r((()=>[(t(),e(E(o.meta.icon),{class:"el-icon"}))])),_:2},1024),c("span",null,i(o.meta.name),1)])),_:2},1032,["index","onClick"])))),256))])),_:1}),a(m,{index:"/project",onClick:u[0]||(u[0]=e=>n.$router.push("/project"))},{default:r((()=>u[3]||(u[3]=[c("span",null,"项目管理",-1)]))),_:1})]),(t(!0),s(v,null,w(o(U),(o=>(t(),e(f,{index:o.path},{title:r((()=>[c("span",null,i(o.meta.projectName),1)])),default:r((()=>[(t(!0),s(v,null,w(o.children,(o=>(t(),e(m,{key:o.path,index:o.path,onClick:e=>{return t=o,J.setCache("resource",t),l.push({path:t.path}),void(A.value=!0);var t}},{default:r((()=>[x(i(o.meta.desc),1)])),_:2},1032,["index","onClick"])))),128))])),_:2},1032,["index"])))),256))])),_:1},8,["default-active"])])])),_:1}),a(H,{class:"app-container-right"},{default:r((()=>[a(V,{class:"app-header"},{default:r((()=>[c("div",le,[c("div",ue,[a(G,{class:"right-menu-item hover-effect",trigger:"click",onCommand:S},{dropdown:r((()=>[a(B,null,{default:r((()=>[a(N,{command:"logout"},{default:r((()=>u[4]||(u[4]=[x("退出登录")]))),_:1})])),_:1})])),default:r((()=>[c("span",de,[x(i(o(p))+" ",1),a(d,{color:"black",size:"10"},{default:r((()=>[a(z)])),_:1})])])),_:1})])])])),_:1}),a(q,{class:"app-main"},{default:r((()=>[(t(),e($,{key:n.$route.fullPath}))])),_:1})])),_:1})])),_:1})])])}}},he={path:"/project",name:"project",meta:{name:"project",icon:"App",resource_url:"/project",methods:{get:!0,post:!0,put:!0,delete:!0}},component:()=>H((()=>import("./project-BFx6JD-k.js")),__vite__mapDeps([9,1,2,3,4,5,6]))},me=[{path:"/usermanager",name:"usermanager",meta:{name:"用户管理",icon:"User"},component:()=>H((()=>import("./user-Dk1aLYV6.js")),__vite__mapDeps([10,11,2,3,4,12]))},{path:"/character",name:"character",meta:{name:"角色管理",icon:"Avatar"},component:()=>H((()=>import("./character-swN-iIB1.js")),__vite__mapDeps([13,11,2,3,4,12]))}],fe=[{path:"/welcome",name:"welcome",component:()=>H((()=>import("./welcome-CusT05GU.js")),__vite__mapDeps([14,2,3]))},{path:"/user",name:"user",meta:{name:"user",icon:"User"},children:me},he],ge={path:"/",name:"home",component:re(pe,[["__scopeId","data-v-eb21a6f2"]]),children:fe},_e=U({history:A("/"),routes:[{path:"/login",name:"login",component:()=>H((()=>import("./Login-C9FInl8Y.js")),__vite__mapDeps([15,2,3,16])),hidden:!0},ge]});_e.beforeEach(((e,t,o)=>{const n=X();if(n&&void 0!==n.token&&""!==n.token)"/login"===e.path?(console.log("有token走登录跳过登录",n),o({path:"/welcome"})):(console.log("跳到页面:"+e.path+",当前所有路由:",_e.getRoutes()),Q().hasGetUserInfo()?(console.log("获取过用户数据,跳过获取。。。"),"/"===e.path?o({path:"/welcome"}):o()):Q().getUserInfo().then((()=>{console.log("获取用户信息成功,继续:",e.path),"/"===e.path?o({path:"/welcome"}):o({...e,replace:!0})})).catch((e=>{Q().logout().then((()=>{M.error(e),o({path:"/login"})}))})));else{if("/login"===e.path)return void o();console.log("token无效走登录。",n),o(`/login?redirect=${e.fullPath}`)}}));const ye=S();ye.use(z);const Ie=N($);for(const[je,ke]of Object.entries(B))Ie.component(je,ke);Ie.use(G,{locale:V}),Ie.use(ye),Ie.use(_e),Ie.mount("#app");export{re as _,he as c,ne as g,J as l,_e as r,W as s,Q as u};