component-sanzhizhou 1.2.1 → 1.2.2

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,7 +1,8 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import React from 'react';
3
+ import React, { useState } from 'react';
3
4
  import { LockOutlined, UserOutlined, EyeTwoTone, EyeInvisibleOutlined } from '@ant-design/icons';
4
- import { Input, Button, Form } from 'antd';
5
+ import { Input, Button, Form, Radio } from 'antd';
5
6
  import { useRequest } from '@umijs/hooks';
6
7
  import * as AuthController from "../service/api/AuthController";
7
8
  import formatMessage from "../lib/formatMessage";
@@ -18,6 +19,10 @@ var Login = function Login(_ref) {
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.accountLogin(data, {
23
28
  env: env,
@@ -34,14 +39,28 @@ var Login = function Login(_ref) {
34
39
  run = _useRequest.run;
35
40
  var onFinish = function onFinish(values) {
36
41
  values.accountName = (values.accountName || '').replace(/\s+/g, '');
37
- run(values);
42
+ run(_objectSpread(_objectSpread({}, values), {}, {
43
+ accountType: accountType
44
+ }));
38
45
  };
39
46
  return /*#__PURE__*/React.createElement("section", null, /*#__PURE__*/React.createElement(Form, {
40
47
  form: form,
41
48
  onFinish: onFinish,
42
49
  disabled: loading,
43
50
  autoComplete: "off"
44
- }, /*#__PURE__*/React.createElement(Form.Item, {
51
+ }, /*#__PURE__*/React.createElement(Radio.Group, {
52
+ value: accountType,
53
+ onChange: function onChange(e) {
54
+ return setAccountType(e.target.value);
55
+ },
56
+ style: {
57
+ marginBottom: 16
58
+ }
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, {
45
64
  label: disabledFormItemLabel ? undefined : formatMessage('手机号码'),
46
65
  labelCol: {
47
66
  span: 8
@@ -8,6 +8,8 @@ export interface AccountAuthData {
8
8
  nickname: string;
9
9
  avatarUrl: string;
10
10
  gender: number;
11
+ isSubAccount: boolean;
12
+ powerKindList: string[];
11
13
  }
12
14
  /** PoW 挑战。 */
13
15
  export interface PowChallengeData {
@@ -29,6 +29,8 @@ export interface AccountAuthResult {
29
29
  nickname: string;
30
30
  avatarUrl: string;
31
31
  gender: number;
32
+ isSubAccount: boolean;
33
+ powerKindList: string[];
32
34
  }
33
35
  export interface PowChallengeResult {
34
36
  challenge: string;
@@ -48,6 +50,7 @@ export declare function sendSmsCode(body: {
48
50
  export declare function accountLogin(body: {
49
51
  accountName: string;
50
52
  password: string;
53
+ accountType?: string;
51
54
  }, options?: ServicesApi.RequestOptions): Promise<AccountAuthResult>;
52
55
  export declare function accountReg(body: {
53
56
  accountName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-sanzhizhou",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",