@ibiz-template/mob-vue3-components 0.7.41-alpha.21 → 0.7.41-alpha.22
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/dist/ibiz-markdown-editor-COU_MxNu.js +2 -0
- package/dist/ibiz-markdown-editor-COU_MxNu.js.map +1 -0
- package/dist/index-Bn7VkqJp.js +76 -0
- package/dist/index-Bn7VkqJp.js.map +1 -0
- package/dist/{index-BkzKmBm3.js → index-ChdHGLJI.js} +2 -2
- package/dist/{index-BkzKmBm3.js.map → index-ChdHGLJI.js.map} +1 -1
- package/dist/index-Dd7yiMzY.js +2 -0
- package/dist/index-Dd7yiMzY.js.map +1 -0
- package/dist/index.es-D0mZvSDS.js +14 -0
- package/dist/index.es-D0mZvSDS.js.map +1 -0
- package/dist/index.min.css +9 -9
- package/dist/index.system.min.js +1 -1
- package/dist/{quill-D-355-KZ.js → quill-BOA7ZLOz.js} +2 -2
- package/dist/{quill-D-355-KZ.js.map → quill-BOA7ZLOz.js.map} +1 -1
- package/dist/{quill-editor-DyVF1l3P.js → quill-editor-DcZd_lqh.js} +2 -2
- package/dist/{quill-editor-DyVF1l3P.js.map → quill-editor-DcZd_lqh.js.map} +1 -1
- package/dist/quill-editor-preview-DghpeKpg.js +2 -0
- package/dist/quill-editor-preview-DghpeKpg.js.map +1 -0
- package/dist/{tree-sdPuTW-7.js → tree-BTa0bMPr.js} +2 -2
- package/dist/{tree-sdPuTW-7.js.map → tree-BTa0bMPr.js.map} +1 -1
- package/dist/xlsx-util-CQaOn5OK.js +105 -0
- package/dist/xlsx-util-CQaOn5OK.js.map +1 -0
- package/es/_virtual/FileSaver.min.mjs +3 -0
- package/es/_virtual/index12.mjs +2 -2
- package/es/_virtual/index14.mjs +2 -2
- package/es/_virtual/index18.mjs +2 -2
- package/es/_virtual/index19.mjs +2 -2
- package/es/common/split-trigger/split-trigger.css +1 -1
- package/es/common/tab-layout/tab-default-layout/tab-default-layout.mjs +1 -0
- package/es/common/tab-layout/tab-sidebar-layout/tab-sidebar-layout.css +1 -1
- package/es/common/view-message/view-message.mjs +1 -1
- package/es/control/app-menu-icon-view/app-menu-icon-view.css +1 -1
- package/es/control/app-menu-icon-view/app-menu-icon-view.mjs +1 -1
- package/es/control/app-menu-list-view/app-menu-list-view.css +1 -1
- package/es/control/calendar/calendar.css +1 -1
- package/es/control/calendar/calendar.mjs +1 -1
- package/es/control/caption-bar/caption-bar.css +1 -1
- package/es/control/dashboard/custom-dashboard-design/custom-dashboard-design.css +1 -1
- package/es/control/dashboard/dashboard.css +1 -1
- package/es/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
- package/es/control/data-view/data-view.css +1 -1
- package/es/control/drbar/drbar.css +1 -1
- package/es/control/drtab/drtab.controller.mjs +1 -1
- package/es/control/drtab/drtab.css +1 -1
- package/es/control/list/md-ctrl/md-ctrl.css +1 -1
- package/es/control/search-bar/filter-tree/filter-tree.css +1 -1
- package/es/control/search-bar/search-bar.css +1 -1
- package/es/control/tab-exp-panel/tab-exp-panel.css +1 -1
- package/es/control/toolbar/toolbar-render-util.mjs +4 -0
- package/es/control/toolbar/toolbar.css +1 -1
- package/es/control/tree/tree.css +1 -1
- package/es/control/wizard-panel/wizard-panel.css +1 -1
- package/es/editor/array/ibiz-array/ibiz-array.css +1 -1
- package/es/editor/data-picker/picker-editor.controller.mjs +1 -1
- package/es/editor/html/quill-editor/quill-editor.css +1 -1
- package/es/editor/html/quill-editor-preview/quill-editor-preview.css +1 -1
- package/es/editor/html/quill-editor-preview/quill-editor-preview.mjs +1 -2
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +3 -1
- package/es/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
- package/es/editor/stepper/ibiz-stepper/ibiz-stepper.css +1 -1
- package/es/editor/text-box/ibiz-input-number/ibiz-input-number.css +1 -1
- package/es/editor/text-box/input/input.mjs +33 -2
- package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.css +1 -1
- package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.mjs +1 -1
- package/es/ibiz-vue3.mjs +1 -0
- package/es/index.mjs +3 -0
- package/es/locale/en/index.mjs +23 -0
- package/es/locale/zh-CN/index.mjs +26 -1
- package/es/mob-app/components/modal-router-shell/modal-router-shell.mjs +2 -2
- package/es/mob-app/guard/auth-guard/auth-guard.mjs +206 -194
- package/es/mob-app/guard/auth-guard/dyna-auth-guard.mjs +65 -0
- package/es/mob-app/guard/index.mjs +1 -0
- package/es/mob-app/index.mjs +1 -0
- package/es/mob-app/main.mjs +14 -1
- package/es/mob-app/router/index.mjs +6 -4
- package/es/node_modules/.pnpm/@amap_amap-jsapi-loader@1.0.1_patch_hash_73bpcwbs2m5ip4qppmz6a7epsa/node_modules/@amap/amap-jsapi-loader/dist/index.mjs +1 -1
- package/es/node_modules/.pnpm/@ibiz-template-plugin_ibiz-mob-ai-chat@0.0.1_cherry-markdown@0.8.58_interactjs@1.10.27_qx-uti_xgmgjpxet4ghyc7txs4jkjxilq/node_modules/@ibiz-template-plugin/ibiz-mob-ai-chat/dist/index.es.mjs +4425 -0
- package/es/node_modules/.pnpm/dingtalk-jsapi@3.2.0/node_modules/dingtalk-jsapi/lib/packages/frame-talk-client-pc/index.mjs +1 -1
- package/es/node_modules/.pnpm/file-saver@2.0.5/node_modules/file-saver/dist/FileSaver.min.mjs +15 -0
- package/es/node_modules/.pnpm/lodash.clonedeep@4.5.0/node_modules/lodash.clonedeep/index.mjs +1 -1
- package/es/node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.mjs +1 -1
- package/es/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx.mjs +24580 -0
- package/es/panel-component/view-content-panel-container/view-content-panel-container.css +1 -1
- package/es/panel-component/view-content-panel-container/view-content-panel-container.mjs +18 -4
- package/es/util/ai-chat-util/ai-chat-util.mjs +932 -0
- package/es/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
- package/es/util/ai-chat-util/ai-feedback/ai-feedback.mjs +140 -0
- package/es/util/app-drawer/app-drawer-component.mjs +7 -17
- package/es/util/app-modal/app-modal-component.mjs +4 -2
- package/es/util/app-util/app-util.mjs +76 -6
- package/es/util/index.mjs +2 -0
- package/es/util/list-util/list-render-util.mjs +1 -1
- package/es/util/user-route-util/user-route-util.mjs +55 -0
- package/es/util/xlsx-util/xlsx-util.mjs +163 -0
- package/es/view/portal-view/portal-view.mjs +3 -2
- package/es/view-engine/mob-calendar-view.engine.mjs +4 -0
- package/es/view-engine/mob-pickup-md-view.engine.mjs +1 -0
- package/lib/_virtual/FileSaver.min.cjs +5 -0
- package/lib/_virtual/index12.cjs +2 -2
- package/lib/_virtual/index14.cjs +2 -2
- package/lib/_virtual/index18.cjs +2 -2
- package/lib/_virtual/index19.cjs +2 -2
- package/lib/common/split-trigger/split-trigger.css +1 -1
- package/lib/common/tab-layout/tab-default-layout/tab-default-layout.cjs +1 -0
- package/lib/common/tab-layout/tab-sidebar-layout/tab-sidebar-layout.css +1 -1
- package/lib/common/view-message/view-message.cjs +1 -1
- package/lib/control/app-menu-icon-view/app-menu-icon-view.cjs +1 -1
- package/lib/control/app-menu-icon-view/app-menu-icon-view.css +1 -1
- package/lib/control/app-menu-list-view/app-menu-list-view.css +1 -1
- package/lib/control/calendar/calendar.cjs +1 -1
- package/lib/control/calendar/calendar.css +1 -1
- package/lib/control/caption-bar/caption-bar.css +1 -1
- package/lib/control/dashboard/custom-dashboard-design/custom-dashboard-design.css +1 -1
- package/lib/control/dashboard/dashboard.css +1 -1
- package/lib/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
- package/lib/control/data-view/data-view.css +1 -1
- package/lib/control/drbar/drbar.css +1 -1
- package/lib/control/drtab/drtab.controller.cjs +1 -1
- package/lib/control/drtab/drtab.css +1 -1
- package/lib/control/list/md-ctrl/md-ctrl.css +1 -1
- package/lib/control/search-bar/filter-tree/filter-tree.css +1 -1
- package/lib/control/search-bar/search-bar.css +1 -1
- package/lib/control/tab-exp-panel/tab-exp-panel.css +1 -1
- package/lib/control/toolbar/toolbar-render-util.cjs +4 -0
- package/lib/control/toolbar/toolbar.css +1 -1
- package/lib/control/tree/tree.css +1 -1
- package/lib/control/wizard-panel/wizard-panel.css +1 -1
- package/lib/editor/array/ibiz-array/ibiz-array.css +1 -1
- package/lib/editor/data-picker/picker-editor.controller.cjs +1 -1
- package/lib/editor/html/quill-editor/quill-editor.css +1 -1
- package/lib/editor/html/quill-editor-preview/quill-editor-preview.cjs +1 -2
- package/lib/editor/html/quill-editor-preview/quill-editor-preview.css +1 -1
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +3 -1
- package/lib/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
- package/lib/editor/stepper/ibiz-stepper/ibiz-stepper.css +1 -1
- package/lib/editor/text-box/ibiz-input-number/ibiz-input-number.css +1 -1
- package/lib/editor/text-box/input/input.cjs +32 -1
- package/lib/editor/upload/ibiz-file-upload/ibiz-file-upload.cjs +1 -1
- package/lib/editor/upload/ibiz-file-upload/ibiz-file-upload.css +1 -1
- package/lib/ibiz-vue3.cjs +1 -0
- package/lib/index.cjs +7 -0
- package/lib/locale/en/index.cjs +23 -0
- package/lib/locale/zh-CN/index.cjs +26 -1
- package/lib/mob-app/components/modal-router-shell/modal-router-shell.cjs +2 -2
- package/lib/mob-app/guard/auth-guard/auth-guard.cjs +206 -194
- package/lib/mob-app/guard/auth-guard/dyna-auth-guard.cjs +67 -0
- package/lib/mob-app/guard/index.cjs +2 -0
- package/lib/mob-app/index.cjs +2 -0
- package/lib/mob-app/main.cjs +14 -1
- package/lib/mob-app/router/index.cjs +6 -4
- package/lib/node_modules/.pnpm/@amap_amap-jsapi-loader@1.0.1_patch_hash_73bpcwbs2m5ip4qppmz6a7epsa/node_modules/@amap/amap-jsapi-loader/dist/index.cjs +1 -1
- package/lib/node_modules/.pnpm/@ibiz-template-plugin_ibiz-mob-ai-chat@0.0.1_cherry-markdown@0.8.58_interactjs@1.10.27_qx-uti_xgmgjpxet4ghyc7txs4jkjxilq/node_modules/@ibiz-template-plugin/ibiz-mob-ai-chat/dist/index.es.cjs +4427 -0
- package/lib/node_modules/.pnpm/dingtalk-jsapi@3.2.0/node_modules/dingtalk-jsapi/lib/packages/frame-talk-client-pc/index.cjs +1 -1
- package/lib/node_modules/.pnpm/file-saver@2.0.5/node_modules/file-saver/dist/FileSaver.min.cjs +20 -0
- package/lib/node_modules/.pnpm/lodash.clonedeep@4.5.0/node_modules/lodash.clonedeep/index.cjs +1 -1
- package/lib/node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.cjs +1 -1
- package/lib/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx.cjs +24599 -0
- package/lib/panel-component/view-content-panel-container/view-content-panel-container.cjs +18 -4
- package/lib/panel-component/view-content-panel-container/view-content-panel-container.css +1 -1
- package/lib/util/ai-chat-util/ai-chat-util.cjs +934 -0
- package/lib/util/ai-chat-util/ai-feedback/ai-feedback.cjs +142 -0
- package/lib/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
- package/lib/util/app-drawer/app-drawer-component.cjs +7 -17
- package/lib/util/app-modal/app-modal-component.cjs +4 -2
- package/lib/util/app-util/app-util.cjs +75 -5
- package/lib/util/index.cjs +5 -0
- package/lib/util/list-util/list-render-util.cjs +1 -1
- package/lib/util/user-route-util/user-route-util.cjs +58 -0
- package/lib/util/xlsx-util/xlsx-util.cjs +166 -0
- package/lib/view/portal-view/portal-view.cjs +3 -2
- package/lib/view-engine/mob-calendar-view.engine.cjs +4 -0
- package/lib/view-engine/mob-pickup-md-view.engine.cjs +1 -0
- package/package.json +12 -9
- package/dist/ibiz-markdown-editor-DMe7ZdYW.js +0 -2
- package/dist/ibiz-markdown-editor-DMe7ZdYW.js.map +0 -1
- package/dist/index-CADWRoaa.js +0 -76
- package/dist/index-CADWRoaa.js.map +0 -1
- package/dist/index-ugd4IDkI.js +0 -2
- package/dist/index-ugd4IDkI.js.map +0 -1
- package/dist/quill-editor-preview-3eAbHBYz.js +0 -2
- package/dist/quill-editor-preview-3eAbHBYz.js.map +0 -1
|
@@ -1,66 +1,121 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@ibiz-template/core');
|
|
4
|
-
var modelHelper = require('@ibiz-template/model-helper');
|
|
5
4
|
var ramda = require('ramda');
|
|
6
5
|
var vue3Util = require('@ibiz-template/vue3-util');
|
|
7
6
|
var devtool = require('@ibiz-template/devtool');
|
|
8
|
-
var index = require('../../../locale/index.cjs');
|
|
9
7
|
var authGuardHooks = require('../auth-guard-hooks.cjs');
|
|
10
8
|
|
|
11
9
|
"use strict";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
class AuthGuard {
|
|
11
|
+
/**
|
|
12
|
+
* @description 总的入口校验
|
|
13
|
+
* @param {IParams} appContext
|
|
14
|
+
* @param {boolean} [permission=true]
|
|
15
|
+
* @returns {*} {Promise<boolean>}
|
|
16
|
+
* @memberof AuthGuard
|
|
17
|
+
*/
|
|
18
|
+
async verify(appContext, permission = true) {
|
|
19
|
+
if (permission) {
|
|
20
|
+
let result = true;
|
|
21
|
+
try {
|
|
22
|
+
if (ibiz.env.enableAnonymous) {
|
|
23
|
+
await this.anonymousValidate(appContext);
|
|
24
|
+
} else {
|
|
25
|
+
await this.appInit(appContext);
|
|
26
|
+
}
|
|
27
|
+
} catch (error) {
|
|
28
|
+
result = false;
|
|
29
|
+
error.tag = "APPINIT";
|
|
30
|
+
ibiz.util.error.handle(error);
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
if (ibiz.env.enableAnonymous) {
|
|
35
|
+
try {
|
|
36
|
+
await this.anonymousValidate(appContext);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
error.tag = "APPINIT";
|
|
39
|
+
ibiz.util.error.handle(error);
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
await this.initModel(appContext, false);
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
24
46
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
47
|
+
/**
|
|
48
|
+
* @description 加载应用数据
|
|
49
|
+
* @param {IParams} [context]
|
|
50
|
+
* @returns {*} {Promise<void>}
|
|
51
|
+
* @memberof AuthGuard
|
|
52
|
+
*/
|
|
53
|
+
async loadAppData(context) {
|
|
54
|
+
let res;
|
|
55
|
+
if (context && Object.keys(context).length > 0) {
|
|
56
|
+
res = await ibiz.net.get("/appdata", context);
|
|
57
|
+
} else {
|
|
58
|
+
res = await ibiz.net.get("/appdata");
|
|
59
|
+
}
|
|
60
|
+
if (res.ok) {
|
|
61
|
+
ibiz.appData = res.data;
|
|
62
|
+
ibiz.appData.context.modeldesigndefaultmode = "close";
|
|
63
|
+
if (window.location.search && window.location.search.indexOf("srfignoredevtool=true") !== -1)
|
|
64
|
+
return;
|
|
65
|
+
devtool.updateDevToolConfig();
|
|
33
66
|
}
|
|
34
67
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
68
|
+
/**
|
|
69
|
+
* @description 加载组织数据
|
|
70
|
+
* @returns {*} {Promise<void>}
|
|
71
|
+
* @memberof AuthGuard
|
|
72
|
+
*/
|
|
73
|
+
async loadOrgData() {
|
|
74
|
+
const res = await ibiz.net.get(`/uaa/getbydcsystem/${ibiz.env.dcSystem}`);
|
|
75
|
+
if (res.ok) {
|
|
76
|
+
const orgDataItems = res.data;
|
|
77
|
+
if (orgDataItems) {
|
|
78
|
+
const [data] = orgDataItems;
|
|
79
|
+
ibiz.orgData = data;
|
|
47
80
|
}
|
|
48
81
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @description 加载主题插件
|
|
85
|
+
* @returns {*} {Promise<void>}
|
|
86
|
+
* @memberof AuthGuard
|
|
87
|
+
*/
|
|
88
|
+
async loadTheme() {
|
|
89
|
+
const app = ibiz.hub.getApp();
|
|
90
|
+
const uiThemes = app.model.appUIThemes || [];
|
|
91
|
+
if (uiThemes.length > 0) {
|
|
92
|
+
const colorThemes = uiThemes.filter((uiTheme) => {
|
|
93
|
+
return uiTheme.themeParams && uiTheme.themeParams["icon-theme"] !== "true";
|
|
94
|
+
});
|
|
95
|
+
if (colorThemes.length > 0) {
|
|
96
|
+
for (let index = 0; index < colorThemes.length; index++) {
|
|
97
|
+
const colorTheme = colorThemes[index];
|
|
98
|
+
await ibiz.util.theme.loadTheme(colorTheme);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const iconThemes = uiThemes.filter((uiTheme) => {
|
|
102
|
+
return uiTheme.themeParams && uiTheme.themeParams["icon-theme"] === "true";
|
|
103
|
+
});
|
|
104
|
+
if (iconThemes.length > 0) {
|
|
105
|
+
for (let index = 0; index < iconThemes.length; index++) {
|
|
106
|
+
const iconTheme = iconThemes[index];
|
|
107
|
+
await ibiz.util.theme.loadTheme(iconTheme, "ICON");
|
|
108
|
+
}
|
|
56
109
|
}
|
|
57
110
|
}
|
|
58
111
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
112
|
+
/**
|
|
113
|
+
* @description 根据应用自定义参数解析成环境变量
|
|
114
|
+
* @param {IApplication} app
|
|
115
|
+
* @returns {*} {Promise<void>}
|
|
116
|
+
* @memberof AuthGuard
|
|
117
|
+
*/
|
|
118
|
+
async initEnvironment(app) {
|
|
64
119
|
const userParam = app.userParam;
|
|
65
120
|
if (userParam) {
|
|
66
121
|
Object.keys(userParam).forEach((key) => {
|
|
@@ -83,172 +138,129 @@ async function initEnvironment() {
|
|
|
83
138
|
ibiz.log.setLevel(ibiz.env.logLevel);
|
|
84
139
|
}
|
|
85
140
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const app = await ibiz.hub.getAppAsync(ibiz.env.appId);
|
|
107
|
-
await initEnvironment();
|
|
108
|
-
await vue3Util.AppHooks.initedApp.call({ context, app });
|
|
109
|
-
const appModel = app.model;
|
|
110
|
-
ibiz.env.isMob = appModel.mobileApp === true;
|
|
111
|
-
if (ibiz.env.isEnableMultiLan) {
|
|
112
|
-
const lang = ibiz.i18n.getLang();
|
|
113
|
-
const m = await helper.getPSAppLang(lang.replace("-", "_").toUpperCase());
|
|
114
|
-
const items = m.languageItems || [];
|
|
115
|
-
const data = {};
|
|
116
|
-
items.forEach((item) => {
|
|
117
|
-
data[item.lanResTag] = item.content;
|
|
118
|
-
});
|
|
119
|
-
index.i18n.global.mergeLocaleMessage(lang, data);
|
|
120
|
-
}
|
|
121
|
-
const module = await import('@ibiz-template/mob-theme');
|
|
122
|
-
const theme = module.default || module;
|
|
123
|
-
vue3Util.AppHooks.useComponent.callSync(null, theme);
|
|
124
|
-
if (ibiz.config.theme)
|
|
125
|
-
ibiz.util.theme.setTheme(ibiz.config.theme);
|
|
126
|
-
if (appModel.appUIThemes) {
|
|
127
|
-
await loadTheme();
|
|
128
|
-
}
|
|
129
|
-
if (app.model.title) {
|
|
130
|
-
ibiz.util.setBrowserTitle("");
|
|
141
|
+
/**
|
|
142
|
+
* @description 初始化模型
|
|
143
|
+
* @param {IParams} context
|
|
144
|
+
* @param {boolean} [_permission=true]
|
|
145
|
+
* @returns {*} {Promise<void>}
|
|
146
|
+
* @memberof AuthGuard
|
|
147
|
+
*/
|
|
148
|
+
async initModel(context, _permission = true) {
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* @description 应用参数初始化
|
|
152
|
+
* @param {IParams} context
|
|
153
|
+
* @returns {*} {Promise<void>}
|
|
154
|
+
* @memberof AuthGuard
|
|
155
|
+
*/
|
|
156
|
+
async appInit(context) {
|
|
157
|
+
await vue3Util.AppHooks.beforeInitApp.call({ context });
|
|
158
|
+
await authGuardHooks.AuthGuardHooks.beforeAuth.call(null, null);
|
|
159
|
+
if (ibiz.env.isSaaSMode === true) {
|
|
160
|
+
await this.loadOrgData();
|
|
131
161
|
}
|
|
162
|
+
await this.loadAppData(context);
|
|
163
|
+
await authGuardHooks.AuthGuardHooks.afterAuth.call(null, null);
|
|
164
|
+
await vue3Util.AppHooks.authedApp.call({ context });
|
|
165
|
+
await this.initModel(context);
|
|
166
|
+
await ibiz.auth.extendLogin(context);
|
|
167
|
+
await ibiz.hub.notice.init();
|
|
132
168
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
169
|
+
/**
|
|
170
|
+
* @description 抛401异常
|
|
171
|
+
*/
|
|
172
|
+
throw401() {
|
|
173
|
+
throw new core.HttpError({
|
|
174
|
+
response: {
|
|
175
|
+
status: 401,
|
|
176
|
+
statusText: ibiz.i18n.t("mobApp.authGuard.noPermission")
|
|
177
|
+
}
|
|
178
|
+
});
|
|
139
179
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (status === 401) {
|
|
164
|
-
const refreshToken = core.getAppCookie(core.CoreConst.REFRESH_TOKEN);
|
|
165
|
-
if (refreshToken) {
|
|
166
|
-
await ibiz.auth.refreshToken();
|
|
167
|
-
await appInit(context);
|
|
168
|
-
return;
|
|
180
|
+
/**
|
|
181
|
+
* @description 匿名登录
|
|
182
|
+
* @param {IParams} context
|
|
183
|
+
* @returns {*} {Promise<void>}
|
|
184
|
+
*/
|
|
185
|
+
async anonymousValidate(context) {
|
|
186
|
+
const authInfo = ibiz.auth.getAuthInfo();
|
|
187
|
+
if (authInfo && !authInfo.isAnonymous) {
|
|
188
|
+
try {
|
|
189
|
+
await this.appInit(context);
|
|
190
|
+
return;
|
|
191
|
+
} catch (error) {
|
|
192
|
+
const { status } = error;
|
|
193
|
+
if (status === 401) {
|
|
194
|
+
const refreshToken = core.getAppCookie(core.CoreConst.REFRESH_TOKEN);
|
|
195
|
+
if (refreshToken) {
|
|
196
|
+
await ibiz.auth.refreshToken();
|
|
197
|
+
await this.appInit(context);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
ibiz.auth.clearAuthData();
|
|
201
|
+
} else {
|
|
202
|
+
throw error;
|
|
169
203
|
}
|
|
170
|
-
ibiz.auth.clearAuthData();
|
|
171
|
-
} else {
|
|
172
|
-
throw error;
|
|
173
204
|
}
|
|
174
205
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
206
|
+
if (authInfo == null ? void 0 : authInfo.token) {
|
|
207
|
+
try {
|
|
208
|
+
await this.appInit(context);
|
|
209
|
+
} catch (error) {
|
|
210
|
+
const { status } = error;
|
|
211
|
+
if (status === 401) {
|
|
212
|
+
const loginResult = await ibiz.auth.anonymousLogin();
|
|
213
|
+
if (!loginResult) {
|
|
214
|
+
this.throw401();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
await this.appInit(context);
|
|
218
|
+
} else {
|
|
219
|
+
throw error;
|
|
186
220
|
}
|
|
187
|
-
await appInit(context);
|
|
188
|
-
} else {
|
|
189
|
-
throw error;
|
|
190
221
|
}
|
|
191
222
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
await appInit(context);
|
|
200
|
-
}
|
|
201
|
-
const urlPaths = window.location.hash.split("/");
|
|
202
|
-
const viewName = urlPaths[urlPaths.length - 2];
|
|
203
|
-
let viewModel;
|
|
204
|
-
try {
|
|
205
|
-
if (["#", "index"].includes(viewName) && ibiz.hub.defaultPage) {
|
|
206
|
-
viewModel = await ibiz.hub.getAppView(ibiz.hub.defaultPage.id);
|
|
207
|
-
} else {
|
|
208
|
-
viewModel = await ibiz.hub.getAppView(viewName);
|
|
223
|
+
if (!authInfo || !authInfo.token) {
|
|
224
|
+
const loginResult = await ibiz.auth.anonymousLogin();
|
|
225
|
+
if (!loginResult) {
|
|
226
|
+
this.throw401();
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
await this.appInit(context);
|
|
209
230
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if (!viewModel) {
|
|
214
|
-
ibiz.log.error(
|
|
215
|
-
`\u627E\u4E0D\u5230\u89C6\u56FE\u6A21\u578B${viewName},\u8BF7\u786E\u4FDD\u8BE5\u89C6\u56FE\u914D\u7F6E\u4E86\u533F\u540D\u8BBF\u95EE\u548C\u7528\u6237\u5F15\u7528`
|
|
216
|
-
);
|
|
217
|
-
throw401();
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
if (viewModel.accUserMode !== 3) {
|
|
221
|
-
throw401();
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
async function AuthGuard(appContext, permission = true) {
|
|
225
|
-
if (permission) {
|
|
226
|
-
let result = true;
|
|
231
|
+
const urlPaths = window.location.hash.split("/");
|
|
232
|
+
const viewName = urlPaths[urlPaths.length - 2];
|
|
233
|
+
let viewModel;
|
|
227
234
|
try {
|
|
228
|
-
if (ibiz.
|
|
229
|
-
await
|
|
235
|
+
if (["#", "index"].includes(viewName) && ibiz.hub.defaultPage) {
|
|
236
|
+
viewModel = await ibiz.hub.getAppView(ibiz.hub.defaultPage.id);
|
|
230
237
|
} else {
|
|
231
|
-
await
|
|
238
|
+
viewModel = await ibiz.hub.getAppView(viewName);
|
|
232
239
|
}
|
|
233
240
|
} catch (error) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
241
|
+
ibiz.log.error(error);
|
|
242
|
+
}
|
|
243
|
+
if (!viewModel) {
|
|
244
|
+
ibiz.log.error(
|
|
245
|
+
`\u627E\u4E0D\u5230\u89C6\u56FE\u6A21\u578B${viewName},\u8BF7\u786E\u4FDD\u8BE5\u89C6\u56FE\u914D\u7F6E\u4E86\u533F\u540D\u8BBF\u95EE\u548C\u7528\u6237\u5F15\u7528`
|
|
246
|
+
);
|
|
247
|
+
this.throw401();
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (viewModel.accUserMode !== 3) {
|
|
251
|
+
this.throw401();
|
|
237
252
|
}
|
|
238
|
-
return result;
|
|
239
253
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
ibiz.util.
|
|
246
|
-
|
|
254
|
+
async initTheme(appModel) {
|
|
255
|
+
const module = await import('@ibiz-template/mob-theme');
|
|
256
|
+
const theme = module.default || module;
|
|
257
|
+
vue3Util.AppHooks.useComponent.callSync(null, theme);
|
|
258
|
+
if (ibiz.config.theme)
|
|
259
|
+
ibiz.util.theme.setTheme(ibiz.config.theme);
|
|
260
|
+
if (appModel.appUIThemes) {
|
|
261
|
+
await this.loadTheme();
|
|
247
262
|
}
|
|
248
|
-
} else {
|
|
249
|
-
await initModel(appContext, false);
|
|
250
263
|
}
|
|
251
|
-
return true;
|
|
252
264
|
}
|
|
253
265
|
|
|
254
266
|
exports.AuthGuard = AuthGuard;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var modelHelper = require('@ibiz-template/model-helper');
|
|
4
|
+
var vue3Util = require('@ibiz-template/vue3-util');
|
|
5
|
+
var authGuard = require('./auth-guard.cjs');
|
|
6
|
+
var index = require('../../../locale/index.cjs');
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __publicField = (obj, key, value) => {
|
|
12
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
13
|
+
return value;
|
|
14
|
+
};
|
|
15
|
+
class DynaAuthGuard extends authGuard.AuthGuard {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
__publicField(this, "hasModelInit", false);
|
|
19
|
+
__publicField(this, "noPermissionModel", false);
|
|
20
|
+
}
|
|
21
|
+
async initModel(context, permission = true) {
|
|
22
|
+
if (!this.hasModelInit || this.hasModelInit && this.noPermissionModel !== permission) {
|
|
23
|
+
const helper = new modelHelper.ModelHelper(
|
|
24
|
+
async (url) => {
|
|
25
|
+
if (ibiz.env.isLocalModel) {
|
|
26
|
+
const res2 = await ibiz.net.getModel(`./model${url}`);
|
|
27
|
+
return res2.data;
|
|
28
|
+
}
|
|
29
|
+
const res = await ibiz.net.get(
|
|
30
|
+
`${ibiz.env.remoteModelUrl}${url}`,
|
|
31
|
+
void 0,
|
|
32
|
+
permission ? {} : { srfdcsystem: ibiz.env.dcSystem }
|
|
33
|
+
);
|
|
34
|
+
return res.data;
|
|
35
|
+
},
|
|
36
|
+
ibiz.env.appId,
|
|
37
|
+
context,
|
|
38
|
+
permission
|
|
39
|
+
);
|
|
40
|
+
const app = await ibiz.hub.getAppAsync(ibiz.env.appId);
|
|
41
|
+
await this.initEnvironment(app);
|
|
42
|
+
await vue3Util.AppHooks.initedApp.call({ context, app });
|
|
43
|
+
const appModel = app.model;
|
|
44
|
+
ibiz.env.isMob = appModel.mobileApp === true;
|
|
45
|
+
if (ibiz.env.isEnableMultiLan) {
|
|
46
|
+
const lang = ibiz.i18n.getLang();
|
|
47
|
+
const m = await helper.getPSAppLang(
|
|
48
|
+
lang.replace("-", "_").toUpperCase()
|
|
49
|
+
);
|
|
50
|
+
const items = m.languageItems || [];
|
|
51
|
+
const data = {};
|
|
52
|
+
items.forEach((item) => {
|
|
53
|
+
data[item.lanResTag] = item.content;
|
|
54
|
+
});
|
|
55
|
+
index.i18n.global.mergeLocaleMessage(lang, data);
|
|
56
|
+
}
|
|
57
|
+
await this.initTheme(app);
|
|
58
|
+
if (app.model.title) {
|
|
59
|
+
ibiz.util.setBrowserTitle("");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
this.noPermissionModel = permission;
|
|
63
|
+
this.hasModelInit = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
exports.DynaAuthGuard = DynaAuthGuard;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var authGuard = require('./auth-guard/auth-guard.cjs');
|
|
4
|
+
var dynaAuthGuard = require('./auth-guard/dyna-auth-guard.cjs');
|
|
4
5
|
var authGuardHooks = require('./auth-guard-hooks.cjs');
|
|
5
6
|
|
|
6
7
|
"use strict";
|
|
7
8
|
|
|
8
9
|
exports.AuthGuard = authGuard.AuthGuard;
|
|
10
|
+
exports.DynaAuthGuard = dynaAuthGuard.DynaAuthGuard;
|
|
9
11
|
exports.AuthGuardHooks = authGuardHooks.AuthGuardHooks;
|
package/lib/mob-app/index.cjs
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
var main = require('./main.cjs');
|
|
4
4
|
require('./guard/index.cjs');
|
|
5
5
|
var authGuardHooks = require('./guard/auth-guard-hooks.cjs');
|
|
6
|
+
var authGuard = require('./guard/auth-guard/auth-guard.cjs');
|
|
6
7
|
|
|
7
8
|
"use strict";
|
|
8
9
|
|
|
9
10
|
exports.runApp = main.runApp;
|
|
10
11
|
exports.AuthGuardHooks = authGuardHooks.AuthGuardHooks;
|
|
12
|
+
exports.AuthGuard = authGuard.AuthGuard;
|
package/lib/mob-app/main.cjs
CHANGED
|
@@ -10,7 +10,9 @@ var createVueApp = require('./create-vue-app.cjs');
|
|
|
10
10
|
var index = require('./router/index.cjs');
|
|
11
11
|
require('./util/index.cjs');
|
|
12
12
|
require('../util/index.cjs');
|
|
13
|
+
require('./guard/index.cjs');
|
|
13
14
|
var unauthorizedHandler = require('./util/unauthorized-handler/unauthorized-handler.cjs');
|
|
15
|
+
var dynaAuthGuard = require('./guard/auth-guard/dyna-auth-guard.cjs');
|
|
14
16
|
var appUtil = require('../util/app-util/app-util.cjs');
|
|
15
17
|
var openViewUtil = require('../util/open-view-util/open-view-util.cjs');
|
|
16
18
|
var messageUtil = require('../util/message-util/message-util.cjs');
|
|
@@ -21,9 +23,10 @@ var loadingUtil = require('../util/loading-util/loading-util.cjs');
|
|
|
21
23
|
var overlayController = require('../util/overlay-controller/overlay-controller.cjs');
|
|
22
24
|
var fullscreenUtil = require('../util/fullscreen/fullscreen-util.cjs');
|
|
23
25
|
var qrcodeUtil = require('../util/qrcode-util/qrcode-util.cjs');
|
|
26
|
+
var aiChatUtil = require('../util/ai-chat-util/ai-chat-util.cjs');
|
|
24
27
|
|
|
25
28
|
"use strict";
|
|
26
|
-
async function runApp(plugins) {
|
|
29
|
+
async function runApp(plugins, opts) {
|
|
27
30
|
vue3Util.AppHooks.createApp.tap((_, app2) => {
|
|
28
31
|
if (plugins) {
|
|
29
32
|
plugins.forEach((plugin) => {
|
|
@@ -61,6 +64,15 @@ async function runApp(plugins) {
|
|
|
61
64
|
});
|
|
62
65
|
await attachEnvironmentConfig.attachEnvironmentConfig();
|
|
63
66
|
devtool.install();
|
|
67
|
+
let authGuard;
|
|
68
|
+
if (opts == null ? void 0 : opts.getAuthGuard) {
|
|
69
|
+
authGuard = opts.getAuthGuard();
|
|
70
|
+
} else {
|
|
71
|
+
authGuard = new dynaAuthGuard.DynaAuthGuard();
|
|
72
|
+
}
|
|
73
|
+
index.AppRouter.setAuthGuard(
|
|
74
|
+
(context, notLogin) => authGuard.verify(context, notLogin)
|
|
75
|
+
);
|
|
64
76
|
const router = index.AppRouter.getRouter();
|
|
65
77
|
app.use(router);
|
|
66
78
|
devtool.listenOpenDevTool(router);
|
|
@@ -78,6 +90,7 @@ async function runApp(plugins) {
|
|
|
78
90
|
return app.config.globalProperties.$textFormat(value, code);
|
|
79
91
|
};
|
|
80
92
|
ibiz.qrcodeUtil = new qrcodeUtil.QrcodeUtil();
|
|
93
|
+
ibiz.aiChatUtil = new aiChatUtil.AIChatUtil();
|
|
81
94
|
await ibiz.i18n.init();
|
|
82
95
|
app.mount("#app");
|
|
83
96
|
}
|
|
@@ -5,11 +5,9 @@ var runtime = require('@ibiz-template/runtime');
|
|
|
5
5
|
var qxUtil = require('qx-util');
|
|
6
6
|
var vue3Util = require('@ibiz-template/vue3-util');
|
|
7
7
|
var qs = require('qs');
|
|
8
|
-
require('../guard/index.cjs');
|
|
9
8
|
require('../components/index.cjs');
|
|
10
9
|
require('../../view/index.cjs');
|
|
11
10
|
require('../../util/index.cjs');
|
|
12
|
-
var authGuard = require('../guard/auth-guard/auth-guard.cjs');
|
|
13
11
|
var _404View = require('../../view/404-view/404-view.cjs');
|
|
14
12
|
var modalRouterShell = require('../components/modal-router-shell/modal-router-shell.cjs');
|
|
15
13
|
var routerShell = require('../components/router-shell/router-shell.cjs');
|
|
@@ -38,6 +36,9 @@ const getPropsCallback = (depth) => {
|
|
|
38
36
|
});
|
|
39
37
|
};
|
|
40
38
|
class AppRouter {
|
|
39
|
+
static setAuthGuard(authGuard) {
|
|
40
|
+
this.authGuard = authGuard;
|
|
41
|
+
}
|
|
41
42
|
static getAppContext(route) {
|
|
42
43
|
let appContext = {};
|
|
43
44
|
if (route.params.appContext && route.params.appContext !== ibiz.env.routePlaceholder) {
|
|
@@ -61,7 +62,7 @@ class AppRouter {
|
|
|
61
62
|
if (!qxUtil.isNilOrEmpty(ibiz.appData)) {
|
|
62
63
|
next();
|
|
63
64
|
} else {
|
|
64
|
-
const authority = await authGuard
|
|
65
|
+
const authority = await this.authGuard(this.getAppContext(_to));
|
|
65
66
|
if (authority) {
|
|
66
67
|
next();
|
|
67
68
|
} else {
|
|
@@ -157,7 +158,7 @@ class AppRouter {
|
|
|
157
158
|
name: "loginView",
|
|
158
159
|
meta: { preset: true },
|
|
159
160
|
beforeEnter: async (_to, _from, next) => {
|
|
160
|
-
await authGuard
|
|
161
|
+
await this.authGuard(this.getAppContext(_to), false);
|
|
161
162
|
next();
|
|
162
163
|
},
|
|
163
164
|
component: loginView.LoginView
|
|
@@ -218,5 +219,6 @@ class AppRouter {
|
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
__publicField(AppRouter, "router");
|
|
222
|
+
__publicField(AppRouter, "authGuard");
|
|
221
223
|
|
|
222
224
|
exports.AppRouter = AppRouter;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _commonjsHelpers = require('../../../../../../../_virtual/_commonjsHelpers.cjs');
|
|
6
|
-
var index = require('../../../../../../../_virtual/
|
|
6
|
+
var index = require('../../../../../../../_virtual/index14.cjs');
|
|
7
7
|
|
|
8
8
|
/*
|
|
9
9
|
*****************************************************************************
|