content: /**
   * Created by Liyazhou on 16/8/28.
   */
  import React from 'react';
  
  import {
      View,
      Text,
      ScrollView,
      TouchableHighlight,
      StyleSheet
  } from 'react-native';
  
  import ItemBlock from './home/itembook';
  import Address from './home/address';
  import Util from './util';
  
  export default class Home extends React.Component {
      constructor(props) {
          super(props);
  
          let width = Math.floor(((Util.size.width - 20) - 50) / 4);
  
          this.state = {
              items : [
                  {
                      title : '研发',
                      partment: '框架开发',
                      color : '#126aff',
                  },
                  {
                      title : '研发',
                      partment: 'BU研发',
                      color : '#ffd600',
                  },
                  {
                      title : '产品',
                      partment: '公共蟾片',
                      color : '#f80728',
                  },
                  {
                      title : '产品',
                      partment: 'BU产品',
                      color : '#05c147',
                  },
                  {
                      title : '项目',
                      partment: '项目管理',
                      color : '#ee810d',
                  },
              ],
              width: width,
          };
      }
  
      _itemPrss(e) {
          let nav = this.props.nav;
          let key = Util.key;
          let partment = this.props.partment;
          let path = Service.host + Service.getUser;
  
          var that = this;
  
          Util.post(path, {key: key, partment: partment}, function (data) {
              this.props.navigator.push({
                  title: that.props.tag,
                  component: Address,
                  passProps: {
                      data: data,
                  },
              });
          });
      }
  
      render() {
  
          let Items1 = [];
          let Items2 = [];
          let Items = this.state.items;
  
          for (let i = 0; i < 4; i++) {
              Items1.push(
                  <ItemBlock
                      title={Items[i].title}
                      partment={Items[i].partment}
                      color={Items[i].color}
                      width={this.state.width}
                      nav={this.props.navigator}
                      itemPrss={(e)=>this._itemPrss(e)}/>
              );
          }
          for (let i = 4; i < Items.length; i++) {
              Items2.push(
                  <ItemBlock
                      title={Items[i].title}
                      partment={Items[i].partment}
                      color={Items[i].color}
                      width={this.state.width}
                      nav={this.props.navigator}
                      itemPrss={(e)=>this._itemPrss(e)}/>
              );
          }
  
          return <ScrollView style={styles.container}>
              <View style={styles.itemRow}>
                  {Items1}
              </View>
              <View style={styles.itemRow}>
                  {Items2}
              </View>
          </ScrollView>
      }
  }
  
  const styles = StyleSheet.create({
      container : {
          flex:1,
          padding:10,
      },
      itemRow: {
          flexDirection:'row',
          marginBottom:20,
      }
  });