@antv/dumi-theme-antv 0.8.0-beta.3 → 0.8.0-beta.4

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.
Files changed (64) hide show
  1. package/dist/builtins/Playground/index.module.less +0 -1
  2. package/dist/components/AI/HomeDialog/AntVBanner/index.module.less +2 -2
  3. package/dist/components/AI/HomeDialog/ModeSelector/index.module.less +39 -22
  4. package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.module.less +3 -3
  5. package/dist/components/AI/HomeDialog/PromptTextarea/index.js +10 -23
  6. package/dist/components/AI/HomeDialog/PromptTextarea/index.module.less +8 -8
  7. package/dist/components/AI/HomeDialog/RecommendCase/card.module.less +1 -1
  8. package/dist/components/AI/HomeDialog/RecommendCase/index.module.less +2 -2
  9. package/dist/components/Login/Captcha/index.js +199 -0
  10. package/dist/components/Login/Captcha/index.less +91 -0
  11. package/dist/components/Login/CheckCode/index.js +262 -0
  12. package/dist/components/Login/CheckCode/index.less +137 -0
  13. package/dist/components/Login/CountDownButton/index.js +115 -0
  14. package/dist/components/Login/CountDownButton/index.less +8 -0
  15. package/dist/components/Login/LoginForm.js +245 -0
  16. package/dist/components/Login/LoginForm.less +409 -0
  17. package/dist/components/Login/index.js +20 -0
  18. package/dist/components/Login/openAuthWindow.js +54 -0
  19. package/dist/components/Login/types.js +5 -0
  20. package/dist/components/Login/utils.js +47 -0
  21. package/dist/layouts/DocLayout.js +2 -1
  22. package/dist/layouts/GlobalLayout/index.js +8 -4
  23. package/dist/locales/en.json +52 -1
  24. package/dist/locales/zh.json +52 -1
  25. package/dist/model/AIChat.js +2 -2
  26. package/dist/model/auth.js +89 -0
  27. package/dist/pages/AIPlayground/components/ConversationsMenu/index.module.less +2 -0
  28. package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.js +7 -5
  29. package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.module.less +1 -2
  30. package/dist/pages/AIPlayground/components/MsgBox/index.js +179 -140
  31. package/dist/pages/AIPlayground/components/MsgBox/index.module.less +3 -2
  32. package/dist/pages/AIPlayground/components/MsgBox/useAutoScroll.js +46 -0
  33. package/dist/pages/AIPlayground/components/SessionLayout/index.module.less +1 -1
  34. package/dist/pages/AIPlayground/components/TaskBox/generateCode.js +7 -1
  35. package/dist/pages/AIPlayground/components/TaskBox/index.js +31 -52
  36. package/dist/pages/AIPlayground/components/TaskBox/index.module.less +1 -0
  37. package/dist/pages/Examples/components/Accouncement/index.module.less +1 -1
  38. package/dist/pages/Examples/index.module.less +11 -11
  39. package/dist/pages/Index/components/Cases/index.module.less +8 -8
  40. package/dist/pages/Index/components/Companies/index.module.less +4 -3
  41. package/dist/pages/Index/components/Features/FeatureCard.module.less +4 -5
  42. package/dist/pages/Index/components/Features/index.module.less +5 -5
  43. package/dist/pages/Index/components/_.less +9 -9
  44. package/dist/slots/Banner/Notification.module.less +8 -8
  45. package/dist/slots/Banner/index.module.less +10 -9
  46. package/dist/slots/CodeEditor/index.module.less +3 -0
  47. package/dist/slots/CodePreview/index.module.less +0 -3
  48. package/dist/slots/ContentTable/index.module.less +2 -1
  49. package/dist/slots/Detail/News.module.less +9 -9
  50. package/dist/slots/Detail/index.module.less +11 -14
  51. package/dist/slots/ExampleSider/index.module.less +3 -4
  52. package/dist/slots/Footer/index.module.less +2 -2
  53. package/dist/slots/Header/Products/Product.module.less +2 -2
  54. package/dist/slots/Header/Search/SearchResult.js +7 -0
  55. package/dist/slots/Header/Search/SearchResult.module.less +1 -0
  56. package/dist/slots/Header/index.module.less +5 -5
  57. package/dist/slots/LiveExample/index.module.less +1 -1
  58. package/dist/slots/Loading/index.module.less +30 -28
  59. package/dist/slots/ManualContent/index.module.less +14 -17
  60. package/dist/slots/_.less +9 -9
  61. package/dist/utils/auth.js +10 -0
  62. package/dist/utils/env.js +24 -0
  63. package/dist/utils/request.js +104 -0
  64. package/package.json +7 -2
@@ -2,7 +2,6 @@
2
2
  width: 100%;
3
3
  height: 400px;
4
4
  position: relative;
5
-
6
5
  margin: 0;
7
6
  padding: 0;
8
7
  border: 1px solid #f0f0f0;
@@ -27,9 +27,9 @@
27
27
 
28
28
  .slogan {
29
29
  background: linear-gradient(to right, #6d81ba, #6475ff);
30
- -webkit-background-clip: text;
30
+ background-clip: text;
31
31
  -webkit-text-fill-color: transparent;
32
- margin: 0px;
32
+ margin: 0;
33
33
  font-size: 16px;
34
34
  }
35
35
  }
@@ -21,11 +21,10 @@
21
21
  display: flex;
22
22
  flex-direction: row;
23
23
  gap: 6px;
24
-
25
24
  backdrop-filter: blur(12px);
26
25
  padding: 4px;
27
26
  border-radius: 26px;
28
- box-shadow: inset 1px -1px 0 0 rgba(255, 255, 255, 0.89);
27
+ box-shadow: inset 1px -1px 0 0 rgba(255, 255, 255, 89%);
29
28
 
30
29
  &::before {
31
30
  border-radius: 26px;
@@ -40,12 +39,12 @@
40
39
  opacity: 0.75;
41
40
  background-image: linear-gradient(
42
41
  90deg,
43
- rgba(255, 255, 255, 0.02) 0%,
44
- rgba(217, 217, 217, 0.06) 50%,
45
- rgba(29, 33, 41, 0) 100%
42
+ rgba(255, 255, 255, 2%) 0%,
43
+ rgba(217, 217, 217, 6%) 50%,
44
+ rgba(29, 33, 41, 0%) 100%
46
45
  );
47
- box-shadow: inset 1px -1px 0 0 rgba(255, 255, 255, 0.89);
48
- background: rgba(255, 255, 255, 0.5);
46
+ box-shadow: inset 1px -1px 0 0 rgba(255, 255, 255, 89%);
47
+ background: rgba(255, 255, 255, 50%);
49
48
  }
50
49
 
51
50
  .switchBtn {
@@ -53,7 +52,6 @@
53
52
  align-items: center;
54
53
  justify-content: center;
55
54
  gap: 8px;
56
-
57
55
  width: 120px;
58
56
  height: 38px;
59
57
  cursor: pointer;
@@ -68,42 +66,48 @@
68
66
  &.active {
69
67
  color: #1d2129;
70
68
  font-weight: 500;
71
-
72
- background: #ffffff;
69
+ background: #fff;
73
70
  border-color: #eeeef0;
74
- box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.08);
71
+ box-shadow: 0 0 4px 0 rgba(0, 0, 0, 8%);
75
72
  }
76
73
  }
77
74
  }
78
75
 
79
76
  .datasetSelectorModal {
80
- top: 0px;
81
- padding-bottom: 0px;
77
+ top: 0;
78
+ padding-bottom: 0;
82
79
 
83
80
  .listItemContent {
84
81
  cursor: pointer;
85
82
  border: none;
86
83
  line-height: 22px;
84
+
87
85
  &.disabled {
88
86
  color: #86909c;
89
87
  cursor: not-allowed;
90
88
  }
89
+
91
90
  &:hover {
92
91
  background: #1677ff1a;
93
92
  }
93
+
94
94
  &:not(.disabled):hover {
95
95
  color: #1677ff;
96
96
  }
97
+
97
98
  padding: 7px 16px 7px 7px;
99
+
98
100
  &--multiline {
99
101
  padding: 4px 16px 4px 7px;
100
102
  }
101
103
  }
104
+
102
105
  .selected {
103
106
  background: #1677ff1a;
104
107
  font-weight: 500;
105
108
  color: #1677ff;
106
109
  }
110
+
107
111
  .nameWrapper {
108
112
  flex: 1 1;
109
113
  min-width: 0;
@@ -122,20 +126,24 @@
122
126
  min-width: 0;
123
127
  }
124
128
  }
129
+
125
130
  .desc {
126
131
  font-size: 12px;
127
132
  color: #86909ccc;
128
133
  line-height: 22px;
129
134
  }
130
135
  }
136
+
131
137
  .list {
132
138
  background: #ffffffdb;
133
- padding: 10px 18px 18px 18px;
139
+ padding: 10px 18px 18px;
140
+
134
141
  :global {
135
142
  .ant-input-affix-wrapper {
136
143
  margin-bottom: 8px;
137
144
  border-radius: 6px;
138
145
  color: #5a607f65;
146
+
139
147
  .ant-input-prefix {
140
148
  margin-right: 8px;
141
149
  }
@@ -148,13 +156,16 @@
148
156
  .ant-alert-info .ant-alert-icon {
149
157
  color: #1677ff;
150
158
  }
159
+
151
160
  .ant-modal-footer {
152
161
  button {
153
162
  box-shadow: none;
163
+
154
164
  &.ant-btn-primary {
155
165
  color: white;
156
166
  background: #1677ff;
157
167
  }
168
+
158
169
  background: none;
159
170
  border: none;
160
171
  border-radius: 6px;
@@ -162,15 +173,18 @@
162
173
  width: 60px;
163
174
  height: 32px;
164
175
  color: #4e5969e6;
176
+
165
177
  &:disabled {
166
178
  background: #4e59693c;
167
179
  color: white;
168
180
  }
169
181
  }
170
182
  }
183
+
171
184
  .ant-modal-close-x {
172
185
  display: none;
173
186
  }
187
+
174
188
  .ant-modal-body {
175
189
  padding: 0;
176
190
  }
@@ -178,21 +192,26 @@
178
192
  .ant-modal-header {
179
193
  border-radius: 8px 8px 0 0;
180
194
  }
195
+
181
196
  .ant-modal-content {
182
197
  border-radius: 8px;
183
198
  }
199
+
184
200
  .ant-modal-content {
185
201
  background-color: rgb(251, 252, 253);
186
202
  }
203
+
187
204
  .ant-tabs-nav {
188
205
  padding-left: 18px;
189
206
  padding-right: 18px;
190
207
  margin-bottom: 0;
191
208
  }
209
+
192
210
  .ant-tabs-tab {
193
211
  font-size: 14px;
194
- padding: 14px 0 13px 0;
212
+ padding: 14px 0 13px;
195
213
  }
214
+
196
215
  .ant-alert {
197
216
  padding: 4px 15px;
198
217
  }
@@ -214,7 +233,6 @@
214
233
  white-space: nowrap;
215
234
  text-overflow: ellipsis;
216
235
  overflow: hidden;
217
-
218
236
  font-size: 14px;
219
237
  color: #5a607fe0;
220
238
  }
@@ -230,17 +248,17 @@
230
248
  .switchBtn {
231
249
  width: 100px;
232
250
  border-radius: 12px;
233
- background: #ffffff;
251
+ background: #fff;
234
252
  border: 1px solid #5a607fe0;
235
253
  opacity: 0.4;
236
- box-shadow: 0px 3px 12px 0px #0000000a;
254
+ box-shadow: 0 3px 12px 0 #0000000a;
237
255
  font-size: 14px;
238
256
  color: #86909c;
239
257
  line-height: 24px;
240
258
  height: 24px;
241
259
 
242
260
  &.active {
243
- background: #ffffff;
261
+ background: #fff;
244
262
  border: 1px solid #2d84ff;
245
263
  color: #1677ff;
246
264
  opacity: 1;
@@ -261,12 +279,11 @@
261
279
  border-radius: 4px;
262
280
  margin-left: 8px;
263
281
  flex-shrink: 0;
264
-
265
282
  color: #86909c;
266
- background: rgba(0, 0, 0, 0.04);
283
+ background: rgba(0, 0, 0, 4%);
267
284
 
268
285
  &.primary {
269
286
  color: #f68b02;
270
- background: rgba(246, 144, 61, 0.1);
287
+ background: rgba(246, 144, 61, 10%);
271
288
  }
272
289
  }
@@ -3,11 +3,10 @@
3
3
  align-items: center;
4
4
  height: 32px;
5
5
  position: relative;
6
-
7
6
  padding-left: 8px;
8
7
  padding-right: 12px;
9
- background: rgba(212, 215, 219, 0.4);
10
- border: 1px solid rgba(222, 226, 241, 0.7);
8
+ background: rgba(212, 215, 219, 40%);
9
+ border: 1px solid rgba(222, 226, 241, 70%);
11
10
  border-radius: 8px;
12
11
 
13
12
  img {
@@ -24,6 +23,7 @@
24
23
  text-overflow: ellipsis;
25
24
  white-space: nowrap;
26
25
  }
26
+
27
27
  .desc {
28
28
  margin-left: 16px;
29
29
  font-size: 10px;
@@ -10,23 +10,22 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import { DatasourceCard } from "./DatasourceCard";
12
12
  import { useEventListener } from 'ahooks';
13
- import { Tooltip, Upload } from 'antd';
14
13
  import classnames from 'classnames';
15
14
  import _ from 'lodash';
16
15
  import React, { useState } from 'react';
17
16
  import styles from "./index.module.less";
18
17
  import { SendButton } from "./SendButton";
19
- import { AIMode, FileIcons } from "../../constant";
20
18
  import { ChooseLib } from "./ChooseLib";
21
19
  import { useSiteData, useIntl } from 'dumi';
22
20
  import { ic } from "../../../../slots/hooks";
23
21
  import { useTypewriter } from "../../../../hooks/useTypewriter";
24
- import { DataUploader } from "./Uploader/DataUploader";
22
+ import { authStore, showLoginModal } from "../../../../model/auth";
23
+ import { useSnapshot } from "valtio";
25
24
  var PLACEHOLDER = {
26
25
  implement: 'ai.placeholder.implement',
27
26
  solve: 'ai.placeholder.solve'
28
27
  };
29
- function PromptTextarea(props) {
28
+ export var PromptTextarea = /*#__PURE__*/React.memo(function PromptTextareaInner(props) {
30
29
  var value = props.value,
31
30
  size = props.size,
32
31
  _onChange = props.onChange,
@@ -39,6 +38,7 @@ function PromptTextarea(props) {
39
38
  onLibChange = props.onLibChange,
40
39
  _props$showAction = props.showAction,
41
40
  showAction = _props$showAction === void 0 ? true : _props$showAction;
41
+ var authSnap = useSnapshot(authStore);
42
42
  var _useIntl = useIntl(),
43
43
  formatMessage = _useIntl.formatMessage;
44
44
 
@@ -93,6 +93,10 @@ function PromptTextarea(props) {
93
93
  var datasourceNode = renderDatasourceCard();
94
94
  var promptTextValid = Boolean(value);
95
95
  var send = function send() {
96
+ if (!authSnap.isAuthenticated) {
97
+ showLoginModal();
98
+ return;
99
+ }
96
100
  if (promptTextValid) {
97
101
  onConfirm === null || onConfirm === void 0 || onConfirm();
98
102
  }
@@ -137,23 +141,7 @@ function PromptTextarea(props) {
137
141
  value: lib,
138
142
  onChange: onLibChange,
139
143
  size: size
140
- }), mode === AIMode.implement && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DataUploader, {
141
- onDataAnalyzed: handleDataAnalyzed,
142
- isCompact: isCompact,
143
- tooltipText: formatMessage({
144
- id: 'ai.upload.tooltip'
145
- })
146
- }), /*#__PURE__*/React.createElement(Tooltip, {
147
- title: isCompact ? formatMessage({
148
- id: 'ai.upload.image'
149
- }) : undefined
150
- }, /*#__PURE__*/React.createElement(Upload, null, /*#__PURE__*/React.createElement("button", {
151
- type: "button"
152
- }, /*#__PURE__*/React.createElement("img", {
153
- src: FileIcons.IMAGE
154
- }), " ", !isCompact && formatMessage({
155
- id: 'ai.upload.image'
156
- }))))))), /*#__PURE__*/React.createElement("div", {
144
+ }))), /*#__PURE__*/React.createElement("div", {
157
145
  className: styles.actions
158
146
  }, loading ? /*#__PURE__*/React.createElement("img", {
159
147
  className: styles.actionBtn,
@@ -166,5 +154,4 @@ function PromptTextarea(props) {
166
154
  id: 'ai.msgbox.send.tip'
167
155
  }) : undefined
168
156
  }))));
169
- }
170
- export { PromptTextarea };
157
+ });
@@ -7,10 +7,10 @@
7
7
  padding: 16px;
8
8
  gap: 16px;
9
9
  transition: all 0.2s;
10
- border: 1px solid rgba(134, 144, 156, 0.2);
10
+ border: 1px solid rgba(134, 144, 156, 20%);
11
11
  border-radius: 16px;
12
- background: #ffffff99;
13
- box-shadow: 8px 8px 20px 0px #0000000a, inset 1px -1px 0 0px #ffffffe3;
12
+ background: #fff9;
13
+ box-shadow: 8px 8px 20px 0 #0000000a, inset 1px -1px 0 0 #ffffffe3;
14
14
  z-index: 10;
15
15
  display: flex;
16
16
  flex-direction: column;
@@ -52,8 +52,8 @@
52
52
 
53
53
  &.btn-error {
54
54
  color: #ff4d4f;
55
- box-shadow: inset 1px -1px 0 0 rgba(255, 255, 255, 0.89),
56
- 0 0 12px 0 rgba(250, 16, 16, 0.23);
55
+ box-shadow: inset 1px -1px 0 0 rgba(255, 255, 255, 89%),
56
+ 0 0 12px 0 rgba(250, 16, 16, 23%);
57
57
  }
58
58
 
59
59
  .btn-icon,
@@ -75,9 +75,9 @@
75
75
  }
76
76
 
77
77
  &.active {
78
- background: #ffffff99;
78
+ background: #fff9;
79
79
  border: 1px solid #1677ff;
80
- box-shadow: 0px 8px 20px 0px #1677ff29, inset 1px -1px 0 0px #ffffffe3;
80
+ box-shadow: 0 8px 20px 0 #1677ff29, inset 1px -1px 0 0 #ffffffe3;
81
81
 
82
82
  .promptTextarea::placeholder {
83
83
  color: transparent;
@@ -123,6 +123,6 @@
123
123
  background: transparent;
124
124
 
125
125
  &::placeholder {
126
- color: rgba(122, 132, 153, 0.85);
126
+ color: rgba(122, 132, 153, 85%);
127
127
  }
128
128
  }
@@ -8,7 +8,7 @@
8
8
  overflow: hidden;
9
9
  position: relative;
10
10
  aspect-ratio: 292 / 208;
11
- background: rgba(22, 119, 255, 0.06);
11
+ background: rgba(22, 119, 255, 6%);
12
12
 
13
13
  .typeTag {
14
14
  display: flex;
@@ -27,15 +27,15 @@
27
27
  display: flex;
28
28
  gap: 2px;
29
29
  align-items: center;
30
-
31
30
  font-size: 12px;
32
- color: rgba(78, 89, 105, 0.6);
31
+ color: rgba(78, 89, 105, 60%);
33
32
  }
34
33
  }
35
34
 
36
35
  .listContainer {
37
36
  width: 100%;
38
37
  }
38
+
39
39
  .list {
40
40
  display: grid;
41
41
  grid-template-columns: repeat(4, 1fr);
@@ -0,0 +1,199 @@
1
+ import { NC_SCENE } from "../utils";
2
+ import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react'; // 图形验证码资源文件
3
+
4
+ import { Form, Input } from 'antd';
5
+ import cls from 'classnames';
6
+ import { useIntl } from 'dumi';
7
+ import "./index.less";
8
+
9
+ // 图形验证码资源文件
10
+ var NC_CSS_SOURCE = 'https://g.alicdn.com/sd/ncpc/nc.css?t=1514534550478';
11
+ var NC_SCRIPT_SOURCE = 'https://g.alicdn.com/sd/ncpc/nc.js?t=1514534550478';
12
+ var NC_NAME = 'NoCaptcha';
13
+ var Captcha = /*#__PURE__*/forwardRef(function (_ref, ref) {
14
+ var _ref$ncName = _ref.ncName,
15
+ ncName = _ref$ncName === void 0 ? NC_NAME : _ref$ncName,
16
+ _ref$scene = _ref.scene,
17
+ scene = _ref$scene === void 0 ? NC_SCENE.login : _ref$scene,
18
+ form = _ref.form,
19
+ en = _ref.en,
20
+ _ref$onCallback = _ref.onCallback,
21
+ onCallback = _ref$onCallback === void 0 ? function () {} : _ref$onCallback,
22
+ className = _ref.className;
23
+ var _useIntl = useIntl(),
24
+ formatMessage = _useIntl.formatMessage;
25
+ var ncInstance = useRef(null);
26
+ function reset() {
27
+ var _ncInstance$current;
28
+ form.setFieldsValue({
29
+ csessionid: '',
30
+ sig: '',
31
+ token: '',
32
+ scene: '',
33
+ captcha: null
34
+ });
35
+ (_ncInstance$current = ncInstance.current) === null || _ncInstance$current === void 0 || _ncInstance$current.reset(1);
36
+ }
37
+ function getValues() {
38
+ return form.getFieldsValue(['csessionid', 'sig', 'token', 'scene', 'captcha']);
39
+ }
40
+ useImperativeHandle(ref, function () {
41
+ return {
42
+ resetCaptcha: function resetCaptcha() {
43
+ reset();
44
+ },
45
+ getCaptchaValues: function getCaptchaValues() {
46
+ return getValues();
47
+ }
48
+ };
49
+ });
50
+ function loadCaptcha() {
51
+ var _document$getElementB, _ncInstance$current2;
52
+ if (!ncInstance.current) {
53
+ /* eslint no-undef:0 */
54
+ /* eslint new-cap:0 */
55
+ ncInstance.current = new window.noCaptcha();
56
+ window[ncName] = ncInstance.current;
57
+ }
58
+ var nc_appkey = 'FFFF000000000179A3AD';
59
+ var nc_token = [nc_appkey, new Date().getTime(), Math.random()].join(':');
60
+ var nc_scene = scene;
61
+ var nc_customWidth = ((_document$getElementB = document.getElementById("captcha_render_id_".concat(ncName))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.offsetWidth) || 300;
62
+ var nc_option = {
63
+ renderTo: "#captcha_render_id_".concat(ncName),
64
+ appkey: nc_appkey,
65
+ scene: nc_scene,
66
+ token: nc_token,
67
+ language: en ? 'en' : 'cn',
68
+ customWidth: nc_customWidth,
69
+ callback: function callback(data) {
70
+ // 校验成功回调
71
+ var setFieldsValue = form.setFieldsValue;
72
+ setFieldsValue({
73
+ csessionid: data.csessionid,
74
+ sig: data.sig,
75
+ token: nc_token,
76
+ scene: nc_scene,
77
+ captcha: 'true'
78
+ });
79
+ onCallback === null || onCallback === void 0 || onCallback();
80
+ }
81
+ };
82
+ (_ncInstance$current2 = ncInstance.current) === null || _ncInstance$current2 === void 0 || _ncInstance$current2.init(nc_option);
83
+ var lang = {
84
+ _startTEXT: en ? formatMessage({
85
+ id: 'login.captcha.drag.en'
86
+ }) : formatMessage({
87
+ id: 'login.captcha.drag'
88
+ }),
89
+ _yesTEXT: en ? formatMessage({
90
+ id: 'login.captcha.success.en'
91
+ }) : formatMessage({
92
+ id: 'login.captcha.success'
93
+ }),
94
+ _Loading: en ? formatMessage({
95
+ id: 'login.captcha.loading.en'
96
+ }) : formatMessage({
97
+ id: 'login.captcha.loading'
98
+ }),
99
+ _error300: en ? formatMessage({
100
+ id: 'login.captcha.error.wrong.en'
101
+ }) + ' <a href="javascript:__nc.reset()">' + formatMessage({
102
+ id: 'login.captcha.error.refresh.en'
103
+ }) + '</a>' : formatMessage({
104
+ id: 'login.captcha.error.wrong'
105
+ }) + ' <a href="javascript:__nc.reset()">' + formatMessage({
106
+ id: 'login.captcha.error.refresh'
107
+ }) + '</a>',
108
+ _errorNetwork: en ? formatMessage({
109
+ id: 'login.captcha.error.network.en'
110
+ }) + ' <a href="javascript:__nc.reset()">' + formatMessage({
111
+ id: 'login.captcha.error.refresh.en'
112
+ }) + '</a>' : formatMessage({
113
+ id: 'login.captcha.error.network'
114
+ }) + ' <a href="javascript:__nc.reset()">' + formatMessage({
115
+ id: 'login.captcha.error.refresh'
116
+ }) + '</a>'
117
+ };
118
+ if (en) {
119
+ var _ncInstance$current3;
120
+ (_ncInstance$current3 = ncInstance.current) === null || _ncInstance$current3 === void 0 || _ncInstance$current3.upLang('en', lang);
121
+ } else {
122
+ var _ncInstance$current4;
123
+ (_ncInstance$current4 = ncInstance.current) === null || _ncInstance$current4 === void 0 || _ncInstance$current4.upLang('cn', lang);
124
+ }
125
+ }
126
+ useEffect(function () {
127
+ var script = document.createElement('script');
128
+ script.src = NC_SCRIPT_SOURCE;
129
+ var link = document.createElement('link');
130
+ script.async = true;
131
+ link.href = NC_CSS_SOURCE;
132
+ link.rel = 'stylesheet';
133
+ link.type = 'text/css';
134
+
135
+ // 如果资源没有加载过,则添加到head中
136
+ document.head.appendChild(link);
137
+ if (!window.noCaptcha) {
138
+ document.head.appendChild(script);
139
+ script.onload = function () {
140
+ loadCaptcha();
141
+ };
142
+ } else {
143
+ loadCaptcha();
144
+ }
145
+ return function () {
146
+ try {
147
+ script.remove();
148
+ link.remove();
149
+ if (script.parentNode === document.body) {
150
+ document.body.removeChild(script);
151
+ }
152
+ if (link.parentNode === document.body) {
153
+ document.body.removeChild(link);
154
+ }
155
+ } catch (e) {
156
+ // ignore error
157
+ }
158
+ };
159
+ }, []);
160
+ return /*#__PURE__*/React.createElement("div", {
161
+ className: cls('captcha', className)
162
+ }, /*#__PURE__*/React.createElement("div", {
163
+ id: "captcha_render_id_".concat(ncName)
164
+ }), /*#__PURE__*/React.createElement(Form.Item, {
165
+ name: "csessionid",
166
+ noStyle: true
167
+ }, /*#__PURE__*/React.createElement(Input, {
168
+ type: "hidden"
169
+ })), /*#__PURE__*/React.createElement(Form.Item, {
170
+ name: "sig",
171
+ noStyle: true
172
+ }, /*#__PURE__*/React.createElement(Input, {
173
+ type: "hidden"
174
+ })), /*#__PURE__*/React.createElement(Form.Item, {
175
+ name: "token",
176
+ noStyle: true
177
+ }, /*#__PURE__*/React.createElement(Input, {
178
+ type: "hidden"
179
+ })), /*#__PURE__*/React.createElement(Form.Item, {
180
+ name: "scene",
181
+ noStyle: true
182
+ }, /*#__PURE__*/React.createElement(Input, {
183
+ type: "hidden"
184
+ })), /*#__PURE__*/React.createElement(Form.Item, {
185
+ name: "captcha",
186
+ rules: [{
187
+ required: true,
188
+ message: en ? formatMessage({
189
+ id: 'login.captcha.required.en'
190
+ }) : formatMessage({
191
+ id: 'login.captcha.required'
192
+ })
193
+ }],
194
+ className: "captcha-tip"
195
+ }, /*#__PURE__*/React.createElement(Input, {
196
+ type: "hidden"
197
+ })));
198
+ });
199
+ export default Captcha;