king
2020-06-16 1dfbdd345812e76abdeec3ee5efe9424dc13a733
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
import React, {Component} from 'react'
import {connect} from 'react-redux'
import { Icon } from 'antd'
 
import zhCN from '@/locales/zh-CN/login.js'
import enUS from '@/locales/en-US/login.js'
import asyncComponent from '@/utils/asyncComponent'
 
import './index.scss'
 
const Header = asyncComponent(() => import('@/mob/header'))
const Home = asyncComponent(() => import('@/mob/home'))
const Login = asyncComponent(() => import('@/mob/login'))
 
class Mobile extends Component {
  state = {
    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    view: null
  }
 
  UNSAFE_componentWillMount() {
    this.setState({
      view: {uuid: 'login', type: 'home', parentId: null, parentType: null}
    })
  }
 
  /**
   * @description 组件销毁,清除state更新
   */
  componentWillUnmount () {
    this.setState = () => {
      return
    }
  }
 
  render () {
    const { view } = this.state
 
    return (
      <div className="mobile-view">
        <Header />
        <div className="mob-body">
          <div className="mob-tool">
            <div className="mob-tool-content">
              <div className="plus-content">
                <Icon type="plus-circle" />添 加 内 容
              </div>
              <div className="useable-component"></div>
            </div>
            <div className="mob-tool-other"></div>
          </div>
          <div className="mob-shell">
            {view ? <div className="mob-shell-inner">
              {view.type === 'login' ? <Login /> : null}
              {view.type === 'home' ? <Home /> : null}
            </div> : null}
          </div>
          <div className="mob-setting">
          </div>
        </div>
      </div>
    )
  }
}
 
const mapStateToProps = () => {
  return {}
}
 
const mapDispatchToProps = () => {
  return {}
}
 
export default connect(mapStateToProps, mapDispatchToProps)(Mobile)