SecurityView.js 2.95 KB
Newer Older
1
import React, { Component, Fragment } from 'react';
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
2
import { formatMessage, FormattedMessage } from 'umi/locale';
3
import { List } from 'antd';
4
// import { getTimeDistance } from '@/utils/utils';
5 6

const passwordStrength = {
7 8 9 10 11 12 13 14 15 16 17 18
  strong: (
    <font className="strong">
      <FormattedMessage id="app.settings.security.strong" defaultMessage="Strong" />
    </font>
  ),
  medium: (
    <font className="medium">
      <FormattedMessage id="app.settings.security.medium" defaultMessage="Medium" />
    </font>
  ),
  weak: (
    <font className="weak">
19 20
      <FormattedMessage id="app.settings.security.weak" defaultMessage="Weak" />
      Weak
21 22
    </font>
  ),
23 24
};

25
class SecurityView extends Component {
26 27 28
  getData = () => {
    return [
      {
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
29
        title: formatMessage({ id: 'app.settings.security.password' }, {}),
30 31
        description: (
          <Fragment>
32 33
            {formatMessage({ id: 'app.settings.security.password-description' }, {})}๏ผš
            {passwordStrength.strong}
34 35 36 37 38 39 40
          </Fragment>
        ),
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.modify" defaultMessage="Modify" />
          </a>,
        ],
41 42
      },
      {
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
43 44
        title: formatMessage({ id: 'app.settings.security.phone' }, {}),
        description: `${formatMessage(
45 46 47 48 49 50 51 52
          { id: 'app.settings.security.phone-description' },
          {}
        )}๏ผš138****8293`,
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.modify" defaultMessage="Modify" />
          </a>,
        ],
53 54
      },
      {
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
55 56
        title: formatMessage({ id: 'app.settings.security.question' }, {}),
        description: formatMessage({ id: 'app.settings.security.question-description' }, {}),
57 58 59 60 61
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.set" defaultMessage="Set" />
          </a>,
        ],
62 63
      },
      {
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
64 65
        title: formatMessage({ id: 'app.settings.security.email' }, {}),
        description: `${formatMessage(
66 67 68 69 70 71 72 73
          { id: 'app.settings.security.email-description' },
          {}
        )}๏ผšant***sign.com`,
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.modify" defaultMessage="Modify" />
          </a>,
        ],
74 75
      },
      {
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
76 77
        title: formatMessage({ id: 'app.settings.security.mfa' }, {}),
        description: formatMessage({ id: 'app.settings.security.mfa-description' }, {}),
78 79 80 81 82
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.bind" defaultMessage="Bind" />
          </a>,
        ],
83 84 85
      },
    ];
  };
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
86

87 88 89 90 91 92 93 94
  render() {
    return (
      <Fragment>
        <List
          itemLayout="horizontal"
          dataSource={this.getData()}
          renderItem={item => (
            <List.Item actions={item.actions}>
jim's avatar
jim committed
95
              <List.Item.Meta title={item.title} description={item.description} />
96 97 98 99 100 101 102
            </List.Item>
          )}
        />
      </Fragment>
    );
  }
}
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
103
export default SecurityView;