MyselfMobile.js
3.79 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import React from 'react';
import { Button, List } from 'antd-mobile';
import 'antd-mobile/dist/antd-mobile.css';
// import ExamineMobile from './ExamineMobile';
import * as commonConfig from '../../utils/config';
import * as commonUtils from '../../utils/utils';
import CommobileBase from '../../mobile/common/CommobileBase';
import styles from '../mobile.less';
import setting from '../../assets/mobile/setting.png';
import mailList from '../../assets/mobile/mailList.png';
import recommendation from '../../assets/mobile/recommendation.png';
import CommobileListEvent from './CommobileListEvent';
// eslint-disable-next-line prefer-destructuring
const Item = List.Item;
class myselfMobile extends React.Component {
constructor(props) {
super(props);
this.state = {
sId: props.app.userinfo.sId,
sUserName: props.app.userinfo.sUserName,
sComponanyName: props.app.systemData.findIndex(item => item.sName === 'CbxCompanyName') > -1 ? props.app.systemData.filter(item => item.sName === 'CbxCompanyName')[0].sValue : '',
};
}
btnOnclick = (value) => {
const { dispatch } = this.props;
const { sId } = this.state;
if (value === 'loginOut') {
const url = `${commonConfig.server_host}logout`;
dispatch({ type: 'app/loginOut', payload: { url, sId, loginOutType: 'loginMobileOut' } });
} else if (value === 'about') {
window.open('about.html');
} else {
dispatch({
type: 'content/onRouterMobile',
payload: {
url: `/indexMobile/${value}`,
},
});
}
}
render() {
const { sUserName, sComponanyName } = this.state;
const { slaveData } = this.props;
let sDepartName = '';
if (commonUtils.isNotEmptyArr(slaveData) && commonUtils.isNotEmptyObject(sUserName)) {
const findIndex = slaveData.findIndex(item => item.sEmployeeName === 'sUserName');
if (findIndex > -1) {
// eslint-disable-next-line prefer-destructuring
sDepartName = slaveData[findIndex].sDepartName;
} else {
sDepartName = '暂无';
}
}
const sUserNameFirst = sUserName.charAt(0);
return (
<div>
<div className={styles.myselfContent}>
<div className={styles.company}>{sComponanyName}</div>
<div className={styles.textInfo}>
<div className={styles.myselfNameFirst}>{sUserNameFirst}</div>
<div className={styles.myselfName}>
<div className={styles.myselfNameInfo}>{sUserName}</div>
<div className={styles.companyInfo}>{sDepartName}</div>
</div>
</div>
</div>
<List className={styles.myselfList}>
<Item
thumb={mailList}
arrow="horizontal"
onClick={this.btnOnclick.bind(this, 'contacts')}
style={{ margin: '10px 0' }}
>
企业通讯录
</Item>
<Item
thumb={setting}
onClick={this.btnOnclick.bind(this, 'revisePassword')}
arrow="horizontal"
style={{ margin: '10px 0' }}
>
修改密码
</Item>
<Item
thumb={recommendation}
onClick={() => {}}
arrow="horizontal"
style={{ margin: '10px 0' }}
>
推荐给好友
</Item>
<Item
thumb={setting}
onClick={this.btnOnclick.bind(this, 'about')}
arrow="horizontal"
style={{ margin: '10px 0' }}
>
关于软件
</Item>
</List>
<Button
onClick={this.btnOnclick.bind(this, 'loginOut')}
style={{ color: 'red', margin: '50px 0 10px 0' }}
>
退出登录
</Button>
</div>
);
}
}
export default CommobileBase(CommobileListEvent(myselfMobile));