gw-gis-standard-global-vue3 1.1.78 → 1.1.79

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.
@@ -2788,17 +2788,16 @@ var GisPermission = /*#__PURE__*/function () {
2788
2788
  // const {getRouteTagsListFn, isHideNeedCache, removeIncludeListFn, routeTagsList} = gisRouteTags()
2789
2789
  // window.gisRouteTags = gisRouteTags()
2790
2790
  this.router.beforeEach(function (to, from, next) {
2791
- var _window$top;
2792
2791
  // 当前路由和跳转一样时则不跳转
2793
2792
  // if (this.router?.currentRoute && to.path === this.router?.currentRoute?.value?.path) {
2794
2793
  // return
2795
2794
  // }
2796
2795
  // console.log('【to-router-from】', from)
2797
2796
  // 仅供测试
2798
- if ((_window$top = window.top) !== null && _window$top !== void 0 && _window$top._showRouteTo) {
2799
- console.log('【router-from】', from);
2800
- console.log('【router-to】', to);
2801
- }
2797
+ // if (window.top?._showRouteTo) {
2798
+ console.log('【router-from】', from);
2799
+ console.log('【router-to】', to);
2800
+ // }
2802
2801
  // 缓存当前临时路由 - 会初次加载路由接口无需缓存
2803
2802
  // cacheCurrentTempRouteFn(to)
2804
2803
  // 这是判断路由变化后是否需要缓存
@@ -2901,88 +2900,190 @@ var GisPermission = /*#__PURE__*/function () {
2901
2900
 
2902
2901
  // 判断如果导航栏重定向的子菜单是,根据权限而隐藏的 ,则将菜单在该菜单数组中找到能显示的第一个页面 并跳转(找不到,不跳转),
2903
2902
  // 注意:权限不足,直接跳转403
2903
+ // if (to.matched.length > 0) {
2904
+ // // const lastRouteMsg = to.matched.at(-1)
2905
+ // const lastRouteMsg = to
2906
+ // if (lastRouteMsg.meta.GwRoleSet && !lastRouteMsg.meta.visible) {
2907
+ // // 找整个模块第一个显示的页面
2908
+ // if (to.path) {
2909
+ // const firstPath = (to.path.split('/').length > 0 && to.path.split('/')[1]) || undefined
2910
+ // if (firstPath) {
2911
+ // if (to.matched && to.matched.length > 0) {
2912
+ // let findRoute = to.matched.find(item => item.path === ('/' + firstPath))
2913
+ // if (!findRoute) {
2914
+ // findRoute = lastRouteMsg
2915
+ // }
2916
+ // if (findRoute) {
2917
+ // let findRouteMsg
2918
+ // if (findRoute?.children?.length > 0) {
2919
+ // findRouteMsg = recursionRouteFn(findRoute.children)
2920
+ // } else {
2921
+ // findRouteMsg = lastRouteMsg
2922
+ // }
2923
+ // if (findRouteMsg) {
2924
+ // // 进入首页 如果配置的首页该用户无法访问,则跳转到第一个显示的页面
2925
+ // if ((findRouteMsg?.meta?.isHomePage && (findRouteMsg.meta.visible || !findRouteMsg.meta.hasOwnProperty('visible')))
2926
+ // || (to.redirectedFrom && to.redirectedFrom.path === "/")
2927
+ // || (to.redirectedFrom && to.redirectedFrom.fullPath === "/") || to.path === "/") {
2928
+ // if ((to?.meta?.hasOwnProperty('visible') && !to?.meta?.visible)
2929
+ // || (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible)
2930
+ // || (lastRouteMsg?.meta?.hasOwnProperty('visible') && !lastRouteMsg?.meta?.visible)) {
2931
+ // let hasShowHomePage = undefined
2932
+ // for (let i = 0; i < to.matched[0].children.length; i++) {
2933
+ // if (!to.matched[0].children[i].meta.hasOwnProperty('visible') || to.matched[0].children[i].meta.visible) {
2934
+ // hasShowHomePage = recursionRouteFn(to.matched[0].children[i].children)
2935
+ // if (hasShowHomePage) {
2936
+ // break;
2937
+ // }
2938
+ // }
2939
+ // }
2940
+ // if (hasShowHomePage) {
2941
+ // getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
2942
+ // next({
2943
+ // path: hasShowHomePage.path,
2944
+ // query: hasShowHomePage?.meta?.query
2945
+ // })
2946
+ // }
2947
+ // }
2948
+ // } else if (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible) {
2949
+ // getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
2950
+ // next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
2951
+ // } else if (from.path === findRouteMsg.path) {
2952
+ // getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
2953
+ // next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
2954
+ // } else {
2955
+ // if (to.meta?.hasOwnProperty('visible') && !to.meta.visible) {
2956
+ // next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
2957
+ // } else {
2958
+ // next({
2959
+ // path: findRouteMsg.path,
2960
+ // query: findRouteMsg?.meta?.query
2961
+ // })
2962
+ // }
2963
+ // }
2964
+ // } else {
2965
+ // next(constType.NO_IN_LAYOUT_MSG.ERROR)
2966
+ // }
2967
+ // }
2968
+ // }
2969
+ // }
2970
+ // }
2971
+ // }
2972
+ // }
2973
+ // -----------------------------
2904
2974
  if (to.matched.length > 0) {
2975
+ var _to$meta, _to$redirectedFrom, _to$meta2, _lastRouteMsg$meta2;
2905
2976
  var lastRouteMsg = to.matched.at(-1);
2906
- lastRouteMsg.meta = _objectSpread2(_objectSpread2({}, to.meta), lastRouteMsg.meta);
2907
- if (lastRouteMsg.meta.GwRoleSet && !lastRouteMsg.meta.visible) {
2908
- // 找整个模块第一个显示的页面
2909
- if (to.path) {
2910
- var firstPath = to.path.split('/').length > 0 && to.path.split('/')[1] || undefined;
2911
- if (firstPath) {
2912
- if (to.matched && to.matched.length > 0) {
2913
- var findRoute = to.matched.find(function (item) {
2914
- return item.path === '/' + firstPath;
2915
- });
2916
- if (!findRoute) {
2917
- findRoute = lastRouteMsg;
2918
- }
2919
- if (findRoute) {
2920
- var findRouteMsg;
2921
- if (findRoute.children.length > 0) {
2922
- findRouteMsg = recursionRouteFn(findRoute.children);
2923
- } else {
2924
- findRouteMsg = lastRouteMsg;
2925
- }
2926
- if (findRouteMsg) {
2927
- var _findRouteMsg, _findRouteMsg4, _findRouteMsg5;
2928
- // 进入首页 如果配置的首页该用户无法访问,则跳转到第一个显示的页面
2929
- if ((_findRouteMsg = findRouteMsg) !== null && _findRouteMsg !== void 0 && (_findRouteMsg = _findRouteMsg.meta) !== null && _findRouteMsg !== void 0 && _findRouteMsg.isHomePage && (findRouteMsg.meta.visible || !findRouteMsg.meta.hasOwnProperty('visible')) || to.redirectedFrom && to.redirectedFrom.path === "/" || to.redirectedFrom && to.redirectedFrom.fullPath === "/" || to.path === "/") {
2930
- var _to$meta, _to$meta2, _findRouteMsg2, _findRouteMsg3, _lastRouteMsg$meta, _lastRouteMsg$meta2;
2931
- if (to !== null && to !== void 0 && (_to$meta = to.meta) !== null && _to$meta !== void 0 && _to$meta.hasOwnProperty('visible') && !(to !== null && to !== void 0 && (_to$meta2 = to.meta) !== null && _to$meta2 !== void 0 && _to$meta2.visible) || (_findRouteMsg2 = findRouteMsg) !== null && _findRouteMsg2 !== void 0 && (_findRouteMsg2 = _findRouteMsg2.meta) !== null && _findRouteMsg2 !== void 0 && _findRouteMsg2.hasOwnProperty('visible') && !((_findRouteMsg3 = findRouteMsg) !== null && _findRouteMsg3 !== void 0 && (_findRouteMsg3 = _findRouteMsg3.meta) !== null && _findRouteMsg3 !== void 0 && _findRouteMsg3.visible) || lastRouteMsg !== null && lastRouteMsg !== void 0 && (_lastRouteMsg$meta = lastRouteMsg.meta) !== null && _lastRouteMsg$meta !== void 0 && _lastRouteMsg$meta.hasOwnProperty('visible') && !(lastRouteMsg !== null && lastRouteMsg !== void 0 && (_lastRouteMsg$meta2 = lastRouteMsg.meta) !== null && _lastRouteMsg$meta2 !== void 0 && _lastRouteMsg$meta2.visible)) {
2932
- var hasShowHomePage = undefined;
2933
- for (var i = 0; i < to.matched[0].children.length; i++) {
2934
- if (!to.matched[0].children[i].meta.hasOwnProperty('visible') || to.matched[0].children[i].meta.visible) {
2935
- hasShowHomePage = recursionRouteFn(to.matched[0].children[i].children);
2936
- if (hasShowHomePage) {
2937
- break;
2938
- }
2939
- }
2940
- }
2941
- if (hasShowHomePage) {
2942
- var _hasShowHomePage;
2943
- getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
2944
- next({
2945
- path: hasShowHomePage.path,
2946
- query: (_hasShowHomePage = hasShowHomePage) === null || _hasShowHomePage === void 0 || (_hasShowHomePage = _hasShowHomePage.meta) === null || _hasShowHomePage === void 0 ? void 0 : _hasShowHomePage.query
2947
- });
2948
- }
2949
- }
2950
- } else if ((_findRouteMsg4 = findRouteMsg) !== null && _findRouteMsg4 !== void 0 && (_findRouteMsg4 = _findRouteMsg4.meta) !== null && _findRouteMsg4 !== void 0 && _findRouteMsg4.hasOwnProperty('visible') && !((_findRouteMsg5 = findRouteMsg) !== null && _findRouteMsg5 !== void 0 && (_findRouteMsg5 = _findRouteMsg5.meta) !== null && _findRouteMsg5 !== void 0 && _findRouteMsg5.visible)) {
2951
- getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
2952
- next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
2953
- } else if (from.path === findRouteMsg.path) {
2954
- getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
2955
- next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
2956
- } else {
2957
- var _to$meta3;
2958
- if ((_to$meta3 = to.meta) !== null && _to$meta3 !== void 0 && _to$meta3.hasOwnProperty('visible') && !to.meta.visible) {
2959
- next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
2960
- } else {
2961
- var _findRouteMsg6;
2962
- next({
2963
- path: findRouteMsg.path,
2964
- query: (_findRouteMsg6 = findRouteMsg) === null || _findRouteMsg6 === void 0 || (_findRouteMsg6 = _findRouteMsg6.meta) === null || _findRouteMsg6 === void 0 ? void 0 : _findRouteMsg6.query
2965
- });
2966
- }
2967
- }
2968
- } else {
2969
- next(constType.NO_IN_LAYOUT_MSG.ERROR);
2970
- }
2971
- }
2977
+ // const lastRouteMsg = to
2978
+ console.log('lastRouteMsglastRouteMsg', to);
2979
+ // 进入主页,主页如果已被隐藏则进去第一个显示的页面
2980
+ 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) === '/') {
2981
+ var hasShowHomePage = undefined;
2982
+ for (var i = 0; i < to.matched[0].children.length; i++) {
2983
+ if (!to.matched[0].children[i].meta.hasOwnProperty('visible') || to.matched[0].children[i].meta.visible) {
2984
+ hasShowHomePage = recursionRouteFn(to.matched[0].children[i].children);
2985
+ if (hasShowHomePage) {
2986
+ break;
2972
2987
  }
2973
2988
  }
2974
2989
  }
2990
+ console.log('hasShowHomePage', hasShowHomePage);
2991
+ if (hasShowHomePage) {
2992
+ var _hasShowHomePage;
2993
+ getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
2994
+ next({
2995
+ path: hasShowHomePage.path,
2996
+ query: (_hasShowHomePage = hasShowHomePage) === null || _hasShowHomePage === void 0 || (_hasShowHomePage = _hasShowHomePage.meta) === null || _hasShowHomePage === void 0 ? void 0 : _hasShowHomePage.query
2997
+ });
2998
+ }
2999
+ } else if ((_to$meta2 = to.meta) !== null && _to$meta2 !== void 0 && _to$meta2.GwRoleSet && to.meta.hasOwnProperty('visible') && !to.meta.visible) {
3000
+ var _lastRouteMsg$meta;
3001
+ if ((_lastRouteMsg$meta = lastRouteMsg.meta) !== null && _lastRouteMsg$meta !== void 0 && _lastRouteMsg$meta.GwRoleSet && lastRouteMsg.meta.hasOwnProperty('visible') && !lastRouteMsg.meta.visible) {
3002
+ getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
3003
+ next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
3004
+ }
3005
+ } else if ((_lastRouteMsg$meta2 = lastRouteMsg.meta) !== null && _lastRouteMsg$meta2 !== void 0 && _lastRouteMsg$meta2.GwRoleSet && lastRouteMsg.meta.hasOwnProperty('visible') && !lastRouteMsg.meta.visible) {
3006
+ getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
3007
+ next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
2975
3008
  }
3009
+
3010
+ // if (lastRouteMsg.meta.GwRoleSet && !lastRouteMsg.meta.visible) {
3011
+ // // 找整个模块第一个显示的页面
3012
+ // if (to.path) {
3013
+ // const firstPath = (to.path.split('/').length > 0 && to.path.split('/')[1]) || undefined
3014
+ // if (firstPath) {
3015
+ // if (to.matched && to.matched.length > 0) {
3016
+ // let findRoute = to.matched.find(item => item.path === ('/' + firstPath))
3017
+ // if (!findRoute) {
3018
+ // findRoute = lastRouteMsg
3019
+ // }
3020
+ // if (findRoute) {
3021
+ // let findRouteMsg
3022
+ // if (findRoute?.children?.length > 0) {
3023
+ // findRouteMsg = recursionRouteFn(findRoute.children)
3024
+ // } else {
3025
+ // findRouteMsg = lastRouteMsg
3026
+ // }
3027
+ // if (findRouteMsg) {
3028
+ // // 进入首页 如果配置的首页该用户无法访问,则跳转到第一个显示的页面
3029
+ // if ((findRouteMsg?.meta?.isHomePage && (findRouteMsg.meta.visible || !findRouteMsg.meta.hasOwnProperty('visible')))
3030
+ // || (to.redirectedFrom && to.redirectedFrom.path === "/")
3031
+ // || (to.redirectedFrom && to.redirectedFrom.fullPath === "/") || to.path === "/") {
3032
+ // if ((to?.meta?.hasOwnProperty('visible') && !to?.meta?.visible)
3033
+ // || (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible)
3034
+ // || (lastRouteMsg?.meta?.hasOwnProperty('visible') && !lastRouteMsg?.meta?.visible)) {
3035
+ // let hasShowHomePage = undefined
3036
+ // for (let i = 0; i < to.matched[0].children.length; i++) {
3037
+ // if (!to.matched[0].children[i].meta.hasOwnProperty('visible') || to.matched[0].children[i].meta.visible) {
3038
+ // hasShowHomePage = recursionRouteFn(to.matched[0].children[i].children)
3039
+ // if (hasShowHomePage) {
3040
+ // break;
3041
+ // }
3042
+ // }
3043
+ // }
3044
+ // if (hasShowHomePage) {
3045
+ // getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
3046
+ // next({
3047
+ // path: hasShowHomePage.path,
3048
+ // query: hasShowHomePage?.meta?.query
3049
+ // })
3050
+ // }
3051
+ // }
3052
+ // } else if (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible) {
3053
+ // getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
3054
+ // next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
3055
+ // } else if (from.path === findRouteMsg.path) {
3056
+ // getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
3057
+ // next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
3058
+ // } else {
3059
+ // if (to.meta?.hasOwnProperty('visible') && !to.meta.visible) {
3060
+ // next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
3061
+ // } else {
3062
+ // next({
3063
+ // path: findRouteMsg.path,
3064
+ // query: findRouteMsg?.meta?.query
3065
+ // })
3066
+ // }
3067
+ // }
3068
+ // } else {
3069
+ // next(constType.NO_IN_LAYOUT_MSG.ERROR)
3070
+ // }
3071
+ // }
3072
+ // }
3073
+ // }
3074
+ // }
3075
+ // }
2976
3076
  }
3077
+
2977
3078
  // ----end----
2978
3079
  // 判断在子应用中是否有父级token,非动态菜单才有作用,动态菜单则失效
2979
3080
  // console.log('路由-child')
2980
3081
  if (window.self !== window.top) {
2981
- var _window$top2, _window$top3;
2982
- 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') {
2983
- var _window$top4;
3082
+ var _window$top, _window$top2;
3083
+ 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') {
3084
+ var _window$top3;
2984
3085
  // 主应用是否有token
2985
- 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) {
3086
+ 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) {
2986
3087
  var hasTopToken = getCache(constType.COOKIE).get(window.top.gisConfig.VITE_APP_SET_GIS_TOKEN);
2987
3088
  if (hasTopToken) {
2988
3089
  getCache(constType.COOKIE).set(window.gisConfig.VITE_APP_SET_GIS_TOKEN, hasTopToken);
@@ -3016,8 +3117,8 @@ var GisPermission = /*#__PURE__*/function () {
3016
3117
  return;
3017
3118
  }
3018
3119
  } else {
3019
- var _to$redirectedFrom;
3020
- if ((to === null || to === void 0 || (_to$redirectedFrom = to.redirectedFrom) === null || _to$redirectedFrom === void 0 ? void 0 : _to$redirectedFrom.path) === "/") {
3120
+ var _to$redirectedFrom2;
3121
+ if ((to === null || to === void 0 || (_to$redirectedFrom2 = to.redirectedFrom) === null || _to$redirectedFrom2 === void 0 ? void 0 : _to$redirectedFrom2.path) === "/") {
3021
3122
  next(constType.NO_IN_LAYOUT_MSG.LOGIN);
3022
3123
  NProgress.done();
3023
3124
  return;
@@ -3159,9 +3260,9 @@ function visibleIsCacheFn(to) {
3159
3260
 
3160
3261
  // 进度条控制
3161
3262
  var nProgressFn = function nProgressFn(NProgressConfigure) {
3162
- var _window$top5;
3263
+ var _window$top4;
3163
3264
  // 嵌入的子应用不需要进度条
3164
- 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') {
3265
+ 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') {
3165
3266
  // 这是进度条的一些配置项
3166
3267
  NProgress.configure(NProgressConfigure);
3167
3268
  NProgress.start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gw-gis-standard-global-vue3",
3
- "version": "1.1.78",
3
+ "version": "1.1.79",
4
4
  "description": "gw js 库",
5
5
  "main": "gw-gis-standard-global.js",
6
6
  "scripts": {