index.jsx 2.9 KB

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