<commit_before>import React, { PropTypes } from 'react'
import { ListFilter } from './common/list-filter.jsx'
import { CarConfig } from './config/car-config.js'
import { MediaSlider } from './common/media-slider.jsx'
import { MediaItem } from './common/media-item.jsx'
import _ from 'lodash'



const CarItemList = React.createClass({
  render () {
    return (
      <ul className='list-recommend J_ItemBox'>
        {
          _.map(this.state.data,(v,k)=>{
            return (
              <li key={k} className='item-box'>
                <a href='/' className='img-box'>
                  <MediaItem aspectRatio={'3:2'} width={380} mediaUrl={v.coverUrlWeb || '//placehold.it/380x253'}/>
                </a>
                <div className='brd'>
                  <div className="htile">
                    <span>{v.title}</span>
                  </div>
                  <p className="pname">
                    <span className='spa1'>{v.rentalPrice===0?'面议': String.fromCharCode(165)+parseFloat(v.rentalPrice).toFixed(2)}</span>
                    <span className='spa2'>市场价：<em>{String.fromCharCode(165)+parseFloat(v.marketPrice).toFixed(2)}</em></span>
                  </p>
                </div>
              </li>
            )
          })
        }
      </ul>
    )
  },
  propTypes: {
    'dataUrl': React.PropTypes.string
  },
  getDefaultProps(){
    return {
      'dataUrl':''
    }
  },
  getInitialState(){
    return {
      data:[]
    }
  },
  componentDidMount() {
    if (this.props.dataUrl !== undefined) {
      fetch(this.props.baseUrl + this.props.dataUrl)
      .then(res => {return res.json()})
      .then(j=>{
        this.setState({ data:j.data })
        $('.J_Count').html(j.count)
      })
    }
  }
})



const Car = React.createClass({
  render () {
    return (
      <div className="zuche-view">
        <div className="bannar-all-box">
          <div className="custom-banner">
            <div id="slider_top" className="slider-box bannar"  style={{height:'450px'}}>
              <MediaSlider {...CarConfig['MediaSlider']} />
            </div>
          </div>
        </div>
        <div className="layout-center-box clearfix">
          <ListFilter title={'婚车档次'} name={'name'} klass={'ico-17-js ico-17-1-js'} valueKey={['id']} conditions={this.state.levels} sorterKey={['cityId']} />
          <ListFilter title={'婚车车型'} name={'name'} klass={'ico-17-js ico-17-2-js'} valueKey={['id']} conditions={this.state.models} sorterKey={['cityId']} />
          <ListFilter title={'婚车品牌'} name={'name'} klass={'ico-17-js ico-17-3-js'} valueKey={['id']} conditions={this.state.brands} sorterKey={['hotelType']} />
          <ListFilter title={'婚车价格'} name={'name'} klass={'ico-17-js ico-17-4-js'} valueKey={['minPrice','maxPrice']} conditions={this.state.prices} sorterKey={['minPrice','maxPrice']} />

          <p className="result">
            <span>只看车队</span>
            <input type="checkbox" name="FirstCar" className="cbox J_IsTeam" />
            <i> | </i>
            <span>{'找到相关车辆 '}</span>
            <em className='J_Count'>--</em>
            <span>{' 辆'}</span>
          </p>
          {/*<ul className="list-recommend J_ItemBox">
            {
              _.map(self.state.data,function(value,key){

                return <CarInfoItem
                    key={key}
                    title={value.title}
                    coverUrl={value.coverUrl}
                    weddingCarRentalId={value.weddingCarRentalId}
                    baseurl={self.state.url}
                    retailPrice={(parseFloat(value.rentalPrice) == 0)?'面议':(String.fromCharCode(165)+parseFloat(value.rentalPrice||'0').toFixed(2) + '')}
                    marketPrice={String.fromCharCode(165)+parseFloat(value.marketRentalPrice || '0').toFixed(2) + ''}
                    />
              })
            }
          </ul>*/}
          <CarItemList {...CarConfig['CarItemList']} />
        </div>
      </div>
    )
  },
  getInitialState() {
    return {
      data:[], // car list
      models:[],
      levels:[],
      brands:[],
      prices:CarConfig['PriceCategory']
    };
  },
  componentDidMount() {
    const ModelCategory = CarConfig['ModelCategory'] //取到配置的获取类型数据的请求地址
    if (ModelCategory.dataUrl !== undefined) {
      fetch(ModelCategory.baseUrl + ModelCategory.dataUrl)
      .then(res => {return res.json()})
      .then(j=>{
        /* 针对每个类型只取name和id字段 */
        this.setState({ models: _.map(j.data || [],(v,k)=>{ return _.pick(v,['name','id']) }) })
      })
    }

    const LevelCategory = CarConfig['LevelCategory'] //地区数据接口地址
    if (LevelCategory.dataUrl !== undefined) {
      fetch(LevelCategory.baseUrl + LevelCategory.dataUrl)
      .then(res => {return res.json()})
      .then(j=>{
        /* 针对每个地区只取name和id字段 */<commit_msg>201602291500<commit_after>import React, { PropTypes } from 'react'
import { ListFilter } from './common/list-filter.jsx'
import { CarConfig } from './config/car-config.js'
import { MediaSlider } from './common/media-slider.jsx'
import { MediaItem } from './common/media-item.jsx'
import _ from 'lodash'



const CarItemList = React.createClass({
  render () {
    return (
      <ul className='list-recommend J_ItemBox'>
        {
          _.map(this.state.data,(v,k)=>{
            return (
              <li key={k} className='item-box'>
                <a href='/' className='img-box'>
                  <MediaItem aspectRatio={'3:2'} width={380} mediaUrl={v.coverUrlWeb || '//placehold.it/380x253'}/>
                </a>
                <div className='brd'>
                  <div className="htile">
                    <span>{v.title}</span>
                  </div>
                  <p className="pname">
                    <span className='spa1'>{v.rentalPrice===0?'面议': String.fromCharCode(165)+parseFloat(v.rentalPrice).toFixed(2)}</span>
                    <span className='spa2'>市场价：<em>{String.fromCharCode(165)+parseFloat(v.marketPrice).toFixed(2)}</em></span>
                  </p>
                </div>
              </li>
            )
          })
        }
      </ul>
    )
  },
  propTypes: {
    'dataUrl': React.PropTypes.string
  },
  getDefaultProps(){
    return {
      'dataUrl':''
    }
  },
  getInitialState(){
    return {
      data:[]
    }
  },
  componentDidMount() {
    if (this.props.dataUrl !== undefined) {
      fetch(this.props.baseUrl + this.props.dataUrl)
      .then(res => {return res.json()})
      .then(j=>{
        this.setState({ data:j.data })
        $('.J_Count').html(j.count)
      })
    }
  }
})



const Car = React.createClass({
  render () {
    return (
      <div className="zuche-view">
        <div className="bannar-all-box">
          <div className="custom-banner">
            <div id="slider_top" className="slider-box bannar"  style={{height:'450px'}}>
              <MediaSlider {...CarConfig['MediaSlider']} />
            </div>
          </div>
        </div>
        <div className="layout-center-box clearfix">
          <ListFilter title={'婚车档次'} name={'name'} klass={'ico-17-js ico-17-1-js'} valueKey={['id']} conditions={this.state.levels} sorterKey={['cityId']} />
          <ListFilter title={'婚车车型'} name={'name'} klass={'ico-17-js ico-17-2-js'} valueKey={['id']} conditions={this.state.models} sorterKey={['cityId']} />
          <ListFilter title={'婚车品牌'} name={'name'} klass={'ico-17-js ico-17-3-js'} valueKey={['id']} conditions={this.state.brands} sorterKey={['hotelType']} />
          <ListFilter title={'婚车价格'} name={'name'} klass={'ico-17-js ico-17-4-js'} valueKey={['minPrice','maxPrice']} conditions={this.state.prices} sorterKey={['minPrice','maxPrice']} />

          <p className="result">
            <span>只看车队</span>
            <input type="checkbox" name="FirstCar" className="cbox J_IsTeam" />
            <i> | </i>
            <span>{'找到相关车辆 '}</span>
            <em className='J_Count'>--</em>
            <span>{' 辆'}</span>
          </p>
          <CarItemList {...CarConfig['CarItemList']} />
        </div>
      </div>
    )
  },
  getInitialState() {
    return {
      data:[], // car list
      models:[],
      levels:[],
      brands:[],
      prices:CarConfig['PriceCategory']
    };
  },
  componentDidMount() {
    const ModelCategory = CarConfig['ModelCategory'] //取到配置的获取类型数据的请求地址
    if (ModelCategory.dataUrl !== undefined) {
      fetch(ModelCategory.baseUrl + ModelCategory.dataUrl)
      .then(res => {return res.json()})
      .then(j=>{
        /* 针对每个类型只取name和id字段 */
        this.setState({ models: _.map(j.data || [],(v,k)=>{ return _.pick(v,['name','id']) }) })
      })
    }

    const LevelCategory = CarConfig['LevelCategory'] //地区数据接口地址
    if (LevelCategory.dataUrl !== undefined) {
      fetch(LevelCategory.baseUrl + LevelCategory.dataUrl)
      .then(res => {return res.json()})
      .then(j=>{
        /* 针对每个地区只取name和id字段 */
{'fraction_non_alphanumeric': 0.18645973909131805, 'fraction_numerical': 0.012708052181736392, 'mean_word_length': 2.1625177809388334, 'pattern_counts': {'":': 0, '<': 106, '<?xml version=': 0, '>': 122, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2311757', 'n_tokens_mistral': 3001, 'n_tokens_neox': 3001, 'n_words': 428}