import React, { Component } from 'react'
|
import { connect } from 'react-redux'
|
import { DndProvider } from 'react-dnd'
|
import HTML5Backend from 'react-dnd-html5-backend'
|
import { Icon, Tabs } from 'antd'
|
|
import Api from '@/api'
|
import zhCN from '@/locales/zh-CN/mob.js'
|
import enUS from '@/locales/en-US/mob.js'
|
import asyncComponent from '@/utils/asyncComponent'
|
|
import './index.scss'
|
|
const { TabPane } = Tabs
|
|
const Header = asyncComponent(() => import('@/mob/header'))
|
const MobShell = asyncComponent(() => import('@/mob/mobshell'))
|
const SourceWrap = asyncComponent(() => import('@/mob/modelsource'))
|
const DataSource = asyncComponent(() => import('@/mob/datasource'))
|
|
class Mobile extends Component {
|
state = {
|
dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
|
appId: this.props.match.params.appId,
|
appType: this.props.match.params.appType,
|
saveIng: false,
|
config: null
|
}
|
|
UNSAFE_componentWillMount() {
|
this.getPageParam(this.props.match.params.appId)
|
}
|
|
/**
|
* @description 组件销毁,清除state更新
|
*/
|
componentWillUnmount () {
|
this.setState = () => {
|
return
|
}
|
}
|
|
jumpToManage = () => {
|
this.props.history.replace('/mobmanage')
|
// this.props.history.push('/mobdesign/sdafadjfidsf/dsfsdf')
|
}
|
|
triggerSave = () => {
|
this.setState({
|
saveIng: true
|
})
|
}
|
|
getPageParam = (id) => {
|
Api.getSystemConfig({
|
func: 'sPC_Get_LongParam',
|
MenuID: id
|
}).then(result => {
|
|
})
|
}
|
|
updateConfig = () => {
|
|
}
|
|
render () {
|
const { saveIng, appType, config } = this.state
|
|
return (
|
<div className="mobile-view">
|
<Header view="design" jumpToManage={this.jumpToManage} triggerSave={this.triggerSave} saveIng={saveIng} />
|
<DndProvider backend={HTML5Backend}>
|
<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">
|
<SourceWrap appType={appType} />
|
</div>
|
</div>
|
<div className="mob-tool-other"></div>
|
</div>
|
<div className="mob-shell">
|
<MobShell />
|
</div>
|
<div className="mob-setting">
|
<Tabs defaultActiveKey="2" animated={false} size="small">
|
<TabPane tab="配置" key="1">
|
Content of Tab Pane 1
|
</TabPane>
|
<TabPane tab="数据源" key="2">
|
<DataSource config={config} updateConfig={this.updateConfig} />
|
</TabPane>
|
</Tabs>
|
</div>
|
</div>
|
</DndProvider>
|
</div>
|
)
|
}
|
}
|
|
const mapStateToProps = () => {
|
return {}
|
}
|
|
const mapDispatchToProps = () => {
|
return {}
|
}
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Mobile)
|