@titaui/pc 1.11.4-0 → 1.11.4-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/es/components/cascader/time.js +31 -0
- package/es/components/common-share/request-apis.js +56 -0
- package/es/components/confidence/heart.js +66 -0
- package/es/components/create-okr-modal/fields/index.js +17 -0
- package/es/components/create-okr-modal/utils/getCreateOkrSurpassPercent.js +154 -0
- package/es/components/date-picker/BodyItem.js +121 -0
- package/es/components/date-picker/CalendarBody.js +157 -0
- package/es/components/date-picker/CalendarHeader.js +187 -0
- package/es/components/date-picker/index.js +157 -0
- package/es/components/date-range-picker/index.js +210 -0
- package/es/components/dialog/index.js +119 -0
- package/es/components/dialog-confirm/index.js +154 -0
- package/es/components/drop-selector/icon-item.js +40 -0
- package/es/components/drop-selector/index.js +179 -0
- package/es/components/dynamic/dynamic-like-ranking/mock.js +84 -0
- package/es/components/dynamic/dynamic-liking/mock.js +83 -0
- package/es/components/dynamic/dynamic-topping/request-api.js +36 -0
- package/es/components/e-priority/index.js +88 -0
- package/es/components/e-status-dropdown/index.js +94 -0
- package/es/components/grid-layout/commen-components/index.js +73 -0
- package/es/components/grid-layout/image/could.js +8 -0
- package/es/components/grid-layout/image/lv.js +8 -0
- package/es/components/grid-layout/image/tita-mask.js +8 -0
- package/es/components/help-card/request-api.js +35 -0
- package/es/components/icon-button-list/index.js +65 -0
- package/es/components/menus/context.js +18 -0
- package/es/components/menus/precls.js +8 -0
- package/es/components/okr-detail/auth.js +197 -0
- package/es/components/okr-detail/components/ao-nice/index.js +245 -0
- package/es/components/okr-detail/components/block-line/index.js +20 -0
- package/es/components/okr-detail/components/header/index.js +211 -0
- package/es/components/okr-detail/components/icon-text/index.js +116 -0
- package/es/components/okr-detail/components/okr-tree/index.js +48 -0
- package/es/components/okr-detail/components/okr-tree/precls.js +8 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/default-node.js +22 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/e-node/e-priority-dropdown.js +88 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/e-node/e-project.js +200 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/e-node/e-status-dropdown.js +98 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/e-node/e-task-level2.js +412 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/get-process-color.js +62 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/index.js +90 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/kr-node/get-process-color.js +46 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/kr-node/index.js +421 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/index.js +54 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/style.js +62 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/kr-node/range-picker-pop.js +94 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/kr-parent-node/index.js +273 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/o-child-node/index.js +207 -0
- package/es/components/okr-detail/components/okr-tree/tree-node/o-parent-node/index.js +236 -0
- package/es/components/okr-detail/components/padding-layout.js +22 -0
- package/es/components/okr-detail/components/tab-panel-content/index.js +27 -0
- package/es/components/okr-detail/context.js +30 -0
- package/es/components/okr-detail/e-list/index.js +243 -0
- package/es/components/okr-detail/e-list/precls.js +8 -0
- package/es/components/okr-detail/e-list/search-form/fields/e-order.js +172 -0
- package/es/components/okr-detail/e-list/search-form/fields/e-status.js +99 -0
- package/es/components/okr-detail/e-list/search-form/fields/e-user.js +49 -0
- package/es/components/okr-detail/e-list/search-form/index.js +143 -0
- package/es/components/okr-detail/error-page/index.js +33 -0
- package/es/components/okr-detail/index.js +428 -0
- package/es/components/okr-detail/loading/index.js +28 -0
- package/es/components/okr-detail/okr-list/add-parent-okr.js +37 -0
- package/es/components/okr-detail/okr-list/create-kr-item/heart.js +38 -0
- package/es/components/okr-detail/okr-list/drag-order-kr.js +62 -0
- package/es/components/okr-detail/okr-list/empty/index.js +48 -0
- package/es/components/okr-detail/okr-list/index.js +524 -0
- package/es/components/okr-detail/okr-list/warp-parent-okr.js +21 -0
- package/es/components/okr-detail/store.js +1 -0
- package/es/components/okr-flow/child-node/fields/creator.js +175 -0
- package/es/components/okr-flow/child-node/fields/okrClassify.js +31 -0
- package/es/components/okr-flow/child-node/fields/okrType.js +21 -0
- package/es/components/okr-flow/child-node/helper.js +35 -0
- package/es/components/okr-flow/child-node/index.js +110 -0
- package/es/components/okr-flow/child-node/kr-node.js +75 -0
- package/es/components/okr-flow/child-node/work-node.js +242 -0
- package/es/components/okr-flow/context.js +14 -0
- package/es/components/okr-flow/empty/index.js +29 -0
- package/es/components/okr-flow/export-modules/okr-search-panel/index.js +394 -0
- package/es/components/okr-flow/index.js +24 -0
- package/es/components/okr-flow/mini-map/index.js +112 -0
- package/es/components/okr-flow/mini-map/map.js +145 -0
- package/es/components/okr-flow/mini-map/mini-node.js +57 -0
- package/es/components/okr-flow/mini-map/utils.js +79 -0
- package/es/components/okr-flow/okr-map/index.js +192 -0
- package/es/components/okr-flow/open-data/index.js +115 -0
- package/es/components/okr-flow/precls.js +8 -0
- package/es/components/okr-flow/request-apis.js +118 -0
- package/es/components/okr-flow/root-node/index.js +229 -0
- package/es/components/okr-flow/utils/config.js +18 -0
- package/es/components/okr-flow/utils/helper.js +36 -0
- package/es/components/okr-flow/utils/index.js +66 -0
- package/es/components/okr-flow/utils/tree-handler.js +323 -0
- package/es/components/okr-progress-modal/helper.js +156 -0
- package/es/components/okr-progress-modal/request-apis.js +34 -0
- package/es/components/okr-share/request-apis.js +56 -0
- package/es/components/okrcase-library/server/network.js +407 -0
- package/es/components/pagination/locale/en_US.js +22 -0
- package/es/components/pagination/locale/zh_CN.js +22 -0
- package/es/components/point-demo/drop-down-box/index.js +159 -0
- package/es/components/point-demo/index.js +533 -0
- package/es/components/point-demo/input/index.js +176 -0
- package/es/components/point-demo/point-demo.js +75 -0
- package/es/components/point-demo/popup/index.js +113 -0
- package/es/components/point-demo/popup/placement.js +44 -0
- package/es/components/range-picker-pop/index.js +273 -0
- package/es/components/scrollbar/simplebar/helpers.js +59 -0
- package/es/components/scrollbar/simplebar/index.js +91 -0
- package/es/components/scrollbar/simplebar/scrollbar-width.js +47 -0
- package/es/components/scrollbar/simplebar/simplebar.js +852 -0
- package/es/components/scrollbar/simplebar-react.js +163 -0
- package/es/components/search-dropdown/index.js +40 -0
- package/es/components/search-input/index.js +126 -0
- package/es/components/select/Option.js +94 -0
- package/es/components/select/index.js +330 -0
- package/es/components/selector-input/debounce.js +36 -0
- package/es/components/selector-input/index.js +109 -0
- package/es/components/slider-input/index.js +119 -0
- package/es/components/switch/index.js +39 -0
- package/es/components/table/index.js +275 -0
- package/es/components/tabs/index.js +63 -0
- package/es/components/task-relation-modal/tree-node/index.js +58 -0
- package/es/components/tita-chart/charts/img/could.js +8 -0
- package/es/components/tooltip/error-tip.js +24 -0
- package/es/components/tooltip/index.js +21 -0
- package/es/components/tree/index.js +79 -0
- package/es/components/tree/precls.js +8 -0
- package/es/components/upvote/request-apis.js +45 -0
- package/es/components/user-selector/action-btns/btn-cancel.js +21 -0
- package/es/components/user-selector/action-btns/btn-ok.js +21 -0
- package/es/components/user-selector/action-btns/index.js +27 -0
- package/es/components/user-selector/context.js +18 -0
- package/es/components/user-selector/empty/group.js +55 -0
- package/es/components/user-selector/empty/index.js +28 -0
- package/es/components/user-selector/export-modules/depart-search-selector/result-part.js +41 -0
- package/es/components/user-selector/export-modules/group-selector/index.js +170 -0
- package/es/components/user-selector/export-modules/group-selector/searched-panel.js +68 -0
- package/es/components/user-selector/export-modules/multiple-user-selector--bak/index.js +246 -0
- package/es/components/user-selector/index.js +25 -0
- package/es/components/user-selector/layout/index.js +25 -0
- package/es/components/user-selector/loading/index.js +18 -0
- package/es/components/user-selector/request-apis.js +180 -0
- package/es/components/user-selector/searched-panel/index.js +139 -0
- package/es/components/user-selector/searched-panel/result-part.js +43 -0
- package/es/components/user-selector/select-tree/selected-tree/index.js +91 -0
- package/es/components/user-selector/select-tree/tree-nodes/tree-depart-node/index.js +48 -0
- package/es/components/user-selector/select-tree/tree-nodes/tree-duties-node/index.js +27 -0
- package/es/components/user-selector/select-tree/tree-nodes/tree-group-node/index.js +57 -0
- package/es/components/user-selector/select-tree/tree-nodes/tree-person-node/index.js +93 -0
- package/es/components/user-selector/utils.js +139 -0
- package/es/components/viewer/ImageListRender.js +143 -0
- package/es/components/viewer/index.js +168 -0
- package/es/components/word-cloud/index.js +109 -0
- package/es/components/word-cloud/request-apis.js +26 -0
- package/es/components-v1/animate/AnimateChild.js +76 -0
- package/es/components-v1/animate/animate.js +148 -0
- package/es/components-v1/animate/index.js +13 -0
- package/es/components-v1/dom/index.js +30 -0
- package/es/components-v1/placement/index.js +13 -0
- package/es/components-v1/placement/placement.js +111 -0
- package/es/components-v1/placement/placementInner.js +139 -0
- package/es/components-v1/pop/Pop.js +246 -0
- package/es/components-v1/pop/PopInner.js +163 -0
- package/es/components-v1/pop/index.js +13 -0
- package/es/components-v1/progress/CircleProgress.js +152 -0
- package/es/components-v1/progress/LineProgress.js +83 -0
- package/es/components-v1/progress/index.js +80 -0
- package/es/components-v1/select/Option.js +94 -0
- package/es/components-v1/select/index.js +330 -0
- package/es/components-v1/utils/animate/animate.js +103 -0
- package/es/components-v1/utils/animate/event.js +79 -0
- package/es/components-v1/utils/dom/index.js +30 -0
- package/es/components-v1/utils/placement/autoAdjustPlacement.js +93 -0
- package/es/components-v1/utils/placement/getContainerVisibleArea.js +22 -0
- package/es/components-v1/utils/placement/getExpectPlacement.js +49 -0
- package/es/components-v1/utils/placement/getPlacementInContainer.js +26 -0
- package/es/components-v1/utils/placement/placement.js +76 -0
- package/es/index.js +777 -0
- package/es/pages/appointment-demo/drop-down-box/index.js +159 -0
- package/es/pages/appointment-demo/index.js +649 -0
- package/es/pages/appointment-demo/input/index.js +176 -0
- package/es/pages/appointment-demo/popup/index.js +113 -0
- package/es/pages/appointment-demo/popup/placement.js +44 -0
- package/es/pages/group-management/components/checkbox/index.js +28 -0
- package/es/pages/group-management/components/input-form/index.js +174 -0
- package/es/pages/group-management/components/radio/index.js +21 -0
- package/es/pages/group-management/components/table/index.js +174 -0
- package/es/pages/group-management/groupInterface.js +293 -0
- package/es/pages/group-management/index.js +13 -0
- package/es/pages/group-management/page-view/empty.js +111 -0
- package/es/pages/group-management/page-view/group-empty.js +66 -0
- package/es/pages/group-management/page-view/importGroupStaff/index.js +208 -0
- package/es/pages/group-management/page-view/index.js +412 -0
- package/es/pages/group-management/page-view/loading/index.js +32 -0
- package/es/pages/group-management/table/index.js +104 -0
- package/es/pages/group-management/tree/add-group-dialog/index.js +153 -0
- package/es/pages/group-management/tree/delete-group-dialog/index.js +82 -0
- package/es/pages/group-management/tree/edit-group-dialog/index.js +155 -0
- package/es/pages/group-management/tree/group-form/index.js +207 -0
- package/es/pages/group-management/tree/index.js +168 -0
- package/es/pages/group-management/tree/operation-panel.js +41 -0
- package/es/pages/group-management/tree/trigger-render.js +99 -0
- package/es/pages/like-ranking/mock.js +366 -0
- package/es/pages/okr-map/export-modules/index.js +1 -0
- package/es/pages/okr-map/export-modules/okr-map/header/index.js +182 -0
- package/es/pages/okr-map/export-modules/okr-map/header/show-kr-confirm.js +47 -0
- package/es/pages/okr-map/export-modules/okr-map/okr-map.js +497 -0
- package/es/pages/okr-map/export-modules/share-okr-page/header/index.js +69 -0
- package/es/pages/okr-map/export-modules/share-okr-page/share-okr-map.js +168 -0
- package/es/pages/okr-map/hooks/useStorage.js +96 -0
- package/es/pages/okr-map/index.js +18 -0
- package/es/pages/okr-map/level2-search/depart.js +53 -0
- package/es/pages/okr-map/level2-search/group.js +69 -0
- package/es/pages/okr-map/level2-search/index.js +51 -0
- package/es/pages/okr-map/level2-search/level2-input.js +46 -0
- package/es/pages/okr-map/level2-search/user.js +54 -0
- package/es/pages/okr-map/no-okr/index.js +24 -0
- package/es/pages/okr-map/number-select/index.js +81 -0
- package/es/pages/okr-map/open-data/index.js +115 -0
- package/es/pages/okr-map/precls.js +8 -0
- package/es/pages/okr-map/request-apis.js +76 -0
- package/es/pages/okr-map/share-dialog/index.js +122 -0
- package/es/pages/okr-map/unsupport-ie/index.js +83 -0
- package/es/pages/okr-map/utils.js +51 -0
- package/es/utils/auth.js +294 -0
- package/es/utils/bs-global.js +114 -0
- package/es/utils/local-storage.js +42 -0
- package/es/utils/mblog.js +33 -0
- package/es/utils/mock-bsglobal.js +1837 -0
- package/es/utils/open-data.js +341 -0
- package/es/utils/request-v1.js +115 -0
- package/es/utils/request.js +183 -0
- package/es/utils/tools.js +286 -0
- package/lib/components/date-picker/BodyItem.js +3 -3
- package/lib/components/date-picker/CalendarHeader.js +3 -3
- package/lib/components/delete-confirm-pop/ConfirmPop.js +3 -3
- package/lib/components/dynamic/constant.js +31 -31
- package/lib/components/dynamic/dynamic-item/dynamic-interview/img/wifi.svg +24 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview/index.css +36 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview/index.js +51 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview/interview-content.js +53 -0
- package/lib/components/dynamic/dynamic-item/index.js +40 -32
- package/lib/components/eReport/eReportLists/reportList.js +3 -3
- package/lib/components/emotions-selector/selector-pop.js +3 -3
- package/lib/components/ereport-list/index.js +3 -3
- package/lib/components/form/form-fields/date/index.css +24 -0
- package/lib/components/form/form-fields/date/index.js +98 -0
- package/lib/components/form/form-fields/user/index.css +1 -1
- package/lib/components/form/index.js +10 -3
- package/lib/components/mblog/components/MblogAction.js +3 -3
- package/lib/components/menus/export-modules/interview-menus/constant.js +23 -17
- package/lib/components/menus/export-modules/interview-menus/handle-highlight.js +5 -5
- package/lib/components/menus/export-modules/interview-menus/index.js +1 -2
- package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/edit-pop.js +3 -3
- package/lib/components/okr-review/components/ReviewItem/index.js +3 -3
- package/lib/components/okr-review/components/confirm-pop/ConfirmPop.js +3 -3
- package/lib/components/picker/components/picker-trigger/index.css +16 -0
- package/lib/components/picker/components/picker-trigger/index.js +18 -9
- package/lib/components/picker/picker-panels.js +1 -1
- package/lib/components/picker/picker.js +12 -13
- package/lib/components/range-selector-pop/RangeSelectorPop.js +3 -3
- package/lib/components/rich-editor/models/schema.js +6 -6
- package/lib/components/rich-editor/plugins/block/block-quote/index.js +8 -8
- package/lib/components/rich-editor/plugins/block/heading/index.js +8 -8
- package/lib/components/rich-editor/plugins/block/lists/index.js +14 -14
- package/lib/components/rich-editor/plugins/block/paragraph/index.js +5 -5
- package/lib/components/rich-editor/plugins/core/index.js +4 -4
- package/lib/components/rich-editor/plugins/extension/alignment/index.js +5 -5
- package/lib/components/rich-editor/plugins/extension/placeholder/index.js +4 -4
- package/lib/components/rich-editor/plugins/inline/color/index.js +11 -11
- package/lib/components/rich-editor/plugins/inline/delete-line/index.js +8 -8
- package/lib/components/rich-editor/plugins/inline/em/index.js +5 -5
- package/lib/components/rich-editor/plugins/inline/link/index.js +8 -8
- package/lib/components/rich-editor/plugins/inline/strong/index.js +8 -8
- package/lib/components/rich-editor/plugins/inline/under-line/index.js +8 -8
- package/lib/components/rich-editor/react/uiProvider.js +3 -3
- package/lib/components/rich-editor/ui/Popup/index.js +3 -3
- package/lib/components/select/Option.js +3 -3
- package/lib/components/time-picker/index.css +18 -0
- package/lib/components/time-picker/time-picker-selector.js +8 -12
- package/lib/components/time-picker/time-picker.js +117 -100
- package/lib/components/time-picker/utils.js +13 -2
- package/lib/components/tita-chart/errorBoundary/index.js +3 -3
- package/lib/components-v1/animate/AnimateChild.js +3 -3
- package/lib/components-v1/avatar/index.js +3 -3
- package/lib/components-v1/dropDownSelector/StatelessDropdown.js +3 -3
- package/lib/components-v1/progress/CircleProgress.js +3 -3
- package/lib/components-v1/select/Option.js +3 -3
- package/lib/components-v1/userSelector/UserSelectorPop.js +3 -3
- package/lib/components-v1/userSelector/components/MultiMode/index.js +3 -3
- package/lib/components-v1/userSelector/components/UserItem.js +3 -3
- package/package.json +1 -1
- package/yarn-error.log +5424 -6356
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.parseTag = exports.parseString = exports.parseHtmlAndTextTag = exports.isWxTrial = exports.isWechat = exports.isPlatform = exports.getSource = exports.getOpenId = exports["default"] = exports.OpenUserName = exports.OpenDepartmentName = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _bsGlobal = require("./bs-global");
|
|
13
|
+
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
|
|
22
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
|
|
24
|
+
var WX_SOURCE = 860;
|
|
25
|
+
var WX_UA_STR = "micromessenger";
|
|
26
|
+
var FEISHU_SOURCE = 862;
|
|
27
|
+
var DINGTALK_SOURCE = 861;
|
|
28
|
+
|
|
29
|
+
var getSource = function getSource() {
|
|
30
|
+
return (0, _bsGlobal.getBSGlobal)("tenantInfo").Source;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.getSource = getSource;
|
|
34
|
+
|
|
35
|
+
var isWechat = function isWechat() {
|
|
36
|
+
return getSource() == 860;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.isWechat = isWechat;
|
|
40
|
+
|
|
41
|
+
var isWxTrial = function isWxTrial() {
|
|
42
|
+
return getSource() == 860 && (0, _bsGlobal.getVersion)() == 1;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.isWxTrial = isWxTrial;
|
|
46
|
+
|
|
47
|
+
var getUA = function getUA() {
|
|
48
|
+
return navigator.userAgent.toLowerCase();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
var getOpenId = function getOpenId(id, type) {
|
|
52
|
+
var openIds;
|
|
53
|
+
|
|
54
|
+
if (type == "userName") {
|
|
55
|
+
openIds = (0, _bsGlobal.getBSGlobal)("openIds");
|
|
56
|
+
} else if (type == "departmentName") {
|
|
57
|
+
openIds = (0, _bsGlobal.getBSGlobal)("openDepartmentIds");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return openIds && openIds[id];
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.getOpenId = getOpenId;
|
|
64
|
+
|
|
65
|
+
function openData(p) {
|
|
66
|
+
if (getSource() == WX_SOURCE || getUA().includes(WX_UA_STR)) {
|
|
67
|
+
return function (p) {
|
|
68
|
+
if (p.id === undefined) return p.name || null;
|
|
69
|
+
var openId = getOpenId(p.id, p.type);
|
|
70
|
+
if (!openId) return p.name || p.id || null;
|
|
71
|
+
var ref = (0, _react.useRef)(null);
|
|
72
|
+
(0, _react.useEffect)(function () {
|
|
73
|
+
var wWOpenData = window.top.WWOpenData; // // 如果当前页面中没有 WWOpenData 则去 top 上尝试获取
|
|
74
|
+
// if (!wWOpenData && window.top.WWOpenData) {
|
|
75
|
+
// wWOpenData = window.top.WWOpenData;
|
|
76
|
+
// }
|
|
77
|
+
|
|
78
|
+
wWOpenData && wWOpenData.bind(ref.current);
|
|
79
|
+
});
|
|
80
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
81
|
+
style: {
|
|
82
|
+
display: "inline-block",
|
|
83
|
+
position: "relative",
|
|
84
|
+
overflow: "hidden",
|
|
85
|
+
textOverflow: "ellipsis",
|
|
86
|
+
verticalAlign: "middle"
|
|
87
|
+
}
|
|
88
|
+
}, /*#__PURE__*/_react["default"].createElement("ww-open-data", {
|
|
89
|
+
ref: ref,
|
|
90
|
+
type: p.type,
|
|
91
|
+
openid: openId
|
|
92
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
93
|
+
style: {
|
|
94
|
+
position: "absolute",
|
|
95
|
+
top: 0,
|
|
96
|
+
left: 0,
|
|
97
|
+
right: 0,
|
|
98
|
+
bottom: 0,
|
|
99
|
+
zIndex: 1
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return function (p) {
|
|
106
|
+
return p.name || p.id || null;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var getOpenData = openData();
|
|
111
|
+
|
|
112
|
+
var OpenUserName = function OpenUserName(p) {
|
|
113
|
+
return getOpenData(_objectSpread(_objectSpread({}, p), {}, {
|
|
114
|
+
type: "userName"
|
|
115
|
+
}));
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
exports.OpenUserName = OpenUserName;
|
|
119
|
+
|
|
120
|
+
var OpenDepartmentName = function OpenDepartmentName(p) {
|
|
121
|
+
return getOpenData(_objectSpread(_objectSpread({}, p), {}, {
|
|
122
|
+
type: "departmentName"
|
|
123
|
+
}));
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
exports.OpenDepartmentName = OpenDepartmentName;
|
|
127
|
+
var openDataMap = {
|
|
128
|
+
user: OpenUserName,
|
|
129
|
+
department: OpenDepartmentName
|
|
130
|
+
}; // name:'wx'|'dd'|'feishu',type:'source'|'env'|'all' = 'all'
|
|
131
|
+
|
|
132
|
+
var isPlatform = function isPlatform(name) {
|
|
133
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "all";
|
|
134
|
+
|
|
135
|
+
switch (name) {
|
|
136
|
+
case "wx":
|
|
137
|
+
{
|
|
138
|
+
if (type == "source") return getSource() == WX_SOURCE;
|
|
139
|
+
if (type == "env") return getUA().includes(WX_UA_STR);
|
|
140
|
+
return getSource() == WX_SOURCE || getUA().includes(WX_UA_STR);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
case "dd":
|
|
144
|
+
{
|
|
145
|
+
return getSource() == DINGTALK_SOURCE;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
case "feishu":
|
|
149
|
+
{
|
|
150
|
+
return getSource() == FEISHU_SOURCE;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
exports.isPlatform = isPlatform;
|
|
156
|
+
|
|
157
|
+
var parseTag = function parseTag(str) {
|
|
158
|
+
var source = window.BSGlobal.tenantInfo.Source;
|
|
159
|
+
var ua = navigator.userAgent.toLowerCase();
|
|
160
|
+
var reg = /<\w+[\w\W]*?(userId|departmentId)=["'](\S+?)["'][\w\W]*?>@([\w\W]*?)<\/\w+>/g;
|
|
161
|
+
var strReg = /<\w+[\w\s"'\/=\:\.]*?(?:userId|departmentId)=["']\S+?["'][\w\s"'\/=\:\.]*?>[\w\W]*?<\/\w+?>/;
|
|
162
|
+
var openDatas = [];
|
|
163
|
+
var matchStr = reg.exec(str); // if (source != 860 && ua.indexOf('micromessenger') == -1)
|
|
164
|
+
// return <span dangerouslySetInnerHTML={{ '__html': str }} />;
|
|
165
|
+
|
|
166
|
+
while (matchStr != null) {
|
|
167
|
+
var OpenDataCompoent = matchStr[1] == "userId" ? OpenUserName : OpenDepartmentName;
|
|
168
|
+
|
|
169
|
+
if (!OpenDataCompoent) {
|
|
170
|
+
openDatas.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
171
|
+
dangerouslySetInnerHTML: {
|
|
172
|
+
__html: matchStr[0]
|
|
173
|
+
},
|
|
174
|
+
onClick: function onClick(e) {
|
|
175
|
+
return e.stopPropagation();
|
|
176
|
+
}
|
|
177
|
+
}));
|
|
178
|
+
} else {
|
|
179
|
+
openDatas.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
180
|
+
style: {
|
|
181
|
+
color: "#1890ff",
|
|
182
|
+
margin: '0 4px'
|
|
183
|
+
},
|
|
184
|
+
onClick: function onClick(e) {
|
|
185
|
+
return e.stopPropagation();
|
|
186
|
+
}
|
|
187
|
+
}, "@", /*#__PURE__*/_react["default"].createElement(OpenDataCompoent, {
|
|
188
|
+
id: matchStr[2],
|
|
189
|
+
name: matchStr[3]
|
|
190
|
+
})));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
matchStr = reg.exec(str);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
var commonStrs = str.split(strReg);
|
|
197
|
+
var renderData = [];
|
|
198
|
+
|
|
199
|
+
for (var i = 0; i < commonStrs.length; i++) {
|
|
200
|
+
renderData.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
201
|
+
dangerouslySetInnerHTML: {
|
|
202
|
+
__html: commonStrs[i]
|
|
203
|
+
}
|
|
204
|
+
}));
|
|
205
|
+
renderData.push(openDatas[i]);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return renderData;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
exports.parseTag = parseTag;
|
|
212
|
+
|
|
213
|
+
var parseString = function parseString(str) {
|
|
214
|
+
// @ts-ignore
|
|
215
|
+
var source = window.BSGlobal.tenantInfo.Source;
|
|
216
|
+
var ua = navigator.userAgent.toLowerCase();
|
|
217
|
+
if (source != 860 && ua.indexOf("micromessenger") == -1) return /*#__PURE__*/_react["default"].createElement("span", {
|
|
218
|
+
dangerouslySetInnerHTML: {
|
|
219
|
+
__html: str
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
var reg = /\[(\w+?)\:(\w+?)\]/g;
|
|
223
|
+
var strReg = /\[\w+?\:\w+?\]/;
|
|
224
|
+
var openDatas = [];
|
|
225
|
+
var matchStr = reg.exec(str);
|
|
226
|
+
|
|
227
|
+
while (matchStr != null) {
|
|
228
|
+
var OpenDataCompoent = openDataMap[matchStr[2]];
|
|
229
|
+
|
|
230
|
+
if (!OpenDataCompoent) {
|
|
231
|
+
openDatas.push(matchStr[0]);
|
|
232
|
+
} else {
|
|
233
|
+
openDatas.push( /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(OpenDataCompoent, {
|
|
234
|
+
id: matchStr[1]
|
|
235
|
+
})));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
matchStr = reg.exec(str);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
var commonStrs = str.split(strReg);
|
|
242
|
+
var renderData = [];
|
|
243
|
+
|
|
244
|
+
for (var i = 0; i < commonStrs.length; i++) {
|
|
245
|
+
renderData.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
246
|
+
dangerouslySetInnerHTML: {
|
|
247
|
+
__html: commonStrs[i]
|
|
248
|
+
}
|
|
249
|
+
}));
|
|
250
|
+
renderData.push(openDatas[i]);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return renderData;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
exports.parseString = parseString;
|
|
257
|
+
|
|
258
|
+
var parseHtmlAndTextTag = function parseHtmlAndTextTag(str) {
|
|
259
|
+
var reg = /<\w+[\w\W]*?(userId|departmentId)=["'](\S+?)["'][\w\W]*?>@([\w\W]*?)<\/\w+>/g;
|
|
260
|
+
var strReg = /<\w+[\w\s"'\/=\:\.]*?(?:userId|departmentId)=["']\S+?["'][\w\s"'\/=\:\.]*?>[\w\W]*?<\/\w+?>/;
|
|
261
|
+
var openDatas = [];
|
|
262
|
+
var matchStr = reg.exec(str);
|
|
263
|
+
var openDatareg = /\[(\w+?)\:(\w+?)\]/g;
|
|
264
|
+
var openDataStrReg = /\[\w+?\:\w+?\]/;
|
|
265
|
+
var openDataMatchStr = openDatareg.exec(str);
|
|
266
|
+
|
|
267
|
+
while (matchStr != null || openDataMatchStr != null) {
|
|
268
|
+
if (matchStr) {
|
|
269
|
+
var OpenDataCompoent = matchStr[1] == "userId" ? OpenUserName : OpenDepartmentName;
|
|
270
|
+
|
|
271
|
+
if (!OpenDataCompoent) {
|
|
272
|
+
openDatas.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
273
|
+
dangerouslySetInnerHTML: {
|
|
274
|
+
__html: matchStr[0]
|
|
275
|
+
},
|
|
276
|
+
onClick: function onClick(e) {
|
|
277
|
+
return e.stopPropagation();
|
|
278
|
+
}
|
|
279
|
+
}));
|
|
280
|
+
} else {
|
|
281
|
+
openDatas.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
282
|
+
style: {
|
|
283
|
+
color: "#1890ff",
|
|
284
|
+
margin: '0 4px'
|
|
285
|
+
},
|
|
286
|
+
onClick: function onClick(e) {
|
|
287
|
+
return e.stopPropagation();
|
|
288
|
+
}
|
|
289
|
+
}, "@", /*#__PURE__*/_react["default"].createElement(OpenDataCompoent, {
|
|
290
|
+
id: matchStr[2],
|
|
291
|
+
name: matchStr[3]
|
|
292
|
+
})));
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
matchStr = reg.exec(str);
|
|
296
|
+
} else if (openDataMatchStr) {
|
|
297
|
+
var _OpenDataCompoent = openDataMap[openDataMatchStr[2]];
|
|
298
|
+
|
|
299
|
+
if (!_OpenDataCompoent) {
|
|
300
|
+
openDatas.push(openDataMatchStr[0]);
|
|
301
|
+
} else {
|
|
302
|
+
openDatas.push( /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_OpenDataCompoent, {
|
|
303
|
+
id: openDataMatchStr[1]
|
|
304
|
+
})));
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
openDataMatchStr = reg.exec(str);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
var commonStrs = str.split(strReg);
|
|
312
|
+
var tempStrs = [];
|
|
313
|
+
commonStrs && commonStrs.forEach(function (item) {
|
|
314
|
+
tempStrs.push(item.split(openDataStrReg).filter(function (item) {
|
|
315
|
+
return item !== '';
|
|
316
|
+
}));
|
|
317
|
+
});
|
|
318
|
+
var renderData = [];
|
|
319
|
+
|
|
320
|
+
for (var i = 0; i < tempStrs.length; i++) {
|
|
321
|
+
renderData.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
322
|
+
style: {
|
|
323
|
+
verticalAlign: 'middle'
|
|
324
|
+
},
|
|
325
|
+
dangerouslySetInnerHTML: {
|
|
326
|
+
__html: tempStrs[i]
|
|
327
|
+
}
|
|
328
|
+
}));
|
|
329
|
+
renderData.push(openDatas[i]);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return renderData;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
exports.parseHtmlAndTextTag = parseHtmlAndTextTag;
|
|
336
|
+
var _default = {
|
|
337
|
+
OpenUserName: OpenUserName,
|
|
338
|
+
OpenDepartmentName: OpenDepartmentName,
|
|
339
|
+
isWechat: isWechat
|
|
340
|
+
};
|
|
341
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getApiUrl = getApiUrl;
|
|
7
|
+
exports.getApiUrl2 = getApiUrl2;
|
|
8
|
+
exports.getApiUrl3 = getApiUrl3;
|
|
9
|
+
exports.taker = taker;
|
|
10
|
+
|
|
11
|
+
var _bsGlobal = require("./bs-global");
|
|
12
|
+
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
|
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
+
|
|
17
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
|
|
19
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
20
|
+
|
|
21
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
22
|
+
|
|
23
|
+
function taker(_x, _x2, _x3) {
|
|
24
|
+
return _taker.apply(this, arguments);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _taker() {
|
|
28
|
+
_taker = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, method, body) {
|
|
29
|
+
var header,
|
|
30
|
+
settings,
|
|
31
|
+
bodyStr,
|
|
32
|
+
key,
|
|
33
|
+
response,
|
|
34
|
+
data,
|
|
35
|
+
_args = arguments;
|
|
36
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
37
|
+
while (1) {
|
|
38
|
+
switch (_context.prev = _context.next) {
|
|
39
|
+
case 0:
|
|
40
|
+
header = _args.length > 3 && _args[3] !== undefined ? _args[3] : {};
|
|
41
|
+
settings = {};
|
|
42
|
+
|
|
43
|
+
if (method) {
|
|
44
|
+
settings.headers = _objectSpread(_objectSpread({}, {
|
|
45
|
+
Accept: "application/json, application/xml, text/play, text/html, *.*",
|
|
46
|
+
"Content-Type": "application/json; charset=utf-8"
|
|
47
|
+
}), header);
|
|
48
|
+
settings.method = method;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (body) settings.body = JSON.stringify(body);
|
|
52
|
+
|
|
53
|
+
if (settings.headers) {
|
|
54
|
+
if (settings.headers["Content-Type"] == "application/x-www-form-urlencoded") {
|
|
55
|
+
bodyStr = "";
|
|
56
|
+
|
|
57
|
+
for (key in body) {
|
|
58
|
+
bodyStr += "".concat(key, "=").concat(body[key], "&");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
bodyStr.substring(0, bodyStr.length - 1);
|
|
62
|
+
settings.body = bodyStr;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
settings.credentials = "same-origin";
|
|
67
|
+
_context.prev = 6;
|
|
68
|
+
_context.next = 9;
|
|
69
|
+
return fetch(url, settings);
|
|
70
|
+
|
|
71
|
+
case 9:
|
|
72
|
+
response = _context.sent;
|
|
73
|
+
_context.next = 12;
|
|
74
|
+
return response.json();
|
|
75
|
+
|
|
76
|
+
case 12:
|
|
77
|
+
data = _context.sent;
|
|
78
|
+
return _context.abrupt("return", data);
|
|
79
|
+
|
|
80
|
+
case 16:
|
|
81
|
+
_context.prev = 16;
|
|
82
|
+
_context.t0 = _context["catch"](6);
|
|
83
|
+
_context.next = 20;
|
|
84
|
+
return Promise.reject(_context.t0);
|
|
85
|
+
|
|
86
|
+
case 20:
|
|
87
|
+
case "end":
|
|
88
|
+
return _context.stop();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, _callee, null, [[6, 16]]);
|
|
92
|
+
}));
|
|
93
|
+
return _taker.apply(this, arguments);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function getApiUrl(url) {
|
|
97
|
+
var uid = (0, _bsGlobal.getUserInfo)().Id;
|
|
98
|
+
var tid = (0, _bsGlobal.getTenantInfo)().Id;
|
|
99
|
+
var apiServer = (0, _bsGlobal.getBSGlobal)("apiPath");
|
|
100
|
+
return "".concat(apiServer, "/api/v1/").concat(tid, "/").concat(uid, "/").concat(url);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function getApiUrl3(url) {
|
|
104
|
+
var uid = (0, _bsGlobal.getUserInfo)().Id;
|
|
105
|
+
var tid = (0, _bsGlobal.getTenantInfo)().Id;
|
|
106
|
+
var apiServer = (0, _bsGlobal.getBSGlobal)("apiPath");
|
|
107
|
+
return "".concat(apiServer, "/api/v3/").concat(tid, "/").concat(uid, "/").concat(url);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function getApiUrl2(url) {
|
|
111
|
+
var uid = (0, _bsGlobal.getUserInfo)().Id;
|
|
112
|
+
var tid = (0, _bsGlobal.getTenantInfo)().Id;
|
|
113
|
+
var apiServer = (0, _bsGlobal.getBSGlobal)("apiPath");
|
|
114
|
+
return "".concat(apiServer, "/api/v2/").concat(tid, "/").concat(uid, "/").concat(url);
|
|
115
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.rput = exports.rpost = exports.rget = exports.rdelete = exports.postForTableList = exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
|
+
|
|
14
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
15
|
+
|
|
16
|
+
var tenantId = BSGlobal && BSGlobal.tenantInfo.Id || 0;
|
|
17
|
+
var userId = BSGlobal && BSGlobal.loginUserInfo.Id || 0; // 开启mock
|
|
18
|
+
|
|
19
|
+
var mockEnabled = false;
|
|
20
|
+
|
|
21
|
+
var requestDomain = function requestDomain() {
|
|
22
|
+
if (!window.location.hostname.match(/dev/)) return "";
|
|
23
|
+
return "".concat(location.protocol, "//www.tita.gift");
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var getPurePath = function getPurePath(path) {
|
|
27
|
+
var purePath = path;
|
|
28
|
+
var hasQuery = path.match(/\?/);
|
|
29
|
+
if (hasQuery) purePath = path.split("?")[0];
|
|
30
|
+
return purePath;
|
|
31
|
+
}; // 获取指定接口的MOCK数据
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var getMockData = function getMockData(version, path, method) {
|
|
35
|
+
var purePath = getPurePath(path);
|
|
36
|
+
var mockData = localStorage.getItem("titaui-mock");
|
|
37
|
+
if (!mockData) return;
|
|
38
|
+
mockData = JSON.parse(mockData);
|
|
39
|
+
return mockData["".concat(method, "_").concat(version, "::").concat(purePath)];
|
|
40
|
+
}; // 存储接口返回值
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
var storeMockData = function storeMockData(version, path, method, data) {
|
|
44
|
+
var purePath = getPurePath(path);
|
|
45
|
+
var mockData = localStorage.getItem("titaui-mock");
|
|
46
|
+
if (!mockData) mockData = {};else mockData = JSON.parse(mockData);
|
|
47
|
+
mockData["".concat(method, "_").concat(version, "::").concat(purePath)] = data;
|
|
48
|
+
localStorage.setItem("titaui-mock", JSON.stringify(mockData));
|
|
49
|
+
}; // 请求PROXY,用于处理MOCK开启与关于的数据请求行为
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var mocking = function mocking(version, path, method, getRealRequest) {
|
|
53
|
+
var mockRequest;
|
|
54
|
+
|
|
55
|
+
if (mockEnabled) {
|
|
56
|
+
var storageData = getMockData(version, path, method);
|
|
57
|
+
|
|
58
|
+
if (!storageData) {
|
|
59
|
+
mockRequest = getRealRequest;
|
|
60
|
+
} else {
|
|
61
|
+
return function () {
|
|
62
|
+
return new Promise(function (resolve) {
|
|
63
|
+
resolve(storageData);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
mockRequest = getRealRequest;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return mockRequest;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var rpost = function rpost(version) {
|
|
75
|
+
return function (path) {
|
|
76
|
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
77
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
78
|
+
var mockingRequest = mocking(version, path, "post", function () {
|
|
79
|
+
return _axios["default"].post("".concat(requestDomain(), "/api/").concat(version, "/").concat(tenantId, "/").concat(userId, "/").concat(path), data, options).then(function (res) {
|
|
80
|
+
return res.data;
|
|
81
|
+
}).then(function (data) {
|
|
82
|
+
storeMockData(version, path, "post", data);
|
|
83
|
+
return data;
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
return mockingRequest();
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
exports.rpost = rpost;
|
|
91
|
+
|
|
92
|
+
var rget = function rget(version) {
|
|
93
|
+
return function (path) {
|
|
94
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
95
|
+
var mockingRequest = mocking(version, path, "get", function () {
|
|
96
|
+
return _axios["default"].get("".concat(requestDomain(), "/api/").concat(version, "/").concat(tenantId, "/").concat(userId, "/").concat(path), options).then(function (res) {
|
|
97
|
+
return res.data;
|
|
98
|
+
}).then(function (data) {
|
|
99
|
+
storeMockData(version, path, "get", data);
|
|
100
|
+
return data;
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
return mockingRequest();
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
exports.rget = rget;
|
|
108
|
+
|
|
109
|
+
var rput = function rput(version) {
|
|
110
|
+
return function (path) {
|
|
111
|
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
112
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
113
|
+
var mockingRequest = mocking(version, path, "put", function () {
|
|
114
|
+
return _axios["default"].put("".concat(requestDomain(), "/api/").concat(version, "/").concat(tenantId, "/").concat(userId, "/").concat(path), data, options).then(function (res) {
|
|
115
|
+
return res.data;
|
|
116
|
+
}).then(function (data) {
|
|
117
|
+
storeMockData(version, path, "put", data);
|
|
118
|
+
return data;
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
return mockingRequest();
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
exports.rput = rput;
|
|
126
|
+
|
|
127
|
+
var rdelete = function rdelete(version) {
|
|
128
|
+
return function (path) {
|
|
129
|
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
130
|
+
var mockingRequest = mocking(version, path, "delete", function () {
|
|
131
|
+
return _axios["default"]["delete"]("".concat(requestDomain(), "/api/").concat(version, "/").concat(tenantId, "/").concat(userId, "/").concat(path), data).then(function (res) {
|
|
132
|
+
return res.data;
|
|
133
|
+
}).then(function (data) {
|
|
134
|
+
storeMockData(version, path, "delete", data);
|
|
135
|
+
return data;
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
return mockingRequest();
|
|
139
|
+
};
|
|
140
|
+
}; // 撰取数据
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
exports.rdelete = rdelete;
|
|
144
|
+
|
|
145
|
+
var postForTableList = /*#__PURE__*/function () {
|
|
146
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
147
|
+
var body,
|
|
148
|
+
res,
|
|
149
|
+
_args = arguments;
|
|
150
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
151
|
+
while (1) {
|
|
152
|
+
switch (_context.prev = _context.next) {
|
|
153
|
+
case 0:
|
|
154
|
+
body = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
155
|
+
_context.next = 3;
|
|
156
|
+
return _axios["default"].post("/api/v1/".concat(tenantId, "/").concat(userId, "/okr/home/cptDataDrill"), body);
|
|
157
|
+
|
|
158
|
+
case 3:
|
|
159
|
+
res = _context.sent;
|
|
160
|
+
return _context.abrupt("return", res.data);
|
|
161
|
+
|
|
162
|
+
case 5:
|
|
163
|
+
case "end":
|
|
164
|
+
return _context.stop();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}, _callee);
|
|
168
|
+
}));
|
|
169
|
+
|
|
170
|
+
return function postForTableList() {
|
|
171
|
+
return _ref.apply(this, arguments);
|
|
172
|
+
};
|
|
173
|
+
}();
|
|
174
|
+
|
|
175
|
+
exports.postForTableList = postForTableList;
|
|
176
|
+
var _default = {
|
|
177
|
+
rget: rget,
|
|
178
|
+
rput: rput,
|
|
179
|
+
rdelete: rdelete,
|
|
180
|
+
rpost: rpost,
|
|
181
|
+
postForTableList: postForTableList
|
|
182
|
+
};
|
|
183
|
+
exports["default"] = _default;
|