component-sanzhizhou 1.2.2 → 1.2.5

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.
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  interface Props {
3
- id?: number;
3
+ id?: number | string;
4
4
  copyEnabled?: boolean;
5
5
  }
6
6
  declare const IdTag: React.FC<Props>;
@@ -6,6 +6,7 @@ interface Props {
6
6
  disabledFormItemLabel?: boolean;
7
7
  accountRegDisabled?: boolean;
8
8
  onSuccess: () => void;
9
+ showSubAccount?: boolean;
9
10
  }
10
11
  /** 账户登录 / 注册;找回密码通过抽屉弹出。 */
11
12
  declare const Account: React.FC<Props>;
@@ -14,7 +14,8 @@ var Account = function Account(_ref) {
14
14
  roleType = _ref.roleType,
15
15
  disabledFormItemLabel = _ref.disabledFormItemLabel,
16
16
  accountRegDisabled = _ref.accountRegDisabled,
17
- onSuccess = _ref.onSuccess;
17
+ onSuccess = _ref.onSuccess,
18
+ showSubAccount = _ref.showSubAccount;
18
19
  var _useState = useState('login'),
19
20
  _useState2 = _slicedToArray(_useState, 2),
20
21
  activeKey = _useState2[0],
@@ -42,6 +43,7 @@ var Account = function Account(_ref) {
42
43
  apiUrl: apiUrl,
43
44
  roleType: roleType,
44
45
  disabledFormItemLabel: disabledFormItemLabel,
46
+ showSubAccount: showSubAccount,
45
47
  onSuccess: onSuccess,
46
48
  onForgotPassword: function onForgotPassword() {
47
49
  return setForgotOpen(true);
@@ -63,6 +65,7 @@ var Account = function Account(_ref) {
63
65
  env: env,
64
66
  apiUrl: apiUrl,
65
67
  disabledFormItemLabel: disabledFormItemLabel,
68
+ showSubAccount: showSubAccount,
66
69
  onDone: function onDone() {
67
70
  return setForgotOpen(false);
68
71
  }
@@ -3,6 +3,7 @@ interface Props {
3
3
  env?: Global.Env;
4
4
  apiUrl?: string;
5
5
  disabledFormItemLabel?: boolean;
6
+ showSubAccount?: boolean;
6
7
  /** 重置成功后回调(切回登录)。 */
7
8
  onDone: () => void;
8
9
  }
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import React from 'react';
2
+ import React, { useState } from 'react';
3
3
  import { LockOutlined, UserOutlined, EyeTwoTone, EyeInvisibleOutlined } from '@ant-design/icons';
4
- import { Input, Button, Form } from 'antd';
4
+ import { Input, Button, Form, Segmented } from 'antd';
5
5
  import { useRequest } from '@umijs/hooks';
6
6
  import Tool from "../lib/Tool";
7
7
  import * as AuthController from "../service/api/AuthController";
@@ -14,10 +14,15 @@ var ForgotPassword = function ForgotPassword(_ref) {
14
14
  var env = _ref.env,
15
15
  apiUrl = _ref.apiUrl,
16
16
  disabledFormItemLabel = _ref.disabledFormItemLabel,
17
+ showSubAccount = _ref.showSubAccount,
17
18
  onDone = _ref.onDone;
18
19
  var _Form$useForm = Form.useForm(),
19
20
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
20
21
  form = _Form$useForm2[0];
22
+ var _useState = useState('main'),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ accountType = _useState2[0],
25
+ setAccountType = _useState2[1];
21
26
  var _useRequest = useRequest(function (data) {
22
27
  return AuthController.forgotPassword({
23
28
  accountName: data.accountName,
@@ -48,7 +53,23 @@ var ForgotPassword = function ForgotPassword(_ref) {
48
53
  labelCol: {
49
54
  span: FormSpan
50
55
  }
51
- }, /*#__PURE__*/React.createElement(Form.Item, {
56
+ }, showSubAccount && /*#__PURE__*/React.createElement(Form.Item, {
57
+ wrapperCol: {
58
+ offset: FormSpan
59
+ }
60
+ }, /*#__PURE__*/React.createElement(Segmented, {
61
+ value: accountType,
62
+ options: [{
63
+ label: formatMessage('主账户'),
64
+ value: 'main'
65
+ }, {
66
+ label: formatMessage('子账户'),
67
+ value: 'sub'
68
+ }],
69
+ onChange: function onChange(e) {
70
+ return setAccountType(e);
71
+ }
72
+ })), /*#__PURE__*/React.createElement(Form.Item, {
52
73
  label: disabledFormItemLabel ? undefined : formatMessage('手机号码'),
53
74
  name: "accountName",
54
75
  rules: [{
@@ -12,11 +12,12 @@ interface Props {
12
12
  [name: string]: any;
13
13
  };
14
14
  onLoginSuccess: () => void;
15
+ showSubAccount?: boolean;
15
16
  }
16
17
  /**
17
18
  * 登录 / 注册(重构版)。
18
19
  * - 微信扫码:逻辑与旧 Auth 保持一致(WechatQr)。
19
20
  * - 账户:登录 / 短信注册 / 找回密码(Account)。
20
21
  */
21
- declare const Auth: React.FC<Props>;
22
- export default Auth;
22
+ declare const AuthMain: React.FC<Props>;
23
+ export default AuthMain;
@@ -14,7 +14,7 @@ import styles from "./index.module.less";
14
14
  * - 微信扫码:逻辑与旧 Auth 保持一致(WechatQr)。
15
15
  * - 账户:登录 / 短信注册 / 找回密码(Account)。
16
16
  */
17
- var Auth = function Auth(_ref) {
17
+ var AuthMain = function AuthMain(_ref) {
18
18
  var productType = _ref.productType,
19
19
  apiUrl = _ref.apiUrl,
20
20
  clientUniqueKeyList = _ref.clientUniqueKeyList,
@@ -27,7 +27,8 @@ var Auth = function Auth(_ref) {
27
27
  _ref$domain = _ref.domain,
28
28
  domain = _ref$domain === void 0 ? document.location.hostname : _ref$domain,
29
29
  _ref$onLoginSuccess = _ref.onLoginSuccess,
30
- onLoginSuccess = _ref$onLoginSuccess === void 0 ? function () {} : _ref$onLoginSuccess;
30
+ onLoginSuccess = _ref$onLoginSuccess === void 0 ? function () {} : _ref$onLoginSuccess,
31
+ showSubAccount = _ref.showSubAccount;
31
32
  var _useState = useState(_toConsumableArray(loginTypeList)),
32
33
  _useState2 = _slicedToArray(_useState, 2),
33
34
  currentLoginTypeList = _useState2[0],
@@ -81,6 +82,7 @@ var Auth = function Auth(_ref) {
81
82
  roleType: roleType,
82
83
  disabledFormItemLabel: disabledFormItemLabel,
83
84
  accountRegDisabled: accountRegDisabled,
85
+ showSubAccount: showSubAccount,
84
86
  onSuccess: function onSuccess() {
85
87
  return onLoginSuccess();
86
88
  }
@@ -92,4 +94,4 @@ var Auth = function Auth(_ref) {
92
94
  onClick: onCallAccount
93
95
  }));
94
96
  };
95
- export default Auth;
97
+ export default AuthMain;
@@ -3,6 +3,7 @@ import type { AccountFormProps } from './types';
3
3
  interface Props extends AccountFormProps {
4
4
  roleType?: UserAuth.RoleType;
5
5
  disabledFormItemLabel?: boolean;
6
+ showSubAccount?: boolean;
6
7
  onForgotPassword?: () => void;
7
8
  }
8
9
  /** 账户密码登录。 */
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import React, { useState } from 'react';
4
4
  import { LockOutlined, UserOutlined, EyeTwoTone, EyeInvisibleOutlined } from '@ant-design/icons';
5
- import { Input, Button, Form, Radio } from 'antd';
5
+ import { Input, Button, Form, Segmented } from 'antd';
6
6
  import { useRequest } from '@umijs/hooks';
7
7
  import * as AuthController from "../service/api/AuthController";
8
8
  import formatMessage from "../lib/formatMessage";
@@ -14,6 +14,7 @@ var Login = function Login(_ref) {
14
14
  apiUrl = _ref.apiUrl,
15
15
  roleType = _ref.roleType,
16
16
  disabledFormItemLabel = _ref.disabledFormItemLabel,
17
+ showSubAccount = _ref.showSubAccount,
17
18
  _onSuccess = _ref.onSuccess,
18
19
  onForgotPassword = _ref.onForgotPassword;
19
20
  var _Form$useForm = Form.useForm(),
@@ -43,28 +44,33 @@ var Login = function Login(_ref) {
43
44
  accountType: accountType
44
45
  }));
45
46
  };
47
+ var formSpan = 8;
46
48
  return /*#__PURE__*/React.createElement("section", null, /*#__PURE__*/React.createElement(Form, {
49
+ labelCol: {
50
+ span: formSpan
51
+ },
47
52
  form: form,
48
53
  onFinish: onFinish,
49
- disabled: loading,
50
- autoComplete: "off"
51
- }, /*#__PURE__*/React.createElement(Radio.Group, {
54
+ disabled: loading
55
+ // autoComplete="off"
56
+ }, showSubAccount && /*#__PURE__*/React.createElement(Form.Item, {
57
+ wrapperCol: {
58
+ offset: formSpan
59
+ }
60
+ }, /*#__PURE__*/React.createElement(Segmented, {
52
61
  value: accountType,
62
+ options: [{
63
+ label: formatMessage('主账户'),
64
+ value: 'main'
65
+ }, {
66
+ label: formatMessage('子账户'),
67
+ value: 'sub'
68
+ }],
53
69
  onChange: function onChange(e) {
54
- return setAccountType(e.target.value);
55
- },
56
- style: {
57
- marginBottom: 16
70
+ return setAccountType(e);
58
71
  }
59
- }, /*#__PURE__*/React.createElement(Radio.Button, {
60
- value: "main"
61
- }, formatMessage('主账号')), /*#__PURE__*/React.createElement(Radio.Button, {
62
- value: "sub"
63
- }, formatMessage('子账号'))), /*#__PURE__*/React.createElement(Form.Item, {
72
+ })), /*#__PURE__*/React.createElement(Form.Item, {
64
73
  label: disabledFormItemLabel ? undefined : formatMessage('手机号码'),
65
- labelCol: {
66
- span: 8
67
- },
68
74
  name: "accountName",
69
75
  rules: [{
70
76
  required: true,
@@ -80,9 +86,6 @@ var Login = function Login(_ref) {
80
86
  })
81
87
  })), /*#__PURE__*/React.createElement(Form.Item, {
82
88
  label: disabledFormItemLabel ? undefined : formatMessage('密码'),
83
- labelCol: {
84
- span: 8
85
- },
86
89
  name: "password",
87
90
  rules: [{
88
91
  required: true,
@@ -115,7 +118,7 @@ var Login = function Login(_ref) {
115
118
  }
116
119
  })), /*#__PURE__*/React.createElement(Form.Item, {
117
120
  wrapperCol: {
118
- offset: 8
121
+ offset: formSpan
119
122
  }
120
123
  }, /*#__PURE__*/React.createElement(Button, {
121
124
  type: "primary",
@@ -162,7 +162,7 @@ declare const Tool: {
162
162
  getTitleByPath(path: string): string;
163
163
  getDirByPath(path: string): string;
164
164
  h5Pay(query: Pay.H5PayQuery): void;
165
- notification(type: "info" | "error" | "warning" | "success", message: string, description?: import("react").ReactNode, options?: import("./notification").NotificationOption): void;
165
+ notification(type: "success" | "info" | "warning" | "error", message: string, description?: import("react").ReactNode, options?: import("./notification").NotificationOption): void;
166
166
  notificationSuccess(message: string, description?: import("react").ReactNode, options?: import("./notification").NotificationOption): void;
167
167
  notificationError(message: string, description?: import("react").ReactNode, options?: import("./notification").NotificationOption): void;
168
168
  notificationWarning(message: string, description?: import("react").ReactNode, options?: import("./notification").NotificationOption): void;
@@ -0,0 +1,3 @@
1
+ declare namespace AuthMain {
2
+ type AccountType = 'main' | 'sub';
3
+ }
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-sanzhizhou",
3
- "version": "1.2.2",
3
+ "version": "1.2.5",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",