File size: 2,589 Bytes
04aba1b
6b8fc2c
04aba1b
6b8fc2c
04aba1b
af3ef26
 
04aba1b
 
 
 
 
6b8fc2c
af3ef26
 
 
 
04aba1b
 
af3ef26
04aba1b
 
 
 
af3ef26
04aba1b
 
 
 
 
 
af3ef26
04aba1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
af3ef26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import { Button, FloatButton } from 'antd';
import i18n from 'i18next';
import { useTranslation } from 'react-i18next';

import authorizationUtil from '@/utils/authorizationUtil';
import { useEffect } from 'react';
import { useDispatch, useSelector } from 'umi';
import CPwModal from './CPwModal';
import List from './List';
import SAKModal from './SAKModal';
import SSModal from './SSModal';
import TntModal from './TntModal';
import styles from './index.less';

const Setting = () => {
  const dispatch = useDispatch();
  const settingModel = useSelector((state: any) => state.settingModel);
  const { t } = useTranslation();
  const userInfo = authorizationUtil.getUserInfoObject();

  const changeLang = (val: string) => {
    // 改变状态里的 语言 进行切换
    i18n.changeLanguage(val);
  };

  useEffect(() => {
    dispatch({
      type: 'settingModel/getTenantInfo',
      payload: {},
    });
  }, []);

  const showCPwModal = () => {
    dispatch({
      type: 'settingModel/updateState',
      payload: {
        isShowPSwModal: true,
      },
    });
  };
  const showTntModal = () => {
    dispatch({
      type: 'settingModel/updateState',
      payload: {
        isShowTntModal: true,
      },
    });
  };
  const showSSModal = () => {
    dispatch({
      type: 'settingModel/updateState',
      payload: {
        isShowSSModal: true,
      },
    });
  };
  return (
    <div className={styles.settingPage}>

      <div className={styles.avatar}>

        <img

          style={{ width: 50, marginRight: 5 }}

          src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png"

          alt=""

        />

        <div>

          <div>账号:{userInfo.name}</div>

          <div>

            <span>密码:******</span>

            <Button type="link" onClick={showCPwModal}>

              修改密码

            </Button>

          </div>

        </div>

      </div>

      <div>

        <Button type="link" onClick={showTntModal}>

          租户

        </Button>

        <Button type="link" onClick={showSSModal}>

          系统模型设置

        </Button>

        <List />

      </div>

      <CPwModal />

      <SAKModal />

      <SSModal />

      <TntModal />

      <FloatButton

        shape="square"

        description={t('setting.btn')}

        onClick={() => i18n.changeLanguage(i18n.language == 'en' ? 'zh' : 'en')}

        type="default"

        style={{ right: 94, fontSize: 14 }}

      />

    </div>
  );
};
export default Setting;