import { Component } from 'react';
import Taro from '@tarojs/taro';
import { View } from '@tarojs/components'

import ListBottomStart  from '../../components/common/listBottomStart';

import './index.less';

class MyList extends Component {

  constructor(props) {
    super(props);
  }

  render () {
    return (
      <View className='indexPage'>
        <View className='list'>
          {
            this.props.list.map((v,k)=>(
              <View key={k} className='item' onClick={()=>{
                console.log('/pages/egressDetails/index?type='+this.props.type+'&id='+v.id)
                Taro.navigateTo({
                  url:'/pages/egressDetails/index?type='+this.props.type+'&dtails='+JSON.stringify(v)
                })
              }}>
                <View className='infor'>
                  <View className='title'>
                    <View className='aname'>{v.aname}提交的外出申请</View>
                    <View className='createTimes'>{v.createTimes}</View>
                  </View>
                  <View className='userName'>
                    外出地点:
                    {v.userName}
                  </View>
                  <View className='releaseStarts'>
                    开始时间:{v.releaseStarts}
                  </View>
                  <View className='releaseEnds'>
                    结束时间:{v.releaseEnds}
                    <View className='status' style={{
                      color:v.status === 0 ? '#f31212' :
                        v.status === 1 ? '#1d4fea' :
                          v.status === 2 ? '#34de38' : ''
                    }}>
                      {
                        v.status === 0 ? '驳回' :
                          v.status === 1 ? '发起' :
                            v.status === 2 ? '通过' : ''
                      }
                    </View>
                  </View>
                </View>
              </View>
            ))
          }
          <ListBottomStart
            state={this.props.listState}
            reload={()=>{
              this.props.onRefresh
            }}/>
        </View>
      </View>
    )
  }
}

export default MyList
