systemrobotassistant 3.0.8
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.
Potentially problematic release.
This version of systemrobotassistant might be problematic. Click here for more details.
- package/.eslintignore +6 -0
- package/.eslintrc +45 -0
- package/.gitlab-ci.yml +52 -0
- package/.lecprc.ts +76 -0
- package/.yarnrc +1 -0
- package/CHANGELOG.md +114 -0
- package/README.md +14 -0
- package/custom-amd-plugin.ts +46 -0
- package/es/component/answer-itme/index.d.ts +20 -0
- package/es/component/answer-itme/index.d.ts.map +1 -0
- package/es/component/answer-itme/index.js +41 -0
- package/es/component/answer-itme/style.css +35 -0
- package/es/component/data-container/index.d.ts +19 -0
- package/es/component/data-container/index.d.ts.map +1 -0
- package/es/component/data-container/index.js +37 -0
- package/es/component/data-container/style.css +26 -0
- package/es/component/days-tab/index.d.ts +6 -0
- package/es/component/days-tab/index.d.ts.map +1 -0
- package/es/component/days-tab/index.js +119 -0
- package/es/component/days-tab/style.css +43 -0
- package/es/component/days-tab/utils.d.ts +32 -0
- package/es/component/days-tab/utils.d.ts.map +1 -0
- package/es/component/days-tab/utils.js +98 -0
- package/es/component/error-boundary/index.d.ts +2 -0
- package/es/component/error-boundary/index.d.ts.map +1 -0
- package/es/component/error-boundary/index.js +33 -0
- package/es/component/it-notice-modal/columns.d.ts +11 -0
- package/es/component/it-notice-modal/columns.d.ts.map +1 -0
- package/es/component/it-notice-modal/columns.js +108 -0
- package/es/component/it-notice-modal/double-tab.d.ts +6 -0
- package/es/component/it-notice-modal/double-tab.d.ts.map +1 -0
- package/es/component/it-notice-modal/double-tab.js +94 -0
- package/es/component/it-notice-modal/index.d.ts +6 -0
- package/es/component/it-notice-modal/index.d.ts.map +1 -0
- package/es/component/it-notice-modal/index.js +488 -0
- package/es/component/it-notice-modal/server.d.ts +8 -0
- package/es/component/it-notice-modal/server.d.ts.map +1 -0
- package/es/component/it-notice-modal/server.js +43 -0
- package/es/component/it-notice-modal/single-tab.d.ts +6 -0
- package/es/component/it-notice-modal/single-tab.d.ts.map +1 -0
- package/es/component/it-notice-modal/single-tab.js +82 -0
- package/es/component/it-notice-modal/style.css +301 -0
- package/es/component/it-notice-modal/utils.d.ts +2 -0
- package/es/component/it-notice-modal/utils.d.ts.map +1 -0
- package/es/component/it-notice-modal/utils.js +8 -0
- package/es/component/it-notice-tab/index.d.ts +6 -0
- package/es/component/it-notice-tab/index.d.ts.map +1 -0
- package/es/component/it-notice-tab/index.js +206 -0
- package/es/component/it-notice-tab/server.d.ts +3 -0
- package/es/component/it-notice-tab/server.d.ts.map +1 -0
- package/es/component/it-notice-tab/server.js +13 -0
- package/es/component/it-notice-tab/style.css +103 -0
- package/es/component/mail-list-modal/index.d.ts +2 -0
- package/es/component/mail-list-modal/index.d.ts.map +1 -0
- package/es/component/mail-list-modal/index.js +306 -0
- package/es/component/mail-list-modal/server.d.ts +7 -0
- package/es/component/mail-list-modal/server.d.ts.map +1 -0
- package/es/component/mail-list-modal/server.js +38 -0
- package/es/component/mail-list-modal/style.css +132 -0
- package/es/component/myself-chat-card/index.d.ts +15 -0
- package/es/component/myself-chat-card/index.d.ts.map +1 -0
- package/es/component/myself-chat-card/index.js +25 -0
- package/es/component/myself-chat-card/style.css +22 -0
- package/es/component/need-answer/index.d.ts +15 -0
- package/es/component/need-answer/index.d.ts.map +1 -0
- package/es/component/need-answer/index.js +60 -0
- package/es/component/need-answer/style.css +19 -0
- package/es/component/opppsition-chat-card/index.d.ts +11 -0
- package/es/component/opppsition-chat-card/index.d.ts.map +1 -0
- package/es/component/opppsition-chat-card/index.js +25 -0
- package/es/component/opppsition-chat-card/style.css +23 -0
- package/es/component/question-library/index.d.ts +10 -0
- package/es/component/question-library/index.d.ts.map +1 -0
- package/es/component/question-library/index.js +291 -0
- package/es/component/question-library/server.d.ts +4 -0
- package/es/component/question-library/server.d.ts.map +1 -0
- package/es/component/question-library/server.js +19 -0
- package/es/component/question-library/style.css +75 -0
- package/es/component/question-tag/index.d.ts +11 -0
- package/es/component/question-tag/index.d.ts.map +1 -0
- package/es/component/question-tag/index.js +23 -0
- package/es/component/question-tag/style.css +12 -0
- package/es/component/recommend-questions-card/index.d.ts +10 -0
- package/es/component/recommend-questions-card/index.d.ts.map +1 -0
- package/es/component/recommend-questions-card/index.js +104 -0
- package/es/component/recommend-questions-card/style.css +54 -0
- package/es/component/scroll-view/index.d.ts +3 -0
- package/es/component/scroll-view/index.d.ts.map +1 -0
- package/es/component/scroll-view/index.js +2 -0
- package/es/component/scroll-view/scroll-view.d.ts +18 -0
- package/es/component/scroll-view/scroll-view.d.ts.map +1 -0
- package/es/component/scroll-view/scroll-view.js +66 -0
- package/es/component/scroll-view/style.css +34 -0
- package/es/component/tab/index.d.ts +2 -0
- package/es/component/tab/index.d.ts.map +1 -0
- package/es/component/tab/index.js +18 -0
- package/es/component/tab/style.css +26 -0
- package/es/component/tips-answer/index.d.ts +15 -0
- package/es/component/tips-answer/index.d.ts.map +1 -0
- package/es/component/tips-answer/index.js +28 -0
- package/es/component/tips-answer/style.css +10 -0
- package/es/images/expire-robot.svg +16 -0
- package/es/images/pc-invalid.svg +11 -0
- package/es/images/screenshot-5.png +0 -0
- package/es/index.d.ts +92 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +506 -0
- package/es/js/const.d.ts +41 -0
- package/es/js/const.d.ts.map +1 -0
- package/es/js/const.js +46 -0
- package/es/js/gen-render-promise.d.ts +9 -0
- package/es/js/gen-render-promise.d.ts.map +1 -0
- package/es/js/gen-render-promise.js +30 -0
- package/es/js/get-time.d.ts +15 -0
- package/es/js/get-time.d.ts.map +1 -0
- package/es/js/get-time.js +35 -0
- package/es/js/hfc-space.d.ts +16 -0
- package/es/js/hfc-space.d.ts.map +1 -0
- package/es/js/hfc-space.js +71 -0
- package/es/js/render-special.d.ts +16 -0
- package/es/js/render-special.d.ts.map +1 -0
- package/es/js/render-special.js +53 -0
- package/es/js/request/fetch.d.ts +10 -0
- package/es/js/request/fetch.d.ts.map +1 -0
- package/es/js/request/fetch.js +81 -0
- package/es/js/request/request.d.ts +3 -0
- package/es/js/request/request.d.ts.map +1 -0
- package/es/js/request/request.js +63 -0
- package/es/js/showMessage.d.ts +15 -0
- package/es/js/showMessage.d.ts.map +1 -0
- package/es/js/showMessage.js +75 -0
- package/es/js/state-immer.d.ts +3 -0
- package/es/js/state-immer.d.ts.map +1 -0
- package/es/js/state-immer.js +19 -0
- package/es/js/timer-executor.d.ts +3 -0
- package/es/js/timer-executor.d.ts.map +1 -0
- package/es/js/timer-executor.js +83 -0
- package/es/js/to-hfc.d.ts +2 -0
- package/es/js/to-hfc.d.ts.map +1 -0
- package/es/js/to-hfc.js +8 -0
- package/es/js/utils.d.ts +3 -0
- package/es/js/utils.d.ts.map +1 -0
- package/es/js/utils.js +11 -0
- package/es/jsx/chat-modal.d.ts +16 -0
- package/es/jsx/chat-modal.d.ts.map +1 -0
- package/es/jsx/chat-modal.js +268 -0
- package/es/server.d.ts +8 -0
- package/es/server.d.ts.map +1 -0
- package/es/server.js +44 -0
- package/es/style.css +174 -0
- package/lib/component/answer-itme/index.d.ts +20 -0
- package/lib/component/answer-itme/index.d.ts.map +1 -0
- package/lib/component/answer-itme/index.js +51 -0
- package/lib/component/answer-itme/style.css +35 -0
- package/lib/component/data-container/index.d.ts +19 -0
- package/lib/component/data-container/index.d.ts.map +1 -0
- package/lib/component/data-container/index.js +45 -0
- package/lib/component/data-container/style.css +26 -0
- package/lib/component/days-tab/index.d.ts +6 -0
- package/lib/component/days-tab/index.d.ts.map +1 -0
- package/lib/component/days-tab/index.js +129 -0
- package/lib/component/days-tab/style.css +43 -0
- package/lib/component/days-tab/utils.d.ts +32 -0
- package/lib/component/days-tab/utils.d.ts.map +1 -0
- package/lib/component/days-tab/utils.js +110 -0
- package/lib/component/error-boundary/index.d.ts +2 -0
- package/lib/component/error-boundary/index.d.ts.map +1 -0
- package/lib/component/error-boundary/index.js +40 -0
- package/lib/component/it-notice-modal/columns.d.ts +11 -0
- package/lib/component/it-notice-modal/columns.d.ts.map +1 -0
- package/lib/component/it-notice-modal/columns.js +116 -0
- package/lib/component/it-notice-modal/double-tab.d.ts +6 -0
- package/lib/component/it-notice-modal/double-tab.d.ts.map +1 -0
- package/lib/component/it-notice-modal/double-tab.js +104 -0
- package/lib/component/it-notice-modal/index.d.ts +6 -0
- package/lib/component/it-notice-modal/index.d.ts.map +1 -0
- package/lib/component/it-notice-modal/index.js +499 -0
- package/lib/component/it-notice-modal/server.d.ts +8 -0
- package/lib/component/it-notice-modal/server.d.ts.map +1 -0
- package/lib/component/it-notice-modal/server.js +55 -0
- package/lib/component/it-notice-modal/single-tab.d.ts +6 -0
- package/lib/component/it-notice-modal/single-tab.d.ts.map +1 -0
- package/lib/component/it-notice-modal/single-tab.js +92 -0
- package/lib/component/it-notice-modal/style.css +301 -0
- package/lib/component/it-notice-modal/utils.d.ts +2 -0
- package/lib/component/it-notice-modal/utils.d.ts.map +1 -0
- package/lib/component/it-notice-modal/utils.js +15 -0
- package/lib/component/it-notice-tab/index.d.ts +6 -0
- package/lib/component/it-notice-tab/index.d.ts.map +1 -0
- package/lib/component/it-notice-tab/index.js +216 -0
- package/lib/component/it-notice-tab/server.d.ts +3 -0
- package/lib/component/it-notice-tab/server.d.ts.map +1 -0
- package/lib/component/it-notice-tab/server.js +20 -0
- package/lib/component/it-notice-tab/style.css +103 -0
- package/lib/component/mail-list-modal/index.d.ts +2 -0
- package/lib/component/mail-list-modal/index.d.ts.map +1 -0
- package/lib/component/mail-list-modal/index.js +316 -0
- package/lib/component/mail-list-modal/server.d.ts +7 -0
- package/lib/component/mail-list-modal/server.d.ts.map +1 -0
- package/lib/component/mail-list-modal/server.js +50 -0
- package/lib/component/mail-list-modal/style.css +132 -0
- package/lib/component/myself-chat-card/index.d.ts +15 -0
- package/lib/component/myself-chat-card/index.d.ts.map +1 -0
- package/lib/component/myself-chat-card/index.js +35 -0
- package/lib/component/myself-chat-card/style.css +22 -0
- package/lib/component/need-answer/index.d.ts +15 -0
- package/lib/component/need-answer/index.d.ts.map +1 -0
- package/lib/component/need-answer/index.js +70 -0
- package/lib/component/need-answer/style.css +19 -0
- package/lib/component/opppsition-chat-card/index.d.ts +11 -0
- package/lib/component/opppsition-chat-card/index.d.ts.map +1 -0
- package/lib/component/opppsition-chat-card/index.js +35 -0
- package/lib/component/opppsition-chat-card/style.css +23 -0
- package/lib/component/question-library/index.d.ts +10 -0
- package/lib/component/question-library/index.d.ts.map +1 -0
- package/lib/component/question-library/index.js +301 -0
- package/lib/component/question-library/server.d.ts +4 -0
- package/lib/component/question-library/server.d.ts.map +1 -0
- package/lib/component/question-library/server.js +27 -0
- package/lib/component/question-library/style.css +75 -0
- package/lib/component/question-tag/index.d.ts +11 -0
- package/lib/component/question-tag/index.d.ts.map +1 -0
- package/lib/component/question-tag/index.js +33 -0
- package/lib/component/question-tag/style.css +12 -0
- package/lib/component/recommend-questions-card/index.d.ts +10 -0
- package/lib/component/recommend-questions-card/index.d.ts.map +1 -0
- package/lib/component/recommend-questions-card/index.js +114 -0
- package/lib/component/recommend-questions-card/style.css +54 -0
- package/lib/component/scroll-view/index.d.ts +3 -0
- package/lib/component/scroll-view/index.d.ts.map +1 -0
- package/lib/component/scroll-view/index.js +10 -0
- package/lib/component/scroll-view/scroll-view.d.ts +18 -0
- package/lib/component/scroll-view/scroll-view.d.ts.map +1 -0
- package/lib/component/scroll-view/scroll-view.js +76 -0
- package/lib/component/scroll-view/style.css +34 -0
- package/lib/component/tab/index.d.ts +2 -0
- package/lib/component/tab/index.d.ts.map +1 -0
- package/lib/component/tab/index.js +28 -0
- package/lib/component/tab/style.css +26 -0
- package/lib/component/tips-answer/index.d.ts +15 -0
- package/lib/component/tips-answer/index.d.ts.map +1 -0
- package/lib/component/tips-answer/index.js +38 -0
- package/lib/component/tips-answer/style.css +10 -0
- package/lib/images/expire-robot.svg +16 -0
- package/lib/images/pc-invalid.svg +11 -0
- package/lib/images/screenshot-5.png +0 -0
- package/lib/index.d.ts +92 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +516 -0
- package/lib/js/const.d.ts +41 -0
- package/lib/js/const.d.ts.map +1 -0
- package/lib/js/const.js +55 -0
- package/lib/js/gen-render-promise.d.ts +9 -0
- package/lib/js/gen-render-promise.d.ts.map +1 -0
- package/lib/js/gen-render-promise.js +37 -0
- package/lib/js/get-time.d.ts +15 -0
- package/lib/js/get-time.d.ts.map +1 -0
- package/lib/js/get-time.js +43 -0
- package/lib/js/hfc-space.d.ts +16 -0
- package/lib/js/hfc-space.d.ts.map +1 -0
- package/lib/js/hfc-space.js +91 -0
- package/lib/js/render-special.d.ts +16 -0
- package/lib/js/render-special.d.ts.map +1 -0
- package/lib/js/render-special.js +61 -0
- package/lib/js/request/fetch.d.ts +10 -0
- package/lib/js/request/fetch.d.ts.map +1 -0
- package/lib/js/request/fetch.js +88 -0
- package/lib/js/request/request.d.ts +3 -0
- package/lib/js/request/request.d.ts.map +1 -0
- package/lib/js/request/request.js +71 -0
- package/lib/js/showMessage.d.ts +15 -0
- package/lib/js/showMessage.d.ts.map +1 -0
- package/lib/js/showMessage.js +83 -0
- package/lib/js/state-immer.d.ts +3 -0
- package/lib/js/state-immer.d.ts.map +1 -0
- package/lib/js/state-immer.js +27 -0
- package/lib/js/timer-executor.d.ts +3 -0
- package/lib/js/timer-executor.d.ts.map +1 -0
- package/lib/js/timer-executor.js +91 -0
- package/lib/js/to-hfc.d.ts +2 -0
- package/lib/js/to-hfc.d.ts.map +1 -0
- package/lib/js/to-hfc.js +14 -0
- package/lib/js/utils.d.ts +3 -0
- package/lib/js/utils.d.ts.map +1 -0
- package/lib/js/utils.js +19 -0
- package/lib/jsx/chat-modal.d.ts +16 -0
- package/lib/jsx/chat-modal.d.ts.map +1 -0
- package/lib/jsx/chat-modal.js +278 -0
- package/lib/server.d.ts +8 -0
- package/lib/server.d.ts.map +1 -0
- package/lib/server.js +58 -0
- package/lib/style.css +174 -0
- package/package.json +57 -0
- package/rct.config.js +8 -0
- package/src/component/answer-itme/index.jsx +64 -0
- package/src/component/answer-itme/style.less +37 -0
- package/src/component/data-container/index.jsx +45 -0
- package/src/component/data-container/style.less +27 -0
- package/src/component/days-tab/index.jsx +114 -0
- package/src/component/days-tab/style.less +55 -0
- package/src/component/days-tab/utils.js +87 -0
- package/src/component/error-boundary/index.jsx +39 -0
- package/src/component/it-notice-modal/columns.js +102 -0
- package/src/component/it-notice-modal/double-tab.jsx +83 -0
- package/src/component/it-notice-modal/index.jsx +404 -0
- package/src/component/it-notice-modal/server.js +43 -0
- package/src/component/it-notice-modal/single-tab.jsx +70 -0
- package/src/component/it-notice-modal/style.less +367 -0
- package/src/component/it-notice-modal/utils.js +8 -0
- package/src/component/it-notice-tab/index.jsx +196 -0
- package/src/component/it-notice-tab/server.js +14 -0
- package/src/component/it-notice-tab/style.less +120 -0
- package/src/component/mail-list-modal/index.jsx +270 -0
- package/src/component/mail-list-modal/server.js +38 -0
- package/src/component/mail-list-modal/style.less +154 -0
- package/src/component/myself-chat-card/index.jsx +27 -0
- package/src/component/myself-chat-card/style.less +30 -0
- package/src/component/need-answer/index.jsx +56 -0
- package/src/component/need-answer/style.less +21 -0
- package/src/component/opppsition-chat-card/index.jsx +25 -0
- package/src/component/opppsition-chat-card/style.less +33 -0
- package/src/component/question-library/index.jsx +316 -0
- package/src/component/question-library/server.js +19 -0
- package/src/component/question-library/style.less +102 -0
- package/src/component/question-tag/index.jsx +27 -0
- package/src/component/question-tag/style.less +15 -0
- package/src/component/recommend-questions-card/index.jsx +111 -0
- package/src/component/recommend-questions-card/style.less +66 -0
- package/src/component/scroll-view/index.js +3 -0
- package/src/component/scroll-view/scroll-view.jsx +74 -0
- package/src/component/scroll-view/style.less +37 -0
- package/src/component/tab/index.jsx +17 -0
- package/src/component/tab/style.less +26 -0
- package/src/component/tips-answer/index.jsx +38 -0
- package/src/component/tips-answer/style.less +11 -0
- package/src/images/expire-robot.svg +16 -0
- package/src/images/pc-invalid.svg +11 -0
- package/src/images/screenshot-5.png +0 -0
- package/src/index.jsx +554 -0
- package/src/js/const.js +48 -0
- package/src/js/gen-render-promise.js +32 -0
- package/src/js/get-time.js +35 -0
- package/src/js/hfc-space.js +91 -0
- package/src/js/render-special.js +64 -0
- package/src/js/request/fetch.js +87 -0
- package/src/js/request/request.js +74 -0
- package/src/js/showMessage.js +81 -0
- package/src/js/state-immer.js +12 -0
- package/src/js/timer-executor.js +37 -0
- package/src/js/to-hfc.js +9 -0
- package/src/js/utils.js +13 -0
- package/src/jsx/chat-modal.jsx +254 -0
- package/src/main.js +1 -0
- package/src/server.js +45 -0
- package/src/style.less +229 -0
- package/test/cases/case-01.assert.js +6 -0
- package/test/cases/case-01.source.jsx +17 -0
- package/test/cases/case-02.assert.js +6 -0
- package/test/cases/case-02.source.jsx +25 -0
- package/test/cases/case-02.style.less +15 -0
- package/test/cases/case-03.source.jsx +69 -0
- package/test/cases/case-03.style.less +3 -0
- package/tsconfig.json +48 -0
- package/typings.d.ts +5 -0
- package/umd/b415d90208c277ba3703.png +0 -0
- package/umd/index.css +1753 -0
- package/umd/index.js +36258 -0
- package/umd/index.min.css +1 -0
- package/umd/index.min.js +657 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
let hfcSpace
|
|
2
|
+
let hfcUserName
|
|
3
|
+
let translateFn
|
|
4
|
+
|
|
5
|
+
export function setHfcSpace(str) {
|
|
6
|
+
hfcSpace = str
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getHfcSpace() {
|
|
10
|
+
return hfcSpace
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function setHfcUserName(str) {
|
|
14
|
+
hfcUserName = str
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getHfcUserName() {
|
|
18
|
+
return hfcUserName
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function setTranslateFn(fn) {
|
|
22
|
+
translateFn = fn
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function getTranslateFn() {
|
|
26
|
+
return translateFn
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const setHfcTokenKey = '$$hfc_token'
|
|
30
|
+
|
|
31
|
+
export function setHfcToken(str) {
|
|
32
|
+
window.localStorage.setItem(setHfcTokenKey, str)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getHfcToken() {
|
|
36
|
+
return window.localStorage.getItem(setHfcTokenKey)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function setLocalStorage(obj) {
|
|
40
|
+
const keyList = Object.keys(obj)
|
|
41
|
+
if (keyList.length > 0) {
|
|
42
|
+
keyList.forEach((key) => {
|
|
43
|
+
let value = obj[key]
|
|
44
|
+
|
|
45
|
+
if (typeof obj[key] === 'object') {
|
|
46
|
+
value = JSON.stringify(obj[key])
|
|
47
|
+
}
|
|
48
|
+
window.localStorage.setItem(key, String(value))
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function getLocalStorage(key) {
|
|
54
|
+
return window.localStorage.getItem(key)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let env
|
|
58
|
+
|
|
59
|
+
export function setHfcEnv(str) {
|
|
60
|
+
env = str
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const origin = {
|
|
64
|
+
dev: 'hfc-dev01.dotfashion.cn',
|
|
65
|
+
test: 'hfc-test01.dotfashion.cn',
|
|
66
|
+
sit: 'hfc-sit01.dotfashion.cn',
|
|
67
|
+
online: 'hfc.dotfashion.cn',
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function getOrigin() {
|
|
71
|
+
return origin[env]
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
let tokenInvalidCallback
|
|
76
|
+
export function setTokenInvalidCallback(fn) {
|
|
77
|
+
tokenInvalidCallback = fn
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function invokeTokenInvalidCallback(res) {
|
|
81
|
+
if (typeof tokenInvalidCallback === 'function') {
|
|
82
|
+
tokenInvalidCallback(res)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function clearAll() {
|
|
87
|
+
window.localStorage.removeItem(setHfcTokenKey)
|
|
88
|
+
env = undefined
|
|
89
|
+
hfcSpace = undefined
|
|
90
|
+
hfcUserName = undefined
|
|
91
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import ReactDom from 'react-dom'
|
|
2
|
+
import { createHashHistory } from 'history'
|
|
3
|
+
|
|
4
|
+
const hashHistory = createHashHistory()
|
|
5
|
+
class Render {
|
|
6
|
+
constructor(name, useHistory) {
|
|
7
|
+
this.div = null
|
|
8
|
+
this.name = name || 'render-special'
|
|
9
|
+
this.hidden = false
|
|
10
|
+
this.useHistory = useHistory
|
|
11
|
+
|
|
12
|
+
this.create = this.create.bind(this)
|
|
13
|
+
this.remove = this.remove.bind(this)
|
|
14
|
+
this.render = this.render.bind(this)
|
|
15
|
+
this.unmountComponentAtNode = this.unmountComponentAtNode.bind(this)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
create() {
|
|
19
|
+
this.div = document.createElement('div')
|
|
20
|
+
this.div.setAttribute('tool-element', this.name)
|
|
21
|
+
document.body.appendChild(this.div)
|
|
22
|
+
|
|
23
|
+
if (this.hidden) this.div.style.display = 'none'
|
|
24
|
+
else this.div.style.display = ''
|
|
25
|
+
if (this.useHistory) {
|
|
26
|
+
this.historyListener = hashHistory.listen(() => {
|
|
27
|
+
if (this.div) {
|
|
28
|
+
this.unmountComponentAtNode()
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
remove() {
|
|
35
|
+
if (typeof this.historyListener === 'function') {
|
|
36
|
+
this.historyListener()
|
|
37
|
+
this.historyListener = null
|
|
38
|
+
}
|
|
39
|
+
document.body.removeChild(this.div)
|
|
40
|
+
this.div = null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
hide() {
|
|
44
|
+
this.hidden = true
|
|
45
|
+
if (this.div) this.div.style.display = 'none'
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
show() {
|
|
49
|
+
this.hidden = false
|
|
50
|
+
if (this.div) this.div.style.display = ''
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
render(element) {
|
|
54
|
+
if (!this.div) this.create()
|
|
55
|
+
ReactDom.render(element, this.div)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
unmountComponentAtNode() {
|
|
59
|
+
ReactDom.unmountComponentAtNode(this.div)
|
|
60
|
+
this.remove()
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default Render
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { fetch } from 'sheinq'
|
|
2
|
+
import { Message } from 'shineout'
|
|
3
|
+
import { getTranslateFn } from '../hfc-space'
|
|
4
|
+
|
|
5
|
+
const codeMessage = {
|
|
6
|
+
200: '服务器成功返回请求的数据',
|
|
7
|
+
201: '新建或修改数据成功。',
|
|
8
|
+
202: '一个请求已经进入后台排队(异步任务)',
|
|
9
|
+
204: '删除数据成功。',
|
|
10
|
+
400: '发出的请求有错误,服务器没有进行新建或修改数据,的操作。',
|
|
11
|
+
401: '用户没有权限(令牌、用户名、密码错误)。',
|
|
12
|
+
403: '用户得到授权,但是访问是被禁止的。',
|
|
13
|
+
404: '发出的请求针对的是不存在的记录,服务器没有进行操作',
|
|
14
|
+
406: '请求的格式不可得。',
|
|
15
|
+
410: '请求的资源被永久删除,且不会再得到的。',
|
|
16
|
+
422: '当创建一个对象时,发生一个验证错误。',
|
|
17
|
+
500: '服务器发生错误,请检查服务器',
|
|
18
|
+
502: '网关错误,请稍后再试',
|
|
19
|
+
503: '服务不可用,服务器暂时过载或维护',
|
|
20
|
+
504: '网关超时',
|
|
21
|
+
}
|
|
22
|
+
export function checkStatus(response, t) {
|
|
23
|
+
if (response.status >= 200 && response.status < 300) {
|
|
24
|
+
return response
|
|
25
|
+
}
|
|
26
|
+
const errortext = t(codeMessage[response.status] || response.statusText)
|
|
27
|
+
// Message.info('网络开小差了哦~')
|
|
28
|
+
const error = new Error(errortext)
|
|
29
|
+
error.name = response.status
|
|
30
|
+
error.response = response
|
|
31
|
+
throw error
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Requests a URL, returning a promise.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} url The URL we want to request
|
|
38
|
+
* @param {object} [options] The options we want to pass to "fetch"
|
|
39
|
+
* @return {object} An object containing either "data" or "err"
|
|
40
|
+
*/
|
|
41
|
+
export default function request(api, options) {
|
|
42
|
+
// 拼接api
|
|
43
|
+
|
|
44
|
+
// 获取翻译函数
|
|
45
|
+
const translateFn = getTranslateFn()
|
|
46
|
+
|
|
47
|
+
function t(str) {
|
|
48
|
+
return translateFn ? translateFn(str) : str
|
|
49
|
+
}
|
|
50
|
+
const newOptions = { ...options }
|
|
51
|
+
if (newOptions.file && newOptions.method === 'GET') {
|
|
52
|
+
newOptions.headers = {
|
|
53
|
+
Accept: 'application/octet-stream',
|
|
54
|
+
'Content-Type': 'application/octet-stream; charset=utf-8',
|
|
55
|
+
...newOptions.headers,
|
|
56
|
+
}
|
|
57
|
+
return fetch(api, newOptions)
|
|
58
|
+
.then((res) => {
|
|
59
|
+
if (res.body instanceof ReadableStream) return res.blob()
|
|
60
|
+
|
|
61
|
+
Message.error(t('文件类型错误!'))
|
|
62
|
+
return null
|
|
63
|
+
})
|
|
64
|
+
.catch((e) => {
|
|
65
|
+
throw e
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (newOptions.method === 'POST' || newOptions.method === 'PUT') {
|
|
70
|
+
newOptions.headers = {
|
|
71
|
+
Accept: 'application/json',
|
|
72
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
73
|
+
...newOptions.headers,
|
|
74
|
+
}
|
|
75
|
+
newOptions.body = JSON.stringify(newOptions.body)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return fetch(api, newOptions)
|
|
79
|
+
.then(response => checkStatus(response, t))
|
|
80
|
+
.then((response) => {
|
|
81
|
+
if (newOptions.method === 'DELETE' || response.status === 204) {
|
|
82
|
+
return response.text()
|
|
83
|
+
}
|
|
84
|
+
return response.json()
|
|
85
|
+
})
|
|
86
|
+
.catch(e => ({ code: -109, msg: `${e.name} ${e.response}` }))
|
|
87
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getHfcSpace, getHfcToken, getOrigin, invokeTokenInvalidCallback, getLocalStorage,
|
|
3
|
+
} from '../hfc-space'
|
|
4
|
+
import request from './fetch'
|
|
5
|
+
|
|
6
|
+
const CODE = {
|
|
7
|
+
SUCCESS: '0',
|
|
8
|
+
TOKEN_INVALID: '40000',
|
|
9
|
+
INVALID_SPACE: '50000',
|
|
10
|
+
INVALID_CODE: '21102',
|
|
11
|
+
BAN: '121101',
|
|
12
|
+
UN_VALID: '121102',
|
|
13
|
+
NO_FOUND: '121103',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const checkCode = (result, api, checkCodedisabled) => {
|
|
17
|
+
// 不检测code
|
|
18
|
+
if (checkCodedisabled) {
|
|
19
|
+
return result
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (result.code === CODE.SUCCESS) return result
|
|
23
|
+
|
|
24
|
+
if (
|
|
25
|
+
[CODE.TOKEN_INVALID,
|
|
26
|
+
CODE.INVALID_SPACE,
|
|
27
|
+
CODE.INVALID_CODE,
|
|
28
|
+
CODE.BAN,
|
|
29
|
+
CODE.UN_VALID,
|
|
30
|
+
CODE.NO_FOUND,
|
|
31
|
+
].includes(result.code)
|
|
32
|
+
) {
|
|
33
|
+
// 登录失效回调
|
|
34
|
+
invokeTokenInvalidCallback(result)
|
|
35
|
+
// 登录失效也不弹报错了
|
|
36
|
+
return undefined
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 报错提醒全部干掉吧
|
|
40
|
+
// showMessage((result && result.msg) || '报错了接口')
|
|
41
|
+
return undefined
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default function postRequest(api, condition, checkCodedisabled) {
|
|
45
|
+
const requestApi = `https://${getOrigin()}${api}`
|
|
46
|
+
const body = { ...condition }
|
|
47
|
+
const hfcSpace = getHfcSpace()
|
|
48
|
+
const headers = {
|
|
49
|
+
'hfc-space': hfcSpace,
|
|
50
|
+
'hfc-token': getHfcToken(),
|
|
51
|
+
language: getLocalStorage(`${hfcSpace}-lang`) || 'CN',
|
|
52
|
+
}
|
|
53
|
+
const defaultOptions = { credentials: 'include' }
|
|
54
|
+
|
|
55
|
+
return request(requestApi, {
|
|
56
|
+
method: 'POST', body, headers, ...defaultOptions,
|
|
57
|
+
})
|
|
58
|
+
.then(result => checkCode(result, requestApi, checkCodedisabled))
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function testPostRequest(api, params, result) {
|
|
62
|
+
// eslint-disable-next-line no-console
|
|
63
|
+
console.log('api', api)
|
|
64
|
+
// eslint-disable-next-line no-console
|
|
65
|
+
console.log('params', params)
|
|
66
|
+
return new Promise((resolve) => {
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
resolve({
|
|
69
|
+
code: '0',
|
|
70
|
+
info: result,
|
|
71
|
+
})
|
|
72
|
+
}, 1000)
|
|
73
|
+
})
|
|
74
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @cn showMessage
|
|
3
|
+
*/
|
|
4
|
+
import { Modal, Message } from 'shineout'
|
|
5
|
+
|
|
6
|
+
const noop = () => null
|
|
7
|
+
|
|
8
|
+
class Throttle {
|
|
9
|
+
task = {}
|
|
10
|
+
|
|
11
|
+
push = (key) => {
|
|
12
|
+
this.task[key] = Date.now()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
pop = (key) => {
|
|
16
|
+
delete this.task[key]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
20
|
+
isRunning = key => this.task.hasOwnProperty(key)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const throttle = new Throttle()
|
|
24
|
+
|
|
25
|
+
const defaultOptions = {
|
|
26
|
+
time: 10000,
|
|
27
|
+
cb: () => {},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 一般最后一个才能作为默认参数
|
|
32
|
+
* @funcNmae showMessage
|
|
33
|
+
* @param msg string 消息内容
|
|
34
|
+
* @param isSuccess bool 是否显示toast或dialog
|
|
35
|
+
* @param options.time number 消息持续时间,单位毫秒
|
|
36
|
+
* @param options.cb func 浮窗结束或者点击后的回调方法
|
|
37
|
+
* @param options.onClose 点击蒙层的回调方法
|
|
38
|
+
*/
|
|
39
|
+
const showMessage = (
|
|
40
|
+
msg,
|
|
41
|
+
isSuccess = false,
|
|
42
|
+
options = defaultOptions,
|
|
43
|
+
) => {
|
|
44
|
+
let { time = defaultOptions.time } = options
|
|
45
|
+
const { cb = noop, onClose } = options
|
|
46
|
+
time = isSuccess ? 3000 : time
|
|
47
|
+
let modal
|
|
48
|
+
const handle = setTimeout(() => {
|
|
49
|
+
throttle.pop(msg)
|
|
50
|
+
if (modal) modal()
|
|
51
|
+
if (cb) cb()
|
|
52
|
+
}, time)
|
|
53
|
+
if (!throttle.isRunning(msg)) {
|
|
54
|
+
throttle.push(msg)
|
|
55
|
+
if (isSuccess) {
|
|
56
|
+
Message.success(msg, time / 1000, {
|
|
57
|
+
hideClose: true,
|
|
58
|
+
})
|
|
59
|
+
throttle.pop(msg)
|
|
60
|
+
clearTimeout(handle)
|
|
61
|
+
if (cb) cb()
|
|
62
|
+
} else {
|
|
63
|
+
modal = Modal.error({
|
|
64
|
+
title: msg,
|
|
65
|
+
maskClosable: true,
|
|
66
|
+
onOk() {
|
|
67
|
+
throttle.pop(msg)
|
|
68
|
+
clearTimeout(handle)
|
|
69
|
+
if (cb) cb()
|
|
70
|
+
},
|
|
71
|
+
onClose() {
|
|
72
|
+
throttle.pop(msg)
|
|
73
|
+
clearTimeout(handle)
|
|
74
|
+
if (onClose) onClose()
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default showMessage
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import produce from 'immer'
|
|
3
|
+
|
|
4
|
+
const useStateByImmer = (defaultState) => {
|
|
5
|
+
const [value, updater] = useState(defaultState)
|
|
6
|
+
return [value, (newValue) => {
|
|
7
|
+
if (typeof newValue === 'function') return updater(produce(newValue))
|
|
8
|
+
return updater(produce(draftValue => Object.assign(draftValue, newValue)))
|
|
9
|
+
}]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default useStateByImmer
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import moment from 'moment'
|
|
2
|
+
import { openITNoticeModal } from '../component/it-notice-modal'
|
|
3
|
+
import { isPopITInform } from '../server'
|
|
4
|
+
|
|
5
|
+
let timer = null
|
|
6
|
+
|
|
7
|
+
export default async (zIndex, t) => {
|
|
8
|
+
if (timer) {
|
|
9
|
+
clearTimeout(timer)
|
|
10
|
+
}
|
|
11
|
+
const now = moment()
|
|
12
|
+
const timeTemp = now.clone()
|
|
13
|
+
let weekDay = now.day()
|
|
14
|
+
weekDay = weekDay === 0 ? 7 : weekDay
|
|
15
|
+
let nextTime = 0
|
|
16
|
+
// 周一到周日的10点
|
|
17
|
+
const curHour = now.hours()
|
|
18
|
+
if (curHour < 10) {
|
|
19
|
+
nextTime = timeTemp.add(10 - curHour, 'hour').minutes(0).seconds(0)
|
|
20
|
+
} else if (now.minutes() === 0 && now.seconds() === 0) {
|
|
21
|
+
const res = await isPopITInform()
|
|
22
|
+
if (res.info) {
|
|
23
|
+
openITNoticeModal({ zIndex, t })
|
|
24
|
+
}
|
|
25
|
+
nextTime = timeTemp.add(1, 'days').hour(10).minutes(0).seconds(0)
|
|
26
|
+
} else {
|
|
27
|
+
nextTime = timeTemp.add(1, 'days').hour(10).minutes(0).seconds(0)
|
|
28
|
+
}
|
|
29
|
+
if (nextTime) {
|
|
30
|
+
timer = setTimeout(async () => {
|
|
31
|
+
const res = await isPopITInform()
|
|
32
|
+
if (res?.info) {
|
|
33
|
+
openITNoticeModal({ zIndex, t })
|
|
34
|
+
}
|
|
35
|
+
}, nextTime - now)
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/js/to-hfc.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { getHfcSpace, getHfcToken, getOrigin, getHfcUserName, getLocalStorage } from './hfc-space'
|
|
2
|
+
|
|
3
|
+
export function toHfc(path) {
|
|
4
|
+
const origin = `https://${getOrigin()}/#`
|
|
5
|
+
const originUrl = encodeURIComponent(window.location.href)
|
|
6
|
+
const hfcSpace = getHfcSpace()
|
|
7
|
+
const lang = getLocalStorage(`${hfcSpace}-lang`) || 'CN'
|
|
8
|
+
window.open(`${origin + path}/?token=${getHfcToken()}&hfcSpace=${hfcSpace}&originUrl=${originUrl}&userName=${getHfcUserName()}&lang=${lang}`)
|
|
9
|
+
}
|
package/src/js/utils.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const getRandomID = () => Math.random().toString(36).substring(2)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const debounce = (fn, delay) => {
|
|
5
|
+
let pre = new Date().getTime()
|
|
6
|
+
return (...args) => {
|
|
7
|
+
const next = new Date().getTime()
|
|
8
|
+
if (next - pre >= delay) {
|
|
9
|
+
fn(...args)
|
|
10
|
+
pre = next
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|