@tuya-sat/sdf-main-sdk 0.0.1-beta.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/.vscode/settings.json +5 -0
- package/README.md +1 -0
- package/antd.less.overwrite.js +56 -0
- package/color.js +140 -0
- package/dark-variable.less +1449 -0
- package/package.json +74 -0
- package/scripts/gen-localize-file.mjs +56 -0
- package/src/App.less +156 -0
- package/src/App.tsx +87 -0
- package/src/api/index.ts +52 -0
- package/src/api/req.ts +23 -0
- package/src/api/res.ts +29 -0
- package/src/api/urls.ts +30 -0
- package/src/api/utils.ts +41 -0
- package/src/assets/imgs/404.svg +194 -0
- package/src/assets/imgs/reLogin.png +0 -0
- package/src/components/404/index.tsx +44 -0
- package/src/components/500/index.tsx +49 -0
- package/src/components/BCustomNav/index.module.less +17 -0
- package/src/components/BCustomNav/index.tsx +108 -0
- package/src/components/BForgot/index.module.less +5 -0
- package/src/components/BForgot/index.tsx +96 -0
- package/src/components/BHeaderUser/account.png +0 -0
- package/src/components/BHeaderUser/app-scan-en.png +0 -0
- package/src/components/BHeaderUser/app-scan-zh.png +0 -0
- package/src/components/BHeaderUser/app-scan.png +0 -0
- package/src/components/BHeaderUser/components/BSwitchLang/index.module.less +6 -0
- package/src/components/BHeaderUser/components/BSwitchLang/index.tsx +56 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/Drawer/Content.tsx +199 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/Drawer/index.module.less +11 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/Drawer/index.tsx +27 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/hooks.ts +104 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/index.module.less +70 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/index.tsx +184 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/table/index.tsx +184 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/table/read.tsx +67 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/tools/index.tsx +116 -0
- package/src/components/BHeaderUser/components/Badge/index.module.less +99 -0
- package/src/components/BHeaderUser/components/Badge/index.tsx +179 -0
- package/src/components/BHeaderUser/index.module.less +105 -0
- package/src/components/BHeaderUser/index.tsx +261 -0
- package/src/components/BHeaderUser/logout.tsx +26 -0
- package/src/components/BLayout/components/Header/index.module.less +27 -0
- package/src/components/BLayout/components/Header/index.tsx +36 -0
- package/src/components/BLayout/components/Layout/empty.tsx +35 -0
- package/src/components/BLayout/components/Layout/emptyPage.png +0 -0
- package/src/components/BLayout/components/Layout/index.tsx +72 -0
- package/src/components/BLayout/components/Logo.tsx +6 -0
- package/src/components/BLayout/components/Menu/collapse.tsx +41 -0
- package/src/components/BLayout/components/Menu/image/close.tsx +26 -0
- package/src/components/BLayout/components/Menu/image/closedefault.tsx +26 -0
- package/src/components/BLayout/components/Menu/image/open.tsx +38 -0
- package/src/components/BLayout/components/Menu/image/opendefault.tsx +38 -0
- package/src/components/BLayout/components/Menu/index.module.less +125 -0
- package/src/components/BLayout/components/Menu/index.tsx +244 -0
- package/src/components/BLayout/components/MenuIcon.module.less +5 -0
- package/src/components/BLayout/components/MenuIcon.tsx +46 -0
- package/src/components/BLayout/components/MultiSider/index.module.less +104 -0
- package/src/components/BLayout/components/MultiSider/index.tsx +172 -0
- package/src/components/BLayout/components/Sider/index.less +64 -0
- package/src/components/BLayout/components/Sider/index.module.less +17 -0
- package/src/components/BLayout/components/Sider/index.tsx +34 -0
- package/src/components/BLayout/index.tsx +78 -0
- package/src/components/BLayoutLogin/index.module.less +65 -0
- package/src/components/BLayoutLogin/index.tsx +68 -0
- package/src/components/BLayoutLogin/login.jpg +0 -0
- package/src/components/BLogin/component/Clause/index.module.less +25 -0
- package/src/components/BLogin/component/Clause/index.tsx +58 -0
- package/src/components/BLogin/component/ForgotBtn/index.module.less +9 -0
- package/src/components/BLogin/component/ForgotBtn/index.tsx +18 -0
- package/src/components/BLogin/component/Password/index.tsx +39 -0
- package/src/components/BLogin/component/SubmitBtn/index.tsx +30 -0
- package/src/components/BLogin/component/TenanSpace/index.tsx +28 -0
- package/src/components/BLogin/component/Title/index.module.less +6 -0
- package/src/components/BLogin/component/Title/index.tsx +12 -0
- package/src/components/BLogin/component/UserName/index.tsx +48 -0
- package/src/components/BLogin/component/VerifyCode/index.module.less +11 -0
- package/src/components/BLogin/component/VerifyCode/index.tsx +165 -0
- package/src/components/BLogin/index.module.less +31 -0
- package/src/components/BLogin/index.tsx +210 -0
- package/src/components/BRegister/components/TenantName/index.tsx +26 -0
- package/src/components/BRegister/index.module.less +5 -0
- package/src/components/BRegister/index.tsx +71 -0
- package/src/components/Back/index.tsx +25 -0
- package/src/components/IconFont/font.js +66 -0
- package/src/components/IconFont/index.tsx +18 -0
- package/src/components/MicroComponent/Header/index.module.less +7 -0
- package/src/components/MicroComponent/Header/index.tsx +220 -0
- package/src/components/PForgot/index.tsx +10 -0
- package/src/components/PLogin/index.tsx +12 -0
- package/src/components/PRegister/index.tsx +10 -0
- package/src/components/PSetting/index.module.less +53 -0
- package/src/components/PSetting/index.tsx +420 -0
- package/src/constant/chargeStatus.ts +6 -0
- package/src/constant/imgs.ts +6 -0
- package/src/constant/index.ts +293 -0
- package/src/dark-variable.less +1449 -0
- package/src/global.d.ts +54 -0
- package/src/hooks/index.ts +133 -0
- package/src/index.css +1493 -0
- package/src/index.tsx +105 -0
- package/src/lang/en.json +266 -0
- package/src/lang/index.ts +44 -0
- package/src/lang/utils.ts +285 -0
- package/src/lang/zh.json +270 -0
- package/src/micro-script/theme/index.ts +29 -0
- package/src/micro-script/theme/theme-css/static.js +73 -0
- package/src/micro-script/theme/theme-css/subscriber.ts +201 -0
- package/src/micro-script/theme/util/index.ts +58 -0
- package/src/mqtt/index.ts +121 -0
- package/src/pages/403.tsx +18 -0
- package/src/pages/404.tsx +17 -0
- package/src/pages/expiration.tsx +23 -0
- package/src/pages/forgot.tsx +9 -0
- package/src/pages/home/index.tsx +172 -0
- package/src/pages/home/setting/index.tsx +7 -0
- package/src/pages/index.ts +50 -0
- package/src/pages/login.tsx +46 -0
- package/src/pages/register.tsx +9 -0
- package/src/pages/relogin/index.module.less +0 -0
- package/src/pages/relogin/index.tsx +54 -0
- package/src/plugins/index.ts +11 -0
- package/src/public-path.js +8 -0
- package/src/qiankun/globalState.ts +6 -0
- package/src/qiankun/index.ts +174 -0
- package/src/qiankun/utils/index.ts +69 -0
- package/src/qiankun/xhook/index.ts +193 -0
- package/src/reportWebVitals.ts +15 -0
- package/src/sentry/index.ts +33 -0
- package/src/sky/index.ts +57 -0
- package/src/theme/custom-dark.less +64 -0
- package/src/theme/custom-light.less +48 -0
- package/src/theme/index.less +327 -0
- package/src/theme/variable.less +13 -0
- package/src/utils/checkPass.ts +21 -0
- package/src/utils/common.ts +195 -0
- package/src/utils/eventBus.ts +112 -0
- package/src/utils/gt.js +293 -0
- package/src/utils/index.ts +89 -0
- package/src/utils/theme/base.ts +110 -0
- package/src/utils/theme/changeCssVariable.ts +157 -0
- package/src/utils/theme/changeMenuCssVariable.ts +176 -0
- package/src/utils/theme/index.ts +85 -0
- package/src/utils/theme/store.ts +37 -0
- package/tsconfig.json +28 -0
- package/typings.d.ts +10 -0
- package/webpack.config.js +103 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
@import './variable.less';
|
|
2
|
+
|
|
3
|
+
.main-layout {
|
|
4
|
+
background: @pageBgc !important;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// .main-app-layout-header {
|
|
8
|
+
// // background-color: @navBgc !important;
|
|
9
|
+
// border-bottom: 1px solid @main-app-layout-header-bottom;
|
|
10
|
+
// }
|
|
11
|
+
|
|
12
|
+
.main-text-color {
|
|
13
|
+
color: @text-color !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.main-list-item-meta-title {
|
|
17
|
+
color: @text-color-secondary;
|
|
18
|
+
}
|
|
19
|
+
.main-list-item-meta-description {
|
|
20
|
+
color: @text-color;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// .main-menu {
|
|
24
|
+
// background: @navBgc !important;
|
|
25
|
+
// color: @main-menu-item-selected-color;
|
|
26
|
+
// }
|
|
27
|
+
// .main-app-menu-containter .main-menu {
|
|
28
|
+
// border-top: 1px solid @item-hover-bg;
|
|
29
|
+
// }
|
|
30
|
+
// .main-menu-item a {
|
|
31
|
+
// color: @main-menu-item-selected-color;
|
|
32
|
+
// }
|
|
33
|
+
// .main-menu-item-selected,
|
|
34
|
+
// .main-menu-item-selected a {
|
|
35
|
+
// color: @main-menu-item-selected-color-hover !important;
|
|
36
|
+
// }
|
|
37
|
+
|
|
38
|
+
// .main-menu-item-selected a:hover {
|
|
39
|
+
// color: @main-menu-item-selected-color-hover !important;
|
|
40
|
+
// }
|
|
41
|
+
// 菜单hover和选中时
|
|
42
|
+
// .main-menu-item:hover,
|
|
43
|
+
// .main-menu-item a:hover {
|
|
44
|
+
// color: @main-menu-item-selected-color-hover;
|
|
45
|
+
// background-color: @menu-item-active-bg;
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
.main-app-collapsed {
|
|
49
|
+
background: @main-menu-background-color !important;
|
|
50
|
+
border-top: 1px solid @item-hover-bg;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// .main-app-menu-group-mode > .main-menu {
|
|
54
|
+
// border-top: 1px solid @item-hover-bg;
|
|
55
|
+
// }
|
|
56
|
+
|
|
57
|
+
// .main-app-menu-group-title {
|
|
58
|
+
// color: @text-color;
|
|
59
|
+
// background: @main-menu-collapsed-title-background !important;
|
|
60
|
+
// // border-bottom: 1px solid @item-hover-bg;
|
|
61
|
+
// }
|
|
62
|
+
.main-app-menu-group-menu {
|
|
63
|
+
&::-webkit-scrollbar-thumb {
|
|
64
|
+
background: @main-app-scrollbar-thumb-bg;
|
|
65
|
+
border-radius: 3px;
|
|
66
|
+
}
|
|
67
|
+
&::-webkit-scrollbar {
|
|
68
|
+
width: 6px;
|
|
69
|
+
}
|
|
70
|
+
&::-webkit-scrollbar-track {
|
|
71
|
+
width: 6px;
|
|
72
|
+
background: @main-app-scrollbar-track-bg;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.main-app-menu-collapsed-selected {
|
|
76
|
+
background-color: @main-app-menu-collapsed;
|
|
77
|
+
color: @main-menu-item-selected-color-hover !important;
|
|
78
|
+
margin: 4px 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.main-app-qrTitle {
|
|
82
|
+
color: @text-color;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.main-app-account {
|
|
86
|
+
color: @text-color;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 消息中心
|
|
90
|
+
.main-app-message-title {
|
|
91
|
+
color: @text-color;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 设置
|
|
95
|
+
.main-app-setting {
|
|
96
|
+
background-color: @navBgc;
|
|
97
|
+
color: @text-color;
|
|
98
|
+
}
|
|
99
|
+
.main-app-message,
|
|
100
|
+
.main-app-setting-edit,
|
|
101
|
+
.main-app-message-footer,
|
|
102
|
+
.main-app-link {
|
|
103
|
+
color: @primary-color;
|
|
104
|
+
&:hover {
|
|
105
|
+
color: @link-hover-color;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
.main-app-message > .main-list-footer {
|
|
109
|
+
border-top: 1px solid @item-hover-bg;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// .main-group-item {
|
|
113
|
+
// color: @text-color;
|
|
114
|
+
// }
|
|
115
|
+
|
|
116
|
+
// .main-group-active,
|
|
117
|
+
// .main-group-item:hover {
|
|
118
|
+
// // color: @primary-color !important;
|
|
119
|
+
// color: @main-menu-item-selected-color-hover;
|
|
120
|
+
// background-color: @menu-item-active-bg;
|
|
121
|
+
// }
|
|
122
|
+
|
|
123
|
+
.main-group {
|
|
124
|
+
background: @component-background;
|
|
125
|
+
|
|
126
|
+
&::-webkit-scrollbar-thumb {
|
|
127
|
+
background: @main-app-scrollbar-thumb-bg;
|
|
128
|
+
border-radius: 3px;
|
|
129
|
+
}
|
|
130
|
+
&::-webkit-scrollbar-track {
|
|
131
|
+
background: @main-app-scrollbar-track-bg;
|
|
132
|
+
border-radius: 3px;
|
|
133
|
+
// box-shadow: inset 0 0 5px @main-app-scrollbar-track-boxshadow;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// .main-group-cover {
|
|
138
|
+
// background: @mani-menu-collapsed-background;
|
|
139
|
+
// border-right: 1px solid @item-hover-bg;
|
|
140
|
+
// }
|
|
141
|
+
|
|
142
|
+
.main-svg-container {
|
|
143
|
+
svg {
|
|
144
|
+
& path {
|
|
145
|
+
fill: @svg-containter-content-color;
|
|
146
|
+
}
|
|
147
|
+
& > path:nth-child(1) {
|
|
148
|
+
fill: @svg-containter-bg-color;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
&:hover {
|
|
152
|
+
svg {
|
|
153
|
+
& path {
|
|
154
|
+
fill: #fff;
|
|
155
|
+
}
|
|
156
|
+
& > path:nth-child(1) {
|
|
157
|
+
fill: @svg-containter-hover-color;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.main-collapsed-line {
|
|
164
|
+
background-color: @svg-containter-line-color;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.main-svg-container:hover + .main-collapsed-line {
|
|
168
|
+
background-color: @svg-containter-line-hover-color !important;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.main-fake-menu {
|
|
172
|
+
background-color: @component-background;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.main-app-notice {
|
|
176
|
+
background-color: @navBgc;
|
|
177
|
+
color: @text-color;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.main-app-notice-table {
|
|
181
|
+
background-color: @navBgc;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.main-app-setting-top {
|
|
185
|
+
border-bottom-width: 1px;
|
|
186
|
+
border-bottom-style: solid;
|
|
187
|
+
border-bottom-color: @main-app-setting-top;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.main-app-breadcrumb {
|
|
191
|
+
background-color: @layout-sider-background;
|
|
192
|
+
border-left: 1px solid transparent;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.main-app-setting-bottom {
|
|
196
|
+
color: @text-color;
|
|
197
|
+
& > .main-app-setting-bottom-img path {
|
|
198
|
+
// filter: drop-shadow(100px 0 0 @text-color);
|
|
199
|
+
fill: @text-color;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
.main-app-setting-bottom:hover {
|
|
203
|
+
color: @primary-color;
|
|
204
|
+
& > .main-app-setting-bottom-img path {
|
|
205
|
+
// filter: drop-shadow(100px 0 0 @primary-color);
|
|
206
|
+
fill: @primary-color;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
.main-app-tag-priview {
|
|
210
|
+
color: @cyan-7;
|
|
211
|
+
background-color: @cyan-1;
|
|
212
|
+
border-color: @cyan-3;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.main-app-tag-latest {
|
|
216
|
+
color: @blue-7;
|
|
217
|
+
background-color: @blue-1;
|
|
218
|
+
border: 1px solid @blue-3;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.main-app-tag-trial {
|
|
222
|
+
color: @gold-7;
|
|
223
|
+
background-color: @gold-1;
|
|
224
|
+
border: 1px solid @gold-3;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.main-popover-arrow-content::before {
|
|
228
|
+
background: transparent !important;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// .main-menu-submenu-selected,
|
|
232
|
+
// .main-menu-light .main-menu-submenu-title:hover,
|
|
233
|
+
// .main-menu-submenu:hover > .main-menu-submenu-title > .main-menu-submenu-arrow {
|
|
234
|
+
// color: @main-menu-item-selected-color-hover;
|
|
235
|
+
// }
|
|
236
|
+
.main-modal-content,
|
|
237
|
+
.main-modal-header {
|
|
238
|
+
background-color: @navBgc;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.main-select-item-option-selected:not(.main-select-item-option-disabled) {
|
|
242
|
+
background-color: rgba(255, 255, 255, 0.08);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.main-menu-icon img {
|
|
246
|
+
background-color: @main-menu-item-icon-bg;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.main-app-custom-nav,
|
|
250
|
+
.main-app-custom-nav-navItem {
|
|
251
|
+
color: @text-color;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.main-app-custom-nav-navItem:hover {
|
|
255
|
+
color: @text-color;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.main-app-custom-nav {
|
|
259
|
+
&::-webkit-scrollbar-thumb {
|
|
260
|
+
background: @main-app-scrollbar-thumb-bg;
|
|
261
|
+
border-radius: 3px;
|
|
262
|
+
}
|
|
263
|
+
&::-webkit-scrollbar {
|
|
264
|
+
height: 6px;
|
|
265
|
+
}
|
|
266
|
+
&::-webkit-scrollbar-track {
|
|
267
|
+
height: 6px;
|
|
268
|
+
background: @main-app-scrollbar-track-bg;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.main-dropdown-menu {
|
|
273
|
+
background-color: @navBgc;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.main-dropdown-menu-item:hover,
|
|
277
|
+
.main-dropdown-menu-submenu-title:hover {
|
|
278
|
+
background-color: @main-app-drop-down-hover-color;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// 消息中心
|
|
282
|
+
.main-app-message-drawer-tab-check-title {
|
|
283
|
+
color: @text-color;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.main-app-message-drawer-tab-check-describe {
|
|
287
|
+
color: @text-color-describe;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.main-app-message-table-del {
|
|
291
|
+
color: @red-6;
|
|
292
|
+
}
|
|
293
|
+
// .main-dropdown-menu-item:hover,
|
|
294
|
+
// .main-dropdown-menu-submenu-title:hover {
|
|
295
|
+
// background-color: @main-app-drop-down-hover-color;
|
|
296
|
+
// }
|
|
297
|
+
|
|
298
|
+
.main-app-message > .main-list-footer {
|
|
299
|
+
border-top: 1px solid @borderBgc;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.main-table-tbody > tr.main-table-row-selected > td {
|
|
303
|
+
background: @table-row-hover-bg !important;
|
|
304
|
+
}
|
|
305
|
+
.main-table-tbody > tr.main-table-row-selected:hover > td {
|
|
306
|
+
background: @table-row-hover-bg !important;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.main-menu-light .main-menu-item:hover,
|
|
310
|
+
.main-menu-light .main-menu-item-active,
|
|
311
|
+
.main-menu-light .main-menu:not(.main-menu-inline) .main-menu-submenu-open,
|
|
312
|
+
.main-menu-light .main-menu-submenu-active,
|
|
313
|
+
.main-menu-light .main-menu-submenu-title:hover {
|
|
314
|
+
color: @main-menu-item-selected-color-hover;
|
|
315
|
+
}
|
|
316
|
+
.main-bg-color {
|
|
317
|
+
background: @pageBgc !important;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.main-notice-tools-bg {
|
|
321
|
+
background: var(--ant-primary-1);
|
|
322
|
+
border: 1px solid var(--ant-primary-2);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.main-verify-code .main-statistic-content {
|
|
326
|
+
color: @main-static-color;
|
|
327
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@macro-variable-location: if(
|
|
2
|
+
(isdefined(@use-dark-compiler)),
|
|
3
|
+
'../../dark-variable',
|
|
4
|
+
'antd/es/style/variable'
|
|
5
|
+
);
|
|
6
|
+
@macro-entry-name: if(
|
|
7
|
+
(isdefined(@use-dark-compiler)),
|
|
8
|
+
'custom-dark',
|
|
9
|
+
'custom-light'
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
@import '@{macro-variable-location}.less';
|
|
13
|
+
@import './@{macro-entry-name}.less';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function checkPassWord(value: string): boolean {
|
|
2
|
+
if (value.length < 8 || value.length > 20) return false;
|
|
3
|
+
|
|
4
|
+
let isPass = 0;
|
|
5
|
+
// 判断是否含有大写
|
|
6
|
+
const hasUpCase = /[A-Z]/g;
|
|
7
|
+
if (hasUpCase.test(value)) isPass++;
|
|
8
|
+
// 判断是否含有小写
|
|
9
|
+
const hasLowCase = /[a-z]/g;
|
|
10
|
+
if (hasLowCase.test(value)) isPass++;
|
|
11
|
+
// 判断是否含有数字
|
|
12
|
+
const hasNumber = /[0-9]/g;
|
|
13
|
+
if (hasNumber.test(value)) isPass++;
|
|
14
|
+
// 判断是否含有英文符号
|
|
15
|
+
const hasCharacter =
|
|
16
|
+
/[\u0020-\u002F]|[\u003A-\u0040]|[\u005B-\u0060]|[\u007B-\u007E]/g;
|
|
17
|
+
|
|
18
|
+
if (hasCharacter.test(value)) isPass++;
|
|
19
|
+
if (isPass >= 3) return true;
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import Cookies from 'js-cookie';
|
|
2
|
+
import { api, URLS } from '@/api';
|
|
3
|
+
import { SafePath } from '@/constant';
|
|
4
|
+
|
|
5
|
+
export const findEntry = (menus, pathname) => {
|
|
6
|
+
let entry = null;
|
|
7
|
+
for (const menu of menus) {
|
|
8
|
+
const { path, sub_entry_list } = menu;
|
|
9
|
+
if (
|
|
10
|
+
pathname === path ||
|
|
11
|
+
pathname + '/' === path ||
|
|
12
|
+
pathname === path + '/'
|
|
13
|
+
) {
|
|
14
|
+
entry = menu;
|
|
15
|
+
} else if (sub_entry_list && sub_entry_list.length) {
|
|
16
|
+
entry = findEntry(menu.sub_entry_list, pathname);
|
|
17
|
+
}
|
|
18
|
+
if (entry) {
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return entry;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const getDeepestPath = (menu) => {
|
|
26
|
+
if (menu.sub_entry_list?.length) {
|
|
27
|
+
return getDeepestPath(menu.sub_entry_list[0]);
|
|
28
|
+
} else {
|
|
29
|
+
return menu.path;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const auth = (history) => {
|
|
33
|
+
const {
|
|
34
|
+
location: { search, pathname },
|
|
35
|
+
} = history;
|
|
36
|
+
if (SafePath.includes(pathname)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
cleanLocal();
|
|
40
|
+
window.location.href = `/login${search}`;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const getCurrentUser = () => {
|
|
44
|
+
const { user } = window._SDF;
|
|
45
|
+
return user ? { ...user } : user;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const safeLogout = (history) => {
|
|
49
|
+
cleanLocal();
|
|
50
|
+
window.location.href = `/logout`;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const cleanLocal = () => {
|
|
54
|
+
const title = window?._SDF?.saas?.title;
|
|
55
|
+
title && (document.title = title);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const getSearchMap = (search) => {
|
|
59
|
+
return new URLSearchParams(search.substring(1));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const afterLoginHook = ({
|
|
63
|
+
search,
|
|
64
|
+
history,
|
|
65
|
+
}: {
|
|
66
|
+
search: string;
|
|
67
|
+
history: any;
|
|
68
|
+
}) => {
|
|
69
|
+
if (process.env.NODE_ENV === 'development') {
|
|
70
|
+
history.push('/');
|
|
71
|
+
} else {
|
|
72
|
+
const lastPath = getSearchMap(search).get('from') || '/';
|
|
73
|
+
if (lastPath.includes('relogin')) {
|
|
74
|
+
window.location.replace('/');
|
|
75
|
+
} else {
|
|
76
|
+
window.location.replace(decodeURIComponent(lastPath));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export let geetestPromise;
|
|
82
|
+
let _cb;
|
|
83
|
+
export const initGeetest = () => {
|
|
84
|
+
geetestPromise = new Promise((resolve, reject) => {
|
|
85
|
+
api
|
|
86
|
+
.post(URLS.CAPTCHA, {
|
|
87
|
+
userId: '',
|
|
88
|
+
clientType: 'web',
|
|
89
|
+
})
|
|
90
|
+
.then((captcha) => {
|
|
91
|
+
const result = captcha?.result;
|
|
92
|
+
window.initGeetest(
|
|
93
|
+
{
|
|
94
|
+
gt: result?.gt,
|
|
95
|
+
challenge: result?.challenge,
|
|
96
|
+
offline: !result?.success,
|
|
97
|
+
new_captcha: true,
|
|
98
|
+
product: 'bind',
|
|
99
|
+
lang: Cookies.get('main-i18next') === 'zh' ? 'zh-cn' : 'en',
|
|
100
|
+
https: true,
|
|
101
|
+
width: '',
|
|
102
|
+
},
|
|
103
|
+
(geetest) => {
|
|
104
|
+
geetest
|
|
105
|
+
.onReady(() => {
|
|
106
|
+
resolve(geetest);
|
|
107
|
+
})
|
|
108
|
+
.onSuccess(() => {
|
|
109
|
+
const result = geetest.getValidate(); // 获取极验的验证结果
|
|
110
|
+
const secureKey = {
|
|
111
|
+
clientType: 'web',
|
|
112
|
+
challenge: result.geetest_challenge,
|
|
113
|
+
validate: result.geetest_validate,
|
|
114
|
+
seccode: result.geetest_seccode,
|
|
115
|
+
};
|
|
116
|
+
if (_cb) {
|
|
117
|
+
_cb(secureKey);
|
|
118
|
+
_cb = null;
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
.onError((error) => {
|
|
122
|
+
reject(error);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
})
|
|
127
|
+
.catch(() => reject('极验请求出错'));
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const showGeetest = (geetest, form, cb) => {
|
|
132
|
+
_cb = (secureKey) => {
|
|
133
|
+
if (form) {
|
|
134
|
+
cb(form, secureKey);
|
|
135
|
+
} else {
|
|
136
|
+
cb(secureKey);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
geetest.verify();
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const isSupportMultiLang = () => {
|
|
143
|
+
return window._SDF_CONFIG?.saas?.MULTI_LANG.ENABLE !== false;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const isOpenGt = () => !!window._SDF.saas?.is_need_jiyan;
|
|
147
|
+
|
|
148
|
+
export const isMessageCt = () => {
|
|
149
|
+
return (
|
|
150
|
+
window._SDF_CONFIG?.saas?.TOP_MESSAGE_ENABLE !== false &&
|
|
151
|
+
!!window._SDF.saas?.message_switch
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const replacePathInCSS = (css, mapFn) => {
|
|
156
|
+
const hasQuote = /^\s*('|")/;
|
|
157
|
+
return [
|
|
158
|
+
/(@import\s+)(')(.+?)(')/gi,
|
|
159
|
+
/(@import\s+)(")(.+?)(")/gi,
|
|
160
|
+
/(url\s*\()(\s*')([^']+?)(')/gi,
|
|
161
|
+
/(url\s*\()(\s*")([^"]+?)(")/gi,
|
|
162
|
+
/(url\s*\()(\s*)([^\s'")].*?)(\s*\))/gi,
|
|
163
|
+
].reduce((css, reg, index) => {
|
|
164
|
+
return css.replace(reg, (all, lead, quote1, path, quote2) => {
|
|
165
|
+
const ret = mapFn(path, quote1);
|
|
166
|
+
if (hasQuote.test(ret) && hasQuote.test(quote1)) quote1 = quote2 = '';
|
|
167
|
+
return lead + quote1 + ret + quote2;
|
|
168
|
+
});
|
|
169
|
+
}, css);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const isUrlReg = /^(data:|https?:|\/\/)/i;
|
|
173
|
+
export const processLoadAssetInCss = (apps, url, args) => {
|
|
174
|
+
return {
|
|
175
|
+
async text() {
|
|
176
|
+
const res = await window.fetch(url, ...args);
|
|
177
|
+
let css = await res.text();
|
|
178
|
+
let baseUrl = '';
|
|
179
|
+
apps.forEach((app) => {
|
|
180
|
+
if (url.includes(app.props.resourcePrefix)) {
|
|
181
|
+
baseUrl = app.props.resourcePrefix;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
if (baseUrl) {
|
|
185
|
+
css = replacePathInCSS(css, (path) => {
|
|
186
|
+
if (isUrlReg.test(path)) {
|
|
187
|
+
return path;
|
|
188
|
+
}
|
|
189
|
+
return baseUrl + '/' + path;
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return css;
|
|
193
|
+
},
|
|
194
|
+
} as any;
|
|
195
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
interface TEvent {
|
|
2
|
+
timestamp: number;
|
|
3
|
+
value?: any;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
type EventCallback = (e: any) => void;
|
|
7
|
+
|
|
8
|
+
interface IEvent {
|
|
9
|
+
addEventListener: (type: string, callback: EventCallback) => void;
|
|
10
|
+
removeEventListener: (type: string, callback: EventCallback) => boolean;
|
|
11
|
+
removeAllEventListener: (type?: string) => boolean;
|
|
12
|
+
dispatchEvent: (type: string, value?: any) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function buildEventParam(value?: any) {
|
|
16
|
+
return {
|
|
17
|
+
value,
|
|
18
|
+
timestamp: Date.now(),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class CustomEvent implements IEvent {
|
|
23
|
+
static eventMap: { [key: string]: EventCallback[] } = {};
|
|
24
|
+
|
|
25
|
+
private eventMap: { [key: string]: EventCallback[] } = {};
|
|
26
|
+
|
|
27
|
+
static addEventListener = (type: string, callback: EventCallback) => {
|
|
28
|
+
if (!CustomEvent.eventMap[type]) {
|
|
29
|
+
CustomEvent.eventMap[type] = [];
|
|
30
|
+
}
|
|
31
|
+
if (!CustomEvent.hasEventListener(type, callback)) {
|
|
32
|
+
CustomEvent.eventMap[type].push(callback);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
static removeEventListener = (type: string, callback: EventCallback) => {
|
|
37
|
+
const listeners = CustomEvent.eventMap[type] || [];
|
|
38
|
+
const index = listeners.findIndex((cb) => cb === callback);
|
|
39
|
+
if (index > -1) {
|
|
40
|
+
listeners.splice(index, 1);
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
static removeAllEventListener = (type?: string) => {
|
|
47
|
+
if (type !== undefined && CustomEvent.eventMap[type]) {
|
|
48
|
+
delete CustomEvent.eventMap[type];
|
|
49
|
+
} else if (type === undefined) {
|
|
50
|
+
CustomEvent.eventMap = {};
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
static dispatchEvent = (type: string, value?: any) => {
|
|
56
|
+
const listeners = CustomEvent.eventMap[type] || [];
|
|
57
|
+
for (const listener of listeners) {
|
|
58
|
+
if (listener && typeof listener === 'function') {
|
|
59
|
+
listener(buildEventParam(value));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
static hasEventListener = (type: string, callback: EventCallback) => {
|
|
65
|
+
const listeners = CustomEvent.eventMap[type] || [];
|
|
66
|
+
return listeners.some((listener) => listener === callback);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
public addEventListener = (type: string, callback: EventCallback) => {
|
|
70
|
+
if (!this.eventMap[type]) {
|
|
71
|
+
this.eventMap[type] = [];
|
|
72
|
+
}
|
|
73
|
+
if (!this.hasEventListener(type, callback)) {
|
|
74
|
+
this.eventMap[type].push(callback);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
public removeEventListener = (type: string, callback: EventCallback) => {
|
|
79
|
+
const listeners = this.eventMap[type] || [];
|
|
80
|
+
const index = listeners.findIndex((cb) => cb === callback);
|
|
81
|
+
if (index > -1) {
|
|
82
|
+
listeners.splice(index, 1);
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
public removeAllEventListener = (type?: string) => {
|
|
89
|
+
if (type !== undefined && this.eventMap[type]) {
|
|
90
|
+
delete this.eventMap[type];
|
|
91
|
+
} else if (type === undefined) {
|
|
92
|
+
this.eventMap = {};
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
public dispatchEvent = (type: string, value?: any) => {
|
|
98
|
+
const listeners = this.eventMap[type] || [];
|
|
99
|
+
for (const listener of listeners) {
|
|
100
|
+
if (listener && typeof listener === 'function') {
|
|
101
|
+
listener(buildEventParam(value));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
private hasEventListener = (type: string, callback: EventCallback) => {
|
|
107
|
+
const listeners = this.eventMap[type] || [];
|
|
108
|
+
return listeners.some((listener) => listener === callback);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export default CustomEvent;
|