@gct-paas/core 0.1.6-dev.25 → 0.1.6-dev.27
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/index.esm.min.js +2 -2
- package/dist/{redirect-index-DrFyFXgv.js → redirect-index-2mXSgnns.js} +1 -1
- package/es/constants/index.d.ts +4 -0
- package/es/constants/index.mjs +5 -1
- package/es/enums/page-designer/panel.d.ts +1 -2
- package/es/enums/page-designer/panel.mjs +0 -1
- package/es/index.mjs +18 -17
- package/es/interface/i-app-context/i-app-context.d.ts +6 -0
- package/es/locale/index.d.ts +2 -13
- package/es/locale/index.mjs +9 -39
- package/es/locale/sys.d.ts +14 -0
- package/es/locale/sys.mjs +14 -0
- package/es/modules/env-manager/env-manager.d.ts +7 -0
- package/es/modules/env-manager/env-manager.mjs +9 -0
- package/es/modules/platform-config/useThemeSetting.mjs +21 -3
- package/es/modules/user-stores/store/user.store.mjs +4 -2
- package/es/router/index.mjs +10 -0
- package/es/setup-app.mjs +0 -9
- package/es/utils/auth-util/auth-util.d.ts +31 -0
- package/es/utils/auth-util/auth-util.mjs +67 -0
- package/es/utils/axios/check-status.d.ts +1 -0
- package/es/utils/axios/check-status.mjs +64 -0
- package/es/utils/axios/interceptors.mjs +21 -3
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.mjs +2 -1
- package/es/utils/openUtil/modal/modal.mjs +1 -1
- package/es/utils/openUtil/overlay-container/overlay-container.mjs +1 -1
- package/es/utils/tools/tools.mjs +2 -2
- package/package.json +3 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @gct-paas/core v0.1.6-dev.
|
|
1
|
+
/*! @gct-paas/core v0.1.6-dev.27 */
|
|
2
2
|
import{createElementBlock as e,defineComponent as r,openBlock as t,unref as a}from"vue";import{useRouter as p}from"vue-router";var o=/* @__PURE__ */r({__name:"redirect-index",setup(r){const{currentRoute:o,replace:i}=p(),{params:s,query:u}=a(o),{path:m,_redirect_type:n="path"}=s;Reflect.deleteProperty(s,"_redirect_type"),Reflect.deleteProperty(s,"path");const c=Array.isArray(m)?m.join("/"):m;return i("name"===n?{name:c,query:u,params:JSON.parse(s._origin_params??"{}")}:{path:c.startsWith("/")?c:"/"+c,query:u}),(r,a)=>(t(),e("div"))}});export{o as default};
|
package/es/constants/index.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ export declare const PLUGIN_BASE_URL = "/minio";
|
|
|
10
10
|
* 图片文件基础路径
|
|
11
11
|
*/
|
|
12
12
|
export declare const VITE_MINIO_PATH = "/minio";
|
|
13
|
+
/**
|
|
14
|
+
* 默认头像
|
|
15
|
+
*/
|
|
16
|
+
export declare const VITE_GLOB_DEFAULT_AVATAR = "system/user_default_img-fddbb29e-63ec-46e9-bf70-6330df2cf555.png";
|
|
13
17
|
/**
|
|
14
18
|
* 应用实例全局标识符
|
|
15
19
|
*/
|
package/es/constants/index.mjs
CHANGED
|
@@ -25,8 +25,12 @@ var PLUGIN_BASE_URL = "/minio";
|
|
|
25
25
|
*/
|
|
26
26
|
var VITE_MINIO_PATH = "/minio";
|
|
27
27
|
/**
|
|
28
|
+
* 默认头像
|
|
29
|
+
*/
|
|
30
|
+
var VITE_GLOB_DEFAULT_AVATAR = "system/user_default_img-fddbb29e-63ec-46e9-bf70-6330df2cf555.png";
|
|
31
|
+
/**
|
|
28
32
|
* 应用实例全局标识符
|
|
29
33
|
*/
|
|
30
34
|
var APP_INST = "app_inst";
|
|
31
35
|
//#endregion
|
|
32
|
-
export { APP_INST, PLUGIN_BASE_URL, STYLE_NAMESPACE_TAG, VITE_MINIO_PATH };
|
|
36
|
+
export { APP_INST, PLUGIN_BASE_URL, STYLE_NAMESPACE_TAG, VITE_GLOB_DEFAULT_AVATAR, VITE_MINIO_PATH };
|
|
@@ -268,7 +268,6 @@ var GLOBAL_VAR_TYPE = /* @__PURE__ */ function(GLOBAL_VAR_TYPE) {
|
|
|
268
268
|
GLOBAL_VAR_TYPE["DATE"] = "date";
|
|
269
269
|
GLOBAL_VAR_TYPE["DATETIME"] = "datetime";
|
|
270
270
|
GLOBAL_VAR_TYPE["TIME"] = "time";
|
|
271
|
-
GLOBAL_VAR_TYPE["VAR"] = "var";
|
|
272
271
|
return GLOBAL_VAR_TYPE;
|
|
273
272
|
}({});
|
|
274
273
|
var GLOBAL_TYPE = /* @__PURE__ */ function(GLOBAL_TYPE) {
|
package/es/index.mjs
CHANGED
|
@@ -23,16 +23,10 @@ import { PluginModeEnum } from "./enums/plugin-enum.mjs";
|
|
|
23
23
|
import { DataSetReturnTypeEnum, EntityFormulaReturnTypeEnum, ExpressionModeEnum, ExpressionTabEnum, IdentifierAddon, OperatorTypeEnum, ReturnTypeEnum, VarTypeEnum, zeroWidthSpace } from "./enums/expressionEnum.mjs";
|
|
24
24
|
import { ProcessTypeEnum } from "./enums/process.mjs";
|
|
25
25
|
import { GctMqttTopsEnum, GlobalParamEnum, PageTypeEnum } from "./enums/index.mjs";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import
|
|
30
|
-
import { LinkedNode } from "./utils/linked-node/linked-node.mjs";
|
|
31
|
-
import { LinkedList } from "./utils/linked-list/linked-list.mjs";
|
|
32
|
-
import { insertCustomCssToHead } from "./utils/lowcode/utils.mjs";
|
|
33
|
-
import { buildItemRules } from "./utils/lowcode/validate.mjs";
|
|
34
|
-
import { mitt } from "./utils/mitt/mitt.mjs";
|
|
35
|
-
import { modelLoader } from "./utils/model-loader/model-loader.mjs";
|
|
26
|
+
import { useUserStore } from "./modules/user-stores/store/user.store.mjs";
|
|
27
|
+
import { useTenantStore } from "./modules/user-stores/store/tenant.store.mjs";
|
|
28
|
+
import { usePermissionStore } from "./modules/user-stores/store/permission.store.mjs";
|
|
29
|
+
import "./modules/user-stores/index.mjs";
|
|
36
30
|
import { ModeFnMap, ModeTabDict, ModeTabMap, ReturnTypeMaps } from "./constants/expression-type/modeCfg.mjs";
|
|
37
31
|
import { BuiltOperators, allOperator, booleanOperator, getOperatorList, numberOperator, returnBolOperator } from "./constants/expression-type/BuiltOperators.mjs";
|
|
38
32
|
import { CUSTOM_LANGUAGE, CUSTOM_THEME } from "./constants/expression-type/editor.mjs";
|
|
@@ -46,7 +40,19 @@ import { DefaultDateTypeConst } from "./constants/default-date-type/default-date
|
|
|
46
40
|
import { CoreConst, TimezoneOptions } from "./constants/core.mjs";
|
|
47
41
|
import { ModelTypeOptions } from "./constants/page-designer/model.mjs";
|
|
48
42
|
import { timeReg, urlReg } from "./constants/page-designer/regex.mjs";
|
|
49
|
-
import { APP_INST, PLUGIN_BASE_URL, STYLE_NAMESPACE_TAG, VITE_MINIO_PATH } from "./constants/index.mjs";
|
|
43
|
+
import { APP_INST, PLUGIN_BASE_URL, STYLE_NAMESPACE_TAG, VITE_GLOB_DEFAULT_AVATAR, VITE_MINIO_PATH } from "./constants/index.mjs";
|
|
44
|
+
import { createWhiteImageWithText, deepMerge, getTenant, getToken, isMobile, isRdoUniqueField, parseMatrixParams, setTenant, setToken, stringifyMatrixParams, tenantRef } from "./utils/tools/tools.mjs";
|
|
45
|
+
import { AuthUtil } from "./utils/auth-util/auth-util.mjs";
|
|
46
|
+
import { cssLoader } from "./utils/css-loader/css-loader.mjs";
|
|
47
|
+
import { gctMemoizeAsync } from "./utils/cache-adapter/cache-adapter.mjs";
|
|
48
|
+
import { DictionaryUtil } from "./utils/dictionary/dictionary.mjs";
|
|
49
|
+
import { t } from "./utils/i18n/index.mjs";
|
|
50
|
+
import { LinkedNode } from "./utils/linked-node/linked-node.mjs";
|
|
51
|
+
import { LinkedList } from "./utils/linked-list/linked-list.mjs";
|
|
52
|
+
import { insertCustomCssToHead } from "./utils/lowcode/utils.mjs";
|
|
53
|
+
import { buildItemRules } from "./utils/lowcode/validate.mjs";
|
|
54
|
+
import { mitt } from "./utils/mitt/mitt.mjs";
|
|
55
|
+
import { modelLoader } from "./utils/model-loader/model-loader.mjs";
|
|
50
56
|
import { Namespace, useNamespace } from "./utils/namespace/namespace.mjs";
|
|
51
57
|
import { Modal } from "./utils/openUtil/modal/modal.mjs";
|
|
52
58
|
import { OverlayContainer } from "./utils/openUtil/overlay-container/overlay-container.mjs";
|
|
@@ -54,7 +60,6 @@ import { OverlayPopoverContainer } from "./utils/openUtil/overlay-popover-contai
|
|
|
54
60
|
import { KitPkgUtil } from "./utils/kit-pkg-util/kit-pkg-util.mjs";
|
|
55
61
|
import { PluginPgkUtil } from "./utils/plugin-pkg-util/plugin-pkg-util.mjs";
|
|
56
62
|
import { PluginStaticResource } from "./utils/plugin-static-resource/plugin-static-resource.mjs";
|
|
57
|
-
import { createWhiteImageWithText, deepMerge, getTenant, getToken, isMobile, isRdoUniqueField, parseMatrixParams, setTenant, setToken, stringifyMatrixParams, tenantRef } from "./utils/tools/tools.mjs";
|
|
58
63
|
import { buildShortUUID, buildUUID, sha256, uuid2 } from "./utils/uuid/uuid.mjs";
|
|
59
64
|
import { afterFieldSet, afterValueSet, cacheFnReturn, computedEx, emitFieldSet, parseValueUnit } from "./utils/value-helper/value-helper.mjs";
|
|
60
65
|
import { interceptors } from "./utils/axios/interceptors.mjs";
|
|
@@ -115,10 +120,6 @@ import { getSeriesList } from "./interface/model-designer/serial.mjs";
|
|
|
115
120
|
import "./interface/index.mjs";
|
|
116
121
|
import { ErrorStrategyFactory } from "./modules/error-handler/error-strategy.mjs";
|
|
117
122
|
import { ErrorHandler, setupErrorHandler } from "./modules/error-handler/index.mjs";
|
|
118
|
-
import { useUserStore } from "./modules/user-stores/store/user.store.mjs";
|
|
119
|
-
import { useTenantStore } from "./modules/user-stores/store/tenant.store.mjs";
|
|
120
|
-
import { usePermissionStore } from "./modules/user-stores/store/permission.store.mjs";
|
|
121
|
-
import "./modules/user-stores/index.mjs";
|
|
122
123
|
import { createAppVue } from "./create-app-vue.mjs";
|
|
123
124
|
import { setupApp } from "./setup-app.mjs";
|
|
124
125
|
import { api } from "@gct-paas/api";
|
|
@@ -154,4 +155,4 @@ function onInit() {
|
|
|
154
155
|
}
|
|
155
156
|
onInit();
|
|
156
157
|
//#endregion
|
|
157
|
-
export { AGLINE_ENUMS, APP_DARK_MODE_KEY_, APP_INST, APP_LOCAL_CACHE_KEY, APP_PREVIEW_PATH_REG, APP_PROD_PATH_REG, APP_RUN_PATH_REG, APP_SESSION_CACHE_KEY, ARRAY_TYPE, ASSIGNMENTSTRATEGY_ENUM, AggTypes, AppPublishStateEnum, BOOLEAN_TYPE, BasicAction, BindCmpStyleEnum, BindCmpStyleTypeEnum, BizServiceEnum, BorderStyle, BpmnNodeTypeEnum, BuiltOperators, BuiltinType, ButtonColorTheme, ButtonColorType, ButtonGroupType, ButtonOpeEnum, ButtonSize, ButtonStyle, ButtonType, ButtonTypeEnum, ButtonTypeGroup, ButtonType_vant, CARD_TRIGGER_ENUM, COLUMNS_TYPE, CURRENCY_ENUM, CURRENCY_LANG_ENUM, CUSTOM_LANGUAGE, CUSTOM_THEME, CacheTypeEnum, CategoryModuleEnum, CategoryTypeEnum, Ch_BindCmpStyleEnum, ContentEnum, ContentTypeEnum, CoreConst, CreateType, CustomAction, DEFAULT_MQTT_INSTANCE_ID, DESIGNER_SESSION_CACHE_KEY, DEV_SINGLE_PATH_REG, DYN_FORMAT_TYPE_ENUM, DataSetReturnTypeEnum, DatasourceTypeEnum, DateRangeEnums, DefaultActions, DefaultDateTypeConst, Dependency_ENUM, DeployModeEnum, DeviceParamsTypeEnum, DictionaryUtil, DisplayEnums, DisplayTagTypeEnum, DisplayType, DynFormatTypes, ENV, EditorRegisterConst, EntityFormulaReturnTypeEnum, EntityModelCategoryEnum, EntityModelTypeEnum, EnvironmentManager, EnvironmentType, ErrorHandler, ErrorStrategyFactory, ErrorTypeEnum, EventCategory, EventsTypeEnum, ExamineAndApproveStateEnum, ExceptionEnum, ExpressionModeEnum, ExpressionTabEnum, FIELD_TYPE, FIELD_TYPE_BASIC, FIELD_TYPE_CATEGORY, FIELD_TYPE_LOGIC, FIELD_TYPE_TRACE, FUNC_KEYS, FUN_BOL_TYPE, FUN_NUM_TYPE, FUN_OBJ_OR_ARR_TYPE, FUN_STR_TYPE, FieldDefaultValueTypeEnum, FieldIconMap, FieldSysVarDefaultValueEnum, FieldTypeToJs, FormComponents, FormContainerType, FormDesignEnum, GENDER_TYPE, GLOBAL_TYPE, GLOBAL_VAR_TYPE, GctGlobal, GctMqttTopsEnum, GlobalParamEnum, GlobalStoreUtil, HOST_REG, INNER_EVENT, IP_REG, IdentifierAddon, KeyMode, KickRuleEnum, KitPkgUtil, LOCALE_KEY, LOCALE_LIST_KEY, LOCAL_I18N_TRANSLATE, LOCK_INFO_KEY, LinkedList, LinkedNode, ListTreeSearchTypeEnum, LocaleUtil, LoginSortTypeEnum, LoginTypeEnum, LogoTypeEnum, MENU_COLLAPSED_WIDTH, MENU_WIDTH_RANGE, MQTT_CLIENT_EVENT, MQTT_DEFAULT_CONNECT_OPTIONS, MULTIPLE_TABS_KEY, MaterialEnum, MenuModeEnum, MenuSplitTyeEnum, MenuType, MenuTypeEnum, MessageType, MixSidebarTriggerEnum, Modal, ModeFnMap, ModeTabDict, ModeTabMap, ModelFieldEnum, ModelTypeEnum, ModelTypeOptions, MqttClient, MqttConnectionStatus, MqttManager, NUMBER_TYPE, Namespace, NodesConfigTypeEnum, OBJECT_TYPE, OTHER_LOGIN_KEYS, OpenMode, OperatorTypeEnum, OpinionTypeEnum, OverlayContainer, OverlayPopoverContainer, PLUGIN_BASE_URL, PROJ_CFG_KEY, PageEnum, PageTypeEnum, PanelEnum, PassRule, PatternEnum, PermissionModeEnum, PersonalCenterType, Platform, PlatformSettingActions, PlatformSettingEnum, PlatformType, PluginModeEnum, PluginPgkUtil, PluginStaticResource, Postion, PrintFormatEnum, PrintModeEnums, PrintResourceEnum, PrintTypeEnum, ProcessStatusEnum, ProcessTypeEnum, ProgressTypeEnum, ProjectName, PropGroup, QuickSearchEnum, REDIRECT_NAME, RELATION_FIELDS, RETURN_TYPE_MAP, ROLES_KEY, RdoButtonOpeEnum, RequestEnum, ResetConditionEnum, ResetRuleType, ResultEnum, ReturnTypeEnum, ReturnTypeMaps, RoleEnum, RouterTransitionEnum, RowSelectionTypeEnums, SANDBOX_PATH_REG, SCOPE, SCOPEINFO, SEARCH_SERVICE, SHOW_FIELDTYPES, SIDE_BAR_MINI_WIDTH, SIDE_BAR_SHOW_TIT_MINI_WIDTH, SINGLE_PATH_REG, STRING_TYPE, STYLE_NAMESPACE_TAG, SUB_TABLE_EDIT_MODE, SUB_TABLE_OPE_EVENT_TYPE, SUB_TABLE_OPE_EVENT_TYPE_INLINE, SYSTEM_FIELD_KEY, SYSTEM_LOGIN_KEYS, SYSTEM_VAR_PREFIX, ScriptTypeEnum, SearchComponents, SelectPickerEnums, SessionTimeoutProcessingEnum, SettingButtonPositionEnum, SignatureStyleEnum, SignatureTypeEnum, SizeEnum, StatisticalMethodEnums, StyleGroup, TENANT_KEY, TEST_SINGLE_PATH_REG, THEME_COLORS, TIMETYPE_ENUM, TIMETYPE_LANG_ENUM, TODO_TYPE, TOKEN_KEY, TableEditingMethodEnum, TableSearchTypeEnum, TableTypeEnum, TagTypeEnum, TextAlign, TextDecoration, TextMeasureUtil, ThemeEnum, TimezoneOptions, ToolkitEnum, TopMenuAlignEnum, TransactionMode, TreeHelper, TriggerEnum, TypeEnum, USER_INFO_KEY, UniqueConstraintType, UploadTypeEnum, Uploader, UserRoleReqEnum, UserServiceType, VERIFICATIONCONDITIONS_TYPE, VITE_MINIO_PATH, VarTypeEnum, WATERMARK_INIT_DATA, WidgetInScopeEnum, WinMsgTypeEnum, WorkBenchTabEnum, WorkbenchType, afterFieldSet, afterValueSet, allOperator, approvalObserver, biBackFunctionGroup, biBackFunctionMap, bindCmpStyleMap, booleanOperator, booleanTypes, buildItemRules, buildShortUUID, buildUUID, buttonShowType, cacheFnReturn, calcFontStyle, calcStyle, calcStylePX, ch_ProcessStatusMap, computedEx, controlConfigEnum, copyTextToClipboard, createAppVue, createWhiteImageWithText, cssLoader, dataURLtoBlob, deepMerge, deleteAndInsertArr, downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, dynamicData, emitFieldSet, fileUrlParser, filterDynFormatTypes, filterTree, findUniqueNode, fixedAlignENUM, functionGroup, functionMap, gctMemoizeAsync, genUrl, getBrowserFingerprint, getDeviceFingerprint, getInterfaceApi, getLoginTypeOptions, getMaxTextWidth, getMinTextWidth, getMobileBrowserFingerprint, getOperatorList, getPageIdentification, getSeriesList, getTenant, getToken, getTotalTextWidth, getVueComponentByCode, globalRefSession, globalRefStorage, hasEmojiAndSpecStr, hasEmojiAndSpecStr1, highlightName, innerVarIds, innerVarList, insertCustomCssToHead, interceptors, ipaasBackFunctionGroup, ipaasBackFunctionMap, isDef, isMobile, isMultipleOperator, isRdoUniqueField, isSortFiled, list2Tree, measureText, measureTexts, mitt, mobileSearchListByFieldType, modelLoader, normalizeEnv, notSingleArr, nullDisplayEnum, numberOperator, numberTypes, openWindow, openWindowEnums, operateSysEnums, operator2FuncMap, padSearchListByFieldType, pageLayoutModeEnum, parentObserver, parseMatrixParams, parseValueUnit, permission, presetColor, randomUUID, returnBolOperator, screenEnum, screenMap, scriptLoader, scriptTypeEnum, searchListByFieldType, selectionTypeEnums, setTenant, setToken, setupApp, setupErrorHandler, setupI18n, sha256, showDynamicTitle, sizeEnum, sizeParser, sortTypeEnum, statisticalMethodEnum, statusEnum, stringifyMatrixParams, t, tableColumnTypeEnum, tableColumnWidthEnum, tabsTypeENUM, tagEnum, tenantRef, timeReg, transformBindCmp2CmpType, transformUrl, truncateText, typeParser, uploaderFiles, urlReg, urlToBase64, useAppInst, useCopyToClipboard, useDebouncePromise, useIFrameProps, useModal, useNamespace, usePermissionStore, usePlatformConfigStore, useTenantStore, useUUid, useUserStore, useWuJieBus, useWuJieProps, uuid2, validateEmoji, validateIsModelName, validateModelName, zeroWidthSpace };
|
|
158
|
+
export { AGLINE_ENUMS, APP_DARK_MODE_KEY_, APP_INST, APP_LOCAL_CACHE_KEY, APP_PREVIEW_PATH_REG, APP_PROD_PATH_REG, APP_RUN_PATH_REG, APP_SESSION_CACHE_KEY, ARRAY_TYPE, ASSIGNMENTSTRATEGY_ENUM, AggTypes, AppPublishStateEnum, AuthUtil, BOOLEAN_TYPE, BasicAction, BindCmpStyleEnum, BindCmpStyleTypeEnum, BizServiceEnum, BorderStyle, BpmnNodeTypeEnum, BuiltOperators, BuiltinType, ButtonColorTheme, ButtonColorType, ButtonGroupType, ButtonOpeEnum, ButtonSize, ButtonStyle, ButtonType, ButtonTypeEnum, ButtonTypeGroup, ButtonType_vant, CARD_TRIGGER_ENUM, COLUMNS_TYPE, CURRENCY_ENUM, CURRENCY_LANG_ENUM, CUSTOM_LANGUAGE, CUSTOM_THEME, CacheTypeEnum, CategoryModuleEnum, CategoryTypeEnum, Ch_BindCmpStyleEnum, ContentEnum, ContentTypeEnum, CoreConst, CreateType, CustomAction, DEFAULT_MQTT_INSTANCE_ID, DESIGNER_SESSION_CACHE_KEY, DEV_SINGLE_PATH_REG, DYN_FORMAT_TYPE_ENUM, DataSetReturnTypeEnum, DatasourceTypeEnum, DateRangeEnums, DefaultActions, DefaultDateTypeConst, Dependency_ENUM, DeployModeEnum, DeviceParamsTypeEnum, DictionaryUtil, DisplayEnums, DisplayTagTypeEnum, DisplayType, DynFormatTypes, ENV, EditorRegisterConst, EntityFormulaReturnTypeEnum, EntityModelCategoryEnum, EntityModelTypeEnum, EnvironmentManager, EnvironmentType, ErrorHandler, ErrorStrategyFactory, ErrorTypeEnum, EventCategory, EventsTypeEnum, ExamineAndApproveStateEnum, ExceptionEnum, ExpressionModeEnum, ExpressionTabEnum, FIELD_TYPE, FIELD_TYPE_BASIC, FIELD_TYPE_CATEGORY, FIELD_TYPE_LOGIC, FIELD_TYPE_TRACE, FUNC_KEYS, FUN_BOL_TYPE, FUN_NUM_TYPE, FUN_OBJ_OR_ARR_TYPE, FUN_STR_TYPE, FieldDefaultValueTypeEnum, FieldIconMap, FieldSysVarDefaultValueEnum, FieldTypeToJs, FormComponents, FormContainerType, FormDesignEnum, GENDER_TYPE, GLOBAL_TYPE, GLOBAL_VAR_TYPE, GctGlobal, GctMqttTopsEnum, GlobalParamEnum, GlobalStoreUtil, HOST_REG, INNER_EVENT, IP_REG, IdentifierAddon, KeyMode, KickRuleEnum, KitPkgUtil, LOCALE_KEY, LOCALE_LIST_KEY, LOCAL_I18N_TRANSLATE, LOCK_INFO_KEY, LinkedList, LinkedNode, ListTreeSearchTypeEnum, LocaleUtil, LoginSortTypeEnum, LoginTypeEnum, LogoTypeEnum, MENU_COLLAPSED_WIDTH, MENU_WIDTH_RANGE, MQTT_CLIENT_EVENT, MQTT_DEFAULT_CONNECT_OPTIONS, MULTIPLE_TABS_KEY, MaterialEnum, MenuModeEnum, MenuSplitTyeEnum, MenuType, MenuTypeEnum, MessageType, MixSidebarTriggerEnum, Modal, ModeFnMap, ModeTabDict, ModeTabMap, ModelFieldEnum, ModelTypeEnum, ModelTypeOptions, MqttClient, MqttConnectionStatus, MqttManager, NUMBER_TYPE, Namespace, NodesConfigTypeEnum, OBJECT_TYPE, OTHER_LOGIN_KEYS, OpenMode, OperatorTypeEnum, OpinionTypeEnum, OverlayContainer, OverlayPopoverContainer, PLUGIN_BASE_URL, PROJ_CFG_KEY, PageEnum, PageTypeEnum, PanelEnum, PassRule, PatternEnum, PermissionModeEnum, PersonalCenterType, Platform, PlatformSettingActions, PlatformSettingEnum, PlatformType, PluginModeEnum, PluginPgkUtil, PluginStaticResource, Postion, PrintFormatEnum, PrintModeEnums, PrintResourceEnum, PrintTypeEnum, ProcessStatusEnum, ProcessTypeEnum, ProgressTypeEnum, ProjectName, PropGroup, QuickSearchEnum, REDIRECT_NAME, RELATION_FIELDS, RETURN_TYPE_MAP, ROLES_KEY, RdoButtonOpeEnum, RequestEnum, ResetConditionEnum, ResetRuleType, ResultEnum, ReturnTypeEnum, ReturnTypeMaps, RoleEnum, RouterTransitionEnum, RowSelectionTypeEnums, SANDBOX_PATH_REG, SCOPE, SCOPEINFO, SEARCH_SERVICE, SHOW_FIELDTYPES, SIDE_BAR_MINI_WIDTH, SIDE_BAR_SHOW_TIT_MINI_WIDTH, SINGLE_PATH_REG, STRING_TYPE, STYLE_NAMESPACE_TAG, SUB_TABLE_EDIT_MODE, SUB_TABLE_OPE_EVENT_TYPE, SUB_TABLE_OPE_EVENT_TYPE_INLINE, SYSTEM_FIELD_KEY, SYSTEM_LOGIN_KEYS, SYSTEM_VAR_PREFIX, ScriptTypeEnum, SearchComponents, SelectPickerEnums, SessionTimeoutProcessingEnum, SettingButtonPositionEnum, SignatureStyleEnum, SignatureTypeEnum, SizeEnum, StatisticalMethodEnums, StyleGroup, TENANT_KEY, TEST_SINGLE_PATH_REG, THEME_COLORS, TIMETYPE_ENUM, TIMETYPE_LANG_ENUM, TODO_TYPE, TOKEN_KEY, TableEditingMethodEnum, TableSearchTypeEnum, TableTypeEnum, TagTypeEnum, TextAlign, TextDecoration, TextMeasureUtil, ThemeEnum, TimezoneOptions, ToolkitEnum, TopMenuAlignEnum, TransactionMode, TreeHelper, TriggerEnum, TypeEnum, USER_INFO_KEY, UniqueConstraintType, UploadTypeEnum, Uploader, UserRoleReqEnum, UserServiceType, VERIFICATIONCONDITIONS_TYPE, VITE_GLOB_DEFAULT_AVATAR, VITE_MINIO_PATH, VarTypeEnum, WATERMARK_INIT_DATA, WidgetInScopeEnum, WinMsgTypeEnum, WorkBenchTabEnum, WorkbenchType, afterFieldSet, afterValueSet, allOperator, approvalObserver, biBackFunctionGroup, biBackFunctionMap, bindCmpStyleMap, booleanOperator, booleanTypes, buildItemRules, buildShortUUID, buildUUID, buttonShowType, cacheFnReturn, calcFontStyle, calcStyle, calcStylePX, ch_ProcessStatusMap, computedEx, controlConfigEnum, copyTextToClipboard, createAppVue, createWhiteImageWithText, cssLoader, dataURLtoBlob, deepMerge, deleteAndInsertArr, downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, dynamicData, emitFieldSet, fileUrlParser, filterDynFormatTypes, filterTree, findUniqueNode, fixedAlignENUM, functionGroup, functionMap, gctMemoizeAsync, genUrl, getBrowserFingerprint, getDeviceFingerprint, getInterfaceApi, getLoginTypeOptions, getMaxTextWidth, getMinTextWidth, getMobileBrowserFingerprint, getOperatorList, getPageIdentification, getSeriesList, getTenant, getToken, getTotalTextWidth, getVueComponentByCode, globalRefSession, globalRefStorage, hasEmojiAndSpecStr, hasEmojiAndSpecStr1, highlightName, innerVarIds, innerVarList, insertCustomCssToHead, interceptors, ipaasBackFunctionGroup, ipaasBackFunctionMap, isDef, isMobile, isMultipleOperator, isRdoUniqueField, isSortFiled, list2Tree, measureText, measureTexts, mitt, mobileSearchListByFieldType, modelLoader, normalizeEnv, notSingleArr, nullDisplayEnum, numberOperator, numberTypes, openWindow, openWindowEnums, operateSysEnums, operator2FuncMap, padSearchListByFieldType, pageLayoutModeEnum, parentObserver, parseMatrixParams, parseValueUnit, permission, presetColor, randomUUID, returnBolOperator, screenEnum, screenMap, scriptLoader, scriptTypeEnum, searchListByFieldType, selectionTypeEnums, setTenant, setToken, setupApp, setupErrorHandler, setupI18n, sha256, showDynamicTitle, sizeEnum, sizeParser, sortTypeEnum, statisticalMethodEnum, statusEnum, stringifyMatrixParams, t, tableColumnTypeEnum, tableColumnWidthEnum, tabsTypeENUM, tagEnum, tenantRef, timeReg, transformBindCmp2CmpType, transformUrl, truncateText, typeParser, uploaderFiles, urlReg, urlToBase64, useAppInst, useCopyToClipboard, useDebouncePromise, useIFrameProps, useModal, useNamespace, usePermissionStore, usePlatformConfigStore, useTenantStore, useUUid, useUserStore, useWuJieBus, useWuJieProps, uuid2, validateEmoji, validateIsModelName, validateModelName, zeroWidthSpace };
|
package/es/locale/index.d.ts
CHANGED
|
@@ -55,19 +55,8 @@ export declare class LocaleUtil {
|
|
|
55
55
|
}>, locale?: string): void;
|
|
56
56
|
/** 路径转 key: './sys/pageDesigner.ts' → 'sys.pageDesigner',排除 index */
|
|
57
57
|
private pathToLocaleKey;
|
|
58
|
-
/**
|
|
59
|
-
private
|
|
60
|
-
/**
|
|
61
|
-
* 将扁平 key 的 messages 对象转为多层嵌套对象
|
|
62
|
-
*
|
|
63
|
-
* @param messages 扁平 key 的 messages,如 { "common.button.submit": "提交" }
|
|
64
|
-
* @returns 嵌套对象,如 { common: { button: { submit: "提交" } } }
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* flattenToNested({ "a.b.c": "v1", "a.b.d": "v2", "a.e": "v3" })
|
|
68
|
-
* // => { a: { b: { c: "v1", d: "v2" }, e: "v3" } }
|
|
69
|
-
*/
|
|
70
|
-
flattenToNested(messages: Record<string, string>): Record<string, unknown>;
|
|
58
|
+
/** 将嵌套对象展平为点号路径: { a: { b: 'hi' } }, 'prefix' → { 'prefix.a.b': 'hi' } */
|
|
59
|
+
private flattenObject;
|
|
71
60
|
/**
|
|
72
61
|
* 设置 HTML 根元素的 lang 属性,供浏览器、辅助技术识别当前语言
|
|
73
62
|
*
|
package/es/locale/index.mjs
CHANGED
|
@@ -106,8 +106,7 @@ var LocaleUtil = class {
|
|
|
106
106
|
acc[key] = value.join(":");
|
|
107
107
|
return acc;
|
|
108
108
|
}, {});
|
|
109
|
-
|
|
110
|
-
this.i18n.global.mergeLocaleMessage(locale, nestedMessages);
|
|
109
|
+
this.i18n.global.mergeLocaleMessage(locale, messages);
|
|
111
110
|
}
|
|
112
111
|
getMessageUrl(payload) {
|
|
113
112
|
if ("app" in payload) {
|
|
@@ -130,8 +129,8 @@ var LocaleUtil = class {
|
|
|
130
129
|
if (!mod?.default) continue;
|
|
131
130
|
const key = this.pathToLocaleKey(path);
|
|
132
131
|
if (!key) continue;
|
|
133
|
-
const messages = this.
|
|
134
|
-
this.
|
|
132
|
+
const messages = this.flattenObject(mod.default, key);
|
|
133
|
+
this.addLocaleMessages(locale, messages);
|
|
135
134
|
}
|
|
136
135
|
}
|
|
137
136
|
/** 路径转 key: './sys/pageDesigner.ts' → 'sys.pageDesigner',排除 index */
|
|
@@ -140,42 +139,13 @@ var LocaleUtil = class {
|
|
|
140
139
|
if (cleaned === "index" || cleaned.endsWith("/index")) return null;
|
|
141
140
|
return cleaned.replace(/\//g, ".");
|
|
142
141
|
}
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
const parts = dotPath.split(".");
|
|
146
|
-
const result = {};
|
|
147
|
-
let current = result;
|
|
148
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
149
|
-
current[parts[i]] = {};
|
|
150
|
-
current = current[parts[i]];
|
|
151
|
-
}
|
|
152
|
-
current[parts[parts.length - 1]] = value;
|
|
153
|
-
return result;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* 将扁平 key 的 messages 对象转为多层嵌套对象
|
|
157
|
-
*
|
|
158
|
-
* @param messages 扁平 key 的 messages,如 { "common.button.submit": "提交" }
|
|
159
|
-
* @returns 嵌套对象,如 { common: { button: { submit: "提交" } } }
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* flattenToNested({ "a.b.c": "v1", "a.b.d": "v2", "a.e": "v3" })
|
|
163
|
-
* // => { a: { b: { c: "v1", d: "v2" }, e: "v3" } }
|
|
164
|
-
*/
|
|
165
|
-
flattenToNested(messages) {
|
|
142
|
+
/** 将嵌套对象展平为点号路径: { a: { b: 'hi' } }, 'prefix' → { 'prefix.a.b': 'hi' } */
|
|
143
|
+
flattenObject(obj, prefix) {
|
|
166
144
|
const result = {};
|
|
167
|
-
for (const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
const parts = key.split(".");
|
|
173
|
-
let current = result;
|
|
174
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
175
|
-
if (!(parts[i] in current) || typeof current[parts[i]] !== "object") current[parts[i]] = {};
|
|
176
|
-
current = current[parts[i]];
|
|
177
|
-
}
|
|
178
|
-
current[parts[parts.length - 1]] = messages[key];
|
|
145
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
146
|
+
const fullKey = `${prefix}.${k}`;
|
|
147
|
+
if (v !== null && typeof v === "object" && !Array.isArray(v)) Object.assign(result, this.flattenObject(v, fullKey));
|
|
148
|
+
else result[fullKey] = v;
|
|
179
149
|
}
|
|
180
150
|
return result;
|
|
181
151
|
}
|
package/es/locale/sys.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
+
errMsg401: string;
|
|
3
|
+
errMsg403: string;
|
|
4
|
+
errMsg404: string;
|
|
5
|
+
errMsg405: string;
|
|
6
|
+
errMsg408: string;
|
|
7
|
+
errMsg500: string;
|
|
8
|
+
errMsg501: string;
|
|
9
|
+
errMsg502: string;
|
|
10
|
+
errMsg503: string;
|
|
11
|
+
errMsg504: string;
|
|
12
|
+
errMsg505: string;
|
|
13
|
+
errorTip: string;
|
|
14
|
+
apiTimeoutMessage: string;
|
|
15
|
+
networkExceptionMsg: string;
|
|
2
16
|
notNull: string;
|
|
3
17
|
regError: string;
|
|
4
18
|
};
|
package/es/locale/sys.mjs
CHANGED
|
@@ -2,6 +2,20 @@ import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
|
2
2
|
//#region src/locale/sys.ts
|
|
3
3
|
var sys_exports = /* @__PURE__ */ __exportAll({ default: () => sys_default });
|
|
4
4
|
var sys_default = {
|
|
5
|
+
errMsg401: "请重新登录",
|
|
6
|
+
errMsg403: "用户得到授权,但是访问是被禁止的!",
|
|
7
|
+
errMsg404: "网络请求错误,未找到该资源!",
|
|
8
|
+
errMsg405: "网络请求错误,请求方法未允许!",
|
|
9
|
+
errMsg408: "网络请求超时!",
|
|
10
|
+
errMsg500: "服务器错误,请联系管理员!",
|
|
11
|
+
errMsg501: "网络未实现!",
|
|
12
|
+
errMsg502: "网络错误!",
|
|
13
|
+
errMsg503: "服务不可用,服务器暂时过载或维护!",
|
|
14
|
+
errMsg504: "网络超时!",
|
|
15
|
+
errMsg505: "http版本不支持该请求!",
|
|
16
|
+
errorTip: "错误提示",
|
|
17
|
+
apiTimeoutMessage: "接口请求超时,请刷新页面重试!",
|
|
18
|
+
networkExceptionMsg: "网络异常,请检查您的网络连接是否正常!",
|
|
5
19
|
notNull: "该值不能为空",
|
|
6
20
|
regError: "校验格式不正确"
|
|
7
21
|
};
|
|
@@ -37,6 +37,13 @@ export declare class EnvironmentManager implements IEnvironmentManager {
|
|
|
37
37
|
* 测试环境租户数据
|
|
38
38
|
*/
|
|
39
39
|
get testTenantData(): Tenant;
|
|
40
|
+
/**
|
|
41
|
+
* 是否为单应用模式
|
|
42
|
+
*
|
|
43
|
+
* @readonly
|
|
44
|
+
* @type {boolean}
|
|
45
|
+
*/
|
|
46
|
+
get isAppSingle(): boolean;
|
|
40
47
|
/**
|
|
41
48
|
* 是否为沙箱环境
|
|
42
49
|
*/
|
|
@@ -55,6 +55,15 @@ var EnvironmentManager = class {
|
|
|
55
55
|
return this._testTenantData;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
+
* 是否为单应用模式
|
|
59
|
+
*
|
|
60
|
+
* @readonly
|
|
61
|
+
* @type {boolean}
|
|
62
|
+
*/
|
|
63
|
+
get isAppSingle() {
|
|
64
|
+
return _gct.store.context.mode === "single";
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
58
67
|
* 是否为沙箱环境
|
|
59
68
|
*/
|
|
60
69
|
get isSandbox() {
|
|
@@ -30,15 +30,33 @@ var menuCollapsedWidth = 46;
|
|
|
30
30
|
var menuWidthRange = MENU_WIDTH_RANGE;
|
|
31
31
|
/** 可选的主题颜色列表 */
|
|
32
32
|
var themeColors = THEME_COLORS;
|
|
33
|
+
function setThemeMode(mode) {
|
|
34
|
+
if (mode === "colorWeak") {
|
|
35
|
+
document.body.classList.add("color-weak");
|
|
36
|
+
document.body.classList.remove("gray-mode");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (mode === "gray") {
|
|
40
|
+
document.body.classList.add("gray-mode");
|
|
41
|
+
document.body.classList.remove("color-weak");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
document.body.classList.remove("gray-mode");
|
|
45
|
+
document.body.classList.remove("color-weak");
|
|
46
|
+
}
|
|
33
47
|
/**
|
|
34
48
|
* 切换颜色模式
|
|
35
49
|
* 根据当前颜色模式更新界面显示效果
|
|
36
50
|
*/
|
|
37
51
|
var toggleColorMode = () => {
|
|
38
52
|
switch (themeSetting.colorMode) {
|
|
39
|
-
case "colorWeak":
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
case "colorWeak":
|
|
54
|
+
setThemeMode("colorWeak");
|
|
55
|
+
break;
|
|
56
|
+
case "gray":
|
|
57
|
+
setThemeMode("gray");
|
|
58
|
+
break;
|
|
59
|
+
default: setThemeMode();
|
|
42
60
|
}
|
|
43
61
|
};
|
|
44
62
|
watch(() => themeSetting.colorMode, (value) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getToken, setToken, tenantRef } from "../../../utils/tools/tools.mjs";
|
|
1
|
+
import { getToken, setTenant, setToken, tenantRef } from "../../../utils/tools/tools.mjs";
|
|
2
2
|
import { sha256 } from "../../../utils/uuid/uuid.mjs";
|
|
3
3
|
import { getDeviceFingerprint, getPageIdentification } from "../../../utils/deviceFingerprint.mjs";
|
|
4
4
|
import "../../../utils/index.mjs";
|
|
@@ -63,7 +63,8 @@ var useUserStore = defineStore("user", {
|
|
|
63
63
|
*/
|
|
64
64
|
async appLoginOut() {
|
|
65
65
|
setToken();
|
|
66
|
-
|
|
66
|
+
setTenant();
|
|
67
|
+
await this.setUserInfo({});
|
|
67
68
|
},
|
|
68
69
|
async setUserInfo(info) {
|
|
69
70
|
this.userInfo = {
|
|
@@ -103,6 +104,7 @@ async function loginApi(params, { hasError = true } = {}) {
|
|
|
103
104
|
* 登出
|
|
104
105
|
*/
|
|
105
106
|
async function doLogout() {
|
|
107
|
+
if (!getToken()) return;
|
|
106
108
|
const session = sessionStorage.getItem("currentPlatOrAppId");
|
|
107
109
|
const env = _gct.env.getEnv();
|
|
108
110
|
const fingerprint = await getDeviceFingerprint();
|
package/es/router/index.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { usePlatformConfigStore } from "../modules/platform-config/store.mjs";
|
|
1
2
|
import "vue";
|
|
2
3
|
import { createRouter, createWebHashHistory } from "vue-router";
|
|
4
|
+
import nProgress from "nprogress";
|
|
3
5
|
//#region src/router/index.ts
|
|
4
6
|
var REDIRECT_NAME = "Redirect";
|
|
5
7
|
var RouterUtil = class {
|
|
@@ -9,6 +11,14 @@ var RouterUtil = class {
|
|
|
9
11
|
history: createWebHashHistory(),
|
|
10
12
|
routes
|
|
11
13
|
});
|
|
14
|
+
this.router.beforeEach((to, _from) => {
|
|
15
|
+
if (to.meta.loaded) return true;
|
|
16
|
+
if (usePlatformConfigStore().themeSetting.pageProgress == true) nProgress.start();
|
|
17
|
+
return true;
|
|
18
|
+
});
|
|
19
|
+
this.router.afterEach(() => {
|
|
20
|
+
nProgress.done();
|
|
21
|
+
});
|
|
12
22
|
}
|
|
13
23
|
/**
|
|
14
24
|
* 添加路由
|
package/es/setup-app.mjs
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { getToken } from "./utils/tools/tools.mjs";
|
|
2
1
|
import { interceptors } from "./utils/axios/interceptors.mjs";
|
|
3
2
|
import "./utils/index.mjs";
|
|
4
3
|
import { usePlatformConfigStore } from "./modules/platform-config/store.mjs";
|
|
5
4
|
import "./modules/platform-config/index.mjs";
|
|
6
|
-
import { useUserStore } from "./modules/user-stores/store/user.store.mjs";
|
|
7
|
-
import "./modules/user-stores/index.mjs";
|
|
8
5
|
import { registerCoreLocale } from "./locale/auto-register.mjs";
|
|
9
6
|
import { HttpUtil } from "@gct-paas/api";
|
|
10
7
|
//#region src/setup-app.ts
|
|
@@ -19,12 +16,6 @@ async function setupApp(_app) {
|
|
|
19
16
|
await _gct.init();
|
|
20
17
|
registerCoreLocale();
|
|
21
18
|
await usePlatformConfigStore().init();
|
|
22
|
-
const token = getToken();
|
|
23
|
-
if (token) try {
|
|
24
|
-
await useUserStore().getUserInfoAction(token);
|
|
25
|
-
} catch (error) {
|
|
26
|
-
console.error("获取用户信息失败", error);
|
|
27
|
-
}
|
|
28
19
|
}
|
|
29
20
|
//#endregion
|
|
30
21
|
export { setupApp };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 认证工具类
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @class AuthUtil
|
|
6
|
+
*/
|
|
7
|
+
export declare class AuthUtil {
|
|
8
|
+
private static instance;
|
|
9
|
+
private constructor();
|
|
10
|
+
/**
|
|
11
|
+
* 加载用户信息
|
|
12
|
+
*
|
|
13
|
+
* @description 现阶段的认证在 paas-front 系统中登录,此处直接获取 token 并加载用户信息,无认证信息或者登录过期直接跳转到登录页
|
|
14
|
+
* @return {*} {Promise<void>}
|
|
15
|
+
*/
|
|
16
|
+
loadUser(): Promise<void>;
|
|
17
|
+
logout(goLogin?: boolean): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* 跳转到首页
|
|
20
|
+
*
|
|
21
|
+
* @return {*} {Promise<void>}
|
|
22
|
+
*/
|
|
23
|
+
goHome(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* 跳转到租户选择页
|
|
26
|
+
*
|
|
27
|
+
* @return {*} {Promise<void>}
|
|
28
|
+
*/
|
|
29
|
+
goTenantSelect(): Promise<void>;
|
|
30
|
+
static getInstance(): AuthUtil;
|
|
31
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useUserStore } from "../../modules/user-stores/store/user.store.mjs";
|
|
2
|
+
import "../../modules/user-stores/index.mjs";
|
|
3
|
+
import { getToken } from "../tools/tools.mjs";
|
|
4
|
+
//#region src/utils/auth-util/auth-util.ts
|
|
5
|
+
/**
|
|
6
|
+
* 认证工具类
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @class AuthUtil
|
|
10
|
+
*/
|
|
11
|
+
var AuthUtil = class AuthUtil {
|
|
12
|
+
static instance;
|
|
13
|
+
constructor() {}
|
|
14
|
+
/**
|
|
15
|
+
* 加载用户信息
|
|
16
|
+
*
|
|
17
|
+
* @description 现阶段的认证在 paas-front 系统中登录,此处直接获取 token 并加载用户信息,无认证信息或者登录过期直接跳转到登录页
|
|
18
|
+
* @return {*} {Promise<void>}
|
|
19
|
+
*/
|
|
20
|
+
async loadUser() {
|
|
21
|
+
const token = getToken();
|
|
22
|
+
if (token) try {
|
|
23
|
+
await useUserStore().getUserInfoAction(token);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error("获取用户信息失败", error);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async logout(goLogin) {
|
|
29
|
+
await useUserStore().submitLoginOut();
|
|
30
|
+
if (goLogin) {
|
|
31
|
+
const url = new URL(`${location.origin}/paas-front/portal`);
|
|
32
|
+
if (_gct.env.isSandbox || _gct.env.isAppSingle) {
|
|
33
|
+
if (_gct.store.context.aid) url.searchParams.set("aid", _gct.store.context.aid);
|
|
34
|
+
url.searchParams.set("env", _gct.env.getEnv());
|
|
35
|
+
if (_gct.env.isAppSingle) url.searchParams.set("mode", "single");
|
|
36
|
+
}
|
|
37
|
+
url.hash = `/login`;
|
|
38
|
+
window.location.href = url.toString();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 跳转到首页
|
|
43
|
+
*
|
|
44
|
+
* @return {*} {Promise<void>}
|
|
45
|
+
*/
|
|
46
|
+
async goHome() {
|
|
47
|
+
const url = new URL(`${location.origin}/paas-front/portal`);
|
|
48
|
+
url.hash = `/home`;
|
|
49
|
+
window.location.href = url.toString();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 跳转到租户选择页
|
|
53
|
+
*
|
|
54
|
+
* @return {*} {Promise<void>}
|
|
55
|
+
*/
|
|
56
|
+
async goTenantSelect() {
|
|
57
|
+
const url = new URL(`${location.origin}/paas-front/portal`);
|
|
58
|
+
url.hash = `/tenant`;
|
|
59
|
+
window.location.href = url.toString();
|
|
60
|
+
}
|
|
61
|
+
static getInstance() {
|
|
62
|
+
if (!AuthUtil.instance) AuthUtil.instance = new AuthUtil();
|
|
63
|
+
return AuthUtil.instance;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { AuthUtil };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkStatus(status: number, msg: string, errorMessageMode?: string): void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AuthUtil } from "../auth-util/auth-util.mjs";
|
|
2
|
+
import { t } from "../i18n/index.mjs";
|
|
3
|
+
//#region src/utils/axios/check-status.ts
|
|
4
|
+
function checkStatus(status, msg, errorMessageMode = "message") {
|
|
5
|
+
let errMessage = "";
|
|
6
|
+
switch (status) {
|
|
7
|
+
case 400:
|
|
8
|
+
errMessage = `${msg}`;
|
|
9
|
+
break;
|
|
10
|
+
case 401:
|
|
11
|
+
errMessage = msg || t("sys.errMsg401");
|
|
12
|
+
AuthUtil.getInstance().logout(true);
|
|
13
|
+
break;
|
|
14
|
+
case 402:
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
if (_gct.env.isSandbox || _gct.env.isAppSingle) AuthUtil.getInstance().logout(true);
|
|
17
|
+
else AuthUtil.getInstance().goHome();
|
|
18
|
+
}, 3e3);
|
|
19
|
+
break;
|
|
20
|
+
case 403:
|
|
21
|
+
errMessage = t("sys.errMsg403");
|
|
22
|
+
break;
|
|
23
|
+
case 404:
|
|
24
|
+
errMessage = t("sys.errMsg404");
|
|
25
|
+
break;
|
|
26
|
+
case 405:
|
|
27
|
+
errMessage = t("sys.errMsg405");
|
|
28
|
+
break;
|
|
29
|
+
case 408:
|
|
30
|
+
errMessage = t("sys.errMsg408");
|
|
31
|
+
break;
|
|
32
|
+
case 500:
|
|
33
|
+
errMessage = t("sys.errMsg500");
|
|
34
|
+
break;
|
|
35
|
+
case 501:
|
|
36
|
+
errMessage = t("sys.errMsg501");
|
|
37
|
+
break;
|
|
38
|
+
case 502:
|
|
39
|
+
errMessage = t("sys.errMsg502");
|
|
40
|
+
break;
|
|
41
|
+
case 503:
|
|
42
|
+
errMessage = t("sys.errMsg503");
|
|
43
|
+
break;
|
|
44
|
+
case 504:
|
|
45
|
+
errMessage = t("sys.errMsg504");
|
|
46
|
+
break;
|
|
47
|
+
case 505:
|
|
48
|
+
errMessage = t("sys.errMsg505");
|
|
49
|
+
break;
|
|
50
|
+
case 510:
|
|
51
|
+
if (_gct.env.isSandbox) _gct.router.replace({
|
|
52
|
+
force: true,
|
|
53
|
+
path: "/notFound"
|
|
54
|
+
});
|
|
55
|
+
break;
|
|
56
|
+
default:
|
|
57
|
+
}
|
|
58
|
+
if (errMessage) {
|
|
59
|
+
if (errorMessageMode === "modal") console.warn("errorMessageMode === \"modal\" 暂未支持", errMessage);
|
|
60
|
+
else if (errorMessageMode === "message") _gct.message.error(errMessage);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { checkStatus };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { getTenant, getToken } from "../tools/tools.mjs";
|
|
2
|
+
import { AuthUtil } from "../auth-util/auth-util.mjs";
|
|
3
|
+
import { t } from "../i18n/index.mjs";
|
|
4
|
+
import { checkStatus } from "./check-status.mjs";
|
|
2
5
|
import { globalRefStorage } from "../../store/storage-store.mjs";
|
|
3
6
|
import "../../store/index.mjs";
|
|
4
7
|
import { AxiosHeaders } from "axios";
|
|
@@ -25,12 +28,27 @@ function interceptors(axios) {
|
|
|
25
28
|
else {
|
|
26
29
|
const { errorMessageMode } = response.config || {};
|
|
27
30
|
const { subMessage, message, subCode } = response.data;
|
|
28
|
-
if (
|
|
31
|
+
if (subCode === "sys.global.tenantId.required") {
|
|
32
|
+
console.error("租户信息缺失", response.data);
|
|
33
|
+
AuthUtil.getInstance().goTenantSelect();
|
|
34
|
+
} else if (subCode === "sys.plat.api.pass.failure.over.max_times") console.error("账号锁定", response.data);
|
|
35
|
+
else if (errorMessageMode === "none") console.error(response.data);
|
|
29
36
|
else if (subMessage || message) _gct.message.error(subMessage || message);
|
|
30
37
|
}
|
|
31
38
|
return response;
|
|
32
|
-
}, (
|
|
33
|
-
|
|
39
|
+
}, (error) => {
|
|
40
|
+
const { response, code, message, status } = error || {};
|
|
41
|
+
const errorMessageMode = response.config?.errorMessageMode || "none";
|
|
42
|
+
let errMessage = "";
|
|
43
|
+
if (code === "ECONNABORTED" && message?.indexOf("timeout") !== -1) errMessage = t("sys.apiTimeoutMessage");
|
|
44
|
+
if (message?.includes("Network Error")) errMessage = t("sys.networkExceptionMsg");
|
|
45
|
+
if (errMessage) {
|
|
46
|
+
if (errorMessageMode === "modal") console.warn("errorMessageMode === \"modal\" 暂未支持", errMessage);
|
|
47
|
+
else if (errorMessageMode === "message") _gct.message.error(errMessage);
|
|
48
|
+
return Promise.reject(error);
|
|
49
|
+
}
|
|
50
|
+
checkStatus(status, message, errorMessageMode);
|
|
51
|
+
return Promise.reject(error);
|
|
34
52
|
});
|
|
35
53
|
}
|
|
36
54
|
//#endregion
|
package/es/utils/index.d.ts
CHANGED