2 lines
22 KiB
JavaScript
2 lines
22 KiB
JavaScript
var e=Object.defineProperty,t=(t,a,s)=>(((t,a,s)=>{a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s})(t,"symbol"!=typeof a?a+"":a,s),s);import{d as a,u as s,a as n,c as o,r,o as l,b as i,w as d,e as c,_ as u,f as m,g as h,h as p,i as g,j as f,p as v,k as w,l as b,m as T,I as _,R as S,W as y,n as E,P as I,q as A,B as C,C as R,s as k,t as O,v as L,N as x,x as N,y as U,z as $,A as D,D as P,E as K,F as j,G as M,H as B,J as F,K as G,L as H,M as q,O as V,Q as W,S as J,T as z,U as Y,V as X,X as Q,Y as Z,Z as ee,$ as te,a0 as ae,a1 as se,a2 as ne,a3 as oe,a4 as re,a5 as le,a6 as ie,a7 as de,a8 as ce,a9 as ue,aa as me,ab as he,ac as pe,ad as ge}from"../js/.pnpm/.pnpm.38b82a0b.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 a of e)if("childList"===a.type)for(const e of a.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 fe=(e,t)=>{const a=e.__vccOpts||e;for(const[s,n]of t)a[s]=n;return a};const ve=fe(a({setup(){window.$message=s()}}),[["render",function(e,t,a,s,n,o){return null}]]),we={common:{},Layout:{},Menu:{},Input:{}},be={common:{primaryColor:"#0057ff",primaryColorHover:"#0057ff",primaryColorPressed:"#0057ff",borderRadius:"5px"},Input:{}};const Te=fe(a({components:{MessageApi:ve},setup(){const e=n();let t=o((()=>e.getters["theme/getTheme"]));return{locale:r(null),dateLocale:r(null),darkThemeOverrides:we,lightThemeOverrides:be,theme:t}},beforeCreate(){this.$store.dispatch("theme/init"),this.$store.dispatch("auth/initClientId"),this.$store.dispatch("adminNavStore/initTabs")}}),[["render",function(e,t,a,s,n,o){const r=ve,g=u,f=m("router-view"),v=h,w=p;return l(),i(w,{"preflight-style-disabled":"","inline-theme-disabled":!1,theme:e.theme,"theme-overrides":null===e.theme?e.lightThemeOverrides:e.darkThemeOverrides,locale:e.$store.state.theme.locale,"date-locale":e.$store.state.theme.dateLocale},{default:d((()=>[c(g,null,{default:d((()=>[c(r)])),_:1}),c(f),c(v)])),_:1},8,["theme","theme-overrides","locale","date-locale"])}]]),_e={},Se=function(e,t,a){if(!t||0===t.length)return e();const s=document.getElementsByTagName("link");return Promise.all(t.map((e=>{if(e=function(e,t){return new URL(e,t).href}(e,a),e in _e)return;_e[e]=!0;const t=e.endsWith(".css"),n=t?'[rel="stylesheet"]':"";if(!!a)for(let a=s.length-1;a>=0;a--){const n=s[a];if(n.href===e&&(!t||"stylesheet"===n.rel))return}else if(document.querySelector(`link[href="${e}"]${n}`))return;const o=document.createElement("link");return o.rel=t?"stylesheet":"modulepreload",t||(o.as="script",o.crossOrigin=""),o.href=e,document.head.appendChild(o),t?new Promise(((t,a)=>{o.addEventListener("load",t),o.addEventListener("error",(()=>a(new Error(`Unable to preload CSS for ${e}`))))})):void 0}))).then((()=>e()))},ye=[{path:"/test",name:"Test",component:()=>Se((()=>import("../js/test/Index.8ee0328c.js")),["../js/test/Index.8ee0328c.js","../js/.pnpm/.pnpm.38b82a0b.js"],import.meta.url)}],Ee=[];["home","admin","admin-group","admin-log","user"].forEach((e=>{const t=Object.assign({"../../../../views/Admin/admin-group/Index.vue":()=>Se((()=>import("../js/admin-group/Index.7ca46a1a.js")),["../js/admin-group/Index.7ca46a1a.js","../js/TableData/TableData.bf91a0fc.js","../js/.pnpm/.pnpm.38b82a0b.js","./TableData.3ed117a5.css","./Index.08994523.css"],import.meta.url),"../../../../views/Admin/admin-log/Index.vue":()=>Se((()=>import("../js/admin-log/Index.c3225d80.js")),["../js/admin-log/Index.c3225d80.js","../js/TableData/TableData.bf91a0fc.js","../js/.pnpm/.pnpm.38b82a0b.js","./TableData.3ed117a5.css","./Index.1c1841a8.css"],import.meta.url),"../../../../views/Admin/admin/Index.vue":()=>Se((()=>import("../js/admin/Index.76eca1f0.js")),["../js/admin/Index.76eca1f0.js","../js/TableData/TableData.bf91a0fc.js","../js/.pnpm/.pnpm.38b82a0b.js","./TableData.3ed117a5.css"],import.meta.url),"../../../../views/Admin/home/Index.vue":()=>Se((()=>import("../js/home/Index.22fe00e6.js")),["../js/home/Index.22fe00e6.js","../js/.pnpm/.pnpm.38b82a0b.js"],import.meta.url),"../../../../views/Admin/login/Index.vue":()=>Se((()=>import("../js/login/Index.e0f5ad83.js")),["../js/login/Index.e0f5ad83.js","../js/.pnpm/.pnpm.38b82a0b.js","./Index.1fe3a4fe.css"],import.meta.url),"../../../../views/Admin/user/Index.vue":()=>Se((()=>import("../js/user/Index.c7a7ad21.js")),["../js/user/Index.c7a7ad21.js","../js/.pnpm/.pnpm.38b82a0b.js","./Index.0c6908dc.css"],import.meta.url)});Ee.push({path:e,name:e.toUpperCase(),component:t[`../../../../views/Admin/${e}/Index.vue`]})}));const Ie=[{path:"",redirect:"/admin/home"}].concat(Ee),Ae={setup:()=>({})},Ce={class:"not-found"},Re=(e=>(v("data-v-efa2effb"),e=e(),w(),e))((()=>b("span",{class:"label"},"404",-1)));const ke=fe(Ae,[["render",function(e,t,a,s,n,o){const r=m("css-doodle");return l(),g("div",Ce,[c(r,{class:"bg"},{default:d((()=>[f(" @grid: 50x1 / 100%; @place: center; @size: calc(75% / @I * @i); transform: rotate(calc(@i * 5deg)); border-radius: 30%; border: 1px solid hsla( calc(10 + 4 * @i), 70%, 68%, @r.8 ); ")])),_:1}),Re])}],["__scopeId","data-v-efa2effb"]]),Oe={setup:()=>({})},Le={class:"m-auto h-screen bg-gray-400"},xe=[T('<div class="relative top-1/3"><div class="m-auto bg-white w-64 shadow-2xl p-3 rounded-xl cursor-pointer"><div></div><div class="text-center"><div class="font-bold text-black text-base">Yaa - yii2</div><div class="text-slate-400">@welcome</div></div></div></div>',1)];const Ne=fe(Oe,[["render",function(e,t,a,s,n,o){return l(),g("div",Le,xe)}]]);const Ue=fe({setup:()=>({}),created(){}},[["render",function(e,t,a,s,n,o){const r=m("router-view");return l(),i(r)}]]);const $e=fe(a({components:{Icon:_,RefreshRound:S,WeatherMoon24Regular:y,WeatherSunny24Regular:E,PositionForward24Filled:I,PositionBackward24Filled:A,BroadActivityFeed16Regular:C,CalendarWeekStart24Regular:R,CheckboxUnchecked20Regular:k},setup(){const e=O("reload"),t=n();return{reload:e,theme:o((()=>t.getters["theme/getTheme"])),haveFroward:o((()=>t.getters["theme/getHaveForward"])),showTabs:o((()=>t.getters["adminNavStore/getShowTabs"])),toggleShowTabs(){t.dispatch("adminNavStore/setShowTabs")}}},methods:{toggleTheme(e){this.$store.dispatch("theme/toggle",e)},toggleLanguage(e){this.$store.dispatch("theme/toggleLanguage",e)},goRouter(e){return this.$router.go(e)}}}),[["render",function(e,t,a,s,n,o){const r=m("WeatherMoon24Regular"),u=x,h=N,p=m("WeatherSunny24Regular"),g=m("RefreshRound"),v=U,w=m("PositionBackward24Filled"),b=m("PositionForward24Filled"),T=m("CalendarWeekStart24Regular"),_=m("BroadActivityFeed16Regular"),S=$,y=D;return l(),i(y,{class:"header-box"},{default:d((()=>[c(S,null,{default:d((()=>[null==e.theme?(l(),i(h,{key:0,strong:"",secondary:"",circle:"",onClick:t[0]||(t[0]=t=>e.toggleTheme("moon"))},{icon:d((()=>[c(u,null,{default:d((()=>[c(r)])),_:1})])),_:1})):(l(),i(h,{key:1,strong:"",secondary:"",circle:"",onClick:t[1]||(t[1]=t=>e.toggleTheme(""))},{icon:d((()=>[c(u,null,{default:d((()=>[c(p)])),_:1})])),_:1})),c(v,{placement:"top-start",trigger:"hover"},{trigger:d((()=>[c(h,{strong:"",secondary:"",circle:"",onClick:e.reload},{icon:d((()=>[c(u,null,{default:d((()=>[c(g)])),_:1})])),_:1},8,["onClick"])])),default:d((()=>[f(" 刷新页面 ")])),_:1}),c(v,{placement:"top-start",trigger:"hover"},{trigger:d((()=>[c(h,{strong:"",secondary:"",circle:"",onClick:t[2]||(t[2]=t=>e.goRouter(-1))},{icon:d((()=>[c(u,null,{default:d((()=>[c(w)])),_:1})])),_:1})])),default:d((()=>[f(" 后退一页 ")])),_:1}),e.haveFroward?(l(),i(v,{key:2,placement:"top-start",trigger:"hover"},{trigger:d((()=>[c(h,{strong:"",secondary:"",circle:"",onClick:t[3]||(t[3]=t=>e.goRouter(1)),disabled:!e.haveFroward},{icon:d((()=>[c(u,null,{default:d((()=>[c(b)])),_:1})])),_:1},8,["disabled"])])),default:d((()=>[f(" 前进一页 ")])),_:1})):L("",!0),c(h,{strong:"",secondary:"",circle:"",onClick:e.toggleShowTabs},{icon:d((()=>[c(u,null,{default:d((()=>[e.showTabs?(l(),i(T,{key:0})):(l(),i(_,{key:1}))])),_:1})])),_:1},8,["onClick"])])),_:1})])),_:1})}],["__scopeId","data-v-4f009f56"]]),De=a({props:["src","isShadow","fillet","showLabel"]}),Pe={key:0,class:"label"};const Ke=fe(De,[["render",function(e,t,a,s,n,o){const r=K;return l(),g("div",{class:P(["avatar",(0==e.isShadow?"no-shadow":"")+(1==e.fillet?"fillet":"")])},[c(r,{src:e.src,"fallback-src":"https://inews.gtimg.com/newsapp_bt/0/14751264257/1000"},null,8,["src"]),1==e.showLabel?(l(),g("div",Pe)):L("",!0)],2)}],["__scopeId","data-v-2b9fed72"]]),je=Object.freeze(Object.defineProperty({__proto__:null,Home24Filled:j,PeopleAudience24Filled:M,People24Filled:B},Symbol.toStringTag,{value:"Module"}));const Me=F([]),Be=a({props:["activeKey"],components:{NLayoutSider:G,NMenu:H,NImage:K},setup(e){const t=n();let a=r(e.activeKey);const s=r(null),o=r([a.value]);return q((()=>t.getters["menuStore/getActiveKey"]),(e=>{var t;a.value=e,null==(t=s.value)||t.showOption(e)})),setTimeout((()=>{var e;null==(e=s.value)||e.showOption(a.value)}),500),{activeKey:a,menuOptions:Me,menuInstRef:s,defaultExpandedKeys:o}},created(){this.menuOptions.length<=0&&this.show()},methods:{async show(){const{data:e}=await this.$http.get("admin/api/auth/authentication");if(e){const t=this.$route.path.replace("/admin/",""),a={path:"/admin/"+t,title:e.menuKey[t][1],pin:!0,pathKey:e.menuKey[t][0]};this.$store.dispatch("adminNavStore/addTab",a),e.menus.forEach((e=>{const t=(a=e.icon,je[a]);var a,s;e.icon=(s=t,()=>V(x,null,{default:()=>V(s)})),this.menuOptions.push(e)}))}},changMenu(e,t){let a="/admin/";this.$store.dispatch("menuStore/setActiveKey",e);const s={path:a+e,title:t.label,pin:!0,pathKey:t.pathKey};return this.$store.dispatch("adminNavStore/addTab",s),this.$router.push(a+e)}}});const Fe=a({components:{GeneralMenu:fe(Be,[["render",function(e,t,a,s,n,o){const r=H;return e.menuOptions.length>0?(l(),i(r,{key:0,class:"menu-item",ref:"menuInstRef",value:e.activeKey,"onUpdate:value":t[0]||(t[0]=t=>e.activeKey=t),options:e.menuOptions,onUpdateValue:e.changMenu,"default-expanded-keys":e.defaultExpandedKeys},null,8,["value","options","onUpdateValue","default-expanded-keys"])):L("",!0)}]]),Avatar:Ke,LogOutOutline:W,Icon:_},setup(){const e=n(),t=o((()=>e.getters["menuStore/getActiveKey"]));let a=o((()=>e.getters["theme/getTheme"]));return{userInfo:e.getters["auth/getUser"],activeKey:t,theme:a,collapsed:r(!1)}},created(){let e=this.$route.path.replace("/admin/","");this.$store.dispatch("menuStore/setActiveKey",e)},methods:{async handleSelect(e){if("logout"==e){const{data:e}=await this.$http.post("admin/api/auth/logout");if(e)return this.$store.dispatch("auth/logout"),this.$store.dispatch("auth/initClientId"),this.$router.push({path:"/admin/login",query:{direct:this.$route.fullPath}})}}}}),Ge={class:"user-box"},He={class:"account-box"},qe={class:"info"},Ve={class:"name"},We={class:"des"},Je={key:0,style:{"margin-top":"35px"}},ze=(e=>(v("data-v-9890ae10"),e=e(),w(),e))((()=>b("div",{class:"left-filter-box"},null,-1)));const Ye=fe(Fe,[["render",function(e,t,a,s,n,o){const r=Ke,u=m("LogOutOutline"),h=m("Icon"),p=N,f=z,v=m("GeneralMenu"),w=G;return l(),i(w,{class:P(["left-menu",(1==e.collapsed?" collapsed ":"")+(null==e.theme?" moon ":"drak")]),bordered:"","collapse-mode":"width","collapsed-width":90,width:268,collapsed:e.collapsed,"show-trigger":"",onCollapse:t[1]||(t[1]=t=>e.collapsed=!0),onExpand:t[2]||(t[2]=t=>e.collapsed=!1)},{default:d((()=>[b("div",Ge,[b("div",He,[c(r,{showLabel:!0,src:e.userInfo.avatar,"onUpdate:src":t[0]||(t[0]=t=>e.userInfo.avatar=t)},null,8,["src"]),b("div",qe,[b("div",Ve,J(e.userInfo.username),1),b("div",We,J(e.userInfo.adminGroupId),1)])]),1!=e.collapsed?(l(),g("div",Je,[c(f,{options:[{label:"退出登录",key:"logout"}],placement:"bottom-start",trigger:"click",onSelect:e.handleSelect},{default:d((()=>[c(p,{strong:"",secondary:"",circle:""},{icon:d((()=>[c(h,null,{default:d((()=>[c(u)])),_:1})])),_:1})])),_:1},8,["onSelect"])])):L("",!0)]),c(v,{activeKey:e.activeKey},null,8,["activeKey"]),ze])),_:1},8,["class","collapsed"])}],["__scopeId","data-v-9890ae10"]]),Xe=a({setup(){const e=n(),t=o((()=>e.getters["adminNavStore/getTabs"])),a=r("");return q((()=>e.getters["adminNavStore/getCurrentTab"]),(e=>{a.value=e.title}),{deep:!0}),{navTabs:t,defaultTab:a,handleClose(t){e.dispatch("adminNavStore/deleteTab",t)}}},methods:{handleUpdateValue(e){this.navTabs.forEach((t=>{t.title==e&&(this.$store.dispatch("adminNavStore/addTab",t),this.$router.push(t.path))}))}}});const Qe=[{path:"/",component:Ue,children:[{path:"",component:Ne},...ye,{path:"/admin/",component:fe(a({components:{AdminHeader:$e,AdminHeaderTab:fe(Xe,[["render",function(e,t,a,s,n,o){const r=Q,u=Z,m=D;return l(),i(m,{class:"header-tabs","content-style":"padding: 0;"},{default:d((()=>[c(u,{type:"card","tabs-padding":20,class:"tabs",closable:"",onClose:e.handleClose,value:e.defaultTab,"onUpdate:value":[t[0]||(t[0]=t=>e.defaultTab=t),e.handleUpdateValue]},{default:d((()=>[(l(!0),g(X,null,Y(e.navTabs,(e=>(l(),i(r,{class:"item",key:e.path,name:e.title,closable:e.pin},null,8,["name","closable"])))),128))])),_:1},8,["onClose","value","onUpdate:value"])])),_:1})}],["__scopeId","data-v-712ecae1"]]),AdminLeftMenu:Ye},setup(){const e=n();let t=r(!0);const a=o((()=>e.getters["adminNavStore/getShowTabs"]));return ee("reload",(()=>{t.value=!1,setTimeout((()=>{t.value=!0}),1)})),{isRouterAlive:t,showTabs:a}}}),[["render",function(e,t,a,s,n,o){const r=Ye,u=$e,h=m("AdminHeaderTab"),p=m("router-view"),g=re;return l(),i(g,{"has-sider":"",class:"page"},{default:d((()=>[c(r),c(g,{class:"content-page-box"},{default:d((()=>[c(u),c(te,{name:"fade",mode:"out-in"},{default:d((()=>[ae(c(h,null,null,512),[[se,!0===e.showTabs]])])),_:1}),c(p,null,{default:d((({Component:t})=>[c(te,{name:"fade",mode:"out-in"},{default:d((()=>[b("div",null,[e.isRouterAlive?(l(),i(ne,{key:0},[(l(),i(oe(t)))],1024)):L("",!0)])])),_:2},1024)])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-27c2172e"]]),children:[...Ie]},{path:"/admin/login",component:()=>Se((()=>import("../js/login/Index.e0f5ad83.js")),["../js/login/Index.e0f5ad83.js","../js/.pnpm/.pnpm.38b82a0b.js","./Index.1fe3a4fe.css"],import.meta.url)},{path:"/:pathMatch(.*)*",name:"NotFound",component:ke}]}],Ze={Encrypt(e){var t=le.AES.encrypt(e,le.enc.Utf8.parse("yt12an145920Yt20"),{iv:le.enc.Utf8.parse("20yt029541NA21Yt")});return le.enc.Base64.stringify(t.ciphertext)},Decrypt:e=>(e=e.replace(/\s+/g,"+"),le.AES.decrypt(e,le.enc.Utf8.parse("yt12an145920Yt20"),{iv:le.enc.Utf8.parse("20yt029541NA21Yt")}).toString(le.enc.Utf8))},et={getClientId:()=>window.localStorage.getItem("client-id"),setClientId(e){window.localStorage.setItem("client-id",e)},getAccessToken:()=>window.localStorage.getItem("ACCESS_TOKEN"),resetToken(){const e=window.localStorage.getItem("ACCESS_TOKEN");if(e){const t=Ze.Decrypt(e).split(","),a=(new Date).valueOf()-3e3,s=t[0]+","+t[1]+","+a;return Ze.Encrypt(s)}return""},setAccessToken(e){null==e?window.localStorage.removeItem("ACCESS_TOKEN"):window.localStorage.setItem("ACCESS_TOKEN",e)}},tt=ue({strict:!1,modules:{theme:{namespaced:!0,state:()=>({theme:null,locale:ie,dateLocale:de,haveForward:!1}),getters:{getTheme:e=>e.theme,getHaveForward:e=>e.haveForward},mutations:{INIT_THEME:e=>{const t=window.localStorage.getItem("darkMode");null==t?e.theme?window.localStorage.setItem("darkMode","true"):window.localStorage.setItem("darkMode","false"):e.theme="true"==t?ce:null},TOGGLE_THEME:(e,t)=>{t?(e.theme=ce,window.localStorage.setItem("darkMode","true")):(e.theme=null,window.localStorage.setItem("darkMode","false"))},TOGGLE_LANGUAGE:(e,t)=>{"zh-CN"==t?(e.locale=ie,e.dateLocale=de):(e.locale=null,e.dateLocale=null)},TOGGLE_ROUTER_STATUS:(e,t)=>{e.haveForward=t}},actions:{init({commit:e}){e("INIT_THEME")},toggle({commit:e},t){e("TOGGLE_THEME",t)},toggleLanguage({commit:e},t){e("TOGGLE_LANGUAGE",t)},toggleRouter({commit:e},t){e("TOGGLE_ROUTER_STATUS",t)}}},auth:{namespaced:!0,state:()=>({user:null}),getters:{getUser:e=>e.user},mutations:{INIT_USER:(e,t)=>{e.user=t,window.localStorage.setItem("userInfo",JSON.stringify(t))},RESET_USER:e=>{let t=window.localStorage.getItem("userInfo");t&&(t=JSON.parse(t),e.user=t)}},actions:{initClientId({commit:e}){et.getClientId()||et.setClientId(Math.random().toString(36).substr(2)),e("RESET_USER")},logout(){window.localStorage.clear()},clear({commit:e}){window.localStorage.clear(),et.setAccessToken(null),et.setClientId(Math.random().toString(36).substr(2))},login({commit:e},t){e("INIT_USER",t),et.setAccessToken(t.token)}}},menuStore:{namespaced:!0,state:()=>({activeKey:""}),getters:{getActiveKey:e=>e.activeKey},mutations:{SET:(e,t)=>{e.activeKey=t}},actions:{setActiveKey({commit:e},t){e("SET",t)}}},tableStore:{namespaced:!0,state:()=>({selectDragArr:[],tableDrag:[]}),getters:{getTableDrag:e=>e.tableDrag,getSelectDragArr:e=>e.selectDragArr},mutations:{SET_TABLE_DRAG:(e,t)=>{e.tableDrag=t},SET_SELECT_DRAG_ARR:(e,t)=>{e.selectDragArr=t}},actions:{setTableDrag({commit:e},t){e("SET_TABLE_DRAG",t)},setSelectDrag({commit:e},t){e("SET_SELECT_DRAG_ARR",t)}}},adminNavStore:{namespaced:!0,state:()=>({tabs:[{path:"/admin/home",title:"控制台",pin:!1}],currentTab:[],showTabs:!1}),getters:{getTabs:e=>e.tabs,getCurrentTab:e=>e.currentTab,getShowTabs:e=>e.showTabs},mutations:{INIT_TABS:(e,t)=>{const a=window.localStorage.getItem("yaa-tabs-nav"),s=window.localStorage.getItem("ifyaa-tabs-nav");a&&a.length>0&&(e.tabs=JSON.parse(a)),s&&(e.showTabs=JSON.parse(s))},ADD_TABS:(e,t)=>{if(e.tabs.length>0){let a=!1;for(let s=0;s<e.tabs.length;s++)t.title==e.tabs[s].title&&(a=!0);a||e.tabs.push(t)}else e.tabs.push(t);e.currentTab=t,window.localStorage.setItem("yaa-tabs-nav",JSON.stringify(e.tabs))},DELETE_TABS:(e,t)=>{let a=null,s=null,n=null,o=e.tabs.length;e.tabs.forEach(((a,o)=>{a.title==t&&(n=o),a.title==e.currentTab.title&&(s=o)})),e.tabs.splice(n,1),n==s&&(a=s+1>=o?e.tabs[s-1]:e.tabs[s]),window.localStorage.setItem("yaa-tabs-nav",JSON.stringify(e.tabs)),a&&(e.currentTab=a,at.push(a.path))},SET_SHOW_TABS(e){e.showTabs=!e.showTabs,window.localStorage.setItem("ifyaa-tabs-nav",e.showTabs)}},actions:{initTabs({commit:e},t){e("INIT_TABS",t)},addTab({commit:e},t){e("ADD_TABS",t)},deleteTab({commit:e},t){e("DELETE_TABS",t)},setShowTabs({commit:e},t){e("SET_SHOW_TABS",t)}}}}}),at=me({history:he(),routes:Qe,scrollBehavior(e,t,a){const s=e.path.replace("/admin/","");tt.dispatch("menuStore/setActiveKey",s),a&&window.history.state.forward?tt.dispatch("theme/toggleRouter",!0):tt.dispatch("theme/toggleRouter",!1)}});at.beforeEach(((e,t,a)=>{const s=/^\/admin\/(.*?)/.test(e.path);"/admin/login"!=e.path?s?et.getAccessToken()?a():a({path:"/admin/login",query:{redirect:e.fullPath}}):a():et.getAccessToken()?a("/admin/"):a()}));const st=200,nt=401,ot=new class{constructor(e){t(this,"httpClient");const a={baseUrl:"",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},params:{},timeout:9e6,withCredentials:!1,responseType:"json",maxContentLength:2e3,validateStatus:function(e){return e>=200&&e<500},maxRedirects:3,data:{},getClientId:()=>null,getAccessToken:()=>null,successHandler:e=>{Promise.resolve(e)},errorHandler:e=>{Promise.reject(e)},...e},s=pe.create({baseURL:a.baseUrl,timeout:a.timeout,withCredentials:a.withCredentials});s.interceptors.request.use((e=>{const t=a.getClientId();t&&(e.headers["X-Client-Id"]=t);const s=a.getAccessToken();return s&&(e.headers["X-Access-Token"]=s),e.headers["admin-campus-id"]=window.localStorage.getItem("admin_campus_id"),e})),s.interceptors.response.use((e=>a.successHandler(e)),(e=>a.errorHandler(e))),this.httpClient=s}request(e,t,a=null,s=null){const n={};return n.url=t,n.method=e,a&&(n.params=a),s&&(n.data=s),this.httpClient.request(n).then((e=>({...e,error:null}))).catch((e=>({err:e,data:null})))}get(e,t=null){return this.request("GET",e,t)}head(e,t=null){return this.request("HEAD",e,t)}post(e,t=null,a=null){return this.request("POST",e,a,t)}put(e,t=null,a=null){return this.request("PUT",e,a,t)}path(e,t=null,a=null){return this.request("PATH",e,a,t)}delete(e,t=null,a=null){return this.request("DELETE",e,a,t)}download(e,t,a=null,s=null,n=null){const o={};return o.url=t,o.method=e,o.timeout=9e10,o.responseType="blob",a&&(o.params=a),s&&(o.data=s),this.httpClient.request(o).then((e=>{let t=e.headers["x-suggested-filename"];const a=window.URL.createObjectURL(new Blob([e.data])),s=document.createElement("a");s.href=a,s.setAttribute("target","_blank");const o=(n||"")+new Date+t;return s.setAttribute("download",decodeURIComponent(o)),s.click(),window.URL.revokeObjectURL(a),!0})).catch((()=>!1))}}({baseUrl:"http://localhost:9527/",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},getClientId:()=>et.getClientId(),getAccessToken:()=>et.resetToken(),successHandler:e=>{const t=window.$message;let a=e.data.code;if(a==nt&&(et.setAccessToken(null),at.replace({path:"/admin/login",query:{direct:at.currentRoute.value.fullPath}})),a!=st){if(e.data){const a=e.data;if(a.msg)t.error(a.msg);else if(Array.isArray(a))a.forEach((function(e){t.error(e.msg)}));else if(a instanceof Blob){const e=new Blob([a]),s=new FileReader;s.onloadend=()=>{t.error("error")},s.readAsText(e)}}return Promise.reject(e.data)}return Promise.resolve(e.data)},errorHandler:e=>{const t=window.$message;if(e.response){if(e.response.status!=st)if(e.response.data){const a=e.response.data;if(a.msg)t.error(a.msg);else if(a instanceof Blob){const e=new Blob([a]),s=new FileReader;s.onloadend=()=>{t.error("error")},s.readAsText(e)}}else t.error(e.message)}else t.error(e.message);return Promise.reject(e)}}),rt=a({data:()=>({_handleBtn:F([{title:"操作",key:"tags",width:200,fixed:"right",NButtons:[{size:"small",emitFunction:"view",text:"查看"},{size:"small",type:"info",emitFunction:"edit",text:"编辑"}]}])}),methods:{openModal(e=null,t=null){if(!t)return window.$message.warning("请在使用openModal方法时, 填写ref名称。");const a=this.$refs[t];if(!a)return window.$message.warning("请确保ref名称组件存在。");a.show(e)}}}),lt=ge(Te);lt.config.globalProperties.$http=ot,lt.config.globalProperties.$store=tt,lt.mixin(rt),lt.use(tt).use(at).mount("#app");export{Ze as C,ot as R,fe as _};
|