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

const passwordStrength = {
张秀玲's avatar
张秀玲 committed
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
张秀玲's avatar
张秀玲 committed
21 22
    </font>
  ),
陈帅's avatar
陈帅 committed
23 24
};

张秀玲's avatar
张秀玲 committed
25
class SecurityView extends Component {
陈帅's avatar
陈帅 committed
26 27 28
  getData = () => {
    return [
      {
陈帅's avatar
陈帅 committed
29
        title: formatMessage({ id: 'app.settings.security.password' }, {}),
张秀玲's avatar
张秀玲 committed
30 31
        description: (
          <Fragment>
32 33
            {formatMessage({ id: 'app.settings.security.password-description' }, {})}
            {passwordStrength.strong}
张秀玲's avatar
张秀玲 committed
34 35 36 37 38 39 40
          </Fragment>
        ),
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.modify" defaultMessage="Modify" />
          </a>,
        ],
陈帅's avatar
陈帅 committed
41 42
      },
      {
陈帅's avatar
陈帅 committed
43 44
        title: formatMessage({ id: 'app.settings.security.phone' }, {}),
        description: `${formatMessage(
张秀玲's avatar
张秀玲 committed
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>,
        ],
陈帅's avatar
陈帅 committed
53 54
      },
      {
陈帅's avatar
陈帅 committed
55 56
        title: formatMessage({ id: 'app.settings.security.question' }, {}),
        description: formatMessage({ id: 'app.settings.security.question-description' }, {}),
张秀玲's avatar
张秀玲 committed
57 58 59 60 61
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.set" defaultMessage="Set" />
          </a>,
        ],
陈帅's avatar
陈帅 committed
62 63
      },
      {
陈帅's avatar
陈帅 committed
64 65
        title: formatMessage({ id: 'app.settings.security.email' }, {}),
        description: `${formatMessage(
张秀玲's avatar
张秀玲 committed
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>,
        ],
陈帅's avatar
陈帅 committed
74 75
      },
      {
陈帅's avatar
陈帅 committed
76 77
        title: formatMessage({ id: 'app.settings.security.mfa' }, {}),
        description: formatMessage({ id: 'app.settings.security.mfa-description' }, {}),
张秀玲's avatar
张秀玲 committed
78 79 80 81 82
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.bind" defaultMessage="Bind" />
          </a>,
        ],
陈帅's avatar
陈帅 committed
83 84 85
      },
    ];
  };
陈帅's avatar
陈帅 committed
86

陈帅's avatar
陈帅 committed
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} />
陈帅's avatar
陈帅 committed
96 97 98 99 100 101 102
            </List.Item>
          )}
        />
      </Fragment>
    );
  }
}
陈帅's avatar
陈帅 committed
103
export default SecurityView;