component-sanzhizhou 1.1.8 → 1.2.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/dist/auth-main/account.d.ts +12 -0
- package/dist/auth-main/account.js +71 -0
- package/dist/auth-main/forgot-password.d.ts +11 -0
- package/dist/auth-main/forgot-password.js +109 -0
- package/dist/auth-main/human-verify.d.ts +12 -0
- package/dist/auth-main/human-verify.js +89 -0
- package/dist/auth-main/index.d.ts +22 -0
- package/dist/auth-main/index.js +95 -0
- package/dist/auth-main/index.module.less +178 -0
- package/dist/auth-main/login-success.d.ts +3 -0
- package/dist/auth-main/login-success.js +14 -0
- package/dist/auth-main/login.d.ts +10 -0
- package/dist/auth-main/login.js +108 -0
- package/dist/auth-main/phone-code.d.ts +13 -0
- package/dist/auth-main/phone-code.js +158 -0
- package/dist/auth-main/pow.d.ts +11 -0
- package/dist/auth-main/pow.js +172 -0
- package/dist/auth-main/register.d.ts +9 -0
- package/dist/auth-main/register.js +143 -0
- package/dist/auth-main/types.d.ts +23 -0
- package/dist/auth-main/types.js +1 -0
- package/dist/auth-main/wechat-qr.d.ts +8 -0
- package/dist/auth-main/wechat-qr.js +227 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/locales/ar-EG.json +24 -1
- package/dist/locales/de-DE.json +24 -1
- package/dist/locales/en-US.json +24 -1
- package/dist/locales/es-ES.json +24 -1
- package/dist/locales/fr-FR.json +24 -1
- package/dist/locales/it-IT.json +24 -1
- package/dist/locales/ja-JP.json +24 -1
- package/dist/locales/ko-KR.json +24 -1
- package/dist/locales/pt-PT.json +24 -1
- package/dist/locales/ru-RU.json +24 -1
- package/dist/locales/th-TH.json +24 -1
- package/dist/locales/vi-VN.json +24 -1
- package/dist/locales/zh-CN.json +22 -1
- package/dist/locales/zh-HK.json +29 -6
- package/dist/locales/zh-TW.json +29 -6
- package/dist/service/api/AuthController.d.ts +39 -0
- package/dist/service/api/AuthController.js +119 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
env?: Global.Env;
|
|
4
|
+
apiUrl?: string;
|
|
5
|
+
roleType?: UserAuth.RoleType;
|
|
6
|
+
disabledFormItemLabel?: boolean;
|
|
7
|
+
accountRegDisabled?: boolean;
|
|
8
|
+
onSuccess: () => void;
|
|
9
|
+
}
|
|
10
|
+
/** 账户登录 / 注册;找回密码通过抽屉弹出。 */
|
|
11
|
+
declare const Account: React.FC<Props>;
|
|
12
|
+
export default Account;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { Radio, Drawer } from 'antd';
|
|
4
|
+
import { UserOutlined, UserAddOutlined } from '@ant-design/icons';
|
|
5
|
+
import formatMessage from "../lib/formatMessage";
|
|
6
|
+
import Login from "./login";
|
|
7
|
+
import Register from "./register";
|
|
8
|
+
import ForgotPassword from "./forgot-password";
|
|
9
|
+
import styles from "./index.module.less";
|
|
10
|
+
/** 账户登录 / 注册;找回密码通过抽屉弹出。 */
|
|
11
|
+
var Account = function Account(_ref) {
|
|
12
|
+
var env = _ref.env,
|
|
13
|
+
apiUrl = _ref.apiUrl,
|
|
14
|
+
roleType = _ref.roleType,
|
|
15
|
+
disabledFormItemLabel = _ref.disabledFormItemLabel,
|
|
16
|
+
accountRegDisabled = _ref.accountRegDisabled,
|
|
17
|
+
onSuccess = _ref.onSuccess;
|
|
18
|
+
var _useState = useState('login'),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
activeKey = _useState2[0],
|
|
21
|
+
setActiveKey = _useState2[1];
|
|
22
|
+
var _useState3 = useState(false),
|
|
23
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
|
+
forgotOpen = _useState4[0],
|
|
25
|
+
setForgotOpen = _useState4[1];
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: styles.Account
|
|
28
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: styles.radioSelectBox
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, {
|
|
31
|
+
value: activeKey,
|
|
32
|
+
onChange: function onChange(e) {
|
|
33
|
+
return setActiveKey(e.target.value);
|
|
34
|
+
}
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Radio.Button, {
|
|
36
|
+
value: "login"
|
|
37
|
+
}, /*#__PURE__*/React.createElement(UserOutlined, null), " ", formatMessage('登录')), /*#__PURE__*/React.createElement(Radio.Button, {
|
|
38
|
+
value: "reg",
|
|
39
|
+
disabled: accountRegDisabled
|
|
40
|
+
}, /*#__PURE__*/React.createElement(UserAddOutlined, null), " ", formatMessage('注册')))), activeKey === 'login' && /*#__PURE__*/React.createElement(Login, {
|
|
41
|
+
env: env,
|
|
42
|
+
apiUrl: apiUrl,
|
|
43
|
+
roleType: roleType,
|
|
44
|
+
disabledFormItemLabel: disabledFormItemLabel,
|
|
45
|
+
onSuccess: onSuccess,
|
|
46
|
+
onForgotPassword: function onForgotPassword() {
|
|
47
|
+
return setForgotOpen(true);
|
|
48
|
+
}
|
|
49
|
+
}), activeKey === 'reg' && /*#__PURE__*/React.createElement(Register, {
|
|
50
|
+
env: env,
|
|
51
|
+
apiUrl: apiUrl,
|
|
52
|
+
roleType: roleType,
|
|
53
|
+
disabledFormItemLabel: disabledFormItemLabel,
|
|
54
|
+
onSuccess: onSuccess
|
|
55
|
+
}), /*#__PURE__*/React.createElement(Drawer, {
|
|
56
|
+
title: formatMessage('找回密码'),
|
|
57
|
+
open: forgotOpen,
|
|
58
|
+
onClose: function onClose() {
|
|
59
|
+
return setForgotOpen(false);
|
|
60
|
+
},
|
|
61
|
+
size: 620
|
|
62
|
+
}, /*#__PURE__*/React.createElement(ForgotPassword, {
|
|
63
|
+
env: env,
|
|
64
|
+
apiUrl: apiUrl,
|
|
65
|
+
disabledFormItemLabel: disabledFormItemLabel,
|
|
66
|
+
onDone: function onDone() {
|
|
67
|
+
return setForgotOpen(false);
|
|
68
|
+
}
|
|
69
|
+
})));
|
|
70
|
+
};
|
|
71
|
+
export default Account;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
env?: Global.Env;
|
|
4
|
+
apiUrl?: string;
|
|
5
|
+
disabledFormItemLabel?: boolean;
|
|
6
|
+
/** 重置成功后回调(切回登录)。 */
|
|
7
|
+
onDone: () => void;
|
|
8
|
+
}
|
|
9
|
+
/** 找回密码:短信验证码 + 新密码。 */
|
|
10
|
+
declare const ForgotPassword: React.FC<Props>;
|
|
11
|
+
export default ForgotPassword;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { LockOutlined, UserOutlined, EyeTwoTone, EyeInvisibleOutlined } from '@ant-design/icons';
|
|
4
|
+
import { Input, Button, Form } from 'antd';
|
|
5
|
+
import { useRequest } from '@umijs/hooks';
|
|
6
|
+
import Tool from "../lib/Tool";
|
|
7
|
+
import * as AuthController from "../service/api/AuthController";
|
|
8
|
+
import formatMessage from "../lib/formatMessage";
|
|
9
|
+
import PhoneCode from "./phone-code";
|
|
10
|
+
var FormSpan = 6;
|
|
11
|
+
|
|
12
|
+
/** 找回密码:短信验证码 + 新密码。 */
|
|
13
|
+
var ForgotPassword = function ForgotPassword(_ref) {
|
|
14
|
+
var env = _ref.env,
|
|
15
|
+
apiUrl = _ref.apiUrl,
|
|
16
|
+
disabledFormItemLabel = _ref.disabledFormItemLabel,
|
|
17
|
+
onDone = _ref.onDone;
|
|
18
|
+
var _Form$useForm = Form.useForm(),
|
|
19
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
20
|
+
form = _Form$useForm2[0];
|
|
21
|
+
var _useRequest = useRequest(function (data) {
|
|
22
|
+
return AuthController.forgotPassword({
|
|
23
|
+
accountName: data.accountName,
|
|
24
|
+
smsCode: data.smsCode,
|
|
25
|
+
password: data.password
|
|
26
|
+
}, {
|
|
27
|
+
env: env,
|
|
28
|
+
apiUrl: apiUrl
|
|
29
|
+
});
|
|
30
|
+
}, {
|
|
31
|
+
manual: true,
|
|
32
|
+
onSuccess: function onSuccess() {
|
|
33
|
+
Tool.toast(formatMessage('密码已重置,请登录'));
|
|
34
|
+
onDone();
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
loading = _useRequest.loading,
|
|
38
|
+
run = _useRequest.run;
|
|
39
|
+
var onFinish = function onFinish(values) {
|
|
40
|
+
values.accountName = (values.accountName || '').replace(/\s+/g, '');
|
|
41
|
+
run(values);
|
|
42
|
+
};
|
|
43
|
+
return /*#__PURE__*/React.createElement("section", null, /*#__PURE__*/React.createElement(Form, {
|
|
44
|
+
form: form,
|
|
45
|
+
onFinish: onFinish,
|
|
46
|
+
disabled: loading,
|
|
47
|
+
autoComplete: "off",
|
|
48
|
+
labelCol: {
|
|
49
|
+
span: FormSpan
|
|
50
|
+
}
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
52
|
+
label: disabledFormItemLabel ? undefined : formatMessage('手机号码'),
|
|
53
|
+
name: "accountName",
|
|
54
|
+
rules: [{
|
|
55
|
+
required: true,
|
|
56
|
+
message: formatMessage('请输入')
|
|
57
|
+
}, {
|
|
58
|
+
pattern: /^\s*1\d{2}\s*\d{4}\s*\d{4}\s*$/,
|
|
59
|
+
message: "".concat(formatMessage('这似乎不是中国大陆手机号码'), "\uFF1F")
|
|
60
|
+
}]
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
62
|
+
placeholder: formatMessage('手机号码'),
|
|
63
|
+
prefix: /*#__PURE__*/React.createElement(UserOutlined, {
|
|
64
|
+
className: "input-prefix-icon"
|
|
65
|
+
})
|
|
66
|
+
})), /*#__PURE__*/React.createElement(PhoneCode, {
|
|
67
|
+
formSpan: FormSpan,
|
|
68
|
+
form: form,
|
|
69
|
+
scene: "forgot",
|
|
70
|
+
env: env,
|
|
71
|
+
apiUrl: apiUrl,
|
|
72
|
+
disabledFormItemLabel: disabledFormItemLabel
|
|
73
|
+
}), /*#__PURE__*/React.createElement(Form.Item, {
|
|
74
|
+
label: disabledFormItemLabel ? undefined : formatMessage('新密码'),
|
|
75
|
+
name: "password",
|
|
76
|
+
rules: [{
|
|
77
|
+
required: true,
|
|
78
|
+
message: formatMessage('请输入')
|
|
79
|
+
}, {
|
|
80
|
+
min: 6,
|
|
81
|
+
message: formatMessage('最少{maxCount}个字符', {
|
|
82
|
+
maxCount: 6
|
|
83
|
+
})
|
|
84
|
+
}, {
|
|
85
|
+
max: 60,
|
|
86
|
+
message: formatMessage('最多{maxCount}个字符', {
|
|
87
|
+
maxCount: 60
|
|
88
|
+
})
|
|
89
|
+
}]
|
|
90
|
+
}, /*#__PURE__*/React.createElement(Input.Password, {
|
|
91
|
+
prefix: /*#__PURE__*/React.createElement(LockOutlined, {
|
|
92
|
+
className: "input-prefix-icon"
|
|
93
|
+
}),
|
|
94
|
+
placeholder: formatMessage('请输入'),
|
|
95
|
+
iconRender: function iconRender(visible) {
|
|
96
|
+
return visible ? /*#__PURE__*/React.createElement(EyeTwoTone, null) : /*#__PURE__*/React.createElement(EyeInvisibleOutlined, null);
|
|
97
|
+
}
|
|
98
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
99
|
+
wrapperCol: {
|
|
100
|
+
offset: 6
|
|
101
|
+
}
|
|
102
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
103
|
+
type: "primary",
|
|
104
|
+
loading: loading,
|
|
105
|
+
htmlType: "submit",
|
|
106
|
+
icon: /*#__PURE__*/React.createElement(UserOutlined, null)
|
|
107
|
+
}, formatMessage('重置密码')))));
|
|
108
|
+
};
|
|
109
|
+
export default ForgotPassword;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SmsScene } from './types';
|
|
3
|
+
interface Props {
|
|
4
|
+
phone: string;
|
|
5
|
+
scene: SmsScene;
|
|
6
|
+
env?: Global.Env;
|
|
7
|
+
apiUrl?: string;
|
|
8
|
+
onVerified: (challenge: string, nonce: string) => void;
|
|
9
|
+
}
|
|
10
|
+
/** 人机验证(工作量证明):点击后后台计算,通过后变绿。 */
|
|
11
|
+
declare const HumanVerify: React.FC<Props>;
|
|
12
|
+
export default HumanVerify;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { Spin } from 'antd';
|
|
6
|
+
import { SafetyCertificateOutlined, CheckCircleFilled, LoadingOutlined } from '@ant-design/icons';
|
|
7
|
+
import Tool from "../lib/Tool";
|
|
8
|
+
import formatMessage from "../lib/formatMessage";
|
|
9
|
+
import * as AuthController from "../service/api/AuthController";
|
|
10
|
+
import { solvePow } from "./pow";
|
|
11
|
+
import styles from "./index.module.less";
|
|
12
|
+
var phoneReg = /^1\d{10}$/;
|
|
13
|
+
/** 人机验证(工作量证明):点击后后台计算,通过后变绿。 */
|
|
14
|
+
var HumanVerify = function HumanVerify(_ref) {
|
|
15
|
+
var phone = _ref.phone,
|
|
16
|
+
scene = _ref.scene,
|
|
17
|
+
env = _ref.env,
|
|
18
|
+
apiUrl = _ref.apiUrl,
|
|
19
|
+
onVerified = _ref.onVerified;
|
|
20
|
+
var _useState = useState('idle'),
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
status = _useState2[0],
|
|
23
|
+
setStatus = _useState2[1];
|
|
24
|
+
var onVerify = /*#__PURE__*/function () {
|
|
25
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
26
|
+
var challengeData, _nonce;
|
|
27
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
if (!(status !== 'idle')) {
|
|
31
|
+
_context.next = 2;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
return _context.abrupt("return");
|
|
35
|
+
case 2:
|
|
36
|
+
if (phoneReg.test(phone)) {
|
|
37
|
+
_context.next = 5;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
Tool.toastError(formatMessage('请输入正确的手机号码'));
|
|
41
|
+
return _context.abrupt("return");
|
|
42
|
+
case 5:
|
|
43
|
+
setStatus('verifying');
|
|
44
|
+
_context.prev = 6;
|
|
45
|
+
_context.next = 9;
|
|
46
|
+
return AuthController.powChallenge({
|
|
47
|
+
accountName: phone,
|
|
48
|
+
scene: scene
|
|
49
|
+
}, {
|
|
50
|
+
env: env,
|
|
51
|
+
apiUrl: apiUrl
|
|
52
|
+
});
|
|
53
|
+
case 9:
|
|
54
|
+
challengeData = _context.sent;
|
|
55
|
+
_context.next = 12;
|
|
56
|
+
return solvePow(challengeData.challenge, challengeData.difficulty);
|
|
57
|
+
case 12:
|
|
58
|
+
_nonce = _context.sent;
|
|
59
|
+
setStatus('verified');
|
|
60
|
+
onVerified(challengeData.challenge, _nonce);
|
|
61
|
+
_context.next = 20;
|
|
62
|
+
break;
|
|
63
|
+
case 17:
|
|
64
|
+
_context.prev = 17;
|
|
65
|
+
_context.t0 = _context["catch"](6);
|
|
66
|
+
// 错误已由 request 层 toast
|
|
67
|
+
setStatus('idle');
|
|
68
|
+
case 20:
|
|
69
|
+
case "end":
|
|
70
|
+
return _context.stop();
|
|
71
|
+
}
|
|
72
|
+
}, _callee, null, [[6, 17]]);
|
|
73
|
+
}));
|
|
74
|
+
return function onVerify() {
|
|
75
|
+
return _ref2.apply(this, arguments);
|
|
76
|
+
};
|
|
77
|
+
}();
|
|
78
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: "".concat(styles.humanVerify, " ").concat(status === 'verified' ? styles.humanVerifyOk : ''),
|
|
80
|
+
onClick: onVerify
|
|
81
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
82
|
+
className: styles.humanVerifyIcon
|
|
83
|
+
}, status === 'verified' ? /*#__PURE__*/React.createElement(CheckCircleFilled, null) : status === 'verifying' ? /*#__PURE__*/React.createElement(LoadingOutlined, null) : /*#__PURE__*/React.createElement(SafetyCertificateOutlined, null)), /*#__PURE__*/React.createElement("span", {
|
|
84
|
+
className: styles.humanVerifyText
|
|
85
|
+
}, status === 'verifying' ? "".concat(formatMessage('人机校验中'), "...") : status === 'verified' ? formatMessage('验证通过') : formatMessage('我不是机器人')), status === 'verifying' && /*#__PURE__*/React.createElement(Spin, {
|
|
86
|
+
size: "small"
|
|
87
|
+
}));
|
|
88
|
+
};
|
|
89
|
+
export default HumanVerify;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
productType: string;
|
|
4
|
+
apiUrl?: string;
|
|
5
|
+
clientUniqueKeyList: string[];
|
|
6
|
+
loginTypeList: Global.AuthClientLoginType[];
|
|
7
|
+
domain?: string;
|
|
8
|
+
env?: Global.Env;
|
|
9
|
+
roleType?: UserAuth.RoleType;
|
|
10
|
+
disabledFormItemLabel?: boolean;
|
|
11
|
+
postData: {
|
|
12
|
+
[name: string]: any;
|
|
13
|
+
};
|
|
14
|
+
onLoginSuccess: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 登录 / 注册(重构版)。
|
|
18
|
+
* - 微信扫码:逻辑与旧 Auth 保持一致(WechatQr)。
|
|
19
|
+
* - 账户:登录 / 短信注册 / 找回密码(Account)。
|
|
20
|
+
*/
|
|
21
|
+
declare const Auth: React.FC<Props>;
|
|
22
|
+
export default Auth;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React, { useState, useEffect } from 'react';
|
|
4
|
+
import { WechatOutlined, UserOutlined } from '@ant-design/icons';
|
|
5
|
+
import { Tabs } from 'antd';
|
|
6
|
+
import Platform from "../lib/platform";
|
|
7
|
+
import formatMessage from "../lib/formatMessage";
|
|
8
|
+
import h5WePublicLogin from "../AuthClient/qr/h5-we-public-login";
|
|
9
|
+
import WechatQr from "./wechat-qr";
|
|
10
|
+
import Account from "./account";
|
|
11
|
+
import styles from "./index.module.less";
|
|
12
|
+
/**
|
|
13
|
+
* 登录 / 注册(重构版)。
|
|
14
|
+
* - 微信扫码:逻辑与旧 Auth 保持一致(WechatQr)。
|
|
15
|
+
* - 账户:登录 / 短信注册 / 找回密码(Account)。
|
|
16
|
+
*/
|
|
17
|
+
var Auth = function Auth(_ref) {
|
|
18
|
+
var productType = _ref.productType,
|
|
19
|
+
apiUrl = _ref.apiUrl,
|
|
20
|
+
clientUniqueKeyList = _ref.clientUniqueKeyList,
|
|
21
|
+
_ref$loginTypeList = _ref.loginTypeList,
|
|
22
|
+
loginTypeList = _ref$loginTypeList === void 0 ? [] : _ref$loginTypeList,
|
|
23
|
+
env = _ref.env,
|
|
24
|
+
postData = _ref.postData,
|
|
25
|
+
roleType = _ref.roleType,
|
|
26
|
+
disabledFormItemLabel = _ref.disabledFormItemLabel,
|
|
27
|
+
_ref$domain = _ref.domain,
|
|
28
|
+
domain = _ref$domain === void 0 ? document.location.hostname : _ref$domain,
|
|
29
|
+
_ref$onLoginSuccess = _ref.onLoginSuccess,
|
|
30
|
+
onLoginSuccess = _ref$onLoginSuccess === void 0 ? function () {} : _ref$onLoginSuccess;
|
|
31
|
+
var _useState = useState(_toConsumableArray(loginTypeList)),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
currentLoginTypeList = _useState2[0],
|
|
34
|
+
setCurrentLoginTypeList = _useState2[1];
|
|
35
|
+
var _useState3 = useState((currentLoginTypeList === null || currentLoginTypeList === void 0 ? void 0 : currentLoginTypeList[0]) || 'account'),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
activeKey = _useState4[0],
|
|
38
|
+
setActiveKey = _useState4[1];
|
|
39
|
+
var hasWechat = currentLoginTypeList.includes('wechat');
|
|
40
|
+
var hasAccount = currentLoginTypeList.includes('account-login') || currentLoginTypeList.includes('account');
|
|
41
|
+
var accountRegDisabled = !currentLoginTypeList.includes('account-reg');
|
|
42
|
+
var onTabChange = function onTabChange(keyName) {
|
|
43
|
+
setActiveKey(keyName);
|
|
44
|
+
};
|
|
45
|
+
var onCallWechat = function onCallWechat() {
|
|
46
|
+
currentLoginTypeList.push('wechat');
|
|
47
|
+
setCurrentLoginTypeList(_toConsumableArray(currentLoginTypeList));
|
|
48
|
+
};
|
|
49
|
+
var onCallAccount = function onCallAccount() {
|
|
50
|
+
currentLoginTypeList.push('account', 'account-reg', 'account-login');
|
|
51
|
+
setCurrentLoginTypeList(_toConsumableArray(currentLoginTypeList));
|
|
52
|
+
};
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
if (Platform.isWechat) {
|
|
55
|
+
h5WePublicLogin();
|
|
56
|
+
}
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
}, []);
|
|
59
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: styles.AuthQrLogin
|
|
61
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: styles.LoginForm
|
|
63
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: styles.sszWebTitle
|
|
65
|
+
}, formatMessage('登录/注册')), /*#__PURE__*/React.createElement(Tabs, {
|
|
66
|
+
activeKey: activeKey,
|
|
67
|
+
onChange: onTabChange
|
|
68
|
+
}, hasWechat && /*#__PURE__*/React.createElement(Tabs.TabPane, {
|
|
69
|
+
tab: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(WechatOutlined, null), " ", formatMessage('微信')),
|
|
70
|
+
key: "wechat"
|
|
71
|
+
}, /*#__PURE__*/React.createElement(WechatQr, {
|
|
72
|
+
domain: domain,
|
|
73
|
+
onLoginSuccess: onLoginSuccess
|
|
74
|
+
})), /*#__PURE__*/React.createElement(Tabs.TabPane, {
|
|
75
|
+
tab: /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(UserOutlined, null), " ", formatMessage('账户')),
|
|
76
|
+
disabled: !hasAccount,
|
|
77
|
+
key: "account"
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Account, {
|
|
79
|
+
env: env,
|
|
80
|
+
apiUrl: apiUrl,
|
|
81
|
+
roleType: roleType,
|
|
82
|
+
disabledFormItemLabel: disabledFormItemLabel,
|
|
83
|
+
accountRegDisabled: accountRegDisabled,
|
|
84
|
+
onSuccess: function onSuccess() {
|
|
85
|
+
return onLoginSuccess();
|
|
86
|
+
}
|
|
87
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: styles.callWechat,
|
|
89
|
+
onClick: onCallWechat
|
|
90
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: styles.callAccount,
|
|
92
|
+
onClick: onCallAccount
|
|
93
|
+
}));
|
|
94
|
+
};
|
|
95
|
+
export default Auth;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
.AuthQrLogin {
|
|
2
|
+
position: relative;
|
|
3
|
+
|
|
4
|
+
:global(.ant-tabs-tab-btn .anticon) {
|
|
5
|
+
margin-right: 6px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.weQrUrl {
|
|
9
|
+
position: absolute;
|
|
10
|
+
left: 50%;
|
|
11
|
+
transform: translateX(-50%);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.qr {
|
|
15
|
+
position: relative;
|
|
16
|
+
display: block;
|
|
17
|
+
margin: 12px auto 0;
|
|
18
|
+
width: 230px;
|
|
19
|
+
height: 230px;
|
|
20
|
+
background-repeat: no-repeat;
|
|
21
|
+
background-size: cover;
|
|
22
|
+
background-position: center;
|
|
23
|
+
|
|
24
|
+
.reTry {
|
|
25
|
+
position: absolute;
|
|
26
|
+
z-index: 100;
|
|
27
|
+
left: 0;
|
|
28
|
+
top: 0;
|
|
29
|
+
width: 100%;
|
|
30
|
+
font-size: 80px;
|
|
31
|
+
background-color: rgba(255, 255, 255, 0.95);
|
|
32
|
+
text-align: center;
|
|
33
|
+
line-height: 210px;
|
|
34
|
+
height: 100%;
|
|
35
|
+
|
|
36
|
+
a {
|
|
37
|
+
display: block;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.alt {
|
|
43
|
+
padding: 10px 0 0;
|
|
44
|
+
color: #999;
|
|
45
|
+
text-align: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.altWeb {
|
|
49
|
+
padding: 16px 0 0;
|
|
50
|
+
max-width: 300px;
|
|
51
|
+
margin: 0 auto;
|
|
52
|
+
|
|
53
|
+
.titles {
|
|
54
|
+
text-align: center;
|
|
55
|
+
font-weight: bold;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
ul {
|
|
59
|
+
margin: 0 10px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.percent {
|
|
64
|
+
width: 100%;
|
|
65
|
+
position: absolute;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
left: 0;
|
|
68
|
+
bottom: 0;
|
|
69
|
+
|
|
70
|
+
.warp {
|
|
71
|
+
height: 4px;
|
|
72
|
+
background-color: #1677ff;
|
|
73
|
+
transition: all 1.6s ease-in-out;
|
|
74
|
+
-webkit-transition: all 1.6s ease-in-out;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.callWechat {
|
|
79
|
+
position: absolute;
|
|
80
|
+
left: 6px;
|
|
81
|
+
bottom: 6px;
|
|
82
|
+
background: #f6f6f6;
|
|
83
|
+
width: 4px;
|
|
84
|
+
height: 4px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.callAccount {
|
|
88
|
+
position: absolute;
|
|
89
|
+
right: 6px;
|
|
90
|
+
bottom: 6px;
|
|
91
|
+
background: #f6f6f6;
|
|
92
|
+
width: 4px;
|
|
93
|
+
height: 4px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.sszWebTitle {
|
|
97
|
+
font-weight: normal;
|
|
98
|
+
font-size: 26px;
|
|
99
|
+
text-align: center;
|
|
100
|
+
padding: 6px 0 0 0;
|
|
101
|
+
line-height: 1em;
|
|
102
|
+
|
|
103
|
+
span {
|
|
104
|
+
display: inline-block;
|
|
105
|
+
padding-left: 5px;
|
|
106
|
+
font-weight: lighter;
|
|
107
|
+
font-size: 16px;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.LoginForm {
|
|
113
|
+
margin: 0 auto;
|
|
114
|
+
padding: 12px 16px 6px 16px;
|
|
115
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
116
|
+
border-radius: 6px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.WeQrUrlBox {
|
|
120
|
+
min-height: 240px !important;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.Account {
|
|
124
|
+
.radioSelectBox {
|
|
125
|
+
text-align: right;
|
|
126
|
+
margin-bottom: 8px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
.forgotLink {
|
|
131
|
+
padding: 6px 0 0 0;
|
|
132
|
+
text-align: right;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.humanVerifyItem {
|
|
137
|
+
margin-bottom: 12px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.humanVerify {
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
gap: 10px;
|
|
144
|
+
width: 100%;
|
|
145
|
+
max-width: 300px;
|
|
146
|
+
padding: 10px 14px;
|
|
147
|
+
border: 1px solid #d9d9d9;
|
|
148
|
+
border-radius: 6px;
|
|
149
|
+
background: #fafafa;
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
user-select: none;
|
|
152
|
+
transition: all 0.2s;
|
|
153
|
+
|
|
154
|
+
&:hover {
|
|
155
|
+
border-color: #1677ff;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.humanVerifyIcon {
|
|
159
|
+
font-size: 20px;
|
|
160
|
+
line-height: 1;
|
|
161
|
+
color: #1677ff;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.humanVerifyText {
|
|
165
|
+
flex: 1;
|
|
166
|
+
font-size: 14px;
|
|
167
|
+
color: rgba(0, 0, 0, 0.85);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.humanVerifyOk {
|
|
172
|
+
border-color: #52c41a;
|
|
173
|
+
background: #f6ffed;
|
|
174
|
+
|
|
175
|
+
.humanVerifyIcon {
|
|
176
|
+
color: #52c41a;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import Tool from "../lib/Tool";
|
|
3
|
+
import formatMessage from "../lib/formatMessage";
|
|
4
|
+
/** 登录 / 注册成功后的统一处理:写本地用户信息 + 触发事件。 */
|
|
5
|
+
export function applyLoginSuccess(data, roleType) {
|
|
6
|
+
Tool.setLocalUserInfo(_objectSpread(_objectSpread({}, data), {}, {
|
|
7
|
+
isLogin: true
|
|
8
|
+
}));
|
|
9
|
+
Tool.toast(formatMessage('成功'));
|
|
10
|
+
Tool.event.run('user-info');
|
|
11
|
+
Tool.event.run("".concat(roleType || 'user', "-login-success"), _objectSpread(_objectSpread({}, data), {}, {
|
|
12
|
+
isLogin: true
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AccountFormProps } from './types';
|
|
3
|
+
interface Props extends AccountFormProps {
|
|
4
|
+
roleType?: UserAuth.RoleType;
|
|
5
|
+
disabledFormItemLabel?: boolean;
|
|
6
|
+
onForgotPassword?: () => void;
|
|
7
|
+
}
|
|
8
|
+
/** 账户密码登录。 */
|
|
9
|
+
declare const Login: React.FC<Props>;
|
|
10
|
+
export default Login;
|