gw-gis-standard-global-vue3 1.1.75 → 1.1.76

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,16 +2788,17 @@ 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;
2791
2792
  // 当前路由和跳转一样时则不跳转
2792
2793
  // if (this.router?.currentRoute && to.path === this.router?.currentRoute?.value?.path) {
2793
2794
  // return
2794
2795
  // }
2795
2796
  // console.log('【to-router-from】', from)
2796
2797
  // 仅供测试
2797
- // if (window.top?._showRouteTo) {
2798
- console.log('【router-from】', from);
2799
- console.log('【router-to】', to);
2800
- // }
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
+ }
2801
2802
  // 缓存当前临时路由 - 会初次加载路由接口无需缓存
2802
2803
  // cacheCurrentTempRouteFn(to)
2803
2804
  // 这是判断路由变化后是否需要缓存
@@ -2902,7 +2903,6 @@ var GisPermission = /*#__PURE__*/function () {
2902
2903
  // 注意:权限不足,直接跳转403
2903
2904
  if (to.matched.length > 0) {
2904
2905
  var lastRouteMsg = to.matched.at(-1);
2905
- // console.log('lastRouteMsglastRouteMsg', lastRouteMsg)
2906
2906
  if (lastRouteMsg.meta.GwRoleSet && !lastRouteMsg.meta.visible) {
2907
2907
  // 找整个模块第一个显示的页面
2908
2908
  if (to.path) {
@@ -2923,17 +2923,46 @@ var GisPermission = /*#__PURE__*/function () {
2923
2923
  findRouteMsg = lastRouteMsg;
2924
2924
  }
2925
2925
  if (findRouteMsg) {
2926
- var _findRouteMsg, _findRouteMsg2;
2927
- if ((_findRouteMsg = findRouteMsg) !== null && _findRouteMsg !== void 0 && (_findRouteMsg = _findRouteMsg.meta) !== null && _findRouteMsg !== void 0 && _findRouteMsg.hasOwnProperty('visible') && !((_findRouteMsg2 = findRouteMsg) !== null && _findRouteMsg2 !== void 0 && (_findRouteMsg2 = _findRouteMsg2.meta) !== null && _findRouteMsg2 !== void 0 && _findRouteMsg2.visible)) {
2926
+ var _findRouteMsg, _findRouteMsg4, _findRouteMsg5;
2927
+ // 进入首页 如果配置的首页该用户无法访问,则跳转到第一个显示的页面
2928
+ if ((_findRouteMsg = findRouteMsg) !== null && _findRouteMsg !== void 0 && (_findRouteMsg = _findRouteMsg.meta) !== null && _findRouteMsg !== void 0 && _findRouteMsg.isHomePage || to.redirectedFrom && to.redirectedFrom.path === "/" || to.redirectedFrom && to.redirectedFrom.fullPath === "/" || to.path === "/") {
2929
+ var _to$meta, _to$meta2, _findRouteMsg2, _findRouteMsg3, _lastRouteMsg$meta, _lastRouteMsg$meta2;
2930
+ 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)) {
2931
+ var hasShowHomePage = undefined;
2932
+ for (var 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
+ var _hasShowHomePage;
2942
+ getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
2943
+ next({
2944
+ path: hasShowHomePage.path,
2945
+ query: (_hasShowHomePage = hasShowHomePage) === null || _hasShowHomePage === void 0 || (_hasShowHomePage = _hasShowHomePage.meta) === null || _hasShowHomePage === void 0 ? void 0 : _hasShowHomePage.query
2946
+ });
2947
+ }
2948
+ }
2949
+ } 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)) {
2950
+ getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
2928
2951
  next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
2929
2952
  } else if (from.path === findRouteMsg.path) {
2953
+ getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
2930
2954
  next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
2931
2955
  } else {
2932
- var _findRouteMsg3;
2933
- next({
2934
- path: findRouteMsg.path,
2935
- query: (_findRouteMsg3 = findRouteMsg) === null || _findRouteMsg3 === void 0 || (_findRouteMsg3 = _findRouteMsg3.meta) === null || _findRouteMsg3 === void 0 ? void 0 : _findRouteMsg3.query
2936
- });
2956
+ var _to$meta3;
2957
+ if ((_to$meta3 = to.meta) !== null && _to$meta3 !== void 0 && _to$meta3.hasOwnProperty('visible') && !to.meta.visible) {
2958
+ next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
2959
+ } else {
2960
+ var _findRouteMsg6;
2961
+ next({
2962
+ path: findRouteMsg.path,
2963
+ query: (_findRouteMsg6 = findRouteMsg) === null || _findRouteMsg6 === void 0 || (_findRouteMsg6 = _findRouteMsg6.meta) === null || _findRouteMsg6 === void 0 ? void 0 : _findRouteMsg6.query
2964
+ });
2965
+ }
2937
2966
  }
2938
2967
  } else {
2939
2968
  next(constType.NO_IN_LAYOUT_MSG.ERROR);
@@ -2948,11 +2977,11 @@ var GisPermission = /*#__PURE__*/function () {
2948
2977
  // 判断在子应用中是否有父级token,非动态菜单才有作用,动态菜单则失效
2949
2978
  // console.log('路由-child')
2950
2979
  if (window.self !== window.top) {
2951
- var _window$top, _window$top2;
2952
- 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') {
2953
- var _window$top3;
2980
+ var _window$top2, _window$top3;
2981
+ 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') {
2982
+ var _window$top4;
2954
2983
  // 主应用是否有token
2955
- 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) {
2984
+ 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) {
2956
2985
  var hasTopToken = getCache(constType.COOKIE).get(window.top.gisConfig.VITE_APP_SET_GIS_TOKEN);
2957
2986
  if (hasTopToken) {
2958
2987
  getCache(constType.COOKIE).set(window.gisConfig.VITE_APP_SET_GIS_TOKEN, hasTopToken);
@@ -3129,9 +3158,9 @@ function visibleIsCacheFn(to) {
3129
3158
 
3130
3159
  // 进度条控制
3131
3160
  var nProgressFn = function nProgressFn(NProgressConfigure) {
3132
- var _window$top4;
3161
+ var _window$top5;
3133
3162
  // 嵌入的子应用不需要进度条
3134
- 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') {
3163
+ 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') {
3135
3164
  // 这是进度条的一些配置项
3136
3165
  NProgress.configure(NProgressConfigure);
3137
3166
  NProgress.start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gw-gis-standard-global-vue3",
3
- "version": "1.1.75",
3
+ "version": "1.1.76",
4
4
  "description": "gw js 库",
5
5
  "main": "gw-gis-standard-global.js",
6
6
  "scripts": {