import React, {Component} from 'react';
|
import { Toast } from 'antd-mobile'
|
|
import Api from '@/api'
|
import asyncComponent from '@/utils/asyncPage'
|
import './index.scss';
|
|
const Login1 = asyncComponent(() => import('@/components/login/login-1'))
|
|
class Main extends Component {
|
state = {
|
viewId: this.props.match.params.viewId,
|
config: ''
|
}
|
|
UNSAFE_componentWillMount () {
|
const { viewId } = this.state
|
|
Api.getSystemConfig({
|
func: 'sPC_Get_LongParam',
|
MenuID: viewId,
|
TypeCharOne: 'mob'
|
}).then((res) => {
|
if (res.status) {
|
let config = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
|
this.setState({
|
config: config
|
})
|
} else {
|
Toast.fail(res.message, 3)
|
}
|
})
|
}
|
|
getComponents = () => {
|
const { config } = this.state
|
|
if (!config) return null
|
|
let components = []
|
|
config.components.forEach(item => {
|
if (item.type === 'login') {
|
if (item.subtype === 'mob-login-1') {
|
components.push(<Login1 key={item.uuid} config={item} />)
|
}
|
}
|
})
|
|
return components
|
}
|
|
render () {
|
return (
|
<div className="main-page">
|
{this.getComponents()}
|
</div>
|
);
|
}
|
}
|
|
export default Main;
|