upp-platform-core 1.1.30-devtest.0 → 1.1.30-devtest.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js.gz CHANGED
Binary file
@@ -0,0 +1 @@
1
+ import{Color as r}from"tvision-color";const d={business:{name:"协同门户",landing:"/homePage/index",desc:"面向业务用户的协同办公门户"},admin:{name:"管理员门户",landing:"/homePage/index",desc:"面向系统管理员的管理门户"},dev:{name:"开发者联盟门户",landing:"/homePage/index",desc:"面向开发者的开发者联盟门户"}},o="$system$";function n(r){if(null!=r&&""!==r)return r===o;try{const r=require("vue").default||require("vue"),d=r.prototype?.$proxyEnv?.APP_ID;if(null!=d&&""!==d)return d===o}catch(r){}return!1}const a="currentIdentity";function c(r){return d[r]?.landing||"/homePage/index"}const t={DEFAULT:{"--td-brand-color":"#0052D9","--td-brand-color-1":"#e0ebff","--td-brand-color-2":"#c0d8ff","--td-brand-color-3":"#a1c4ff","--td-brand-color-4":"#81b1ff","--td-brand-color-5":"#5f9bff","--td-brand-color-6":"#3d87ff","--td-brand-color-7":"#176eff","--td-brand-color-8":"#0052D9","--td-brand-color-9":"#0048cd","--td-brand-color-10":"#0035b5"},CYAN:{"--td-brand-color":"#0594FA","--td-brand-color-1":"#d7eefe","--td-brand-color-2":"#aeddfd","--td-brand-color-3":"#84cafd","--td-brand-color-4":"#58b8fc","--td-brand-color-5":"#29a4fb","--td-brand-color-6":"#0594FA","--td-brand-color-7":"#29a4fb","--td-brand-color-8":"#0594FA","--td-brand-color-9":"#0378df","--td-brand-color-10":"#01409b"},GREEN:{"--td-brand-color":"#00A870","--td-brand-color-1":"#8dffd9","--td-brand-color-2":"#00f2a2","--td-brand-color-3":"#00dc92","--td-brand-color-4":"#00c583","--td-brand-color-5":"#00A870","--td-brand-color-6":"#009a5d","--td-brand-color-7":"#00c583","--td-brand-color-8":"#00A870","--td-brand-color-9":"#009a5d","--td-brand-color-10":"#004a14"},ORANGE:{"--td-brand-color":"#ED7B2F","--td-brand-color-1":"#fce5d7","--td-brand-color-2":"#f8cdaf","--td-brand-color-3":"#f4b285","--td-brand-color-4":"#f19659","--td-brand-color-5":"#ED7B2F","--td-brand-color-6":"#e75510","--td-brand-color-7":"#f19659","--td-brand-color-8":"#ED7B2F","--td-brand-color-9":"#e75510","--td-brand-color-10":"#7f0a02"},RED:{"--td-brand-color":"#E34D59","--td-brand-color-1":"#fbe5e7","--td-brand-color-2":"#f7ccd0","--td-brand-color-3":"#f3b2b8","--td-brand-color-4":"#ef989f","--td-brand-color-5":"#ea7b84","--td-brand-color-6":"#E34D59","--td-brand-color-7":"#ea7b84","--td-brand-color-8":"#E34D59","--td-brand-color-9":"#e42c3a","--td-brand-color-10":"#8d0309"},PINK:{"--td-brand-color":"#ED49B4","--td-brand-color-1":"#fce5f4","--td-brand-color-2":"#facae9","--td-brand-color-3":"#f7aede","--td-brand-color-4":"#f491d2","--td-brand-color-5":"#f172c5","--td-brand-color-6":"#ED49B4","--td-brand-color-7":"#f172c5","--td-brand-color-8":"#ED49B4","--td-brand-color-9":"#e80f9d","--td-brand-color-10":"#8f025e"},PURPLE:{"--td-brand-color":"#834EC2","--td-brand-color-1":"#eee6f7","--td-brand-color-2":"#ddceee","--td-brand-color-3":"#ccb6e6","--td-brand-color-4":"#bb9edc","--td-brand-color-5":"#ab87d5","--td-brand-color-6":"#9a6fce","--td-brand-color-7":"#9a6fce","--td-brand-color-8":"#834EC2","--td-brand-color-9":"#783ac3","--td-brand-color-10":"#4c1397"},YELLOW:{"--td-brand-color":"#EBB105","--td-brand-color-1":"#fde9ab","--td-brand-color-2":"#fbd152","--td-brand-color-3":"#EBB105","--td-brand-color-4":"#dda204","--td-brand-color-5":"#ca8d03","--td-brand-color-6":"#b67803","--td-brand-color-7":"#fbd152","--td-brand-color-8":"#EBB105","--td-brand-color-9":"#dda204","--td-brand-color-10":"#603100"}},l={textColor:"rgba(0, 0, 0, 0.9)",placeholderColor:"rgba(0, 0, 0, 0.35)",borderColor:"#dcdcdc",containerColor:"#fff"},b={textColor:"rgba(255, 255, 255, 0.9)",placeholderColor:"rgba(255, 255, 255, 0.35)",borderColor:"#5e5e5e",containerColor:"#242424"};function e(r,d){return d[(/^#[A-F\d]{6}$/i.test(r)?r:function(r){return r.replace(/([A-Z])/g,"_$1").toUpperCase()}(r))||"DEFAULT"]}function f(d,o,n){const a="dark"===n;let c=o.indexOf(d);a&&(o.reverse().map(d=>{const[o,n,a]=r.colorTransform(d,"hex","hsl");return r.colorTransform([o,Number(n)-4,a],"hsl","hex")}),c=5,o[0]=`${o[c]}20`);return{"--td-brand-color":o[c],"--td-brand-color-1":o[0],"--td-brand-color-2":o[1],"--td-brand-color-3":o[2],"--td-brand-color-4":o[3],"--td-brand-color-5":o[4],"--td-brand-color-6":o[5],"--td-brand-color-7":c>0?o[c-1]:d,"--td-brand-color-8":o[c],"--td-brand-color-9":c>8?d:o[c+1],"--td-brand-color-10":o[9]}}function s(r,d,o){const n="dark"===o?`:root[theme-color='${r}'][theme-mode='dark']`:`:root[theme-color='${r}']`,a=document.createElement("style");a.type="text/css",a.innerText=`${n}{\n --td-brand-color: ${d["--td-brand-color"]};\n --td-brand-color-1: ${d["--td-brand-color-1"]};\n --td-brand-color-2: ${d["--td-brand-color-2"]};\n --td-brand-color-3: ${d["--td-brand-color-3"]};\n --td-brand-color-4: ${d["--td-brand-color-4"]};\n --td-brand-color-5: ${d["--td-brand-color-5"]};\n --td-brand-color-6: ${d["--td-brand-color-6"]};\n --td-brand-color-7: ${d["--td-brand-color-7"]};\n --td-brand-color-8: ${d["--td-brand-color-8"]};\n --td-brand-color-9: ${d["--td-brand-color-9"]};\n --td-brand-color-10: ${d["--td-brand-color-10"]};\n }`,document.head.appendChild(a)}export{a as C,b as D,d as I,l as L,t as a,e as b,f as c,s as d,c as g,n as i};
package/lib/store.js CHANGED
@@ -1 +1 @@
1
- import{message as e}from"tdesign-vue";import t from"js-cookie";import o from"vue";import{C as r,i as s,g as a,a as n,L as i,D as u}from"./settingColorHelper-6fce79cf.js";import"tvision-color";let d=null;const m=[],c=[];function l({modules:e,ParentView:t,IframeView:o,itemFn:r=null,keepName:s=!1},a,n=""){return a.filter(a=>"1"!==a.groupBy&&("0"!==a.isFrame&&(a.path=("/"===n?"":n)+("/"===a.path[0]?a.path:`/${a.path}`)),s||(a.name=a.path.replace(/\//g,"-").slice(1)),a.component&&((a.meta||{}).component=a.meta?.component||a.component,"Layout"===a.component||"ParentView"===a.component?(a.component=t,a.path.includes("http")&&c.push(a)):(a.hidden||d||(d=a.path),"IframeView"===a.component?(a.component=o,m.push(a)):"string"==typeof a.component&&(a.componentName=a.component,a.component=e[`../../pages/${a.component}.vue`])),a.meta={...a.meta,isFrame:a.isFrame,openNewWindow:a.openNewWindow,query:a.query}),null!=a.children&&a.children&&a.children.length?(a.children=l({modules:e,ParentView:t,IframeView:o,itemFn:r,keepName:s},a.children,a.path),0===a.children.filter(e=>!e.hidden).length&&(a.redirect=a.children[0].path,a.children[0].meta.title=a.meta.title,a.single=!0,d||(d=a.redirect))):(delete a.children,delete a.redirect),r?.(a),!0))}function h(){return d}function p(){return m}function g(){return c}function I({modules:e,ParentView:t,IframeView:o,flattenDeep:r,getUserMenu:s,envAppId:a,getAsyncRouterList:n,envDefaultTo:i,defaultIsValidMenu:u,addRoutes:d,resetRouter:m,getTopRoutes:c,getLayout:I,handleRouter:R,newAlive:b=!0}){const T={async initRoutes({commit:m,rootGetters:T}){const y=a,f=T["user/currentIdentity"],S=[y?`appId=${y}`:"",f?`currentIdentity=${f}`:""].filter(Boolean).join("&");await s("/system/menu/getRouters"+(S?`?${S}`:"")).then(async s=>{const a=c(),T=n(),y={path:"*",redirect:"/404",hidden:!0},f={path:"/",component:I,children:[]},S=[f,y],w=function(e){e.children?.length>0&&(e.redirect=f.children.find(t=>t.path.includes(e.path))?.path||"noRedirect"),"0"===e.meta.isFrame?S.push({...e,children:void 0}):f.children.push({...e,children:void 0})};l({modules:e,ParentView:t,IframeView:o,itemFn:w,keepName:!0},[...a,...T]);const L=R?await R(s,l,w):l({modules:e,ParentView:t,IframeView:o,itemFn:w},s.data),E=h(),P=p(),A=g();if(L&&L.length>0){const e={};r(L,"children","componentName","name",e),m("setMenuPath",e)}const M=[{path:"/",component:I,children:a.concat(L.map(e=>{let t=null;return t="/"===e.path?{...e.children[0],path:`${e.children[0].path}`,hidden:e.hidden,menuId:e.menuId}:{...e,children:e.children?.map(e=>({...e,path:e.path,redirect:e.children?e.children[0].path:e.redirect})),meta:{...e.meta,single:!!e.children&&(e.meta&&e.children[0].meta.title===e.meta.title)},redirect:e.children?e.children[0].path:"noRedirect"},t}))},y].concat(T);m("setRouters",M[0].children.concat(M.slice(1))),m("setIframeRouters",P),m("setHttpRouters",A),d(b&&S||M),u("/homePage/index")&&m("setHasHomePage",!0),i&&u(i)?m("setDefaultTo",i):m("setDefaultTo",E||"/404")}).catch(e=>{console.error(e)})},async restore({commit:e}){m(),e("setRouters",[]),e("setIframeRouters",[])},updateMainMenuIndex({commit:e},t){e("setMainMenuIndex",t)}};return{namespaced:!0,state:{whiteListRouters:["/login","/index","/logout","/appCallback","/haiNengTodoRedirect","/apply"],routers:[],menuPath:{},mainMenuIndex:-1,defaultTo:null,hasHomePage:!1},mutations:{setRouters:(e,t)=>{e.routers=t},setDefaultTo:(e,t)=>{e.defaultTo=t},setIframeRouters:(e,t)=>{e.iframeRouters=t},setHttpRouters:(e,t)=>{e.httpRouters=t},setMenuPath:(e,t)=>{e.menuPath=t},setMainMenuIndex:(e,t)=>{"number"!=typeof t&&(t=e.routers.findIndex(e=>e.path===t)),e.mainMenuIndex=t},setHasHomePage:(e,t)=>{e.hasHomePage=t}},getters:{routers:e=>e.routers,whiteListRouters:e=>e.whiteListRouters,menuPath:e=>e.menuPath,defaultTo:e=>e.defaultTo,iframeRouters:e=>e.iframeRouters,httpRouters:e=>e.httpRouters,hasHomePage:e=>e.hasHomePage},actions:T}}function R({envApi:n,getQueryString:i,hasRootMenuWidth:u,handleLogout:d,login:m,getInfo:c,getIdentityCodes:l,logout:h,updateUserModel:p,TOKEN_NAME:g,routerPush:I,env:R,USER_NAME:b,appId:T}){const y=s(T),f=y&&localStorage.getItem(g)&&sessionStorage.getItem(r)||"";y&&!f&&sessionStorage.removeItem(r);const S={token:localStorage.getItem(g),userInfo:{roles:[]},projectionMode:!1,currentRoles:[],permissions:[],name:"",avatar:"",userRoles:[],loginBack:!1,logout:"0",userId:null,deptId:null,tenant:null,internal:!1,identityCodes:[],currentIdentity:f},w={setToken(e,t){t?localStorage.setItem(g,t):localStorage.removeItem(g),e.token=t||""},removeToken(e){localStorage.removeItem(g),localStorage.removeItem(b),e.token="",sessionStorage.removeItem(r),e.currentIdentity="",e.identityCodes=[]},setUserInfo(e,t){localStorage.setItem(b,t?.userName||""),e.userInfo=t},setProjectionMode(e,t){e.projectionMode=t},SET_AVATAR:(e,t)=>{e.avatar=t},SET_PERMISSIONS:(e,t)=>{e.permissions=t},SET_ROLES:(e,t)=>{e.userRoles=t},SET_NAME:(e,t)=>{e.name=t},SET_LOGINBACK:(e,t)=>{e.loginBack=t},SETLOGOUT:(e,t)=>{e.logout=t},SET_USERID:(e,t)=>{e.userId=t},SET_DEPTID:(e,t)=>{e.deptId=t},SET_TENANT:(e,t)=>{e.tenant=t},SET_INTERNAL:(e,t)=>{e.internal=t},SET_IDENTITY_CODES:(e,t)=>{e.identityCodes=t||[]},setCurrentIdentity:(e,t)=>{t?sessionStorage.setItem(r,t):sessionStorage.removeItem(r),e.currentIdentity=t||""}},L={userInfo:e=>e.userInfo,token:e=>e.token,roles:e=>e.userInfo?.roles,getProjectionMode:e=>e.projectionMode,permissions:e=>e.permissions,showRootMenu:e=>u&&(y?"business"!==e.currentIdentity:e.permissions?.includes("project:root-menu:show")),showHomeDrag:e=>!e.permissions?.includes("project:home:admin"),showPortalStyle:e=>y?"business"===e.currentIdentity:!e.permissions?.includes("project:home:admin"),avatar:e=>e.avatar,name:e=>e.name,userRoles:e=>e.userRoles,loginBack:e=>e.loginBack,logout:e=>e.logout,userId:e=>e.userId,deptId:e=>e.deptId,tenant:e=>e.tenant,internal:e=>e.internal,workModel:e=>e.userInfo?.workModel,identityCodes:e=>y?e.identityCodes:[],currentIdentity:e=>y&&(e.currentIdentity||sessionStorage.getItem(r))||"",needIdentitySelect:e=>y&&e.identityCodes?.length>1&&!e.currentIdentity},E={login({commit:o,dispatch:r},s){let a={code:s.captcha,uuid:s.uuid,username:s.submitUsername,password:s.submitPassword};s.internal?a=Object.assign(a,{corpOtpCode:s.corpOtpCode,grantType:"corp_au_otp"}):a.smsCode=s.code;let i={};return s.srid&&(i={srid:s.srid}),new Promise((u,d)=>{m(a,i,{notErrorTip:!0}).then(a=>{if(200===a.data.code||200===a.status){const{data:e}=a.data;if(o("setToken",e.access_token),s.srid&&e.redirectUrl){let t="";t="development"===R?`${window.location.origin}${n}`:n,t=`${t}/auth${e.redirectUrl}`,window.location.href=t}else s.rememberMe?(t.set("username",s.username,{expires:30}),t.set("password",s.submitPassword,{expires:30}),t.set("rememberMe",s.rememberMe,{expires:30})):(t.remove("username"),t.remove("password"),t.remove("rememberMe")),r("getUserInfo")}else e.error(a.data.msg);u(a)}).catch(e=>{d(e)})})},getUserInfo:({commit:e,getters:t},o=!1)=>new Promise((r,s)=>{(y?l().catch(()=>null):Promise.resolve(null)).then(o=>{const r=Array.isArray(o)?o.map(e=>e&&"string"==typeof e.identityCode?e.identityCode:"").filter(Boolean):[];return e("SET_IDENTITY_CODES",r),r.length>0&&!r.some(e=>e===t.currentIdentity)&&e("setCurrentIdentity",""),t.currentIdentity||1!==r.length||e("setCurrentIdentity",r[0]),c(t.currentIdentity)}).then(s=>{const{user:n}=s,u=""===n.avatar?"":n.avatar;e("SET_LOGINBACK",s.loginBack),e("SETLOGOUT",n.logout),o||(0===n.logout?sessionStorage.setItem("isGroupLogin","true"):1===n.logout||s.loginBack?sessionStorage.setItem("isGroupLogin","false"):sessionStorage.setItem("isGroupLogin","true"),i("redirectName")?I(`/homePage/index?redirectName=${i("redirectName")}`):t.needIdentitySelect||(t.currentIdentity?I(i("redirect")||a(t.currentIdentity)):I(i("redirect")||"/homePage/index"))),s.roles.length>0||n.roles.length>0?e("SET_ROLES",s.roles):e("SET_ROLES",["ROLE_DEFAULT"]),e("SET_PERMISSIONS",s.permissions),e("SET_NAME",n.userName),e("SET_AVATAR",u),e("SET_USERID",n.userId),e("SET_DEPTID",n.deptId),e("SET_INTERNAL",n.internal),e("setUserInfo",{...n,name:"td_dev",roles:n.roles.length>0?n.roles:["ALL_ROUTERS"]}),r(s)}).catch(e=>{s(e)})}),async logout({commit:e}){await h().finally(()=>{d(),localStorage.removeItem("tabRouterList"),e("removeToken"),e("setUserInfo",{roles:[]}),e("SET_IDENTITY_CODES",[]),e("setCurrentIdentity","")})},selectIdentity({commit:e},t){y&&e("setCurrentIdentity",t)},exchangeTenant({commit:e},t){e("setToken",t.token),window.location.reload()},firstAccessApp:({commit:e})=>o.prototype.$request({url:"/auth/isFirstAccessApp",method:"get"}).then(t=>{t.data&&(localStorage.clear(),e("removeToken"))}),updateModel:({dispatch:e},t)=>p(t).then(t=>{t&&200===t.code&&e("getUserInfo","isRefresh")})};return{namespaced:!0,state:S,mutations:w,actions:E,getters:L}}function b(e){const t={setMsgData(e,t){e.msgData=t},setmsgTotal(e,t){e.msgTotal=t}};return{namespaced:!0,state:{msgData:[],msgTotal:0},mutations:t,actions:{getMsgData(t,o){e(o.queryParams,o.loading).then(e=>{e&&200===e.code&&(t.commit("setMsgData",e.rows),t.commit("setmsgTotal",e.total))})}}}}function T(){const e=[{path:"/homePage/index",routeIdx:0,title:"首页",name:"homePageIndex",isHome:!0}],t={tabRouterList:e,isRefreshing:!1,noDestroyPathArray:[]},o=[],r={setNoDestroyPathArray(e,t){e.noDestroyPathArray=t},toggleTabRouterAlive(e,t){e.isRefreshing=!e.isRefreshing,e.tabRouterList[t].isAlive=!e.tabRouterList[t].isAlive},appendTabRouterList(e,t){const r=!o.includes(t.name),s=e.tabRouterList.findIndex(e=>e.path===t.path);-1===s?e.tabRouterList=e.tabRouterList.concat({...t,isAlive:r}):(e.tabRouterList[s].fullPath=t.fullPath,e.tabRouterList[s].query=t.query)},updateTabRouterQuery(e,t){e.tabRouterList=e.tabRouterList.map(e=>e.name===t.name&&t.query?{...e,query:t.query}:e)},subtractCurrentTabRouter(e,t){const{routeIdx:o,path:r}=t;e.tabRouterList=void 0===o?e.tabRouterList.filter(e=>e.path!==r):e.tabRouterList.slice(0,o).concat(e.tabRouterList.slice(o+1)),this.commit("tabRouter/setNoDestroyPathArray",e.tabRouterList.map(e=>e.path))},subtractTabRouterBehind(e,t){const{routeIdx:o}=t;e.tabRouterList=e.tabRouterList.slice(0,o+1),this.commit("tabRouter/setNoDestroyPathArray",e.tabRouterList.map(e=>e.path))},subtractTabRouterAhead(t,o){const{routeIdx:r}=o;t.tabRouterList=e.concat(t.tabRouterList.slice(r)),this.commit("tabRouter/setNoDestroyPathArray",t.tabRouterList.map(e=>e.path))},subtractTabRouterOther(t,o){const{routeIdx:r}=o;e[0].path!==t.tabRouterList?.[r].path?t.tabRouterList=e.concat([t.tabRouterList?.[r]]):t.tabRouterList=e,this.commit("tabRouter/setNoDestroyPathArray",t.tabRouterList.map(e=>e.path))},removeTabRouterList(){t.tabRouterList=[{path:"/homePage/index",routeIdx:0,title:"首页",name:"homePageIndex",isHome:!0}]},initTabRouterList(e,t){e.tabRouterList=t}};return{namespaced:!0,state:t,mutations:r,actions:{},getters:{tabRouterList:e=>e.tabRouterList,isRefreshing:e=>e.isRefreshing,noDestroyPathArray:e=>e.noDestroyPathArray}}}function y({getConfigStyle:e}){const t={...e(),showSettingPanel:!1,draggable:!1,colorList:n,chartColors:i},o={update(e,t){e.showBreadcrumb=t.showBreadcrumb,e.mode=t.mode,e.layout=t.layout,e.isSidebarCompact=t.isSidebarCompact,e.splitMenu=t.splitMenu,e.isFooterAside=t.isFooterAside,e.isSidebarFixed=t.isSidebarFixed,e.isHeaderFixed=t.isHeaderFixed,e.showHeader=t.showHeader,e.showFooter=t.showFooter,e.backgroundTheme=t.backgroundTheme,e.brandTheme=t.brandTheme,e.isUseTabsRouter=t.isUseTabsRouter},toggleSidebarCompact(e){e.isSidebarCompact=!e.isSidebarCompact},toggleUseTabsRouter(e){e.isUseTabsRouter=!e.isUseTabsRouter},showSidebarCompact(e,t){e.isSidebarCompact=t},toggleSettingPanel(e,t){e.showSettingPanel=t},toggleSettingDrag(e,t){e.draggable=t},addColor(e,t){e.colorList={...e.colorList,...t}},changeChartColor(e,t){e.chartColors={...t}}},r={showHeader:e=>e.showHeader,showSidebar:e=>"top"!==e.layout,showSidebarLogo:e=>"side"===e.layout,showHeaderLogo:e=>"side"!==e.layout,showFooter:e=>e.showFooter,isUseTabsRouter:e=>e.isUseTabsRouter,mode:e=>{if("auto"===e.mode){return window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light"}return e.mode}};return{namespaced:!0,state:t,mutations:o,actions:{changeTheme({commit:e,dispatch:t},o){t("changeMode",o),t("changeBrandTheme",o),e("update",o)},changeMode({commit:e},t){let o=t.mode;if("auto"===t.mode){o=window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light"}const r="dark"===o;document.documentElement.setAttribute("theme-mode",r?"dark":""),e("changeChartColor",r?u:i)},changeBrandTheme(e,t){const{brandTheme:o}=t;document.documentElement.setAttribute("theme-color",o)}},getters:r}}function f({permission:e,user:t,notification:o,tabRouter:r,setting:s}){return{user:R(t),setting:y(s),notification:b(o),permission:I(e),tabRouter:T()}}export{f as default};
1
+ import{message as e}from"tdesign-vue";import t from"js-cookie";import o from"vue";import{i as r,C as a,g as s,a as n,L as i,D as d}from"./settingColorHelper-faa708c6.js";import"tvision-color";let u=null;const m=[],c=[];function l({modules:e,ParentView:t,IframeView:o,itemFn:r=null,keepName:a=!1},s,n=""){return s.filter(s=>"1"!==s.groupBy&&("0"!==s.isFrame&&(s.path=("/"===n?"":n)+("/"===s.path[0]?s.path:`/${s.path}`)),a||(s.name=s.path.replace(/\//g,"-").slice(1)),s.component&&((s.meta||{}).component=s.meta?.component||s.component,"Layout"===s.component||"ParentView"===s.component?(s.component=t,s.path.includes("http")&&c.push(s)):(s.hidden||u||(u=s.path),"IframeView"===s.component?(s.component=o,m.push(s)):"string"==typeof s.component&&(s.componentName=s.component,s.component=e[`../../pages/${s.component}.vue`])),s.meta={...s.meta,isFrame:s.isFrame,openNewWindow:s.openNewWindow,query:s.query}),null!=s.children&&s.children&&s.children.length?(s.children=l({modules:e,ParentView:t,IframeView:o,itemFn:r,keepName:a},s.children,s.path),0===s.children.filter(e=>!e.hidden).length&&(s.redirect=s.children[0].path,s.children[0].meta.title=s.meta.title,s.single=!0,u||(u=s.redirect))):(delete s.children,delete s.redirect),r?.(s),!0))}function h(){return u}function p(){return m}function g(){return c}function I({modules:e,ParentView:t,IframeView:o,flattenDeep:r,getUserMenu:a,envAppId:s,getAsyncRouterList:n,envDefaultTo:i,defaultIsValidMenu:d,addRoutes:u,resetRouter:m,getTopRoutes:c,getLayout:I,handleRouter:R,newAlive:y=!0}){const b={async initRoutes({commit:m,rootGetters:b}){const T=s,f=b["user/currentIdentity"],S=[T?`appId=${T}`:"",f?`currentIdentity=${f}`:""].filter(Boolean).join("&");await a("/system/menu/getRouters"+(S?`?${S}`:"")).then(async a=>{const s=c(),b=n(),T={path:"*",redirect:"/404",hidden:!0},f={path:"/",component:I,children:[]},S=[f,T],w=function(e){e.children?.length>0&&(e.redirect=f.children.find(t=>t.path.includes(e.path))?.path||"noRedirect"),"0"===e.meta.isFrame?S.push({...e,children:void 0}):f.children.push({...e,children:void 0})};l({modules:e,ParentView:t,IframeView:o,itemFn:w,keepName:!0},[...s,...b]);const L=R?await R(a,l,w):l({modules:e,ParentView:t,IframeView:o,itemFn:w},a.data),P=h(),E=p(),A=g();if(L&&L.length>0){const e={};r(L,"children","componentName","name",e),m("setMenuPath",e)}const v=[{path:"/",component:I,children:s.concat(L.map(e=>{let t=null;return t="/"===e.path?{...e.children[0],path:`${e.children[0].path}`,hidden:e.hidden,menuId:e.menuId}:{...e,children:e.children?.map(e=>({...e,path:e.path,redirect:e.children?e.children[0].path:e.redirect})),meta:{...e.meta,single:!!e.children&&(e.meta&&e.children[0].meta.title===e.meta.title)},redirect:e.children?e.children[0].path:"noRedirect"},t}))},T].concat(b);m("setRouters",v[0].children.concat(v.slice(1))),m("setIframeRouters",E),m("setHttpRouters",A),u(y&&S||v),d("/homePage/index")&&m("setHasHomePage",!0),i&&d(i)?m("setDefaultTo",i):m("setDefaultTo",P||"/404")}).catch(e=>{console.error(e)})},async restore({commit:e}){m(),e("setRouters",[]),e("setIframeRouters",[])},updateMainMenuIndex({commit:e},t){e("setMainMenuIndex",t)}};return{namespaced:!0,state:{whiteListRouters:["/login","/index","/logout","/appCallback","/haiNengTodoRedirect","/apply"],routers:[],menuPath:{},mainMenuIndex:-1,defaultTo:null,hasHomePage:!1},mutations:{setRouters:(e,t)=>{e.routers=t},setDefaultTo:(e,t)=>{e.defaultTo=t},setIframeRouters:(e,t)=>{e.iframeRouters=t},setHttpRouters:(e,t)=>{e.httpRouters=t},setMenuPath:(e,t)=>{e.menuPath=t},setMainMenuIndex:(e,t)=>{"number"!=typeof t&&(t=e.routers.findIndex(e=>e.path===t)),e.mainMenuIndex=t},setHasHomePage:(e,t)=>{e.hasHomePage=t}},getters:{routers:e=>e.routers,whiteListRouters:e=>e.whiteListRouters,menuPath:e=>e.menuPath,defaultTo:e=>e.defaultTo,iframeRouters:e=>e.iframeRouters,httpRouters:e=>e.httpRouters,hasHomePage:e=>e.hasHomePage},actions:b}}function R({envApi:n,getQueryString:i,hasRootMenuWidth:d,handleLogout:u,login:m,getInfo:c,getIdentityCodes:l,logout:h,updateUserModel:p,TOKEN_NAME:g,routerPush:I,env:R,USER_NAME:y,appId:b}){const T=r(b),f=T&&localStorage.getItem(g)&&(sessionStorage.getItem(a)||localStorage.getItem(a))||"";T&&!f&&(sessionStorage.removeItem(a),localStorage.removeItem(a));const S={token:window.__POWERED_BY_WUJIE__?window.$wujie?.props?.token:localStorage.getItem(g),userInfo:{roles:[]},projectionMode:!1,currentRoles:[],permissions:[],name:"",avatar:"",userRoles:[],loginBack:!1,logout:"0",userId:null,deptId:null,tenant:null,internal:!1,identityCodes:[],currentIdentity:f},w={setToken(e,t){t?localStorage.setItem(g,t):localStorage.removeItem(g),e.token=t||""},removeToken(e){localStorage.removeItem(g),localStorage.removeItem(y),e.token="",sessionStorage.removeItem(a),localStorage.removeItem(a),e.currentIdentity="",e.identityCodes=[]},setUserInfo(e,t){localStorage.setItem(y,t?.userName||""),e.userInfo=t},setProjectionMode(e,t){e.projectionMode=t},SET_AVATAR:(e,t)=>{e.avatar=t},SET_PERMISSIONS:(e,t)=>{e.permissions=t},SET_ROLES:(e,t)=>{e.userRoles=t},SET_NAME:(e,t)=>{e.name=t},SET_LOGINBACK:(e,t)=>{e.loginBack=t},SETLOGOUT:(e,t)=>{e.logout=t},SET_USERID:(e,t)=>{e.userId=t},SET_DEPTID:(e,t)=>{e.deptId=t},SET_TENANT:(e,t)=>{e.tenant=t},SET_INTERNAL:(e,t)=>{e.internal=t},SET_IDENTITY_CODES:(e,t)=>{e.identityCodes=t||[]},setCurrentIdentity:(e,t)=>{t?(sessionStorage.setItem(a,t),localStorage.setItem(a,t)):(sessionStorage.removeItem(a),localStorage.removeItem(a)),e.currentIdentity=t||""}},L={userInfo:e=>e.userInfo,token:e=>e.token,roles:e=>e.userInfo?.roles,getProjectionMode:e=>e.projectionMode,permissions:e=>e.permissions,showRootMenu:e=>d&&(T?"business"!==e.currentIdentity:e.permissions?.includes("project:root-menu:show")),showHomeDrag:e=>T?"business"===e.currentIdentity:!e.permissions?.includes("project:home:admin"),showPortalStyle:e=>T?"business"===e.currentIdentity:!e.permissions?.includes("project:home:admin"),avatar:e=>e.avatar,name:e=>e.name,userRoles:e=>e.userRoles,loginBack:e=>e.loginBack,logout:e=>e.logout,userId:e=>e.userId,deptId:e=>e.deptId,tenant:e=>e.tenant,internal:e=>e.internal,workModel:e=>e.userInfo?.workModel,identityCodes:e=>T?e.identityCodes:[],currentIdentity:e=>T&&(e.currentIdentity||sessionStorage.getItem(a)||localStorage.getItem(a))||"",needIdentitySelect:e=>T&&e.identityCodes?.length>1&&!e.currentIdentity},P={login({commit:o,dispatch:r},a){let s={code:a.captcha,uuid:a.uuid,username:a.submitUsername,password:a.submitPassword};a.internal?s=Object.assign(s,{corpOtpCode:a.corpOtpCode,grantType:"corp_au_otp"}):s.smsCode=a.code;let i={};return a.srid&&(i={srid:a.srid}),new Promise((d,u)=>{m(s,i,{notErrorTip:!0}).then(s=>{if(200===s.data.code||200===s.status){const{data:e}=s.data;if(o("setToken",e.access_token),a.srid&&e.redirectUrl){let t="";t="development"===R?`${window.location.origin}${n}`:n,t=`${t}/auth${e.redirectUrl}`,window.location.href=t}else a.rememberMe?(t.set("username",a.username,{expires:30}),t.set("password",a.submitPassword,{expires:30}),t.set("rememberMe",a.rememberMe,{expires:30})):(t.remove("username"),t.remove("password"),t.remove("rememberMe")),r("getUserInfo")}else e.error(s.data.msg);d(s)}).catch(e=>{u(e)})})},getUserInfo:({commit:e,getters:t},o=!1)=>new Promise((r,a)=>{(T?l().catch(()=>null):Promise.resolve(null)).then(o=>{const r=Array.isArray(o)?o.map(e=>e&&"string"==typeof e.identityCode?e.identityCode:"").filter(Boolean):[];return e("SET_IDENTITY_CODES",r),r.length>0&&!r.some(e=>e===t.currentIdentity)&&e("setCurrentIdentity",""),t.currentIdentity||1!==r.length||e("setCurrentIdentity",r[0]),c(t.currentIdentity)}).then(a=>{const{user:n}=a,d=""===n.avatar?"":n.avatar;e("SET_LOGINBACK",a.loginBack),e("SETLOGOUT",n.logout),o||(0===n.logout?sessionStorage.setItem("isGroupLogin","true"):1===n.logout||a.loginBack?sessionStorage.setItem("isGroupLogin","false"):sessionStorage.setItem("isGroupLogin","true"),i("redirectName")?I(`/homePage/index?redirectName=${i("redirectName")}`):t.needIdentitySelect||(t.currentIdentity?I(i("redirect")||s(t.currentIdentity)):I(i("redirect")||"/homePage/index"))),a.roles.length>0||n.roles.length>0?e("SET_ROLES",a.roles):e("SET_ROLES",["ROLE_DEFAULT"]),e("SET_PERMISSIONS",a.permissions),e("SET_NAME",n.userName),e("SET_AVATAR",d),e("SET_USERID",n.userId),e("SET_DEPTID",n.deptId),e("SET_INTERNAL",n.internal),e("setUserInfo",{...n,name:"td_dev",roles:n.roles.length>0?n.roles:["ALL_ROUTERS"]}),r(a)}).catch(e=>{a(e)})}),async logout({commit:e}){await h().finally(()=>{u(),localStorage.removeItem("tabRouterList"),e("removeToken"),e("setUserInfo",{roles:[]}),e("SET_IDENTITY_CODES",[]),e("setCurrentIdentity","")})},selectIdentity({commit:e},t){T&&e("setCurrentIdentity",t)},exchangeTenant({commit:e},t){e("setToken",t.token),window.location.reload()},firstAccessApp:({commit:e})=>o.prototype.$request({url:"/auth/isFirstAccessApp",method:"get"}).then(t=>{t.data&&(localStorage.clear(),e("removeToken"))}),updateModel:({dispatch:e},t)=>p(t).then(t=>{t&&200===t.code&&e("getUserInfo","isRefresh")})};return{namespaced:!0,state:S,mutations:w,actions:P,getters:L}}function y(e){const t={setMsgData(e,t){e.msgData=t},setmsgTotal(e,t){e.msgTotal=t}};return{namespaced:!0,state:{msgData:[],msgTotal:0},mutations:t,actions:{getMsgData(t,o){e(o.queryParams,o.loading).then(e=>{e&&200===e.code&&(t.commit("setMsgData",e.rows),t.commit("setmsgTotal",e.total))})}}}}function b(){const e=[{path:"/homePage/index",routeIdx:0,title:"首页",name:"homePageIndex",isHome:!0}],t={tabRouterList:e,isRefreshing:!1,noDestroyPathArray:[]},o=[],r={setNoDestroyPathArray(e,t){e.noDestroyPathArray=t},toggleTabRouterAlive(e,t){e.isRefreshing=!e.isRefreshing;const o=e.tabRouterList[t];o.isAlive=!o.isAlive;const r=o.path,a=e.noDestroyPathArray.indexOf(r);e.isRefreshing?-1!==a&&e.noDestroyPathArray.splice(a,1):o.isAlive&&-1===a&&e.noDestroyPathArray.push(r)},appendTabRouterList(e,t){const r=t.isAlive&&!o.includes(t.name),a=e.tabRouterList.findIndex(e=>e.path===t.path);-1===a?e.tabRouterList=e.tabRouterList.concat({...t,isAlive:r}):(e.tabRouterList[a].fullPath=t.fullPath,e.tabRouterList[a].query=t.query),r&&!e.noDestroyPathArray.includes(t.path)&&e.noDestroyPathArray.push(t.path)},updateTabRouterQuery(e,t){e.tabRouterList=e.tabRouterList.map(e=>e.name===t.name&&t.query?{...e,query:t.query}:e)},subtractCurrentTabRouter(e,t){const{routeIdx:o,path:r}=t;e.tabRouterList=void 0===o?e.tabRouterList.filter(e=>e.path!==r):e.tabRouterList.slice(0,o).concat(e.tabRouterList.slice(o+1)),this.commit("tabRouter/setNoDestroyPathArray",e.tabRouterList.map(e=>e.path))},subtractTabRouterBehind(e,t){const{routeIdx:o}=t;e.tabRouterList=e.tabRouterList.slice(0,o+1),this.commit("tabRouter/setNoDestroyPathArray",e.tabRouterList.map(e=>e.path))},subtractTabRouterAhead(t,o){const{routeIdx:r}=o;t.tabRouterList=e.concat(t.tabRouterList.slice(r)),this.commit("tabRouter/setNoDestroyPathArray",t.tabRouterList.map(e=>e.path))},subtractTabRouterOther(t,o){const{routeIdx:r}=o;e[0].path!==t.tabRouterList?.[r].path?t.tabRouterList=e.concat([t.tabRouterList?.[r]]):t.tabRouterList=e,this.commit("tabRouter/setNoDestroyPathArray",t.tabRouterList.map(e=>e.path))},removeTabRouterList(){t.tabRouterList=[{path:"/homePage/index",routeIdx:0,title:"首页",name:"homePageIndex",isHome:!0}]},initTabRouterList(e,t){e.tabRouterList=t}};return{namespaced:!0,state:t,mutations:r,actions:{},getters:{tabRouterList:e=>e.tabRouterList,isRefreshing:e=>e.isRefreshing,noDestroyPathArray:e=>e.noDestroyPathArray}}}function T({getConfigStyle:e}){const t={...e(),showSettingPanel:!1,draggable:!1,colorList:n,chartColors:i},o={update(e,t){e.showBreadcrumb=t.showBreadcrumb,e.mode=t.mode,e.layout=t.layout,e.isSidebarCompact=t.isSidebarCompact,e.splitMenu=t.splitMenu,e.isFooterAside=t.isFooterAside,e.isSidebarFixed=t.isSidebarFixed,e.isHeaderFixed=t.isHeaderFixed,e.showHeader=t.showHeader,e.showFooter=t.showFooter,e.backgroundTheme=t.backgroundTheme,e.brandTheme=t.brandTheme,e.isUseTabsRouter=t.isUseTabsRouter},updateMode(e,t){e.mode=t},updateColor(e,t){e.brandTheme=t},toggleSidebarCompact(e){e.isSidebarCompact=!e.isSidebarCompact},toggleUseTabsRouter(e){e.isUseTabsRouter=!e.isUseTabsRouter},showSidebarCompact(e,t){e.isSidebarCompact=t},toggleSettingPanel(e,t){e.showSettingPanel=t},toggleSettingDrag(e,t){e.draggable=t},addColor(e,t){e.colorList={...e.colorList,...t}},changeChartColor(e,t){e.chartColors={...t}}},r={showHeader:e=>e.showHeader,showSidebar:e=>"top"!==e.layout,showSidebarLogo:e=>"side"===e.layout,showHeaderLogo:e=>"side"!==e.layout,showFooter:e=>e.showFooter,isUseTabsRouter:e=>e.isUseTabsRouter,mode:e=>{if("auto"===e.mode){return window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light"}return e.mode},brandTheme:e=>e.brandTheme};return{namespaced:!0,state:t,mutations:o,actions:{changeTheme({commit:e,dispatch:t},o){t("changeMode",o),t("changeBrandTheme",o),e("update",o)},changeColor({commit:e,dispatch:t},o){t("changeBrandTheme",{brandTheme:o.color}),e("updateColor",o.color)},changeMode({commit:e},t){let o=t.mode;if("auto"===t.mode){o=window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light"}e("updateMode",o);const r="dark"===o;document.documentElement.setAttribute("theme-mode",r?"dark":""),e("changeChartColor",r?d:i)},changeBrandTheme(e,t){const{brandTheme:o}=t;document.documentElement.setAttribute("theme-color",o)}},getters:r}}function f({permission:e,user:t,notification:o,tabRouter:r,setting:a}){return{user:R(t),setting:T(a),notification:y(o),permission:I(e),tabRouter:b()}}export{f as default};
package/lib/store.js.gz CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "upp-platform-core",
3
- "version": "1.1.30-devtest.0",
3
+ "version": "1.1.30-devtest.2",
4
4
  "main": "lib/index.js",
5
5
  "module": "lib/index.js",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- import{Color as d}from"tvision-color";const o={business:{name:"协同门户",landing:"/homePage/index",desc:"面向业务用户的协同办公门户"},admin:{name:"管理员门户",landing:"/homePage/index",desc:"面向系统管理员的管理门户"},dev:{name:"开发者联盟门户",landing:"/homePage/index",desc:"面向开发者的开发者联盟门户"}};function r(d){return null!=d&&""!==d?"$system$"===d:!(window.__POWERED_BY_WUJIE__||window.$wujie)}const n="currentIdentity";function a(d){return o[d]?.landing||"/homePage/index"}const c={DEFAULT:{"--td-brand-color":"#0052D9","--td-brand-color-1":"#e0ebff","--td-brand-color-2":"#c0d8ff","--td-brand-color-3":"#a1c4ff","--td-brand-color-4":"#81b1ff","--td-brand-color-5":"#5f9bff","--td-brand-color-6":"#3d87ff","--td-brand-color-7":"#176eff","--td-brand-color-8":"#0052D9","--td-brand-color-9":"#0048cd","--td-brand-color-10":"#0035b5"},CYAN:{"--td-brand-color":"#0594FA","--td-brand-color-1":"#d7eefe","--td-brand-color-2":"#aeddfd","--td-brand-color-3":"#84cafd","--td-brand-color-4":"#58b8fc","--td-brand-color-5":"#29a4fb","--td-brand-color-6":"#0594FA","--td-brand-color-7":"#29a4fb","--td-brand-color-8":"#0594FA","--td-brand-color-9":"#0378df","--td-brand-color-10":"#01409b"},GREEN:{"--td-brand-color":"#00A870","--td-brand-color-1":"#8dffd9","--td-brand-color-2":"#00f2a2","--td-brand-color-3":"#00dc92","--td-brand-color-4":"#00c583","--td-brand-color-5":"#00A870","--td-brand-color-6":"#009a5d","--td-brand-color-7":"#00c583","--td-brand-color-8":"#00A870","--td-brand-color-9":"#009a5d","--td-brand-color-10":"#004a14"},ORANGE:{"--td-brand-color":"#ED7B2F","--td-brand-color-1":"#fce5d7","--td-brand-color-2":"#f8cdaf","--td-brand-color-3":"#f4b285","--td-brand-color-4":"#f19659","--td-brand-color-5":"#ED7B2F","--td-brand-color-6":"#e75510","--td-brand-color-7":"#f19659","--td-brand-color-8":"#ED7B2F","--td-brand-color-9":"#e75510","--td-brand-color-10":"#7f0a02"},RED:{"--td-brand-color":"#E34D59","--td-brand-color-1":"#fbe5e7","--td-brand-color-2":"#f7ccd0","--td-brand-color-3":"#f3b2b8","--td-brand-color-4":"#ef989f","--td-brand-color-5":"#ea7b84","--td-brand-color-6":"#E34D59","--td-brand-color-7":"#ea7b84","--td-brand-color-8":"#E34D59","--td-brand-color-9":"#e42c3a","--td-brand-color-10":"#8d0309"},PINK:{"--td-brand-color":"#ED49B4","--td-brand-color-1":"#fce5f4","--td-brand-color-2":"#facae9","--td-brand-color-3":"#f7aede","--td-brand-color-4":"#f491d2","--td-brand-color-5":"#f172c5","--td-brand-color-6":"#ED49B4","--td-brand-color-7":"#f172c5","--td-brand-color-8":"#ED49B4","--td-brand-color-9":"#e80f9d","--td-brand-color-10":"#8f025e"},PURPLE:{"--td-brand-color":"#834EC2","--td-brand-color-1":"#eee6f7","--td-brand-color-2":"#ddceee","--td-brand-color-3":"#ccb6e6","--td-brand-color-4":"#bb9edc","--td-brand-color-5":"#ab87d5","--td-brand-color-6":"#9a6fce","--td-brand-color-7":"#9a6fce","--td-brand-color-8":"#834EC2","--td-brand-color-9":"#783ac3","--td-brand-color-10":"#4c1397"},YELLOW:{"--td-brand-color":"#EBB105","--td-brand-color-1":"#fde9ab","--td-brand-color-2":"#fbd152","--td-brand-color-3":"#EBB105","--td-brand-color-4":"#dda204","--td-brand-color-5":"#ca8d03","--td-brand-color-6":"#b67803","--td-brand-color-7":"#fbd152","--td-brand-color-8":"#EBB105","--td-brand-color-9":"#dda204","--td-brand-color-10":"#603100"}},t={textColor:"rgba(0, 0, 0, 0.9)",placeholderColor:"rgba(0, 0, 0, 0.35)",borderColor:"#dcdcdc",containerColor:"#fff"},b={textColor:"rgba(255, 255, 255, 0.9)",placeholderColor:"rgba(255, 255, 255, 0.35)",borderColor:"#5e5e5e",containerColor:"#242424"};function l(d,o){return o[(/^#[A-F\d]{6}$/i.test(d)?d:function(d){return d.replace(/([A-Z])/g,"_$1").toUpperCase()}(d))||"DEFAULT"]}function e(o,r,n){const a="dark"===n;let c=r.indexOf(o);a&&(r.reverse().map(o=>{const[r,n,a]=d.colorTransform(o,"hex","hsl");return d.colorTransform([r,Number(n)-4,a],"hsl","hex")}),c=5,r[0]=`${r[c]}20`);return{"--td-brand-color":r[c],"--td-brand-color-1":r[0],"--td-brand-color-2":r[1],"--td-brand-color-3":r[2],"--td-brand-color-4":r[3],"--td-brand-color-5":r[4],"--td-brand-color-6":r[5],"--td-brand-color-7":c>0?r[c-1]:o,"--td-brand-color-8":r[c],"--td-brand-color-9":c>8?o:r[c+1],"--td-brand-color-10":r[9]}}function f(d,o,r){const n="dark"===r?`:root[theme-color='${d}'][theme-mode='dark']`:`:root[theme-color='${d}']`,a=document.createElement("style");a.type="text/css",a.innerText=`${n}{\n --td-brand-color: ${o["--td-brand-color"]};\n --td-brand-color-1: ${o["--td-brand-color-1"]};\n --td-brand-color-2: ${o["--td-brand-color-2"]};\n --td-brand-color-3: ${o["--td-brand-color-3"]};\n --td-brand-color-4: ${o["--td-brand-color-4"]};\n --td-brand-color-5: ${o["--td-brand-color-5"]};\n --td-brand-color-6: ${o["--td-brand-color-6"]};\n --td-brand-color-7: ${o["--td-brand-color-7"]};\n --td-brand-color-8: ${o["--td-brand-color-8"]};\n --td-brand-color-9: ${o["--td-brand-color-9"]};\n --td-brand-color-10: ${o["--td-brand-color-10"]};\n }`,document.head.appendChild(a)}export{n as C,b as D,o as I,t as L,c as a,l as b,e as c,f as d,a as g,r as i};