vap1 0.0.1
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/basetype.d.ts +62 -0
- package/basetype.js +2 -0
- package/components/Box/Box.d.ts +118 -0
- package/components/Box/Box.js +150 -0
- package/components/Box/SelectBar.d.ts +90 -0
- package/components/Box/SelectBar.js +93 -0
- package/components/Box/_register.d.ts +49 -0
- package/components/Box/_register.js +29 -0
- package/components/Box/index.d.ts +9 -0
- package/components/Box/index.js +6 -0
- package/components/Lists/SList.d.ts +58 -0
- package/components/Lists/SList.js +167 -0
- package/components/SearchBar/ActionButtons.d.ts +49 -0
- package/components/SearchBar/ActionButtons.js +96 -0
- package/components/SearchBar/ByField.d.ts +3 -0
- package/components/SearchBar/ByField.js +193 -0
- package/components/SearchBar/ByKeyword.d.ts +3 -0
- package/components/SearchBar/ByKeyword.js +34 -0
- package/components/SearchBar/SearchField.d.ts +15 -0
- package/components/SearchBar/SearchField.js +25 -0
- package/components/SearchBar/SearchTags.d.ts +2 -0
- package/components/SearchBar/SearchTags.js +18 -0
- package/components/SearchBar/_FieldType.d.ts +8 -0
- package/components/SearchBar/_FieldType.js +45 -0
- package/components/SearchBar/_register.d.ts +65 -0
- package/components/SearchBar/_register.js +29 -0
- package/components/SearchBar/index.d.ts +134 -0
- package/components/SearchBar/index.js +33 -0
- package/components/Tables/ApiTable.d.ts +18 -0
- package/components/Tables/ApiTable.js +48 -0
- package/components/Tables/ApiTableModal.d.ts +22 -0
- package/components/Tables/ApiTableModal.js +73 -0
- package/components/Tables/Components/ActionBar.d.ts +56 -0
- package/components/Tables/Components/ActionBar.js +100 -0
- package/components/Tables/Components/Actions.d.ts +47 -0
- package/components/Tables/Components/Actions.js +91 -0
- package/components/Tables/Components/Summary.d.ts +11 -0
- package/components/Tables/Components/Summary.js +11 -0
- package/components/Tables/Components/index.d.ts +17 -0
- package/components/Tables/Components/index.js +19 -0
- package/components/Tables/STable.d.ts +5 -0
- package/components/Tables/STable.js +37 -0
- package/components/Tables/TopTable.d.ts +24 -0
- package/components/Tables/TopTable.js +157 -0
- package/components/Tables/TopTableModal.d.ts +5 -0
- package/components/Tables/TopTableModal.js +20 -0
- package/components/Tables/Util.d.ts +3 -0
- package/components/Tables/Util.js +41 -0
- package/components/Tables/VTable.d.ts +11 -0
- package/components/Tables/VTable.js +237 -0
- package/components/Tables/index.d.ts +81 -0
- package/components/Tables/index.js +20 -0
- package/components/TreeSelect/BaseTreeSelect.d.ts +33 -0
- package/components/TreeSelect/BaseTreeSelect.js +190 -0
- package/components/TreeSelect/DTreeSelect.d.ts +24 -0
- package/components/TreeSelect/DTreeSelect.js +66 -0
- package/components/TreeSelect/FTreeSelect.d.ts +11 -0
- package/components/TreeSelect/FTreeSelect.js +39 -0
- package/components/TreeSelect/STreeSelect.d.ts +14 -0
- package/components/TreeSelect/STreeSelect.js +52 -0
- package/components/TreeSelect/index.d.ts +94 -0
- package/components/TreeSelect/index.js +9 -0
- package/components/Trees/ActionTree.d.ts +54 -0
- package/components/Trees/ActionTree.js +657 -0
- package/components/Trees/BaseTree.d.ts +31 -0
- package/components/Trees/BaseTree.js +185 -0
- package/components/Trees/DTree.d.ts +48 -0
- package/components/Trees/DTree.js +142 -0
- package/components/Trees/FTree.d.ts +33 -0
- package/components/Trees/FTree.js +79 -0
- package/components/Trees/STree.d.ts +21 -0
- package/components/Trees/STree.js +92 -0
- package/components/Trees/index.d.ts +134 -0
- package/components/Trees/index.js +9 -0
- package/components/UForm/FormWrapper.d.ts +22 -0
- package/components/UForm/FormWrapper.js +270 -0
- package/components/UForm/UDescriptions.d.ts +5 -0
- package/components/UForm/UDescriptions.js +134 -0
- package/components/UForm/UForm.d.ts +33 -0
- package/components/UForm/UForm.js +484 -0
- package/components/UForm/UFormModal.d.ts +3 -0
- package/components/UForm/UFormModal.js +149 -0
- package/components/UForm/UInfo.d.ts +10 -0
- package/components/UForm/UInfo.js +75 -0
- package/components/UForm/UInfoModal.d.ts +3 -0
- package/components/UForm/UInfoModal.js +50 -0
- package/components/UForm/UModal.d.ts +3 -0
- package/components/UForm/UModal.js +24 -0
- package/components/UForm/_FieldType.d.ts +8 -0
- package/components/UForm/_FieldType.js +100 -0
- package/components/UForm/_FormUtils.d.ts +5 -0
- package/components/UForm/_FormUtils.js +75 -0
- package/components/UForm/_input.d.ts +59 -0
- package/components/UForm/_input.js +147 -0
- package/components/UForm/_register.d.ts +87 -0
- package/components/UForm/_register.js +44 -0
- package/components/UForm/index.d.ts +387 -0
- package/components/UForm/index.js +15 -0
- package/components/Upload/UploadFile.d.ts +3 -0
- package/components/Upload/UploadFile.js +40 -0
- package/components/Upload/UploadImage.d.ts +24 -0
- package/components/Upload/UploadImage.js +93 -0
- package/components/Upload/UploadModal.d.ts +50 -0
- package/components/Upload/UploadModal.js +140 -0
- package/components/Upload/index.d.ts +77 -0
- package/components/Upload/index.js +9 -0
- package/components/Upload/useUpload.d.ts +15 -0
- package/components/Upload/useUpload.js +93 -0
- package/components/_RegisterUtil.d.ts +1 -0
- package/components/_RegisterUtil.js +25 -0
- package/components/_adapt/Alert.d.ts +11 -0
- package/components/_adapt/Alert.js +43 -0
- package/components/_adapt/Button.d.ts +20 -0
- package/components/_adapt/Button.js +26 -0
- package/components/_adapt/Col.d.ts +53 -0
- package/components/_adapt/Col.js +90 -0
- package/components/_adapt/Collapse.d.ts +30 -0
- package/components/_adapt/Collapse.js +33 -0
- package/components/_adapt/Drawer.d.ts +12 -0
- package/components/_adapt/Drawer.js +11 -0
- package/components/_adapt/Dropdown.d.ts +15 -0
- package/components/_adapt/Dropdown.js +38 -0
- package/components/_adapt/Icon.d.ts +14 -0
- package/components/_adapt/Icon.js +34 -0
- package/components/_adapt/Image.d.ts +4 -0
- package/components/_adapt/Image.js +11 -0
- package/components/_adapt/Menu.d.ts +32 -0
- package/components/_adapt/Menu.js +25 -0
- package/components/_adapt/Modal.d.ts +23 -0
- package/components/_adapt/Modal.js +69 -0
- package/components/_adapt/Popconfirm.d.ts +5 -0
- package/components/_adapt/Popconfirm.js +34 -0
- package/components/_adapt/Popover.d.ts +5 -0
- package/components/_adapt/Popover.js +34 -0
- package/components/_adapt/Progress.d.ts +14 -0
- package/components/_adapt/Progress.js +56 -0
- package/components/_adapt/Row.d.ts +10 -0
- package/components/_adapt/Row.js +23 -0
- package/components/_adapt/Select.d.ts +14 -0
- package/components/_adapt/Select.js +47 -0
- package/components/_adapt/Tag.d.ts +7 -0
- package/components/_adapt/Tag.js +12 -0
- package/components/_adapt/Tooltip.d.ts +5 -0
- package/components/_adapt/Tooltip.js +11 -0
- package/components/_adapt/todo/ColorPicker.d.ts +3 -0
- package/components/_adapt/todo/ColorPicker.js +42 -0
- package/components/_adapt/todo/FloatButton.d.ts +2 -0
- package/components/_adapt/todo/FloatButton.js +6 -0
- package/components/_adapt/todo/Image.d.ts +2 -0
- package/components/_adapt/todo/Image.js +6 -0
- package/components/_adapt/todo/Segmented.d.ts +2 -0
- package/components/_adapt/todo/Segmented.js +6 -0
- package/components/_adapt/todo/Space.d.ts +2 -0
- package/components/_adapt/todo/Space.js +6 -0
- package/components/_adapt/utils.d.ts +12 -0
- package/components/_adapt/utils.js +93 -0
- package/components/_common/AutoComplete.d.ts +32 -0
- package/components/_common/AutoComplete.js +87 -0
- package/components/_common/CountUp.d.ts +38 -0
- package/components/_common/CountUp.js +60 -0
- package/components/_common/DateRange.d.ts +52 -0
- package/components/_common/DateRange.js +108 -0
- package/components/_common/HighLight.d.ts +15 -0
- package/components/_common/HighLight.js +37 -0
- package/components/_common/I18N.d.ts +7 -0
- package/components/_common/I18N.js +6 -0
- package/components/_common/Loading.d.ts +9 -0
- package/components/_common/Loading.js +52 -0
- package/components/_common/MonthRange.d.ts +46 -0
- package/components/_common/MonthRange.js +130 -0
- package/components/_common/PromiseLabel.d.ts +11 -0
- package/components/_common/PromiseLabel.js +34 -0
- package/components/_common/Role.d.ts +5 -0
- package/components/_common/Role.js +11 -0
- package/components/_common/Upagination.d.ts +21 -0
- package/components/_common/Upagination.js +106 -0
- package/components/_setup/Const.d.ts +205 -0
- package/components/_setup/Const.js +112 -0
- package/components/_setup/I18N/enUS.d.ts +1 -0
- package/components/_setup/I18N/enUS.js +106 -0
- package/components/_setup/I18N/index.d.ts +3 -0
- package/components/_setup/I18N/index.js +5 -0
- package/components/_setup/I18N/zhCN.d.ts +3 -0
- package/components/_setup/I18N/zhCN.js +109 -0
- package/components/_setup/I18N/zhHK.d.ts +1 -0
- package/components/_setup/I18N/zhHK.js +107 -0
- package/components/_setup/ICON/IconTypes.d.ts +1 -0
- package/components/_setup/ICON/IconTypes.js +10 -0
- package/components/_setup/SearchField/SearchFieldAdvance.d.ts +1 -0
- package/components/_setup/SearchField/SearchFieldAdvance.js +57 -0
- package/components/_setup/SearchField/SearchFieldDate.d.ts +1 -0
- package/components/_setup/SearchField/SearchFieldDate.js +186 -0
- package/components/_setup/SearchField/SearchFieldInput.d.ts +3 -0
- package/components/_setup/SearchField/SearchFieldInput.js +20 -0
- package/components/_setup/SearchField/SearchFieldSelect.d.ts +1 -0
- package/components/_setup/SearchField/SearchFieldSelect.js +106 -0
- package/components/_setup/SearchField/SearchFieldTree.d.ts +1 -0
- package/components/_setup/SearchField/SearchFieldTree.js +191 -0
- package/components/_setup/SelectBar/SelectList.d.ts +1 -0
- package/components/_setup/SelectBar/SelectList.js +21 -0
- package/components/_setup/SelectBar/SelectTree.d.ts +1 -0
- package/components/_setup/SelectBar/SelectTree.js +11 -0
- package/components/_setup/UForm/UFormAdvanceInput.d.ts +1 -0
- package/components/_setup/UForm/UFormAdvanceInput.js +300 -0
- package/components/_setup/UForm/UFormAdvanceSelect.d.ts +0 -0
- package/components/_setup/UForm/UFormAdvanceSelect.js +26 -0
- package/components/_setup/UForm/UFormCrontab.d.ts +1 -0
- package/components/_setup/UForm/UFormCrontab.js +199 -0
- package/components/_setup/UForm/UFormDate.d.ts +1 -0
- package/components/_setup/UForm/UFormDate.js +313 -0
- package/components/_setup/UForm/UFormInput.d.ts +1 -0
- package/components/_setup/UForm/UFormInput.js +159 -0
- package/components/_setup/UForm/UFormJSON.d.ts +1 -0
- package/components/_setup/UForm/UFormJSON.js +219 -0
- package/components/_setup/UForm/UFormOrg.d.ts +1 -0
- package/components/_setup/UForm/UFormOrg.js +121 -0
- package/components/_setup/UForm/UFormRole.d.ts +1 -0
- package/components/_setup/UForm/UFormRole.js +47 -0
- package/components/_setup/UForm/UFormSearch.d.ts +0 -0
- package/components/_setup/UForm/UFormSearch.js +35 -0
- package/components/_setup/UForm/UFormSelect.d.ts +1 -0
- package/components/_setup/UForm/UFormSelect.js +179 -0
- package/components/_setup/UForm/UFormTree.d.ts +0 -0
- package/components/_setup/UForm/UFormTree.js +134 -0
- package/components/_setup/UForm/UFormUpload.d.ts +1 -0
- package/components/_setup/UForm/UFormUpload.js +173 -0
- package/components/_setup/UForm/_utils.d.ts +11 -0
- package/components/_setup/UForm/_utils.js +41 -0
- package/components/_setup/index.d.ts +21 -0
- package/components/_setup/index.js +25 -0
- package/components/index.d.ts +7 -0
- package/components/index.js +16 -0
- package/deps/JsonView.d.ts +6 -0
- package/deps/JsonView.js +57 -0
- package/deps/SpringBoot.d.ts +4 -0
- package/deps/SpringBoot.js +18 -0
- package/deps/SpringCloud.d.ts +14 -0
- package/deps/SpringCloud.js +29 -0
- package/deps/_editor/advance/_Audio.d.ts +0 -0
- package/deps/_editor/advance/_Audio.js +1 -0
- package/deps/_editor/advance/_Image.d.ts +2 -0
- package/deps/_editor/advance/_Image.js +89 -0
- package/deps/_editor/advance/_Table.d.ts +0 -0
- package/deps/_editor/advance/_Table.js +1 -0
- package/deps/_editor/advance/_Video.d.ts +0 -0
- package/deps/_editor/advance/_Video.js +1 -0
- package/deps/_editor/base/Element.d.ts +5 -0
- package/deps/_editor/base/Element.js +43 -0
- package/deps/_editor/base/Leaf.d.ts +3 -0
- package/deps/_editor/base/Leaf.js +36 -0
- package/deps/_editor/base/Support.d.ts +2 -0
- package/deps/_editor/base/Support.js +78 -0
- package/deps/_editor/base/types.d.ts +156 -0
- package/deps/_editor/base/types.js +10 -0
- package/deps/_editor/i18n.d.ts +1 -0
- package/deps/_editor/i18n.js +31 -0
- package/deps/_editor/tools/Button.d.ts +6 -0
- package/deps/_editor/tools/Button.js +86 -0
- package/deps/_editor/tools/ToolBar.d.ts +8 -0
- package/deps/_editor/tools/ToolBar.js +10 -0
- package/deps/_editor/tools/_BlockButton.d.ts +4 -0
- package/deps/_editor/tools/_BlockButton.js +77 -0
- package/deps/_editor/tools/_InsertButton.d.ts +6 -0
- package/deps/_editor/tools/_InsertButton.js +65 -0
- package/deps/_editor/tools/_MarkButton.d.ts +6 -0
- package/deps/_editor/tools/_MarkButton.js +45 -0
- package/deps/_editor/tools/_TxtButton.d.ts +7 -0
- package/deps/_editor/tools/_TxtButton.js +187 -0
- package/deps/_editor/utils/ParseHtml.d.ts +0 -0
- package/deps/_editor/utils/ParseHtml.js +220 -0
- package/deps/api-audit.d.ts +1 -0
- package/deps/api-audit.js +6 -0
- package/deps/api-data.d.ts +0 -0
- package/deps/api-data.js +1 -0
- package/deps/apis/useSource.d.ts +0 -0
- package/deps/apis/useSource.js +152 -0
- package/deps/echarts.d.ts +26 -0
- package/deps/echarts.js +71 -0
- package/deps/editor.d.ts +34 -0
- package/deps/editor.js +111 -0
- package/deps/registerEditor.d.ts +1 -0
- package/deps/registerEditor.js +15 -0
- package/hooks/_list.d.ts +87 -0
- package/hooks/_list.js +13 -0
- package/hooks/index.d.ts +14 -0
- package/hooks/index.js +49 -0
- package/hooks/useAjax.d.ts +14 -0
- package/hooks/useAjax.js +43 -0
- package/hooks/useAjaxAction.d.ts +13 -0
- package/hooks/useAjaxAction.js +42 -0
- package/hooks/useAjaxQuery.d.ts +40 -0
- package/hooks/useAjaxQuery.js +81 -0
- package/hooks/useApi.d.ts +69 -0
- package/hooks/useApi.js +352 -0
- package/hooks/useApiGlobal.d.ts +0 -0
- package/hooks/useApiGlobal.js +5 -0
- package/hooks/useApp.d.ts +243 -0
- package/hooks/useApp.js +17 -0
- package/hooks/useArray.d.ts +21 -0
- package/hooks/useArray.js +182 -0
- package/hooks/useCounter.d.ts +0 -0
- package/hooks/useCounter.js +82 -0
- package/hooks/useDefault.d.ts +6 -0
- package/hooks/useDefault.js +16 -0
- package/hooks/useDoLoad.d.ts +17 -0
- package/hooks/useDoLoad.js +44 -0
- package/hooks/useEffectFunction.d.ts +8 -0
- package/hooks/useEffectFunction.js +16 -0
- package/hooks/useEffectOnce.d.ts +5 -0
- package/hooks/useEffectOnce.js +23 -0
- package/hooks/useError.d.ts +5 -0
- package/hooks/useError.js +21 -0
- package/hooks/useFirstMountState.d.ts +6 -0
- package/hooks/useFirstMountState.js +18 -0
- package/hooks/useGenkey.d.ts +2 -0
- package/hooks/useGenkey.js +16 -0
- package/hooks/useGetSet.d.ts +11 -0
- package/hooks/useGetSet.js +27 -0
- package/hooks/useGlobal.d.ts +19 -0
- package/hooks/useGlobal.js +62 -0
- package/hooks/useGlobal_back.d.ts +1 -0
- package/hooks/useGlobal_back.js +11 -0
- package/hooks/useHover.d.ts +8 -0
- package/hooks/useHover.js +49 -0
- package/hooks/useMemoPromise.d.ts +6 -0
- package/hooks/useMemoPromise.js +42 -0
- package/hooks/useModals.d.ts +40 -0
- package/hooks/useModals.js +98 -0
- package/hooks/useMountedState.d.ts +5 -0
- package/hooks/useMountedState.js +20 -0
- package/hooks/useOpenState.d.ts +28 -0
- package/hooks/useOpenState.js +23 -0
- package/hooks/usePromise.d.ts +7 -0
- package/hooks/usePromise.js +22 -0
- package/hooks/useQueue.d.ts +12 -0
- package/hooks/useQueue.js +34 -0
- package/hooks/useSetState.d.ts +9 -0
- package/hooks/useSetState.js +26 -0
- package/hooks/useStateList.d.ts +13 -0
- package/hooks/useStateList.js +59 -0
- package/hooks/useToggle.d.ts +6 -0
- package/hooks/useToggle.js +12 -0
- package/hooks/useUnmountPromise.d.ts +6 -0
- package/hooks/useUnmountPromise.js +36 -0
- package/hooks/useUpdate.d.ts +7 -0
- package/hooks/useUpdate.js +15 -0
- package/hooks/useUpdateEffect.d.ts +6 -0
- package/hooks/useUpdateEffect.js +18 -0
- package/index.d.ts +139 -0
- package/index.js +161 -0
- package/login/Base65.d.ts +8 -0
- package/login/Base65.js +65 -0
- package/login/Password.d.ts +61 -0
- package/login/Password.js +124 -0
- package/login/SM4.d.ts +20 -0
- package/login/SM4.js +193 -0
- package/login/cems/index.d.ts +10 -0
- package/login/cems/index.js +17 -0
- package/login/jit/index.d.ts +32 -0
- package/login/jit/index.js +180 -0
- package/login/jit/pnxclient.d.ts +54 -0
- package/login/jit/pnxclient.js +575 -0
- package/login/sso/index.d.ts +0 -0
- package/login/sso/index.js +0 -0
- package/login/vap/index.d.ts +1 -0
- package/login/vap/index.js +6 -0
- package/login/xrtx/index.d.ts +2 -0
- package/login/xrtx/index.js +33 -0
- package/package.json +1 -0
- package/screen/Comment.d.ts +31 -0
- package/screen/Comment.js +29 -0
- package/screen/EchartContent.d.ts +0 -0
- package/screen/EchartContent.js +63 -0
- package/screen/Page.d.ts +13 -0
- package/screen/Page.js +74 -0
- package/screen/index.d.ts +3 -0
- package/screen/index.js +9 -0
- package/screen/render.d.ts +5 -0
- package/screen/render.js +10 -0
- package/utils/Ajax.d.ts +85 -0
- package/utils/Ajax.js +147 -0
- package/utils/ArrayUtil.d.ts +22 -0
- package/utils/ArrayUtil.js +51 -0
- package/utils/CacheUtil.d.ts +20 -0
- package/utils/CacheUtil.js +86 -0
- package/utils/Const.d.ts +14 -0
- package/utils/Const.js +37 -0
- package/utils/CustomApp.d.ts +242 -0
- package/utils/CustomApp.js +18 -0
- package/utils/EventUtil.d.ts +22 -0
- package/utils/EventUtil.js +63 -0
- package/utils/Format.d.ts +28 -0
- package/utils/Format.js +206 -0
- package/utils/Global.d.ts +276 -0
- package/utils/Global.js +125 -0
- package/utils/Logger.d.ts +5 -0
- package/utils/Logger.js +32 -0
- package/utils/PageUtil.d.ts +24 -0
- package/utils/PageUtil.js +87 -0
- package/utils/Renders/ApiGetRender.d.ts +23 -0
- package/utils/Renders/ApiGetRender.js +192 -0
- package/utils/Renders/ApiPostRender.d.ts +17 -0
- package/utils/Renders/ApiPostRender.js +161 -0
- package/utils/Renders/DateRender.d.ts +8 -0
- package/utils/Renders/DateRender.js +35 -0
- package/utils/Renders/DictRender.d.ts +23 -0
- package/utils/Renders/DictRender.js +258 -0
- package/utils/Renders/FileRender.d.ts +3 -0
- package/utils/Renders/FileRender.js +46 -0
- package/utils/Renders/ListRender.d.ts +23 -0
- package/utils/Renders/ListRender.js +111 -0
- package/utils/Renders/NumberRender.d.ts +19 -0
- package/utils/Renders/NumberRender.js +65 -0
- package/utils/Renders/StatusRender.d.ts +12 -0
- package/utils/Renders/StatusRender.js +68 -0
- package/utils/Renders/StringRender.d.ts +14 -0
- package/utils/Renders/StringRender.js +194 -0
- package/utils/Renders/_define.d.ts +26 -0
- package/utils/Renders/_define.js +64 -0
- package/utils/Renders/index.d.ts +9 -0
- package/utils/Renders/index.js +42 -0
- package/utils/StringUtil.d.ts +124 -0
- package/utils/StringUtil.js +352 -0
- package/utils/TreeUtil.d.ts +42 -0
- package/utils/TreeUtil.js +69 -0
- package/utils/VAP.d.ts +16 -0
- package/utils/VAP.js +78 -0
- package/utils/XHR.d.ts +9 -0
- package/utils/XHR.js +53 -0
- package/utils/_AjaxUtil.d.ts +11 -0
- package/utils/_AjaxUtil.js +45 -0
- package/utils/_Support.d.ts +22 -0
- package/utils/_Support.js +106 -0
- package/utils/i18n.d.ts +60 -0
- package/utils/i18n.js +184 -0
- package/utils/index.d.ts +19 -0
- package/utils/index.js +54 -0
- package/utils/screenful.d.ts +15 -0
- package/utils/screenful.js +64 -0
- package/widget/index.d.ts +39 -0
- package/widget/index.js +21 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const Login = (text) => {
|
|
2
|
+
};
|
|
3
|
+
const WebSocketTest = () => {
|
|
4
|
+
if ("WebSocket" in window) {
|
|
5
|
+
//alert("WebSocket is supported by your Browser!");
|
|
6
|
+
var ws = new WebSocket("ws://127.0.0.1:30318/");
|
|
7
|
+
ws.onopen = function () {
|
|
8
|
+
var str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><getsignandtokenreq version=\"1\"><challenge>7DbgT65HZFiNEQ5rK3X7eQ==</challenge></getsignandtokenreq>";
|
|
9
|
+
ws.send(str);
|
|
10
|
+
var a = document.createElement('div');
|
|
11
|
+
a.textContent == "" ? a.textContent = '\n开始发送请求...\n' + str : a.innerText = '\n开始发送请求...\n' + str;
|
|
12
|
+
document.getElementById("showResult").appendChild(a);
|
|
13
|
+
};
|
|
14
|
+
ws.onmessage = function (evt) {
|
|
15
|
+
var received_msg = evt.data;
|
|
16
|
+
// var b = document.createElement('div');
|
|
17
|
+
// b.textContent == "" ? b.textContent = '\n返回结果:\n' + evt.data : b.innerText = '\n返回结果:\n' + evt.data;
|
|
18
|
+
Login(received_msg);
|
|
19
|
+
// document.getElementById("showResult").appendChild(b);
|
|
20
|
+
};
|
|
21
|
+
ws.onclose = function () {
|
|
22
|
+
//document.write("Connection is closed...");
|
|
23
|
+
var c = document.createElement('div');
|
|
24
|
+
c.textContent == "" ? c.textContent = '\n连接已关闭' : c.innerText = '\n连接已关闭';
|
|
25
|
+
document.getElementById("showResult").appendChild(c);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
var d = document.createElement('div');
|
|
30
|
+
d.textContent == "" ? d.textContent = '\n浏览器不支持websocket' : d.innerText = '\n浏览器不支持websocket';
|
|
31
|
+
document.getElementById("showResult").appendChild(d);
|
|
32
|
+
}
|
|
33
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"vap1","version":"0.0.1","description":"vap1, Both support MicroService and SAP FrameWork","main":"index.js","author":"Xiang da","license":"ISC","dependencies":{"antd":"^3.26.20","ejs":"^3.1.9","lodash":"^4.17.21","dayjs":"npm:moment@latest","react":"^16.14.0","terser-webpack-plugin":"^5.3.9","webpack":"^5.88.2","webpack-sources":"^3.2.3"}}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 大屏组件属性
|
|
4
|
+
*/
|
|
5
|
+
export type CommentProps = {
|
|
6
|
+
/**
|
|
7
|
+
* 组件样式,说明:width height left top position 的样式会使用 参数的,在这里写无效
|
|
8
|
+
*/
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
/**
|
|
11
|
+
* class 属性
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 组件宽度
|
|
16
|
+
*/
|
|
17
|
+
width: number;
|
|
18
|
+
/**
|
|
19
|
+
* 组件高度
|
|
20
|
+
*/
|
|
21
|
+
height: number;
|
|
22
|
+
/**
|
|
23
|
+
* 组件左边距
|
|
24
|
+
*/
|
|
25
|
+
left: number;
|
|
26
|
+
/**
|
|
27
|
+
* 组件上边距
|
|
28
|
+
*/
|
|
29
|
+
top: number;
|
|
30
|
+
};
|
|
31
|
+
export declare const Comment: React.FC<React.PropsWithChildren<CommentProps>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Comment = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
|
+
const Comment = props => {
|
|
10
|
+
let param = {
|
|
11
|
+
className: 'comment',
|
|
12
|
+
style: {}
|
|
13
|
+
};
|
|
14
|
+
// if (this.props.id) {
|
|
15
|
+
// param.id = this.props.id;
|
|
16
|
+
// }
|
|
17
|
+
if (props.className) {
|
|
18
|
+
param.className = param.className + ' ' + props.className;
|
|
19
|
+
}
|
|
20
|
+
lodash_1.default.extend(param.style, props.style, {
|
|
21
|
+
width: props.width,
|
|
22
|
+
height: props.height,
|
|
23
|
+
left: props.left,
|
|
24
|
+
top: props.top,
|
|
25
|
+
position: 'absolute'
|
|
26
|
+
});
|
|
27
|
+
return react_1.default.createElement("div", Object.assign({}, param), props.children);
|
|
28
|
+
};
|
|
29
|
+
exports.Comment = Comment;
|
|
File without changes
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// import React from 'react';
|
|
2
|
+
// import _ from 'lodash';
|
|
3
|
+
// import echarts from 'echarts';
|
|
4
|
+
// /**
|
|
5
|
+
// * 大屏Echarts组件属性
|
|
6
|
+
// */
|
|
7
|
+
// export type EchartCommentProps = {
|
|
8
|
+
// /**
|
|
9
|
+
// * class 属性
|
|
10
|
+
// */
|
|
11
|
+
// className?: string;
|
|
12
|
+
// /**
|
|
13
|
+
// * 组件样式
|
|
14
|
+
// */
|
|
15
|
+
// style?:React.CSSProperties,
|
|
16
|
+
// /**
|
|
17
|
+
// * 组件宽度
|
|
18
|
+
// */
|
|
19
|
+
// width?: number;
|
|
20
|
+
// /**
|
|
21
|
+
// * 组件高度
|
|
22
|
+
// */
|
|
23
|
+
// height?: number;
|
|
24
|
+
// /**
|
|
25
|
+
// * Echart数据
|
|
26
|
+
// */
|
|
27
|
+
// data:any;
|
|
28
|
+
// }
|
|
29
|
+
// var id = 1000;
|
|
30
|
+
// const genId = () => {
|
|
31
|
+
// id++;
|
|
32
|
+
// return '__echart__' + id;
|
|
33
|
+
// }
|
|
34
|
+
// /**
|
|
35
|
+
// * 定义 echart 的规范
|
|
36
|
+
// */
|
|
37
|
+
// export default abstract class extends React.PureComponent<EchartCommentProps>{
|
|
38
|
+
// id = genId();
|
|
39
|
+
// chart:echarts.ECharts = null;
|
|
40
|
+
// abstract build();
|
|
41
|
+
// abstract update();
|
|
42
|
+
// componentDidMount() {
|
|
43
|
+
// this.chart = echarts.init(document.getElementById(this.id) as HTMLDivElement);
|
|
44
|
+
// this.build();
|
|
45
|
+
// }
|
|
46
|
+
// componentDidUpdate() {
|
|
47
|
+
// this.update();
|
|
48
|
+
// }
|
|
49
|
+
// render() {
|
|
50
|
+
// let param: any = {
|
|
51
|
+
// className: 'comment-echart',
|
|
52
|
+
// style: {}
|
|
53
|
+
// };
|
|
54
|
+
// if (this.props.className) {
|
|
55
|
+
// param.className = param.className + ' ' + this.props.className;
|
|
56
|
+
// }
|
|
57
|
+
// _.extend(param.style, this.props.style, {
|
|
58
|
+
// width: this.props.width||'100%',
|
|
59
|
+
// height: this.props.height||'100%',
|
|
60
|
+
// });
|
|
61
|
+
// return <div id={this.id} {...param}></div>
|
|
62
|
+
// }
|
|
63
|
+
// }
|
package/screen/Page.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type PageProps = {
|
|
3
|
+
/**
|
|
4
|
+
* 比例小于一定值时不进行压缩,默认为 0.1 ,建议在 0.05-0.2 区间
|
|
5
|
+
* */
|
|
6
|
+
diff?: number;
|
|
7
|
+
/**
|
|
8
|
+
* 自定义className
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const Page: React.FC<React.PropsWithChildren<PageProps>>;
|
|
13
|
+
export {};
|
package/screen/Page.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Page = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const antd_1 = require("antd");
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
const { zh_CN } = antd.locales;
|
|
31
|
+
antd_1.Empty.defaultProps = { image: '/images/empty-insight.png' };
|
|
32
|
+
const resize = () => {
|
|
33
|
+
const diff = 0.1;
|
|
34
|
+
// const min: number = 0.1, max: number = 0.1;
|
|
35
|
+
const min = 0.5625 - diff;
|
|
36
|
+
const max = 0.5625 + diff;
|
|
37
|
+
const tW = window.innerWidth;
|
|
38
|
+
const tH = window.innerHeight;
|
|
39
|
+
const scale = tH / tW;
|
|
40
|
+
if (scale >= min && scale <= max) {
|
|
41
|
+
document.body.style.transform = 'scale(' + tW / 1920 + ',' + tH / 1080 + ')';
|
|
42
|
+
document.body.style.marginLeft = '0px';
|
|
43
|
+
document.body.style.marginTop = '0px';
|
|
44
|
+
}
|
|
45
|
+
else if (scale > max) {
|
|
46
|
+
document.body.style.transform = 'scale(' + tW / 1920 + ')';
|
|
47
|
+
document.body.style.marginLeft = '0px';
|
|
48
|
+
document.body.style.marginTop = (tH / (tW / 1920) - 1080) / 2 * tW / 1920 + 'px';
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
document.body.style.transform = 'scale(' + tH / 1080 + ')';
|
|
52
|
+
document.body.style.marginLeft = (tW / (tH / 1080) - 1920) / 2 * tH / 1080 + 'px';
|
|
53
|
+
document.body.style.marginTop = '0px';
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const Page = props => {
|
|
57
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
58
|
+
document.body.style.width = '1920px';
|
|
59
|
+
document.body.style.height = '1080px';
|
|
60
|
+
document.body.style.transformOrigin = 'top left';
|
|
61
|
+
if (props.className) {
|
|
62
|
+
document.getElementById('root').classList.add(props.className);
|
|
63
|
+
}
|
|
64
|
+
window.addEventListener('resize', resize, false);
|
|
65
|
+
resize();
|
|
66
|
+
return () => {
|
|
67
|
+
window.removeEventListener('resize', resize);
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
return react_1.default.createElement(antd_1.ConfigProvider, { locale: zh_CN,
|
|
71
|
+
// autoInsertSpaceInButton={false}
|
|
72
|
+
renderEmpty: () => react_1.default.createElement(antd_1.Empty, null) }, props.children);
|
|
73
|
+
};
|
|
74
|
+
exports.Page = Page;
|
package/screen/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.render = exports.Comment = exports.Page = void 0;
|
|
4
|
+
var Page_1 = require("./Page");
|
|
5
|
+
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return Page_1.Page; } });
|
|
6
|
+
var Comment_1 = require("./Comment");
|
|
7
|
+
Object.defineProperty(exports, "Comment", { enumerable: true, get: function () { return Comment_1.Comment; } });
|
|
8
|
+
var render_1 = require("./render");
|
|
9
|
+
Object.defineProperty(exports, "render", { enumerable: true, get: function () { return render_1.render; } });
|
package/screen/render.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.render = void 0;
|
|
4
|
+
const react_dom_1 = require("react-dom");
|
|
5
|
+
/**
|
|
6
|
+
* 大屏 render 方法根节点请用 Page
|
|
7
|
+
*/
|
|
8
|
+
const render = (children) => (0, react_dom_1.render)(children, document.getElementById('root'));
|
|
9
|
+
exports.render = render;
|
|
10
|
+
// createRoot(document.getElementById('root') as HTMLDivElement).render(children);
|
package/utils/Ajax.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { PlainObject } from '../basetype';
|
|
2
|
+
import type { Result } from './_AjaxUtil';
|
|
3
|
+
export { SESSION, CLEAR, } from './_AjaxUtil';
|
|
4
|
+
/**
|
|
5
|
+
* CATCH 方法可以捕获通用的错误并,省去 try/catch 语法
|
|
6
|
+
*/
|
|
7
|
+
export declare const CATCH: (fn: () => Promise<any>) => (() => Promise<void>);
|
|
8
|
+
export type AjaxOptions = RequestInit & {
|
|
9
|
+
/**
|
|
10
|
+
* 默认 Ajax 会将结果解析为 json
|
|
11
|
+
* 如果想获取纯文本的结果,设置 `text:true`
|
|
12
|
+
*/
|
|
13
|
+
text?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 默认显示进度,如果不想显示进度,则可以传 process:true
|
|
16
|
+
*/
|
|
17
|
+
process?: false;
|
|
18
|
+
/**
|
|
19
|
+
* 传 clean : true 会清空参数所有为 空字符串或 null / undefined 值
|
|
20
|
+
* 传 clean : false 不会执行参数清理
|
|
21
|
+
* 说明,默认情况下 , post 请求会清理空值,put/delete/patch 请求不会清理
|
|
22
|
+
*/
|
|
23
|
+
clean?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* 建议使用 `GET` `POST` `PUT` `DELETE` `PATCH` 发送请求。
|
|
27
|
+
*
|
|
28
|
+
* 当满足不了需求时,可使用 `FETCH`,参考与标准 fetch 类似。
|
|
29
|
+
*/
|
|
30
|
+
export declare const FETCH: (url: string, options: AjaxOptions) => Promise<Result>;
|
|
31
|
+
export declare const GET: (url: string, options?: AjaxOptions) => Promise<Result>;
|
|
32
|
+
export declare const POST: (url: string, param: PlainObject, options?: AjaxOptions) => Promise<Result>;
|
|
33
|
+
export declare const PATCH: (url: string, param: PlainObject, options?: AjaxOptions) => Promise<Result>;
|
|
34
|
+
export declare const DELETE: (url: string, param: PlainObject, options?: AjaxOptions) => Promise<Result>;
|
|
35
|
+
export declare const PUT: (url: string, param: PlainObject, options?: AjaxOptions) => Promise<Result>;
|
|
36
|
+
/**
|
|
37
|
+
* 构造一个等待 Promise ,用于部分场景,如:
|
|
38
|
+
*
|
|
39
|
+
* ```typescript
|
|
40
|
+
* console.log(Date.now())
|
|
41
|
+
* await Ajax.WAIT(500); // 延时500ms 后再往下执行
|
|
42
|
+
* console.log(Date.now())
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare const WAIT: (ms: number) => Promise<unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* 将所有请求一次性发出,用于一次发多个情求时,提升响应速度
|
|
48
|
+
*
|
|
49
|
+
* ### 例如:普通串行
|
|
50
|
+
*
|
|
51
|
+
* ```typescript
|
|
52
|
+
* console.log(Date.now());
|
|
53
|
+
* const resp1 = await Ajax.GET('/api1');
|
|
54
|
+
* console.log(Date.now());
|
|
55
|
+
* const resp2 = await Ajax.GET('/api2');
|
|
56
|
+
* console.log(Date.now());
|
|
57
|
+
* const resp3 = await Ajax.GET('/api3');
|
|
58
|
+
* console.log(resp1,resp2,resp3);
|
|
59
|
+
* // 每个请求都要等上一个请求响应后才开始发送,有点浪费时间
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* ### 改为并行如下
|
|
63
|
+
*
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const [resp1,resp2,resp3] = await Ajax.WHEN(
|
|
66
|
+
* Ajax.GET('/api1'),
|
|
67
|
+
* Ajax.GET('/api2'),
|
|
68
|
+
* Ajax.GET('/api3'),
|
|
69
|
+
* );
|
|
70
|
+
* console.log(resp1,resp2,resp3)
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* ### 不适用于:有逻辑的串行,如
|
|
74
|
+
*
|
|
75
|
+
* ```typescipt
|
|
76
|
+
* const resp = await Ajax.GET('/api1');
|
|
77
|
+
* // 当后面的情求依赖于前面请求的结果时,不能使用 WHEN
|
|
78
|
+
* if(resp.data.xxx=11){
|
|
79
|
+
* await Ajax.GET('/api2/'+resp.data.id)
|
|
80
|
+
* }else{
|
|
81
|
+
* await Ajax.GET('/api3/'+resp.data.yy)
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare const WHEN: (...pos: Promise<any>[]) => Promise<any[]>;
|
package/utils/Ajax.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.WHEN = exports.WAIT = exports.PUT = exports.DELETE = exports.PATCH = exports.POST = exports.GET = exports.FETCH = exports.CATCH = exports.CLEAR = exports.SESSION = void 0;
|
|
16
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
17
|
+
const Global_1 = require("./Global");
|
|
18
|
+
const _Support_1 = require("./_Support");
|
|
19
|
+
const _AjaxUtil_1 = require("./_AjaxUtil");
|
|
20
|
+
var _AjaxUtil_2 = require("./_AjaxUtil");
|
|
21
|
+
Object.defineProperty(exports, "SESSION", { enumerable: true, get: function () { return _AjaxUtil_2.SESSION; } });
|
|
22
|
+
Object.defineProperty(exports, "CLEAR", { enumerable: true, get: function () { return _AjaxUtil_2.CLEAR; } });
|
|
23
|
+
const { start, done } = (0, _Support_1.globalDefault)('NProgress', { start: () => { }, done: () => { } });
|
|
24
|
+
/**
|
|
25
|
+
* CATCH 方法可以捕获通用的错误并,省去 try/catch 语法
|
|
26
|
+
*/
|
|
27
|
+
const CATCH = (fn) => () => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
try {
|
|
29
|
+
yield fn();
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
console.error(e);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
exports.CATCH = CATCH;
|
|
36
|
+
/**
|
|
37
|
+
* 建议使用 `GET` `POST` `PUT` `DELETE` `PATCH` 发送请求。
|
|
38
|
+
*
|
|
39
|
+
* 当满足不了需求时,可使用 `FETCH`,参考与标准 fetch 类似。
|
|
40
|
+
*/
|
|
41
|
+
const FETCH = (url, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
if (options.process !== false)
|
|
43
|
+
start();
|
|
44
|
+
let fetchOptions = lodash_1.default.merge({
|
|
45
|
+
method: 'GET',
|
|
46
|
+
headers: Global_1.CONFIG.AJAX.headers,
|
|
47
|
+
}, options);
|
|
48
|
+
if (fetchOptions.body && lodash_1.default.isPlainObject(fetchOptions.body)) {
|
|
49
|
+
fetchOptions.body = JSON.stringify(fetchOptions.body);
|
|
50
|
+
}
|
|
51
|
+
const response = yield fetch(url, fetchOptions);
|
|
52
|
+
if (options.process !== false)
|
|
53
|
+
done();
|
|
54
|
+
if (response.redirected && lodash_1.default.isString(response.url) && response.url.indexOf('login') >= 0) {
|
|
55
|
+
if (window.location.href.indexOf('login') < 0) {
|
|
56
|
+
window.location.href = response.url;
|
|
57
|
+
return new Promise((r) => r({ code: '9999', message: '请先登录' }));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (fetchOptions.text) {
|
|
61
|
+
return yield response.text();
|
|
62
|
+
}
|
|
63
|
+
let result = yield response.json();
|
|
64
|
+
return result;
|
|
65
|
+
});
|
|
66
|
+
exports.FETCH = FETCH;
|
|
67
|
+
const _FETCH = (method, url, param, options) => {
|
|
68
|
+
const [_url, _method, _headers, _data] = (0, _AjaxUtil_1.AOP_BEFORE)(url, method, (options && options.headers) ? options.headers : {}, param);
|
|
69
|
+
let fetchOptions = Object.assign(Object.assign({}, options), { body: JSON.stringify(_data), headers: _headers, method: _method });
|
|
70
|
+
if (_method == 'GET') {
|
|
71
|
+
lodash_1.default.unset(fetchOptions, 'body');
|
|
72
|
+
}
|
|
73
|
+
return (0, exports.FETCH)(_url, fetchOptions);
|
|
74
|
+
};
|
|
75
|
+
const GET = (url, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
76
|
+
if (_AjaxUtil_1.CACHE_URL.has(url) && sessionStorage.getItem(url)) {
|
|
77
|
+
return yield new Promise(r => r(JSON.parse(sessionStorage.getItem(url))));
|
|
78
|
+
}
|
|
79
|
+
const resp = yield _FETCH('GET', url, {}, options);
|
|
80
|
+
if (_AjaxUtil_1.CACHE_URL.has(url)) {
|
|
81
|
+
if (lodash_1.default.has(resp, 'code') && resp.code == '0') {
|
|
82
|
+
sessionStorage.setItem(url, JSON.stringify(resp));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return resp;
|
|
86
|
+
});
|
|
87
|
+
exports.GET = GET;
|
|
88
|
+
const POST = (url, param, options) => __awaiter(void 0, void 0, void 0, function* () { return _FETCH('POST', url, param, options); });
|
|
89
|
+
exports.POST = POST;
|
|
90
|
+
const PATCH = (url, param, options) => __awaiter(void 0, void 0, void 0, function* () { return _FETCH('PATCH', url, param, options); });
|
|
91
|
+
exports.PATCH = PATCH;
|
|
92
|
+
const DELETE = (url, param, options) => __awaiter(void 0, void 0, void 0, function* () { return _FETCH('DELETE', url, param, options); });
|
|
93
|
+
exports.DELETE = DELETE;
|
|
94
|
+
const PUT = (url, param, options) => __awaiter(void 0, void 0, void 0, function* () { return _FETCH('PUT', url, param, options); });
|
|
95
|
+
exports.PUT = PUT;
|
|
96
|
+
/**
|
|
97
|
+
* 构造一个等待 Promise ,用于部分场景,如:
|
|
98
|
+
*
|
|
99
|
+
* ```typescript
|
|
100
|
+
* console.log(Date.now())
|
|
101
|
+
* await Ajax.WAIT(500); // 延时500ms 后再往下执行
|
|
102
|
+
* console.log(Date.now())
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
const WAIT = (ms) => new Promise(r => setTimeout(r, ms));
|
|
106
|
+
exports.WAIT = WAIT;
|
|
107
|
+
/**
|
|
108
|
+
* 将所有请求一次性发出,用于一次发多个情求时,提升响应速度
|
|
109
|
+
*
|
|
110
|
+
* ### 例如:普通串行
|
|
111
|
+
*
|
|
112
|
+
* ```typescript
|
|
113
|
+
* console.log(Date.now());
|
|
114
|
+
* const resp1 = await Ajax.GET('/api1');
|
|
115
|
+
* console.log(Date.now());
|
|
116
|
+
* const resp2 = await Ajax.GET('/api2');
|
|
117
|
+
* console.log(Date.now());
|
|
118
|
+
* const resp3 = await Ajax.GET('/api3');
|
|
119
|
+
* console.log(resp1,resp2,resp3);
|
|
120
|
+
* // 每个请求都要等上一个请求响应后才开始发送,有点浪费时间
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* ### 改为并行如下
|
|
124
|
+
*
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const [resp1,resp2,resp3] = await Ajax.WHEN(
|
|
127
|
+
* Ajax.GET('/api1'),
|
|
128
|
+
* Ajax.GET('/api2'),
|
|
129
|
+
* Ajax.GET('/api3'),
|
|
130
|
+
* );
|
|
131
|
+
* console.log(resp1,resp2,resp3)
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* ### 不适用于:有逻辑的串行,如
|
|
135
|
+
*
|
|
136
|
+
* ```typescipt
|
|
137
|
+
* const resp = await Ajax.GET('/api1');
|
|
138
|
+
* // 当后面的情求依赖于前面请求的结果时,不能使用 WHEN
|
|
139
|
+
* if(resp.data.xxx=11){
|
|
140
|
+
* await Ajax.GET('/api2/'+resp.data.id)
|
|
141
|
+
* }else{
|
|
142
|
+
* await Ajax.GET('/api3/'+resp.data.yy)
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
const WHEN = (...pos) => Promise.all(pos);
|
|
147
|
+
exports.WHEN = WHEN;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Key, PlainObject } from '../basetype';
|
|
2
|
+
/**
|
|
3
|
+
* 更新一个列表中的一个对象,并返回一个新的列表
|
|
4
|
+
* @param list 需要被修改的列表
|
|
5
|
+
* @param data 新的数据
|
|
6
|
+
* @param rowKey 列表中数据的主键,如果不传,则为 `id`
|
|
7
|
+
* @return 一个新的列表
|
|
8
|
+
*/
|
|
9
|
+
export declare const update: (list: PlainObject[], data: PlainObject, rowKey?: string) => PlainObject[];
|
|
10
|
+
/**
|
|
11
|
+
* 往列表的最前面插入一项,并返回一个新的列表
|
|
12
|
+
* @param list 需要被插入的列表
|
|
13
|
+
* @param data 新的数据
|
|
14
|
+
*/
|
|
15
|
+
export declare const add: (list: PlainObject[], data: PlainObject) => any[];
|
|
16
|
+
/**
|
|
17
|
+
* 在一个列表里面删除指定的数据,并返回一个新的列表
|
|
18
|
+
* @param list 需要被插入的列表
|
|
19
|
+
* @param ids 需要删除的 id 列表
|
|
20
|
+
* @param rowKey 每条数据的识别的主键 默认为 'id'
|
|
21
|
+
*/
|
|
22
|
+
export declare const del: (list: PlainObject[], ids: Key | Key[], rowKey?: string) => PlainObject[];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.del = exports.add = exports.update = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
/**
|
|
9
|
+
* 更新一个列表中的一个对象,并返回一个新的列表
|
|
10
|
+
* @param list 需要被修改的列表
|
|
11
|
+
* @param data 新的数据
|
|
12
|
+
* @param rowKey 列表中数据的主键,如果不传,则为 `id`
|
|
13
|
+
* @return 一个新的列表
|
|
14
|
+
*/
|
|
15
|
+
const update = (list, data, rowKey = 'id') => {
|
|
16
|
+
let arr = lodash_1.default.slice(list);
|
|
17
|
+
let param = {};
|
|
18
|
+
param[rowKey] = data[rowKey];
|
|
19
|
+
let index = lodash_1.default.findIndex(arr, param);
|
|
20
|
+
if (index >= 0) {
|
|
21
|
+
let obj = lodash_1.default.assign({}, data);
|
|
22
|
+
arr[index] = obj;
|
|
23
|
+
}
|
|
24
|
+
return arr;
|
|
25
|
+
};
|
|
26
|
+
exports.update = update;
|
|
27
|
+
/**
|
|
28
|
+
* 往列表的最前面插入一项,并返回一个新的列表
|
|
29
|
+
* @param list 需要被插入的列表
|
|
30
|
+
* @param data 新的数据
|
|
31
|
+
*/
|
|
32
|
+
const add = (list, data) => {
|
|
33
|
+
let arr = lodash_1.default.slice(list);
|
|
34
|
+
arr.unshift(data);
|
|
35
|
+
return arr;
|
|
36
|
+
};
|
|
37
|
+
exports.add = add;
|
|
38
|
+
/**
|
|
39
|
+
* 在一个列表里面删除指定的数据,并返回一个新的列表
|
|
40
|
+
* @param list 需要被插入的列表
|
|
41
|
+
* @param ids 需要删除的 id 列表
|
|
42
|
+
* @param rowKey 每条数据的识别的主键 默认为 'id'
|
|
43
|
+
*/
|
|
44
|
+
const del = (list, ids, rowKey = 'id') => {
|
|
45
|
+
if (lodash_1.default.isArray(ids)) {
|
|
46
|
+
let toDelete = new Set(ids.map(i => i + ''));
|
|
47
|
+
return lodash_1.default.filter(list, item => !toDelete.has(item[rowKey] + ''));
|
|
48
|
+
}
|
|
49
|
+
return lodash_1.default.filter(list, item => ids != item[rowKey]);
|
|
50
|
+
};
|
|
51
|
+
exports.del = del;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const set: (key: string, value: any) => void;
|
|
2
|
+
/**
|
|
3
|
+
* 获取 Session 缓存, 并以 Object 返回 (JSON)
|
|
4
|
+
*/
|
|
5
|
+
export declare const getData: <T extends object = any>(key: string, def?: T) => any;
|
|
6
|
+
/**
|
|
7
|
+
* 获取 Session 缓存, 并以 String 返回
|
|
8
|
+
*/
|
|
9
|
+
export declare const getString: (key: string, def?: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* 获取 Session 缓存,并以 Boolean 值返回
|
|
12
|
+
*
|
|
13
|
+
* - false / 0 / no = false
|
|
14
|
+
* - true / 1 / yes = true
|
|
15
|
+
*/
|
|
16
|
+
export declare const getBoolean: (key: string, def?: boolean) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 获取 Session 缓存, 并以 Integer 返回
|
|
19
|
+
*/
|
|
20
|
+
export declare const getInteger: (key: string, def?: number) => number;
|