index.jsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. import { Component } from 'react'
  2. import { connect } from 'react-redux'
  3. import {View} from '@tarojs/components'
  4. import { AtSteps,AtTabs, AtTabsPane } from 'taro-ui'
  5. import 'taro-ui/dist/style/components/steps.scss';
  6. import 'taro-ui/dist/style/components/icon.scss';
  7. import 'taro-ui/dist/style/components/tabs.scss';
  8. import UserFloatingLayer from '../../components/common/userFloatingLayer';
  9. import { add, minus, asyncAdd } from '../../actions/counter';
  10. import Enterprise from './enterprise';
  11. import PublicContent from './publicContent';
  12. import Result from './result';
  13. import './index.less'
  14. import Taro from '@tarojs/taro';
  15. const items = [
  16. { 'title': '选择公出企业' },
  17. { 'title': '填写公出内容'},
  18. { 'title': '提交公出审核' }
  19. ]
  20. @connect(({ counter }) => ({
  21. counter
  22. }), (dispatch) => ({
  23. add () {
  24. dispatch(add())
  25. },
  26. dec () {
  27. dispatch(minus())
  28. },
  29. asyncAdd () {
  30. dispatch(asyncAdd())
  31. }
  32. }))
  33. class ApplyDepart extends Component {
  34. constructor(props) {
  35. super(props);
  36. this.state={
  37. current:1,
  38. enterpriseInfor:{},
  39. selectArrderLocation:{},
  40. resultState:0
  41. }
  42. }
  43. componentDidShow () {
  44. Taro.eventCenter.on('enterprise', (arg) => {
  45. this.setState({
  46. current:1,
  47. enterpriseInfor:arg
  48. })
  49. })
  50. Taro.eventCenter.on('publicContent', (arg) => {
  51. this.setState({
  52. current:2,
  53. resultState:arg
  54. })
  55. })
  56. Taro.eventCenter.on('enterpriseBack', () => {
  57. this.setState({
  58. current:0,
  59. })
  60. })
  61. Taro.eventCenter.on('result', () => {
  62. this.setState({
  63. current:0,
  64. enterpriseInfor:{},
  65. selectArrderLocation:{},
  66. resultState:0
  67. })
  68. })
  69. //获取地区选定数据
  70. const chooseLocation = requirePlugin('chooseLocation');
  71. const location = chooseLocation.getLocation();
  72. if(location){
  73. this.setState({
  74. selectArrderLocation: location
  75. })
  76. }
  77. }
  78. componentDidMount() {
  79. }
  80. render () {
  81. return (
  82. <View className='applyDepart'>
  83. <UserFloatingLayer/>
  84. <View className='atStepsContent'>
  85. <AtSteps
  86. items={items}
  87. current={this.state.current}
  88. />
  89. <View className='content'>
  90. <View style={{display:this.state.current===0 ? 'block' : 'none'}}>
  91. <Enterprise/>
  92. </View>
  93. <View style={{display:this.state.current===1 ? 'block' : 'none'}}>
  94. <PublicContent enterpriseInfor={this.state.enterpriseInfor} selectArrderLocation={this.state.selectArrderLocation}/>
  95. </View>
  96. <View style={{display:this.state.current===2 ? 'block' : 'none'}}>
  97. <Result resultState={this.state.resultState}/>
  98. </View>
  99. </View>
  100. </View>
  101. </View>
  102. )
  103. }
  104. }
  105. export default ApplyDepart