inl-ui 0.1.73 → 0.1.75

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.
@@ -9,8 +9,8 @@ var core = require('@vueuse/core');
9
9
  var axios$2 = require('axios');
10
10
  var antDesignVue = require('ant-design-vue');
11
11
  var _ = require('lodash');
12
- var dayjs = require('dayjs');
13
12
  var qiankun = require('qiankun');
13
+ var dayjs = require('dayjs');
14
14
  require('vite-plugin-qiankun');
15
15
  var renderWithQiankun = require('vite-plugin-qiankun/dist/helper');
16
16
  var mobile = require('@sszj-temp/mobile');
@@ -280,7 +280,7 @@ function useActiveMenu(menuList, extraPages, isNav = false, watchOnce = false, i
280
280
  return menu;
281
281
  }
282
282
 
283
- function _isSlot$d(s) {
283
+ function _isSlot$e(s) {
284
284
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
285
285
  }
286
286
  const Header$1 = vue.defineComponent({
@@ -375,7 +375,7 @@ const Header$1 = vue.defineComponent({
375
375
  "selectedKeys": acitveMenuKey.value,
376
376
  "onUpdate:selectedKeys": $event => acitveMenuKey.value = $event,
377
377
  "onSelect": handleMenuSelected
378
- }, _isSlot$d(_slot = props.menu.map(item => vue.createVNode(antDesignVue.MenuItem, {
378
+ }, _isSlot$e(_slot = props.menu.map(item => vue.createVNode(antDesignVue.MenuItem, {
379
379
  "key": item.id,
380
380
  "title": item.name
381
381
  }, {
@@ -443,7 +443,7 @@ const Header$1 = vue.defineComponent({
443
443
  }
444
444
  });
445
445
 
446
- function _isSlot$c(s) {
446
+ function _isSlot$d(s) {
447
447
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
448
448
  }
449
449
  const renderMenuItem = item => {
@@ -525,13 +525,91 @@ const SideMenu$1 = vue.defineComponent({
525
525
  "onUpdate:openKeys": $event => expandKeys.value = $event,
526
526
  "selectedKeys": activeMenu.value,
527
527
  "onSelect": handleMenuSelect
528
- }, _isSlot$c(_slot = props.menu.map(item => renderMenuItem(item))) ? _slot : {
528
+ }, _isSlot$d(_slot = props.menu.map(item => renderMenuItem(item))) ? _slot : {
529
529
  default: () => [_slot]
530
530
  });
531
531
  };
532
532
  }
533
533
  });
534
534
 
535
+ function useActiveApp() {
536
+ const route = vueRouter.useRoute();
537
+ const activeAppName = vue.computed(() => {
538
+ return route.path.split("/")[1];
539
+ });
540
+ return activeAppName;
541
+ }
542
+
543
+ const loadedApp = /* @__PURE__ */new Map();
544
+ function useMicroApp(appList) {
545
+ const route = vueRouter.useRoute();
546
+ const activeAppName = useActiveApp();
547
+ const loadAppList = vue.ref(Array.from(loadedApp.values()));
548
+ const appContainerList = vue.ref([]);
549
+ const handleRouteChange = core.useThrottleFn(async () => {
550
+ const microAppName = activeAppName.value;
551
+ let microAppDefine = appList.find(item => item.name === microAppName);
552
+ if (!microAppDefine && !microAppName.startsWith("mtip-")) return;
553
+ const domId = `microApp_${microAppName}`;
554
+ if (!appContainerList.value.some(item => item.id === domId)) {
555
+ appContainerList.value.push({
556
+ name: microAppName,
557
+ id: domId
558
+ });
559
+ }
560
+ setTimeout(async () => {
561
+ const loadApp = loadedApp.get(microAppName);
562
+ if (loadApp) {
563
+ if (!loadApp.mounted) {
564
+ loadApp.app.mount();
565
+ }
566
+ return;
567
+ }
568
+ const app = qiankun.loadMicroApp({
569
+ name: microAppDefine ? microAppDefine.name : microAppName,
570
+ entry: microAppDefine ? microAppDefine.entry : `/${microAppName}/`,
571
+ container: `#${domId}`
572
+ });
573
+ const microApp = {
574
+ name: microAppName,
575
+ domId,
576
+ app,
577
+ mounted: true
578
+ };
579
+ loadAppList.value.push(microApp);
580
+ loadedApp.set(microAppName, microApp);
581
+ await app.mountPromise;
582
+ }, 10);
583
+ }, 100);
584
+ vue.watch(route, handleRouteChange, {
585
+ immediate: true
586
+ });
587
+ vue.onBeforeUnmount(() => {
588
+ loadedApp.forEach(item => item.mounted = false);
589
+ });
590
+ return [loadAppList, appContainerList];
591
+ }
592
+
593
+ function onAddExtraTabs(handler) {
594
+ const route = vueRouter.useRoute();
595
+ const qiankunState = vue.inject("qiankunState");
596
+ vue.watch(() => qiankunState.value.extraTabs, (val = [], prev = []) => {
597
+ if (val.length > prev.length) {
598
+ const added = _.differenceBy(val, prev, item => item.key + item.uniqueKey).map(item => ({
599
+ ...item,
600
+ params: route.query
601
+ }));
602
+ handler(added.map(item => ({
603
+ ...item,
604
+ type: "extraTab"
605
+ })));
606
+ }
607
+ }, {
608
+ deep: true,
609
+ immediate: true
610
+ });
611
+ }
612
+
535
613
  function useQiankunStateValue(key) {
536
614
  const qiankunState = vue.inject("qiankunState");
537
615
  if (___default["default"].isEmpty(qiankunState)) return;
@@ -6439,82 +6517,73 @@ function useRouteActive() {
6439
6517
  return isActive;
6440
6518
  }
6441
6519
 
6442
- function useActiveApp() {
6443
- const route = vueRouter.useRoute();
6444
- const activeAppName = vue.computed(() => {
6445
- return route.path.split("/")[1];
6520
+ function useChildTheme(containerRef, isFullscreen, loadAppList) {
6521
+ const theme = core.useLocalStorage("theme", "default");
6522
+ const globalTheme = useQiankunStateValue("theme");
6523
+ globalTheme.value = theme.value;
6524
+ vue.watch([theme, globalTheme, isFullscreen, loadAppList, containerRef], async () => {
6525
+ if (containerRef.value) {
6526
+ await vue.nextTick();
6527
+ const childContainerList = containerRef.value.querySelectorAll("[id^='__qiankun_microapp_wrapper_for_']");
6528
+ const themeText = globalTheme.value === "dark" ? "dark" : "light";
6529
+ for (const child of Array.from(childContainerList)) {
6530
+ child.setAttribute("data-theme", themeText);
6531
+ child.setAttribute("data-doc-theme", themeText);
6532
+ if (isFullscreen.value) {
6533
+ child.setAttribute("fullscreen", "");
6534
+ } else {
6535
+ child.removeAttribute("fullscreen");
6536
+ }
6537
+ }
6538
+ }
6539
+ }, {
6540
+ immediate: true,
6541
+ deep: true
6446
6542
  });
6447
- return activeAppName;
6448
6543
  }
6449
6544
 
6450
- const loadedApp = /* @__PURE__ */new Map();
6451
- function useMicroApp(appList) {
6452
- const route = vueRouter.useRoute();
6453
- const activeAppName = useActiveApp();
6454
- const loadAppList = vue.ref(Array.from(loadedApp.values()));
6455
- const appContainerList = vue.ref([]);
6456
- const handleRouteChange = core.useThrottleFn(async () => {
6457
- const microAppName = activeAppName.value;
6458
- let microAppDefine = appList.find(item => item.name === microAppName);
6459
- if (!microAppDefine && !microAppName.startsWith("mtip-")) return;
6460
- const domId = `microApp_${microAppName}`;
6461
- if (!appContainerList.value.some(item => item.id === domId)) {
6462
- appContainerList.value.push({
6463
- name: microAppName,
6464
- id: domId
6465
- });
6545
+ function useFullscreenLogic(containerRef, iframeList, activeKey) {
6546
+ const isFullscreenIframe = vue.ref(false);
6547
+ const {
6548
+ isFullscreen,
6549
+ enter
6550
+ } = core.useFullscreen(containerRef);
6551
+ const {
6552
+ elementY
6553
+ } = core.useMouseInElement(containerRef);
6554
+ const isTabsShow = vue.ref(false);
6555
+ vue.watchEffect(() => {
6556
+ if (isFullscreen.value) {
6557
+ isTabsShow.value = false;
6466
6558
  }
6467
- setTimeout(async () => {
6468
- const loadApp = loadedApp.get(microAppName);
6469
- if (loadApp) {
6470
- if (!loadApp.mounted) {
6471
- loadApp.app.mount();
6472
- }
6473
- return;
6474
- }
6475
- const app = qiankun.loadMicroApp({
6476
- name: microAppDefine ? microAppDefine.name : microAppName,
6477
- entry: microAppDefine ? microAppDefine.entry : `/${microAppName}/`,
6478
- container: `#${domId}`
6479
- });
6480
- const microApp = {
6481
- name: microAppName,
6482
- domId,
6483
- app,
6484
- mounted: true
6485
- };
6486
- loadAppList.value.push(microApp);
6487
- loadedApp.set(microAppName, microApp);
6488
- await app.mountPromise;
6489
- }, 10);
6490
- }, 100);
6491
- vue.watch(route, handleRouteChange, {
6492
- immediate: true
6493
6559
  });
6494
- vue.onBeforeUnmount(() => {
6495
- loadedApp.forEach(item => item.mounted = false);
6560
+ vue.watchEffect(() => {
6561
+ if (elementY.value < 10) {
6562
+ isTabsShow.value = true;
6563
+ }
6496
6564
  });
6497
- return [loadAppList, appContainerList];
6498
- }
6499
-
6500
- function onAddExtraTabs(handler) {
6501
- const route = vueRouter.useRoute();
6502
- const qiankunState = vue.inject("qiankunState");
6503
- vue.watch(() => qiankunState.value.extraTabs, (val = [], prev = []) => {
6504
- if (val.length > prev.length) {
6505
- const added = _.differenceBy(val, prev, item => item.key + item.uniqueKey).map(item => ({
6506
- ...item,
6507
- params: route.query
6508
- }));
6509
- handler(added.map(item => ({
6510
- ...item,
6511
- type: "extraTab"
6512
- })));
6565
+ const isPadding = vue.computed(() => {
6566
+ let iframePadding = false;
6567
+ if (activeKey.value) {
6568
+ const currentIframe = iframeList.value.find(item => item.id === activeKey.value);
6569
+ if (currentIframe) {
6570
+ iframePadding = currentIframe.url.includes("hasPadding");
6571
+ if (!iframePadding) return false;
6572
+ }
6513
6573
  }
6514
- }, {
6515
- deep: true,
6516
- immediate: true
6574
+ if (isFullscreen.value) return false;
6575
+ return !isFullscreenIframe.value;
6517
6576
  });
6577
+ const handleFullscreen = tab => {
6578
+ isFullscreenIframe.value = tab.mode === 2;
6579
+ enter();
6580
+ };
6581
+ return {
6582
+ isFullscreen,
6583
+ isTabsShow,
6584
+ isPadding,
6585
+ handleFullscreen
6586
+ };
6518
6587
  }
6519
6588
 
6520
6589
  function setParam(searchParams, obj) {
@@ -6635,7 +6704,7 @@ const TabList = vue.defineComponent({
6635
6704
  }
6636
6705
  });
6637
6706
  vue.onBeforeUnmount(() => tabList.value = []);
6638
- core.watchArray(tabList, async (val, prev, added, removed) => {
6707
+ core.watchArray(tabList, async (_val, _prev, _added, removed) => {
6639
6708
  for (const tab of removed) {
6640
6709
  if (tab.isExtraTab) {
6641
6710
  const idx = qiankunState.value.extraTabs.findIndex(item => item.key === tab.key && item.uniqueKey === tab.uniqueKey);
@@ -6883,32 +6952,33 @@ const TabList = vue.defineComponent({
6883
6952
  }
6884
6953
  });
6885
6954
 
6886
- const PageContent = vue.defineComponent({
6887
- props: {
6888
- currMenu: {
6889
- type: Object
6890
- },
6891
- menu: {
6892
- type: Array,
6893
- default: () => []
6894
- },
6895
- extraPages: {
6896
- type: Array,
6897
- required: true
6898
- },
6899
- appList: {
6900
- type: Array,
6901
- required: true
6902
- },
6903
- showTabList: {
6904
- type: Boolean,
6905
- default: true
6906
- },
6907
- pageContainerRef: {
6908
- type: Object,
6909
- required: true
6910
- }
6955
+ const Props$1 = {
6956
+ currMenu: {
6957
+ type: Object
6958
+ },
6959
+ menu: {
6960
+ type: Array,
6961
+ default: () => []
6911
6962
  },
6963
+ extraPages: {
6964
+ type: Array,
6965
+ required: true
6966
+ },
6967
+ appList: {
6968
+ type: Array,
6969
+ required: true
6970
+ },
6971
+ showTabList: {
6972
+ type: Boolean,
6973
+ default: true
6974
+ },
6975
+ pageContainerRef: {
6976
+ type: Object,
6977
+ required: true
6978
+ }
6979
+ };
6980
+ const PageContent = vue.defineComponent({
6981
+ props: Props$1,
6912
6982
  setup(props, {
6913
6983
  emit
6914
6984
  }) {
@@ -6936,12 +7006,12 @@ const PageContent = vue.defineComponent({
6936
7006
  extraPageList.value.splice(idx, 1);
6937
7007
  }
6938
7008
  };
6939
- const handleMenuChange = val => {
7009
+ const handleMenuChange = (val, isFromMenu = false) => {
6940
7010
  if (!val) return;
6941
7011
  const routeQuery = {
6942
7012
  ...route.query
6943
7013
  };
6944
- const queryCombine = Object.assign(val.params || {}, routeQuery);
7014
+ const queryCombine = Object.assign({}, val.params, routeQuery);
6945
7015
  if (val.isExtra) {
6946
7016
  const exist = extraPageList.value.find(item => item.key === val.key && item.uniqueKey === val.uniqueKey);
6947
7017
  if (!exist) {
@@ -6979,7 +7049,10 @@ const PageContent = vue.defineComponent({
6979
7049
  const tab = ___default["default"].cloneDeep(val);
6980
7050
  switch (mode) {
6981
7051
  case 0:
6982
- if (!isOpened) {
7052
+ if (isOpened) {
7053
+ openedTab.params = isFromMenu ? val.params : queryCombine;
7054
+ val.params = isFromMenu ? val.params : queryCombine;
7055
+ } else {
6983
7056
  tabList.value.push({
6984
7057
  ...tab,
6985
7058
  key: key ?? id,
@@ -7042,7 +7115,11 @@ const PageContent = vue.defineComponent({
7042
7115
  } else if (tab.mode === 2) {
7043
7116
  handleMenuChange(tab);
7044
7117
  } else {
7045
- router.push(tab.url);
7118
+ const resolveRes = router.resolve(tab.url);
7119
+ router.push({
7120
+ path: resolveRes.path,
7121
+ query: Object.assign(resolveRes.query, tab.params)
7122
+ });
7046
7123
  }
7047
7124
  };
7048
7125
  const activeMenu = useActiveMenu(() => props.menu, props.extraPages, false, false, extraIframeList);
@@ -7064,7 +7141,7 @@ const PageContent = vue.defineComponent({
7064
7141
  }, {
7065
7142
  immediate: true
7066
7143
  });
7067
- vue.watch(() => props.currMenu, handleMenuChange, {
7144
+ vue.watch(() => props.currMenu, val => handleMenuChange(val, true), {
7068
7145
  immediate: true
7069
7146
  });
7070
7147
  core.useEventListener("message", e => {
@@ -7093,85 +7170,38 @@ const PageContent = vue.defineComponent({
7093
7170
  }, {
7094
7171
  immediate: true
7095
7172
  });
7096
- vue.watch(() => qiankunState.value.activeTabKey, val => activeKey.value = val);
7173
+ vue.watch(() => qiankunState.value.activeTabKey, val => {
7174
+ if (activeKey !== val) {
7175
+ requestAnimationFrame(() => {
7176
+ activeKey.value = val;
7177
+ });
7178
+ }
7179
+ });
7097
7180
  onAddExtraTabs(added => {
7098
7181
  tabList.value.push(...added);
7099
7182
  });
7100
- const isFullscreenIframe = vue.ref(false);
7101
7183
  const {
7102
7184
  isFullscreen,
7103
- enter
7104
- } = core.useFullscreen(containerRef);
7105
- const {
7106
- elementY
7107
- } = core.useMouseInElement(containerRef);
7108
- const isTabsShow = vue.ref(false);
7109
- vue.watchEffect(() => {
7110
- if (isFullscreen.value) {
7111
- isTabsShow.value = false;
7112
- }
7113
- });
7114
- vue.watchEffect(() => {
7115
- if (elementY.value < 10) {
7116
- isTabsShow.value = true;
7117
- }
7118
- });
7119
- const isPadding = vue.computed(() => {
7120
- let iframePadding = false;
7121
- if (activeKey.value) {
7122
- const currentIframe = iframeList.value.find(item => item.id === activeKey.value);
7123
- if (currentIframe) {
7124
- iframePadding = currentIframe.url.includes("hasPadding");
7125
- if (!iframePadding) return false;
7126
- }
7127
- }
7128
- if (isFullscreen.value) return false;
7129
- return !isFullscreenIframe.value;
7130
- });
7131
- const handleFullscreen = tab => {
7132
- isFullscreenIframe.value = tab.mode === 2;
7133
- enter();
7134
- };
7185
+ handleFullscreen,
7186
+ isPadding,
7187
+ isTabsShow
7188
+ } = useFullscreenLogic(containerRef, iframeList, activeKey);
7135
7189
  const handleRefreshIframe = async ({
7136
7190
  id
7137
7191
  }) => {
7138
7192
  const iframe = iframeList.value.find(item => item.id === id);
7139
- if (iframe) {
7140
- iframe.refreshKey = Date.now();
7141
- const reqCode = await checkIframeUrl(iframe.url);
7142
- iframe.reqCode = reqCode;
7143
- }
7193
+ if (!iframe) return;
7194
+ iframe.refreshKey = Date.now();
7195
+ const reqCode = await checkIframeUrl(iframe.url);
7196
+ iframe.reqCode = reqCode;
7144
7197
  };
7145
7198
  const handleRefreshExtraPage = ({
7146
7199
  key
7147
7200
  }) => {
7148
7201
  const page = extraPageList.value.find(item => item.key === key);
7149
- if (page) {
7150
- page.refreshKey = Date.now();
7151
- }
7202
+ page && (page.refreshKey = Date.now());
7152
7203
  };
7153
- const theme = core.useLocalStorage("theme", "default");
7154
- const globalTheme = useQiankunStateValue("theme");
7155
- globalTheme.value = theme.value;
7156
- vue.watch([theme, globalTheme, isFullscreen, loadAppList, containerRef], async () => {
7157
- if (containerRef.value) {
7158
- await vue.nextTick();
7159
- const childContainerList = containerRef.value.querySelectorAll("[id^='__qiankun_microapp_wrapper_for_']");
7160
- const themeText = globalTheme.value === "dark" ? "dark" : "light";
7161
- for (const child of Array.from(childContainerList)) {
7162
- child.setAttribute("data-theme", themeText);
7163
- child.setAttribute("data-doc-theme", themeText);
7164
- if (isFullscreen.value) {
7165
- child.setAttribute("fullscreen", "");
7166
- } else {
7167
- child.removeAttribute("fullscreen");
7168
- }
7169
- }
7170
- }
7171
- }, {
7172
- immediate: true,
7173
- deep: true
7174
- });
7204
+ useChildTheme(containerRef, isFullscreen, loadAppList);
7175
7205
  const closeExtraPage = tab => {
7176
7206
  tabListRef.value?.closeTab(tab);
7177
7207
  };
@@ -7180,122 +7210,186 @@ const PageContent = vue.defineComponent({
7180
7210
  app.app.unmount();
7181
7211
  }
7182
7212
  });
7183
- return () => vue.createVNode("div", {
7184
- "class": "page-content",
7185
- "ref": containerRef
7186
- }, [props.showTabList && vue.withDirectives(vue.createVNode(TabList, {
7187
- "ref": tabListRef,
7188
- "activeKey": activeKey.value,
7189
- "onUpdate:activeKey": $event => activeKey.value = $event,
7190
- "list": tabList.value,
7191
- "onUpdate:list": $event => tabList.value = $event,
7192
- "containerRef": containerRef,
7193
- "onTabSelect": onTabSelect,
7194
- "onCloseExtraPage": handleExtraPageClose,
7195
- "onCloseIframePage": handleIframePageClose,
7196
- "onFullscreen": handleFullscreen,
7197
- "onRefreshIframe": handleRefreshIframe,
7198
- "onRefreshExtraPage": handleRefreshExtraPage,
7199
- "onMouseLeave": () => isTabsShow.value = false
7200
- }, null), [[vue.vShow, !isFullscreen.value || isTabsShow.value]]), vue.createVNode("div", {
7201
- "class": ["page-container", {
7213
+ return () => {
7214
+ const tabs = vue.withDirectives(vue.createVNode(TabList, {
7215
+ "ref": tabListRef,
7216
+ "activeKey": activeKey.value,
7217
+ "onUpdate:activeKey": $event => activeKey.value = $event,
7218
+ "list": tabList.value,
7219
+ "onUpdate:list": $event => tabList.value = $event,
7220
+ "containerRef": containerRef,
7221
+ "onTabSelect": onTabSelect,
7222
+ "onCloseExtraPage": handleExtraPageClose,
7223
+ "onCloseIframePage": handleIframePageClose,
7224
+ "onFullscreen": handleFullscreen,
7225
+ "onRefreshIframe": handleRefreshIframe,
7226
+ "onRefreshExtraPage": handleRefreshExtraPage,
7227
+ "onMouseLeave": () => isTabsShow.value = false
7228
+ }, null), [[vue.vShow, !isFullscreen.value || isTabsShow.value]]);
7229
+ const containerCns = {
7202
7230
  padding: isPadding.value,
7203
7231
  fullscreen: isFullscreen.value
7204
- }],
7205
- "ref": props.pageContainerRef
7206
- }, [appDomList.value.map(item => vue.withDirectives(vue.createVNode("div", {
7207
- "key": item.id,
7208
- "id": item.id
7209
- }, null), [[vue.vShow, item.name === activeAppName.value]])), iframeList.value.map(item => {
7210
- const show = item.id === activeKey.value;
7211
- if (item.reqCode === 200 || item.reqCode === void 0) {
7212
- return vue.createVNode("iframe", {
7213
- "class": "menu-iframe",
7214
- "key": item.id + item.refreshKey,
7215
- "id": "iframe" + item.id,
7232
+ };
7233
+ const iframeRender = item => {
7234
+ const show = item.id === activeKey.value;
7235
+ if (item.reqCode === 200 || item.reqCode === void 0) {
7236
+ return vue.createVNode("iframe", {
7237
+ "class": "menu-iframe",
7238
+ "key": item.id + item.refreshKey,
7239
+ "id": "iframe" + item.id,
7240
+ "style": {
7241
+ zIndex: show ? "" : "-100"
7242
+ },
7243
+ "src": item.url,
7244
+ "frameborder": "0"
7245
+ }, null);
7246
+ }
7247
+ let src = "/micro-assets/platform_web/developing.png";
7248
+ if (item.reqCode === 404) {
7249
+ src = "/micro-assets/platform_web/page404.png";
7250
+ }
7251
+ return vue.withDirectives(vue.createVNode("div", {
7252
+ "class": "iframe-fallback"
7253
+ }, [vue.createVNode("img", {
7254
+ "src": src,
7255
+ "alt": ""
7256
+ }, null)]), [[vue.vShow, show]]);
7257
+ };
7258
+ const childTypes = [];
7259
+ childTypes.push(vue.createVNode(vue.Fragment, null, [appDomList.value.map(item => vue.withDirectives(vue.createVNode("div", {
7260
+ "key": item.id,
7261
+ "id": item.id
7262
+ }, null), [[vue.vShow, item.name === activeAppName.value]]))]));
7263
+ childTypes.push(vue.createVNode(vue.Fragment, null, [iframeList.value.map(iframeRender)]));
7264
+ childTypes.push(vue.createVNode(vue.Fragment, null, [extraPageList.value.map(item => {
7265
+ const extraPageShoe = getTabUniqueKey(item) === activeKey.value;
7266
+ return vue.withDirectives(vue.createVNode("div", {
7267
+ "key": item.key + item.refreshKey,
7216
7268
  "style": {
7217
- zIndex: show ? "" : "-100"
7218
- },
7219
- "src": item.url,
7220
- "frameborder": "0"
7221
- }, null);
7222
- }
7223
- let src = "/micro-assets/platform_web/developing.png";
7224
- if (item.reqCode === 404) {
7225
- src = "/micro-assets/platform_web/page404.png";
7226
- }
7227
- return vue.withDirectives(vue.createVNode("div", {
7228
- "class": "iframe-fallback"
7229
- }, [vue.createVNode("img", {
7230
- "src": src,
7231
- "alt": ""
7232
- }, null)]), [[vue.vShow, show]]);
7233
- }), extraPageList.value.map(item => vue.withDirectives(vue.createVNode("div", {
7234
- "key": item.key + item.refreshKey,
7235
- "style": {
7236
- "min-height": "100%"
7237
- }
7238
- }, [vue.createVNode(item.component, {
7239
- "onClose": () => closeExtraPage(item)
7240
- }, null)]), [[vue.vShow, getTabUniqueKey(item) === activeKey.value]]))])]);
7269
+ "min-height": "100%"
7270
+ }
7271
+ }, [vue.createVNode(item.component, {
7272
+ "onClose": () => closeExtraPage(item)
7273
+ }, null)]), [[vue.vShow, extraPageShoe]]);
7274
+ })]));
7275
+ return vue.createVNode("div", {
7276
+ "class": "page-content",
7277
+ "ref": containerRef
7278
+ }, [props.showTabList && tabs, vue.createVNode("div", {
7279
+ "class": ["page-container", containerCns],
7280
+ "ref": props.pageContainerRef
7281
+ }, [childTypes])]);
7282
+ };
7241
7283
  }
7242
7284
  });
7243
7285
 
7244
- const Layout = vue.defineComponent({
7245
- emits: ["globalSearch", "personalCenter", "logout", "extraPage"],
7246
- props: {
7247
- // 用户权限菜单
7248
- userMenu: {
7249
- type: Array,
7250
- required: true
7251
- },
7252
- // 版权信息
7253
- copyRight: {
7254
- type: String
7255
- },
7256
- // 用户
7257
- userInfo: {
7258
- type: Object,
7259
- required: true
7260
- },
7261
- // 额外的页面
7262
- extraPages: {
7263
- type: Array,
7264
- default: () => []
7265
- },
7266
- // 未读消息
7267
- messageCount: {
7268
- type: Number,
7269
- default: 0
7270
- },
7271
- // 网页logo
7272
- logo: {
7273
- type: String
7274
- },
7275
- appList: {
7276
- type: Array,
7277
- required: true
7278
- },
7279
- // 展示菜单
7280
- withMenu: {
7281
- type: Boolean,
7282
- default: true
7283
- },
7284
- // 展示在左侧的菜单(不展示菜单模式)
7285
- sideMenu: {
7286
- type: Array
7287
- },
7288
- // 展示导航栏菜单和搜索框
7289
- showNav: {
7290
- type: Boolean,
7291
- default: true
7292
- },
7293
- // 是否展示我的消息
7294
- showNotice: {
7295
- type: Boolean,
7296
- default: true
7286
+ function useFakeModal(pageContainerRef) {
7287
+ const showMask = vue.ref(false);
7288
+ core.useEventListener("message", e => {
7289
+ const {
7290
+ data: event
7291
+ } = e;
7292
+ const {
7293
+ type,
7294
+ val,
7295
+ delay = 0
7296
+ } = event;
7297
+ if (type === "toggleMask") {
7298
+ setTimeout(() => {
7299
+ showMask.value = val;
7300
+ }, delay);
7297
7301
  }
7302
+ });
7303
+ const pageBounding = core.useElementBounding(pageContainerRef);
7304
+ const modalPath = vue.computed(() => {
7305
+ const {
7306
+ top,
7307
+ bottom,
7308
+ left,
7309
+ right
7310
+ } = pageBounding;
7311
+ const topDis = Math.round(top.value);
7312
+ const rightDis = Math.round(window.innerWidth - right.value);
7313
+ const bottomDis = Math.round(window.innerHeight - bottom.value);
7314
+ const leftDis = Math.round(left.value);
7315
+ return `polygon(
7316
+ 0% 0%,
7317
+ 0% 100%,
7318
+ ${leftDis}px 100%,
7319
+ ${leftDis}px ${topDis}px,
7320
+ calc(100% - ${rightDis}px) ${topDis}px,
7321
+ calc(100% - ${rightDis}px) calc(100% - ${bottomDis}px),
7322
+ ${leftDis}px calc(100% - ${bottomDis}px),
7323
+ ${leftDis}px 100%,
7324
+ 100% 100%,
7325
+ 100% 0%
7326
+ )`;
7327
+ });
7328
+ return {
7329
+ showMask,
7330
+ modalPath
7331
+ };
7332
+ }
7333
+
7334
+ function _isSlot$c(s) {
7335
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
7336
+ }
7337
+ const Props = {
7338
+ // 用户权限菜单
7339
+ userMenu: {
7340
+ type: Array,
7341
+ required: true
7342
+ },
7343
+ // 版权信息
7344
+ copyRight: {
7345
+ type: String
7346
+ },
7347
+ // 用户
7348
+ userInfo: {
7349
+ type: Object,
7350
+ required: true
7298
7351
  },
7352
+ // 额外的页面
7353
+ extraPages: {
7354
+ type: Array,
7355
+ default: () => []
7356
+ },
7357
+ // 未读消息
7358
+ messageCount: {
7359
+ type: Number,
7360
+ default: 0
7361
+ },
7362
+ // 网页logo
7363
+ logo: {
7364
+ type: String
7365
+ },
7366
+ appList: {
7367
+ type: Array,
7368
+ required: true
7369
+ },
7370
+ // 展示菜单
7371
+ withMenu: {
7372
+ type: Boolean,
7373
+ default: true
7374
+ },
7375
+ // 展示在左侧的菜单(不展示菜单模式)
7376
+ sideMenu: {
7377
+ type: Array
7378
+ },
7379
+ // 展示导航栏菜单和搜索框
7380
+ showNav: {
7381
+ type: Boolean,
7382
+ default: true
7383
+ },
7384
+ // 是否展示我的消息
7385
+ showNotice: {
7386
+ type: Boolean,
7387
+ default: true
7388
+ }
7389
+ };
7390
+ const Layout = vue.defineComponent({
7391
+ emits: ["globalSearch", "personalCenter", "logout", "extraPage"],
7392
+ props: Props,
7299
7393
  setup(props, {
7300
7394
  emit
7301
7395
  }) {
@@ -7308,15 +7402,13 @@ const Layout = vue.defineComponent({
7308
7402
  const siderMenu = vue.ref([]);
7309
7403
  const sideMenuShow = vue.computed(() => props.sideMenu || siderMenu.value);
7310
7404
  const showSideMenu = vue.computed(() => props.withMenu || !!props.sideMenu);
7311
- vue.watch(() => props.userMenu, val => {
7312
- if (val.length && menuRef) {
7313
- const refMenu = getMenuByKey(val, menuRef, "remark");
7405
+ vue.watchEffect(() => {
7406
+ if (props.userMenu.length > 0 && menuRef) {
7407
+ const refMenu = getMenuByKey(props.userMenu, menuRef, "remark");
7314
7408
  if (refMenu) {
7315
7409
  siderMenu.value = [refMenu];
7316
7410
  }
7317
7411
  }
7318
- }, {
7319
- immediate: true
7320
7412
  });
7321
7413
  const showHeader = vue.computed(() => props.withMenu && !menuRef && !isOnlyPage);
7322
7414
  const showSide = vue.computed(() => showSideMenu.value && !isOnlyPage);
@@ -7347,52 +7439,19 @@ const Layout = vue.defineComponent({
7347
7439
  refreshTabKey: ""
7348
7440
  };
7349
7441
  });
7350
- const showMask = vue.ref(false);
7351
- core.useEventListener("message", e => {
7352
- const {
7353
- data: event
7354
- } = e;
7355
- const {
7356
- type,
7357
- val,
7358
- delay = 0
7359
- } = event;
7360
- if (type === "toggleMask") {
7361
- setTimeout(() => {
7362
- showMask.value = val;
7363
- }, delay);
7364
- }
7365
- });
7366
7442
  const pageContainerRef = vue.ref();
7367
- const pageBounding = core.useElementBounding(pageContainerRef);
7368
- const modalPath = vue.computed(() => {
7369
- const {
7370
- top,
7371
- bottom,
7372
- left,
7373
- right
7374
- } = pageBounding;
7375
- const topDis = Math.round(top.value);
7376
- const rightDis = Math.round(window.innerWidth - right.value);
7377
- const bottomDis = Math.round(window.innerHeight - bottom.value);
7378
- const leftDis = Math.round(left.value);
7379
- return `polygon(
7380
- 0% 0%,
7381
- 0% 100%,
7382
- ${leftDis}px 100%,
7383
- ${leftDis}px ${topDis}px,
7384
- calc(100% - ${rightDis}px) ${topDis}px,
7385
- calc(100% - ${rightDis}px) calc(100% - ${bottomDis}px),
7386
- ${leftDis}px calc(100% - ${bottomDis}px),
7387
- ${leftDis}px 100%,
7388
- 100% 100%,
7389
- 100% 0%
7390
- )`;
7391
- });
7392
- return () => vue.createVNode("div", {
7393
- "class": `${config.prefix}-layout`
7394
- }, [vue.createVNode(antDesignVue.Layout, null, {
7395
- default: () => [showHeader.value && vue.createVNode(antDesignVue.LayoutHeader, null, {
7443
+ const {
7444
+ showMask,
7445
+ modalPath
7446
+ } = useFakeModal(pageContainerRef);
7447
+ return () => {
7448
+ const modalMask = vue.createVNode("div", {
7449
+ "class": "layout-mask",
7450
+ "style": {
7451
+ clipPath: modalPath.value
7452
+ }
7453
+ }, null);
7454
+ const header = vue.createVNode(antDesignVue.LayoutHeader, null, {
7396
7455
  default: () => [vue.createVNode(Header$1, {
7397
7456
  "menu": props.showNav ? props.userMenu : [],
7398
7457
  "withSearch": props.showNav,
@@ -7407,47 +7466,49 @@ const Layout = vue.defineComponent({
7407
7466
  "onLogout": () => emit("logout"),
7408
7467
  "onExtraPage": e => emit("extraPage", e)
7409
7468
  }, null)]
7410
- }), vue.createVNode(antDesignVue.Layout, null, {
7411
- default: () => [showSide.value && vue.createVNode(antDesignVue.LayoutSider, {
7412
- "class": `${config.prefix}-layout-sider`,
7413
- "width": "10.416vw",
7414
- "collapsedWidth": "3.125vw",
7415
- "collapsed": isFolder.value
7416
- }, {
7417
- default: () => [vue.createVNode("div", {
7418
- "class": ["folder", {
7419
- isFold: isFolder.value
7420
- }],
7421
- "onClick": () => toggleFolder()
7422
- }, [isFolder.value ? vue.createVNode(iconsVue.MenuUnfoldOutlined, null, null) : vue.createVNode(iconsVue.MenuFoldOutlined, null, null)]), vue.createVNode(SideMenu$1, {
7423
- "menu": sideMenuShow.value,
7424
- "onMenuSelect": handleMenuSelect,
7425
- "extraPages": props.extraPages,
7426
- "expandAll": !!menuRef
7427
- }, null), vue.createVNode("div", {
7428
- "class": "copyright"
7429
- }, [props.copyRight])]
7430
- }), vue.createVNode(antDesignVue.LayoutContent, {
7431
- "class": {
7432
- "only-page": isOnlyPage
7433
- }
7434
- }, {
7435
- default: () => [vue.createVNode(PageContent, {
7436
- "pageContainerRef": pageContainerRef,
7437
- "currMenu": currMenu.value,
7438
- "menu": props.userMenu,
7439
- "extraPages": props.extraPages,
7440
- "appList": props.appList,
7441
- "showTabList": (props.withMenu || showSideMenu.value) && !isOnlyPage
7442
- }, null)]
7469
+ });
7470
+ const sider = vue.createVNode(antDesignVue.LayoutSider, {
7471
+ "class": `${config.prefix}-layout-sider`,
7472
+ "width": "10.416vw",
7473
+ "collapsedWidth": "3.125vw",
7474
+ "collapsed": isFolder.value
7475
+ }, {
7476
+ default: () => [vue.createVNode("div", {
7477
+ "class": ["folder", {
7478
+ isFold: isFolder.value
7479
+ }],
7480
+ "onClick": () => toggleFolder()
7481
+ }, [isFolder.value ? vue.createVNode(iconsVue.MenuUnfoldOutlined, null, null) : vue.createVNode(iconsVue.MenuFoldOutlined, null, null)]), vue.createVNode(SideMenu$1, {
7482
+ "menu": sideMenuShow.value,
7483
+ "onMenuSelect": handleMenuSelect,
7484
+ "extraPages": props.extraPages,
7485
+ "expandAll": !!menuRef
7486
+ }, null), vue.createVNode("div", {
7487
+ "class": "copyright"
7488
+ }, [props.copyRight])]
7489
+ });
7490
+ const content = vue.createVNode(PageContent, {
7491
+ "pageContainerRef": pageContainerRef,
7492
+ "currMenu": currMenu.value,
7493
+ "menu": props.userMenu,
7494
+ "extraPages": props.extraPages,
7495
+ "appList": props.appList,
7496
+ "showTabList": (props.withMenu || showSideMenu.value) && !isOnlyPage
7497
+ }, null);
7498
+ return vue.createVNode("div", {
7499
+ "class": `${config.prefix}-layout`
7500
+ }, [vue.createVNode(antDesignVue.Layout, null, {
7501
+ default: () => [showHeader.value && header, vue.createVNode(antDesignVue.Layout, null, {
7502
+ default: () => [showSide.value && sider, vue.createVNode(antDesignVue.LayoutContent, {
7503
+ "class": {
7504
+ "only-page": isOnlyPage
7505
+ }
7506
+ }, _isSlot$c(content) ? content : {
7507
+ default: () => [content]
7508
+ })]
7443
7509
  })]
7444
- })]
7445
- }), showMask.value && vue.createVNode("div", {
7446
- "class": "layout-mask",
7447
- "style": {
7448
- clipPath: modalPath.value
7449
- }
7450
- }, null)]);
7510
+ }), showMask.value && modalMask]);
7511
+ };
7451
7512
  }
7452
7513
  });
7453
7514
  var index$8 = installComponent(Layout, "layout");
@@ -8342,39 +8403,41 @@ const ChildHeader = vue.defineComponent({
8342
8403
 
8343
8404
  const isIndependentApp = query => !!query.token && !!query.onlyPage;
8344
8405
  const loginFun = new Login$1();
8345
- const requestLogo = async () => {
8346
- const res = await fetch("/api/common/v1/sysconfig/searchImage?imgType=4&editImg=1&clientType=web");
8347
- const blob = await res.blob();
8348
- return URL.createObjectURL(blob);
8349
- };
8350
- const requestUserTree = async () => {
8351
- const headers = getCommonHeaders();
8352
- const res = await fetch("/api/common/v1/menu/tree", {
8353
- headers
8354
- });
8355
- const treeData = await res.json();
8356
- return treeData.data;
8357
- };
8358
- const requestCopyright = async () => {
8359
- const res = await fetch("/api/common/v1/sysconfig/getSysConfig?clientType=web");
8360
- const data = await res.json();
8361
- return data.data.homepageCopyright;
8362
- };
8363
- const postLogout = async () => {
8364
- const headers = getCommonHeaders();
8365
- await fetch("/api/common/v1/log/insert", {
8366
- method: "POST",
8367
- headers: {
8368
- ...headers,
8369
- "Content-Type": "application/json;charset=UTF-8"
8370
- },
8371
- body: JSON.stringify({
8372
- softSysId: "1",
8373
- operateId: "111",
8374
- recordId: "11",
8375
- content: "\u767B\u51FA"
8376
- })
8377
- });
8406
+ const httpUtil = {
8407
+ requestLogo: async () => {
8408
+ const res = await fetch("/api/common/v1/sysconfig/searchImage?imgType=4&editImg=1&clientType=web");
8409
+ const blob = await res.blob();
8410
+ return URL.createObjectURL(blob);
8411
+ },
8412
+ requestUserTree: async () => {
8413
+ const headers = getCommonHeaders();
8414
+ const res = await fetch("/api/common/v1/menu/tree", {
8415
+ headers
8416
+ });
8417
+ const treeData = await res.json();
8418
+ return treeData.data;
8419
+ },
8420
+ requestCopyright: async () => {
8421
+ const res = await fetch("/api/common/v1/sysconfig/getSysConfig?clientType=web");
8422
+ const data = await res.json();
8423
+ return data.data.homepageCopyright;
8424
+ },
8425
+ postLogout: async () => {
8426
+ const headers = getCommonHeaders();
8427
+ await fetch("/api/common/v1/log/insert", {
8428
+ method: "POST",
8429
+ headers: {
8430
+ ...headers,
8431
+ "Content-Type": "application/json;charset=UTF-8"
8432
+ },
8433
+ body: JSON.stringify({
8434
+ softSysId: "1",
8435
+ operateId: "111",
8436
+ recordId: "11",
8437
+ content: "\u767B\u51FA"
8438
+ })
8439
+ });
8440
+ }
8378
8441
  };
8379
8442
  const DefaultLayout = vue.defineComponent({
8380
8443
  async beforeRouteEnter(to) {
@@ -8419,12 +8482,12 @@ const DefaultLayout = vue.defineComponent({
8419
8482
  const userInfo = core.useSessionStorage("userinfo", {});
8420
8483
  const logo = vue.ref();
8421
8484
  const getLogo = async () => {
8422
- const str = await requestLogo();
8485
+ const str = await httpUtil.requestLogo();
8423
8486
  logo.value = str;
8424
8487
  };
8425
8488
  const copyright = vue.ref("");
8426
8489
  const getCopyright = async () => {
8427
- const str = await requestCopyright();
8490
+ const str = await httpUtil.requestCopyright();
8428
8491
  copyright.value = str;
8429
8492
  };
8430
8493
  const isIndependent = isIndependentApp(route.query);
@@ -8449,7 +8512,7 @@ const DefaultLayout = vue.defineComponent({
8449
8512
  });
8450
8513
  const permissionMenu = vue.ref([]);
8451
8514
  const getPermissionMenu = async () => {
8452
- const tree = await requestUserTree();
8515
+ const tree = await httpUtil.requestUserTree();
8453
8516
  const appRefName = route.query.menuRef ?? undefined.VITE_APP_NAME;
8454
8517
  let userMenu = getMenuByKey(tree, appRefName, "remark");
8455
8518
  if (!userMenu) {
@@ -8460,9 +8523,8 @@ const DefaultLayout = vue.defineComponent({
8460
8523
  const menuList = vue.computed(() => isDev ? devMenuList.value : permissionMenu.value);
8461
8524
  const isIframe = vue.ref(false);
8462
8525
  const iframeUrl = vue.ref("");
8463
- vue.watch([route, menuList], ([{
8464
- query
8465
- }]) => {
8526
+ vue.watch([route, menuList], () => {
8527
+ const query = route.query;
8466
8528
  if (query.iframeId && menuList.value.length) {
8467
8529
  isIframe.value = true;
8468
8530
  const menuRecord = getMenuByKey(menuList.value, query.iframeId, "id");
@@ -8484,7 +8546,7 @@ const DefaultLayout = vue.defineComponent({
8484
8546
  }
8485
8547
  });
8486
8548
  const handleLogout = async () => {
8487
- await postLogout();
8549
+ await httpUtil.postLogout();
8488
8550
  sessionStorage.clear();
8489
8551
  localStorage.clear();
8490
8552
  antDesignVue.message.info("\u7528\u6237\u9000\u51FA\u767B\u5F55");
@@ -8510,48 +8572,51 @@ const DefaultLayout = vue.defineComponent({
8510
8572
  "class": "independent-container"
8511
8573
  }, [vue.createVNode(vue.resolveComponent("router-view"), null, null)]);
8512
8574
  }
8575
+ const header = vue.createVNode(antDesignVue.LayoutHeader, {
8576
+ "class": "header-container"
8577
+ }, {
8578
+ default: () => [isDev ? vue.createVNode(ChildHeaderDev, {
8579
+ "userInfo": userInfo.value
8580
+ }, null) : vue.createVNode(ChildHeader, {
8581
+ "userInfo": userInfo.value,
8582
+ "logo": logo.value,
8583
+ "onLogout": handleLogout
8584
+ }, null)]
8585
+ });
8586
+ const sider = vue.createVNode(antDesignVue.LayoutSider, {
8587
+ "class": `${config.prefix}-layout-sider`,
8588
+ "width": "10.416vw",
8589
+ "collapsedWidth": "3.125vw",
8590
+ "collapsed": isFold.value
8591
+ }, {
8592
+ default: () => [vue.createVNode("div", {
8593
+ "class": ["folder", {
8594
+ isFold: isFold.value
8595
+ }],
8596
+ "onClick": () => toggleFold()
8597
+ }, [isFold.value ? vue.createVNode(iconsVue.MenuUnfoldOutlined, null, null) : vue.createVNode(iconsVue.MenuFoldOutlined, null, null)]), vue.createVNode(SideMenu, {
8598
+ "menuList": menuList.value
8599
+ }, null), vue.createVNode("div", {
8600
+ "class": "copyright"
8601
+ }, [copyright.value])]
8602
+ });
8603
+ const content = vue.createVNode(antDesignVue.LayoutContent, {
8604
+ "class": "layout-content"
8605
+ }, {
8606
+ default: () => [vue.createVNode("div", {
8607
+ "class": "content-inner"
8608
+ }, [vue.withDirectives(vue.createVNode(vue.resolveComponent("router-view"), null, null), [[vue.vShow, !isIframe.value]]), vue.withDirectives(vue.createVNode("iframe", {
8609
+ "src": iframeUrl.value,
8610
+ "height": "100%",
8611
+ "width": "100%",
8612
+ "frameborder": "0"
8613
+ }, null), [[vue.vShow, isIframe.value]])])]
8614
+ });
8513
8615
  return vue.createVNode(antDesignVue.Layout, {
8514
8616
  "class": `${config.prefix}-child-layout`
8515
8617
  }, {
8516
- default: () => [props.withHeader && vue.createVNode(antDesignVue.LayoutHeader, {
8517
- "class": "header-container"
8518
- }, {
8519
- default: () => [isDev ? vue.createVNode(ChildHeaderDev, {
8520
- "userInfo": userInfo.value
8521
- }, null) : vue.createVNode(ChildHeader, {
8522
- "userInfo": userInfo.value,
8523
- "logo": logo.value,
8524
- "onLogout": handleLogout
8525
- }, null)]
8526
- }), vue.createVNode(antDesignVue.Layout, null, {
8527
- default: () => [vue.createVNode(antDesignVue.LayoutSider, {
8528
- "class": `${config.prefix}-layout-sider`,
8529
- "width": "10.416vw",
8530
- "collapsedWidth": "3.125vw",
8531
- "collapsed": isFold.value
8532
- }, {
8533
- default: () => [vue.createVNode("div", {
8534
- "class": ["folder", {
8535
- isFold: isFold.value
8536
- }],
8537
- "onClick": () => toggleFold()
8538
- }, [isFold.value ? vue.createVNode(iconsVue.MenuUnfoldOutlined, null, null) : vue.createVNode(iconsVue.MenuFoldOutlined, null, null)]), vue.createVNode(SideMenu, {
8539
- "menuList": menuList.value
8540
- }, null), vue.createVNode("div", {
8541
- "class": "copyright"
8542
- }, [copyright.value])]
8543
- }), vue.createVNode(antDesignVue.LayoutContent, {
8544
- "class": "layout-content"
8545
- }, {
8546
- default: () => [vue.createVNode("div", {
8547
- "class": "content-inner"
8548
- }, [vue.withDirectives(vue.createVNode(vue.resolveComponent("router-view"), null, null), [[vue.vShow, !isIframe.value]]), vue.withDirectives(vue.createVNode("iframe", {
8549
- "src": iframeUrl.value,
8550
- "height": "100%",
8551
- "width": "100%",
8552
- "frameborder": "0"
8553
- }, null), [[vue.vShow, isIframe.value]])])]
8554
- })]
8618
+ default: () => [props.withHeader && header, vue.createVNode(antDesignVue.Layout, null, {
8619
+ default: () => [sider, content]
8555
8620
  })]
8556
8621
  });
8557
8622
  };