gw-gis-standard-global-vue3 1.1.83 → 1.1.85

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.
@@ -1626,7 +1626,13 @@ var constType = {
1626
1626
  // 横排菜单
1627
1627
  HORIZONTAL: 1,
1628
1628
  // 竖排菜单
1629
- VERTICAL: 2
1629
+ VERTICAL: 2,
1630
+ // 横排
1631
+ NAVBAR: 'navbar',
1632
+ // 二级导航栏
1633
+ SUB_NAVBAR: 'subNavbar',
1634
+ // 侧边栏
1635
+ SIDEBAR: 'sidebar'
1630
1636
  },
1631
1637
  // 非layout路由名称
1632
1638
  NO_IN_LAYOUT_MSG: {
@@ -2780,16 +2786,16 @@ var GisPermission = /*#__PURE__*/function () {
2780
2786
  // const {getRouteTagsListFn, isHideNeedCache, removeIncludeListFn, routeTagsList} = gisRouteTags()
2781
2787
  // window.gisRouteTags = gisRouteTags()
2782
2788
  this.router.beforeEach(function (to, from, next) {
2789
+ var _window$top;
2783
2790
  // 当前路由和跳转一样时则不跳转
2784
2791
  // if (this.router?.currentRoute && to.path === this.router?.currentRoute?.value?.path) {
2785
2792
  // return
2786
2793
  // }
2787
- // console.log('【to-router-from】', from)
2788
2794
  // 仅供测试
2789
- // if (window.top?._showRouteTo) {
2790
- console.log('【router-from】', from);
2791
- console.log('【router-to】', to);
2792
- // }
2795
+ if ((_window$top = window.top) !== null && _window$top !== void 0 && _window$top._showRouteTo) {
2796
+ console.log('【router-from】', from);
2797
+ console.log('【router-to】', to);
2798
+ }
2793
2799
  // 缓存当前临时路由 - 会初次加载路由接口无需缓存
2794
2800
  // cacheCurrentTempRouteFn(to)
2795
2801
  // 这是判断路由变化后是否需要缓存
@@ -2897,34 +2903,39 @@ var GisPermission = /*#__PURE__*/function () {
2897
2903
  var lastRouteMsg = to.matched.at(-1);
2898
2904
  // 进入主页,主页如果已被隐藏则进去第一个显示的页面
2899
2905
  if ((_to$meta = to.meta) !== null && _to$meta !== void 0 && _to$meta.isHomePage && (to === null || to === void 0 || (_to$redirectedFrom = to.redirectedFrom) === null || _to$redirectedFrom === void 0 ? void 0 : _to$redirectedFrom.path) === '/') {
2900
- var hasShowHomePage = undefined;
2901
- var childList = to.matched[0].children;
2902
- for (var i = 0; i < childList.length; i++) {
2903
- if (!childList[i].meta.hasOwnProperty('visible') || childList[i].meta.visible) {
2904
- var _childList$i;
2905
- if (((_childList$i = childList[i]) === null || _childList$i === void 0 || (_childList$i = _childList$i.children) === null || _childList$i === void 0 ? void 0 : _childList$i.length) > 0) {
2906
- hasShowHomePage = recursionRouteFn(childList[i].children);
2907
- if (hasShowHomePage) {
2908
- break;
2909
- }
2910
- } else {
2911
- hasShowHomePage = childList[i];
2912
- if (hasShowHomePage) {
2913
- break;
2906
+ if (to.meta.hasOwnProperty('visible') && !to.meta.visible) {
2907
+ var hasShowHomePage = undefined;
2908
+ var childList = to.matched[0].children;
2909
+ for (var i = 0; i < childList.length; i++) {
2910
+ if (!childList[i].meta.hasOwnProperty('visible') || childList[i].meta.visible) {
2911
+ var _childList$i;
2912
+ if (((_childList$i = childList[i]) === null || _childList$i === void 0 || (_childList$i = _childList$i.children) === null || _childList$i === void 0 ? void 0 : _childList$i.length) > 0) {
2913
+ hasShowHomePage = recursionRouteFn(childList[i].children);
2914
+ if (hasShowHomePage) {
2915
+ break;
2916
+ }
2917
+ } else {
2918
+ hasShowHomePage = childList[i];
2919
+ if (hasShowHomePage) {
2920
+ break;
2921
+ }
2914
2922
  }
2915
2923
  }
2916
2924
  }
2917
- }
2918
- if (hasShowHomePage) {
2919
- var _hasShowHomePage;
2920
- getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
2921
- next({
2922
- path: hasShowHomePage.path,
2923
- query: (_hasShowHomePage = hasShowHomePage) === null || _hasShowHomePage === void 0 || (_hasShowHomePage = _hasShowHomePage.meta) === null || _hasShowHomePage === void 0 ? void 0 : _hasShowHomePage.query
2924
- });
2925
+ if (hasShowHomePage) {
2926
+ var _hasShowHomePage;
2927
+ getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
2928
+ next({
2929
+ path: hasShowHomePage.path,
2930
+ query: (_hasShowHomePage = hasShowHomePage) === null || _hasShowHomePage === void 0 || (_hasShowHomePage = _hasShowHomePage.meta) === null || _hasShowHomePage === void 0 ? void 0 : _hasShowHomePage.query
2931
+ });
2932
+ } else {
2933
+ getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
2934
+ next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
2935
+ }
2925
2936
  } else {
2926
2937
  getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
2927
- next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
2938
+ // next(to.fullPath)
2928
2939
  }
2929
2940
  } else if ((_to$meta2 = to.meta) !== null && _to$meta2 !== void 0 && _to$meta2.gisInfoSetHideRole && to.meta.hasOwnProperty('visible') && !to.meta.visible) {
2930
2941
  getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
@@ -2939,11 +2950,11 @@ var GisPermission = /*#__PURE__*/function () {
2939
2950
  // 判断在子应用中是否有父级token,非动态菜单才有作用,动态菜单则失效
2940
2951
  // console.log('路由-child')
2941
2952
  if (window.self !== window.top) {
2942
- var _window$top, _window$top2;
2943
- if ((_window$top = window.top) !== null && _window$top !== void 0 && _window$top.__MICRO_APP_BASE_APPLICATION__ && ((_window$top2 = window.top) === null || _window$top2 === void 0 || (_window$top2 = _window$top2.gisConfig) === null || _window$top2 === void 0 ? void 0 : _window$top2.VITE_APP_IS_MAIN_MICRO_APP) === 'true') {
2944
- var _window$top3;
2953
+ var _window$top2, _window$top3;
2954
+ if ((_window$top2 = window.top) !== null && _window$top2 !== void 0 && _window$top2.__MICRO_APP_BASE_APPLICATION__ && ((_window$top3 = window.top) === null || _window$top3 === void 0 || (_window$top3 = _window$top3.gisConfig) === null || _window$top3 === void 0 ? void 0 : _window$top3.VITE_APP_IS_MAIN_MICRO_APP) === 'true') {
2955
+ var _window$top4;
2945
2956
  // 主应用是否有token
2946
- if ((_window$top3 = window.top) !== null && _window$top3 !== void 0 && (_window$top3 = _window$top3.gisConfig) !== null && _window$top3 !== void 0 && _window$top3.VITE_APP_SET_GIS_TOKEN) {
2957
+ if ((_window$top4 = window.top) !== null && _window$top4 !== void 0 && (_window$top4 = _window$top4.gisConfig) !== null && _window$top4 !== void 0 && _window$top4.VITE_APP_SET_GIS_TOKEN) {
2947
2958
  var hasTopToken = getCache(constType.COOKIE).get(window.top.gisConfig.VITE_APP_SET_GIS_TOKEN);
2948
2959
  if (hasTopToken) {
2949
2960
  getCache(constType.COOKIE).set(window.gisConfig.VITE_APP_SET_GIS_TOKEN, hasTopToken);
@@ -3120,9 +3131,9 @@ function visibleIsCacheFn(to) {
3120
3131
 
3121
3132
  // 进度条控制
3122
3133
  var nProgressFn = function nProgressFn(NProgressConfigure) {
3123
- var _window$top4;
3134
+ var _window$top5;
3124
3135
  // 嵌入的子应用不需要进度条
3125
- if (!((_window$top4 = window.top) !== null && _window$top4 !== void 0 && _window$top4.__MICRO_APP_BASE_APPLICATION__) || window.gisConfig.VITE_APP_IS_MAIN_MICRO_APP === 'true') {
3136
+ if (!((_window$top5 = window.top) !== null && _window$top5 !== void 0 && _window$top5.__MICRO_APP_BASE_APPLICATION__) || window.gisConfig.VITE_APP_IS_MAIN_MICRO_APP === 'true') {
3126
3137
  // 这是进度条的一些配置项
3127
3138
  NProgress.configure(NProgressConfigure);
3128
3139
  NProgress.start();
@@ -3323,7 +3334,7 @@ var IGlobal = /*#__PURE__*/function () {
3323
3334
  homePageMsg = Global.deepClone(getHomePageFn(list));
3324
3335
  delete homePageMsg.children;
3325
3336
  // 用户角色重定向
3326
- var roleHomeMsg = getCache$1(constType$1.SESSION_STORAGE).get(constType$1.ROLE_HOME_MSG);
3337
+ var roleHomeMsg = getCache$1(constType.SESSION_STORAGE).get(constType.ROLE_HOME_MSG);
3327
3338
  if (roleHomeMsg) {
3328
3339
  this.mainRouter[0].redirect = function (to) {
3329
3340
  return {
@@ -3372,7 +3383,7 @@ var IGlobal = /*#__PURE__*/function () {
3372
3383
  value: function emptyHomeRedirectFn() {
3373
3384
  var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
3374
3385
  if (type && window['gisConfig'] && window['gisConfig'].VITE_APP_PERMISSION === 'true') {
3375
- var roleHomeMsg = getCache$1(constType$1.SESSION_STORAGE).get(constType$1.ROLE_HOME_MSG);
3386
+ var roleHomeMsg = getCache$1(constType.SESSION_STORAGE).get(constType.ROLE_HOME_MSG);
3376
3387
  if (!roleHomeMsg) {
3377
3388
  this.mainRouter[0].redirect = '';
3378
3389
  }
@@ -3610,7 +3621,7 @@ function _getLastRouterMsgFn() {
3610
3621
  getSearchTreeArr(routerList, 'name', list.name);
3611
3622
  }
3612
3623
  if (getLastRouter) {
3613
- cacheMsg = getCache$1(constType$1.LOCAL_STORAGE).get(constType$1.GIS_CONFIG); // 非微应用 才可以获取缓存和显示组件信息
3624
+ cacheMsg = getCache$1(constType.LOCAL_STORAGE).get(constType.GIS_CONFIG); // 非微应用 才可以获取缓存和显示组件信息
3614
3625
  if (!((_window$gisConfig = window.gisConfig) !== null && _window$gisConfig !== void 0 && _window$gisConfig.VITE_APP_IS_MAIN_MICRO_APP) || ((_window$gisConfig2 = window.gisConfig) === null || _window$gisConfig2 === void 0 ? void 0 : _window$gisConfig2.VITE_APP_IS_MAIN_MICRO_APP) === 'false') {
3615
3626
  if (cacheMsg) {
3616
3627
  if ((_cacheMsg$headerConfi = cacheMsg.headerConfig) !== null && _cacheMsg$headerConfi !== void 0 && _cacheMsg$headerConfi.isShowTags) {
@@ -3692,13 +3703,14 @@ function getHomePageFn(list) {
3692
3703
 
3693
3704
  // 获取头部菜单数据
3694
3705
  function getTopMenuListFn(list) {
3706
+ var _constType$MENU_TYPE_, _constType$MENU_TYPE_2, _constType$MENU_TYPE_3;
3695
3707
  if (!list || !Array.isArray(list)) {
3696
- return;
3708
+ return [];
3697
3709
  }
3710
+ var typeList = [constType === null || constType === void 0 || (_constType$MENU_TYPE_ = constType.MENU_TYPE_MSG) === null || _constType$MENU_TYPE_ === void 0 ? void 0 : _constType$MENU_TYPE_.HORIZONTAL, constType === null || constType === void 0 || (_constType$MENU_TYPE_2 = constType.MENU_TYPE_MSG) === null || _constType$MENU_TYPE_2 === void 0 ? void 0 : _constType$MENU_TYPE_2.NAVBAR, constType === null || constType === void 0 || (_constType$MENU_TYPE_3 = constType.MENU_TYPE_MSG) === null || _constType$MENU_TYPE_3 === void 0 ? void 0 : _constType$MENU_TYPE_3.SUB_NAVBAR, 1];
3698
3711
  for (var i = 0; i < list.length; i++) {
3699
3712
  if (list[i].meta) {
3700
- var _constType$MENU_TYPE_;
3701
- if (list[i].meta.type !== ((constType$1 === null || constType$1 === void 0 || (_constType$MENU_TYPE_ = constType$1.MENU_TYPE_MSG) === null || _constType$MENU_TYPE_ === void 0 ? void 0 : _constType$MENU_TYPE_.HORIZONTAL) || 1)) {
3713
+ if (!typeList.includes(list[i].meta.type)) {
3702
3714
  list.splice(i, 1);
3703
3715
  i--;
3704
3716
  }
@@ -3743,7 +3755,7 @@ function setSameMsgFn(sameRouterMsg) {
3743
3755
  if (sameRouterMsg[key].list.length > 1) {
3744
3756
  for (var i = 1; i < sameRouterMsg[key].list.length; i++) {
3745
3757
  // sameRouterMsg[key].list[i].name = sameRouterMsg[key].list[i].name + i
3746
- sameRouterMsg[key].list[i].name = sameRouterMsg[key].list[i].name + constType$1._MULTIPLE_ROUTE_JOIN_STR + sameRouterMsg[key].list[i].meta.code;
3758
+ sameRouterMsg[key].list[i].name = sameRouterMsg[key].list[i].name + constType._MULTIPLE_ROUTE_JOIN_STR + sameRouterMsg[key].list[i].meta.code;
3747
3759
  }
3748
3760
  }
3749
3761
  }
@@ -3767,7 +3779,7 @@ var createRouteComponent = function createRouteComponent(component, name, code)
3767
3779
  });
3768
3780
  // 包装异步组件并设置名称
3769
3781
  return defineComponent({
3770
- name: "".concat(name).concat(constType$1._ROUTE_PAGE_JOIN_STR).concat(code),
3782
+ name: "".concat(name).concat(constType._ROUTE_PAGE_JOIN_STR).concat(code),
3771
3783
  setup: function setup() {
3772
3784
  return function () {
3773
3785
  return h(asyncComponent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gw-gis-standard-global-vue3",
3
- "version": "1.1.83",
3
+ "version": "1.1.85",
4
4
  "description": "gw js 库",
5
5
  "main": "gw-gis-standard-global.js",
6
6
  "scripts": {