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.

Files changed (369) hide show
  1. package/.eslintignore +6 -0
  2. package/.eslintrc +45 -0
  3. package/.gitlab-ci.yml +52 -0
  4. package/.lecprc.ts +76 -0
  5. package/.yarnrc +1 -0
  6. package/CHANGELOG.md +114 -0
  7. package/README.md +14 -0
  8. package/custom-amd-plugin.ts +46 -0
  9. package/es/component/answer-itme/index.d.ts +20 -0
  10. package/es/component/answer-itme/index.d.ts.map +1 -0
  11. package/es/component/answer-itme/index.js +41 -0
  12. package/es/component/answer-itme/style.css +35 -0
  13. package/es/component/data-container/index.d.ts +19 -0
  14. package/es/component/data-container/index.d.ts.map +1 -0
  15. package/es/component/data-container/index.js +37 -0
  16. package/es/component/data-container/style.css +26 -0
  17. package/es/component/days-tab/index.d.ts +6 -0
  18. package/es/component/days-tab/index.d.ts.map +1 -0
  19. package/es/component/days-tab/index.js +119 -0
  20. package/es/component/days-tab/style.css +43 -0
  21. package/es/component/days-tab/utils.d.ts +32 -0
  22. package/es/component/days-tab/utils.d.ts.map +1 -0
  23. package/es/component/days-tab/utils.js +98 -0
  24. package/es/component/error-boundary/index.d.ts +2 -0
  25. package/es/component/error-boundary/index.d.ts.map +1 -0
  26. package/es/component/error-boundary/index.js +33 -0
  27. package/es/component/it-notice-modal/columns.d.ts +11 -0
  28. package/es/component/it-notice-modal/columns.d.ts.map +1 -0
  29. package/es/component/it-notice-modal/columns.js +108 -0
  30. package/es/component/it-notice-modal/double-tab.d.ts +6 -0
  31. package/es/component/it-notice-modal/double-tab.d.ts.map +1 -0
  32. package/es/component/it-notice-modal/double-tab.js +94 -0
  33. package/es/component/it-notice-modal/index.d.ts +6 -0
  34. package/es/component/it-notice-modal/index.d.ts.map +1 -0
  35. package/es/component/it-notice-modal/index.js +488 -0
  36. package/es/component/it-notice-modal/server.d.ts +8 -0
  37. package/es/component/it-notice-modal/server.d.ts.map +1 -0
  38. package/es/component/it-notice-modal/server.js +43 -0
  39. package/es/component/it-notice-modal/single-tab.d.ts +6 -0
  40. package/es/component/it-notice-modal/single-tab.d.ts.map +1 -0
  41. package/es/component/it-notice-modal/single-tab.js +82 -0
  42. package/es/component/it-notice-modal/style.css +301 -0
  43. package/es/component/it-notice-modal/utils.d.ts +2 -0
  44. package/es/component/it-notice-modal/utils.d.ts.map +1 -0
  45. package/es/component/it-notice-modal/utils.js +8 -0
  46. package/es/component/it-notice-tab/index.d.ts +6 -0
  47. package/es/component/it-notice-tab/index.d.ts.map +1 -0
  48. package/es/component/it-notice-tab/index.js +206 -0
  49. package/es/component/it-notice-tab/server.d.ts +3 -0
  50. package/es/component/it-notice-tab/server.d.ts.map +1 -0
  51. package/es/component/it-notice-tab/server.js +13 -0
  52. package/es/component/it-notice-tab/style.css +103 -0
  53. package/es/component/mail-list-modal/index.d.ts +2 -0
  54. package/es/component/mail-list-modal/index.d.ts.map +1 -0
  55. package/es/component/mail-list-modal/index.js +306 -0
  56. package/es/component/mail-list-modal/server.d.ts +7 -0
  57. package/es/component/mail-list-modal/server.d.ts.map +1 -0
  58. package/es/component/mail-list-modal/server.js +38 -0
  59. package/es/component/mail-list-modal/style.css +132 -0
  60. package/es/component/myself-chat-card/index.d.ts +15 -0
  61. package/es/component/myself-chat-card/index.d.ts.map +1 -0
  62. package/es/component/myself-chat-card/index.js +25 -0
  63. package/es/component/myself-chat-card/style.css +22 -0
  64. package/es/component/need-answer/index.d.ts +15 -0
  65. package/es/component/need-answer/index.d.ts.map +1 -0
  66. package/es/component/need-answer/index.js +60 -0
  67. package/es/component/need-answer/style.css +19 -0
  68. package/es/component/opppsition-chat-card/index.d.ts +11 -0
  69. package/es/component/opppsition-chat-card/index.d.ts.map +1 -0
  70. package/es/component/opppsition-chat-card/index.js +25 -0
  71. package/es/component/opppsition-chat-card/style.css +23 -0
  72. package/es/component/question-library/index.d.ts +10 -0
  73. package/es/component/question-library/index.d.ts.map +1 -0
  74. package/es/component/question-library/index.js +291 -0
  75. package/es/component/question-library/server.d.ts +4 -0
  76. package/es/component/question-library/server.d.ts.map +1 -0
  77. package/es/component/question-library/server.js +19 -0
  78. package/es/component/question-library/style.css +75 -0
  79. package/es/component/question-tag/index.d.ts +11 -0
  80. package/es/component/question-tag/index.d.ts.map +1 -0
  81. package/es/component/question-tag/index.js +23 -0
  82. package/es/component/question-tag/style.css +12 -0
  83. package/es/component/recommend-questions-card/index.d.ts +10 -0
  84. package/es/component/recommend-questions-card/index.d.ts.map +1 -0
  85. package/es/component/recommend-questions-card/index.js +104 -0
  86. package/es/component/recommend-questions-card/style.css +54 -0
  87. package/es/component/scroll-view/index.d.ts +3 -0
  88. package/es/component/scroll-view/index.d.ts.map +1 -0
  89. package/es/component/scroll-view/index.js +2 -0
  90. package/es/component/scroll-view/scroll-view.d.ts +18 -0
  91. package/es/component/scroll-view/scroll-view.d.ts.map +1 -0
  92. package/es/component/scroll-view/scroll-view.js +66 -0
  93. package/es/component/scroll-view/style.css +34 -0
  94. package/es/component/tab/index.d.ts +2 -0
  95. package/es/component/tab/index.d.ts.map +1 -0
  96. package/es/component/tab/index.js +18 -0
  97. package/es/component/tab/style.css +26 -0
  98. package/es/component/tips-answer/index.d.ts +15 -0
  99. package/es/component/tips-answer/index.d.ts.map +1 -0
  100. package/es/component/tips-answer/index.js +28 -0
  101. package/es/component/tips-answer/style.css +10 -0
  102. package/es/images/expire-robot.svg +16 -0
  103. package/es/images/pc-invalid.svg +11 -0
  104. package/es/images/screenshot-5.png +0 -0
  105. package/es/index.d.ts +92 -0
  106. package/es/index.d.ts.map +1 -0
  107. package/es/index.js +506 -0
  108. package/es/js/const.d.ts +41 -0
  109. package/es/js/const.d.ts.map +1 -0
  110. package/es/js/const.js +46 -0
  111. package/es/js/gen-render-promise.d.ts +9 -0
  112. package/es/js/gen-render-promise.d.ts.map +1 -0
  113. package/es/js/gen-render-promise.js +30 -0
  114. package/es/js/get-time.d.ts +15 -0
  115. package/es/js/get-time.d.ts.map +1 -0
  116. package/es/js/get-time.js +35 -0
  117. package/es/js/hfc-space.d.ts +16 -0
  118. package/es/js/hfc-space.d.ts.map +1 -0
  119. package/es/js/hfc-space.js +71 -0
  120. package/es/js/render-special.d.ts +16 -0
  121. package/es/js/render-special.d.ts.map +1 -0
  122. package/es/js/render-special.js +53 -0
  123. package/es/js/request/fetch.d.ts +10 -0
  124. package/es/js/request/fetch.d.ts.map +1 -0
  125. package/es/js/request/fetch.js +81 -0
  126. package/es/js/request/request.d.ts +3 -0
  127. package/es/js/request/request.d.ts.map +1 -0
  128. package/es/js/request/request.js +63 -0
  129. package/es/js/showMessage.d.ts +15 -0
  130. package/es/js/showMessage.d.ts.map +1 -0
  131. package/es/js/showMessage.js +75 -0
  132. package/es/js/state-immer.d.ts +3 -0
  133. package/es/js/state-immer.d.ts.map +1 -0
  134. package/es/js/state-immer.js +19 -0
  135. package/es/js/timer-executor.d.ts +3 -0
  136. package/es/js/timer-executor.d.ts.map +1 -0
  137. package/es/js/timer-executor.js +83 -0
  138. package/es/js/to-hfc.d.ts +2 -0
  139. package/es/js/to-hfc.d.ts.map +1 -0
  140. package/es/js/to-hfc.js +8 -0
  141. package/es/js/utils.d.ts +3 -0
  142. package/es/js/utils.d.ts.map +1 -0
  143. package/es/js/utils.js +11 -0
  144. package/es/jsx/chat-modal.d.ts +16 -0
  145. package/es/jsx/chat-modal.d.ts.map +1 -0
  146. package/es/jsx/chat-modal.js +268 -0
  147. package/es/server.d.ts +8 -0
  148. package/es/server.d.ts.map +1 -0
  149. package/es/server.js +44 -0
  150. package/es/style.css +174 -0
  151. package/lib/component/answer-itme/index.d.ts +20 -0
  152. package/lib/component/answer-itme/index.d.ts.map +1 -0
  153. package/lib/component/answer-itme/index.js +51 -0
  154. package/lib/component/answer-itme/style.css +35 -0
  155. package/lib/component/data-container/index.d.ts +19 -0
  156. package/lib/component/data-container/index.d.ts.map +1 -0
  157. package/lib/component/data-container/index.js +45 -0
  158. package/lib/component/data-container/style.css +26 -0
  159. package/lib/component/days-tab/index.d.ts +6 -0
  160. package/lib/component/days-tab/index.d.ts.map +1 -0
  161. package/lib/component/days-tab/index.js +129 -0
  162. package/lib/component/days-tab/style.css +43 -0
  163. package/lib/component/days-tab/utils.d.ts +32 -0
  164. package/lib/component/days-tab/utils.d.ts.map +1 -0
  165. package/lib/component/days-tab/utils.js +110 -0
  166. package/lib/component/error-boundary/index.d.ts +2 -0
  167. package/lib/component/error-boundary/index.d.ts.map +1 -0
  168. package/lib/component/error-boundary/index.js +40 -0
  169. package/lib/component/it-notice-modal/columns.d.ts +11 -0
  170. package/lib/component/it-notice-modal/columns.d.ts.map +1 -0
  171. package/lib/component/it-notice-modal/columns.js +116 -0
  172. package/lib/component/it-notice-modal/double-tab.d.ts +6 -0
  173. package/lib/component/it-notice-modal/double-tab.d.ts.map +1 -0
  174. package/lib/component/it-notice-modal/double-tab.js +104 -0
  175. package/lib/component/it-notice-modal/index.d.ts +6 -0
  176. package/lib/component/it-notice-modal/index.d.ts.map +1 -0
  177. package/lib/component/it-notice-modal/index.js +499 -0
  178. package/lib/component/it-notice-modal/server.d.ts +8 -0
  179. package/lib/component/it-notice-modal/server.d.ts.map +1 -0
  180. package/lib/component/it-notice-modal/server.js +55 -0
  181. package/lib/component/it-notice-modal/single-tab.d.ts +6 -0
  182. package/lib/component/it-notice-modal/single-tab.d.ts.map +1 -0
  183. package/lib/component/it-notice-modal/single-tab.js +92 -0
  184. package/lib/component/it-notice-modal/style.css +301 -0
  185. package/lib/component/it-notice-modal/utils.d.ts +2 -0
  186. package/lib/component/it-notice-modal/utils.d.ts.map +1 -0
  187. package/lib/component/it-notice-modal/utils.js +15 -0
  188. package/lib/component/it-notice-tab/index.d.ts +6 -0
  189. package/lib/component/it-notice-tab/index.d.ts.map +1 -0
  190. package/lib/component/it-notice-tab/index.js +216 -0
  191. package/lib/component/it-notice-tab/server.d.ts +3 -0
  192. package/lib/component/it-notice-tab/server.d.ts.map +1 -0
  193. package/lib/component/it-notice-tab/server.js +20 -0
  194. package/lib/component/it-notice-tab/style.css +103 -0
  195. package/lib/component/mail-list-modal/index.d.ts +2 -0
  196. package/lib/component/mail-list-modal/index.d.ts.map +1 -0
  197. package/lib/component/mail-list-modal/index.js +316 -0
  198. package/lib/component/mail-list-modal/server.d.ts +7 -0
  199. package/lib/component/mail-list-modal/server.d.ts.map +1 -0
  200. package/lib/component/mail-list-modal/server.js +50 -0
  201. package/lib/component/mail-list-modal/style.css +132 -0
  202. package/lib/component/myself-chat-card/index.d.ts +15 -0
  203. package/lib/component/myself-chat-card/index.d.ts.map +1 -0
  204. package/lib/component/myself-chat-card/index.js +35 -0
  205. package/lib/component/myself-chat-card/style.css +22 -0
  206. package/lib/component/need-answer/index.d.ts +15 -0
  207. package/lib/component/need-answer/index.d.ts.map +1 -0
  208. package/lib/component/need-answer/index.js +70 -0
  209. package/lib/component/need-answer/style.css +19 -0
  210. package/lib/component/opppsition-chat-card/index.d.ts +11 -0
  211. package/lib/component/opppsition-chat-card/index.d.ts.map +1 -0
  212. package/lib/component/opppsition-chat-card/index.js +35 -0
  213. package/lib/component/opppsition-chat-card/style.css +23 -0
  214. package/lib/component/question-library/index.d.ts +10 -0
  215. package/lib/component/question-library/index.d.ts.map +1 -0
  216. package/lib/component/question-library/index.js +301 -0
  217. package/lib/component/question-library/server.d.ts +4 -0
  218. package/lib/component/question-library/server.d.ts.map +1 -0
  219. package/lib/component/question-library/server.js +27 -0
  220. package/lib/component/question-library/style.css +75 -0
  221. package/lib/component/question-tag/index.d.ts +11 -0
  222. package/lib/component/question-tag/index.d.ts.map +1 -0
  223. package/lib/component/question-tag/index.js +33 -0
  224. package/lib/component/question-tag/style.css +12 -0
  225. package/lib/component/recommend-questions-card/index.d.ts +10 -0
  226. package/lib/component/recommend-questions-card/index.d.ts.map +1 -0
  227. package/lib/component/recommend-questions-card/index.js +114 -0
  228. package/lib/component/recommend-questions-card/style.css +54 -0
  229. package/lib/component/scroll-view/index.d.ts +3 -0
  230. package/lib/component/scroll-view/index.d.ts.map +1 -0
  231. package/lib/component/scroll-view/index.js +10 -0
  232. package/lib/component/scroll-view/scroll-view.d.ts +18 -0
  233. package/lib/component/scroll-view/scroll-view.d.ts.map +1 -0
  234. package/lib/component/scroll-view/scroll-view.js +76 -0
  235. package/lib/component/scroll-view/style.css +34 -0
  236. package/lib/component/tab/index.d.ts +2 -0
  237. package/lib/component/tab/index.d.ts.map +1 -0
  238. package/lib/component/tab/index.js +28 -0
  239. package/lib/component/tab/style.css +26 -0
  240. package/lib/component/tips-answer/index.d.ts +15 -0
  241. package/lib/component/tips-answer/index.d.ts.map +1 -0
  242. package/lib/component/tips-answer/index.js +38 -0
  243. package/lib/component/tips-answer/style.css +10 -0
  244. package/lib/images/expire-robot.svg +16 -0
  245. package/lib/images/pc-invalid.svg +11 -0
  246. package/lib/images/screenshot-5.png +0 -0
  247. package/lib/index.d.ts +92 -0
  248. package/lib/index.d.ts.map +1 -0
  249. package/lib/index.js +516 -0
  250. package/lib/js/const.d.ts +41 -0
  251. package/lib/js/const.d.ts.map +1 -0
  252. package/lib/js/const.js +55 -0
  253. package/lib/js/gen-render-promise.d.ts +9 -0
  254. package/lib/js/gen-render-promise.d.ts.map +1 -0
  255. package/lib/js/gen-render-promise.js +37 -0
  256. package/lib/js/get-time.d.ts +15 -0
  257. package/lib/js/get-time.d.ts.map +1 -0
  258. package/lib/js/get-time.js +43 -0
  259. package/lib/js/hfc-space.d.ts +16 -0
  260. package/lib/js/hfc-space.d.ts.map +1 -0
  261. package/lib/js/hfc-space.js +91 -0
  262. package/lib/js/render-special.d.ts +16 -0
  263. package/lib/js/render-special.d.ts.map +1 -0
  264. package/lib/js/render-special.js +61 -0
  265. package/lib/js/request/fetch.d.ts +10 -0
  266. package/lib/js/request/fetch.d.ts.map +1 -0
  267. package/lib/js/request/fetch.js +88 -0
  268. package/lib/js/request/request.d.ts +3 -0
  269. package/lib/js/request/request.d.ts.map +1 -0
  270. package/lib/js/request/request.js +71 -0
  271. package/lib/js/showMessage.d.ts +15 -0
  272. package/lib/js/showMessage.d.ts.map +1 -0
  273. package/lib/js/showMessage.js +83 -0
  274. package/lib/js/state-immer.d.ts +3 -0
  275. package/lib/js/state-immer.d.ts.map +1 -0
  276. package/lib/js/state-immer.js +27 -0
  277. package/lib/js/timer-executor.d.ts +3 -0
  278. package/lib/js/timer-executor.d.ts.map +1 -0
  279. package/lib/js/timer-executor.js +91 -0
  280. package/lib/js/to-hfc.d.ts +2 -0
  281. package/lib/js/to-hfc.d.ts.map +1 -0
  282. package/lib/js/to-hfc.js +14 -0
  283. package/lib/js/utils.d.ts +3 -0
  284. package/lib/js/utils.d.ts.map +1 -0
  285. package/lib/js/utils.js +19 -0
  286. package/lib/jsx/chat-modal.d.ts +16 -0
  287. package/lib/jsx/chat-modal.d.ts.map +1 -0
  288. package/lib/jsx/chat-modal.js +278 -0
  289. package/lib/server.d.ts +8 -0
  290. package/lib/server.d.ts.map +1 -0
  291. package/lib/server.js +58 -0
  292. package/lib/style.css +174 -0
  293. package/package.json +57 -0
  294. package/rct.config.js +8 -0
  295. package/src/component/answer-itme/index.jsx +64 -0
  296. package/src/component/answer-itme/style.less +37 -0
  297. package/src/component/data-container/index.jsx +45 -0
  298. package/src/component/data-container/style.less +27 -0
  299. package/src/component/days-tab/index.jsx +114 -0
  300. package/src/component/days-tab/style.less +55 -0
  301. package/src/component/days-tab/utils.js +87 -0
  302. package/src/component/error-boundary/index.jsx +39 -0
  303. package/src/component/it-notice-modal/columns.js +102 -0
  304. package/src/component/it-notice-modal/double-tab.jsx +83 -0
  305. package/src/component/it-notice-modal/index.jsx +404 -0
  306. package/src/component/it-notice-modal/server.js +43 -0
  307. package/src/component/it-notice-modal/single-tab.jsx +70 -0
  308. package/src/component/it-notice-modal/style.less +367 -0
  309. package/src/component/it-notice-modal/utils.js +8 -0
  310. package/src/component/it-notice-tab/index.jsx +196 -0
  311. package/src/component/it-notice-tab/server.js +14 -0
  312. package/src/component/it-notice-tab/style.less +120 -0
  313. package/src/component/mail-list-modal/index.jsx +270 -0
  314. package/src/component/mail-list-modal/server.js +38 -0
  315. package/src/component/mail-list-modal/style.less +154 -0
  316. package/src/component/myself-chat-card/index.jsx +27 -0
  317. package/src/component/myself-chat-card/style.less +30 -0
  318. package/src/component/need-answer/index.jsx +56 -0
  319. package/src/component/need-answer/style.less +21 -0
  320. package/src/component/opppsition-chat-card/index.jsx +25 -0
  321. package/src/component/opppsition-chat-card/style.less +33 -0
  322. package/src/component/question-library/index.jsx +316 -0
  323. package/src/component/question-library/server.js +19 -0
  324. package/src/component/question-library/style.less +102 -0
  325. package/src/component/question-tag/index.jsx +27 -0
  326. package/src/component/question-tag/style.less +15 -0
  327. package/src/component/recommend-questions-card/index.jsx +111 -0
  328. package/src/component/recommend-questions-card/style.less +66 -0
  329. package/src/component/scroll-view/index.js +3 -0
  330. package/src/component/scroll-view/scroll-view.jsx +74 -0
  331. package/src/component/scroll-view/style.less +37 -0
  332. package/src/component/tab/index.jsx +17 -0
  333. package/src/component/tab/style.less +26 -0
  334. package/src/component/tips-answer/index.jsx +38 -0
  335. package/src/component/tips-answer/style.less +11 -0
  336. package/src/images/expire-robot.svg +16 -0
  337. package/src/images/pc-invalid.svg +11 -0
  338. package/src/images/screenshot-5.png +0 -0
  339. package/src/index.jsx +554 -0
  340. package/src/js/const.js +48 -0
  341. package/src/js/gen-render-promise.js +32 -0
  342. package/src/js/get-time.js +35 -0
  343. package/src/js/hfc-space.js +91 -0
  344. package/src/js/render-special.js +64 -0
  345. package/src/js/request/fetch.js +87 -0
  346. package/src/js/request/request.js +74 -0
  347. package/src/js/showMessage.js +81 -0
  348. package/src/js/state-immer.js +12 -0
  349. package/src/js/timer-executor.js +37 -0
  350. package/src/js/to-hfc.js +9 -0
  351. package/src/js/utils.js +13 -0
  352. package/src/jsx/chat-modal.jsx +254 -0
  353. package/src/main.js +1 -0
  354. package/src/server.js +45 -0
  355. package/src/style.less +229 -0
  356. package/test/cases/case-01.assert.js +6 -0
  357. package/test/cases/case-01.source.jsx +17 -0
  358. package/test/cases/case-02.assert.js +6 -0
  359. package/test/cases/case-02.source.jsx +25 -0
  360. package/test/cases/case-02.style.less +15 -0
  361. package/test/cases/case-03.source.jsx +69 -0
  362. package/test/cases/case-03.style.less +3 -0
  363. package/tsconfig.json +48 -0
  364. package/typings.d.ts +5 -0
  365. package/umd/b415d90208c277ba3703.png +0 -0
  366. package/umd/index.css +1753 -0
  367. package/umd/index.js +36258 -0
  368. package/umd/index.min.css +1 -0
  369. 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
+ }
@@ -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
+ }
@@ -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
+ }