ExamineMobile.js
1.08 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
import React from 'react';
import { connect } from 'umi';
import ExamineMobileComponent from '../../../mobile/common/ExamineMobile';
import * as commonUtils from '../../../utils/utils';
function ExamineMobile({
dispatch, app, content, sModelsId, location,
}) {
/* 只有state与sModelsId同时为空时 返回空白页,设备是固定模块id */
if (location.state === null && commonUtils.isEmptyObject(sModelsId)) {
return (<div />);
}
function removePane(changePanes, currentPane) {
dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
}
let param = {};
if (commonUtils.isNotEmptyObject(location.state) && location.state.sParam) {
param = commonUtils.convertStrToObj(location.state.sParam);
} else {
param = commonUtils.convertStrToObj(location.state);
}
const ExamineMobileProps = {
sModelsId,
app,
content,
dispatch,
...param,
onRemovePane: removePane,
};
return (
<ExamineMobileComponent {...ExamineMobileProps} />
);
}
export default connect(({ app, content }) =>
({ app, content }))(ExamineMobile);