Skip to content

Commit

Permalink
update data
Browse files Browse the repository at this point in the history
  • Loading branch information
sayll committed Apr 25, 2017
1 parent d1074e6 commit 819160a
Show file tree
Hide file tree
Showing 22 changed files with 463 additions and 380 deletions.
6 changes: 3 additions & 3 deletions app/view/index/actions/Order.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createAction } from 'redux-actions';
import { createAction } from 'redux-actions'

export const SELECT_CARD = createAction('SELECT_CARD', cardPrice => cardPrice);
export const PAY_ORDER = createAction('PAY_ORDER', user => user);
export const SELECT_CARD = createAction('SELECT_CARD', cardPrice => cardPrice)
export const UPDATE_PRICE = createAction('UPDATE_PRICE', price => price)
6 changes: 3 additions & 3 deletions app/view/index/components/Root/Slider/slider.pcss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.mySlider {
position: relative;
& img{
& img {
height: 392px; /*px*/
width: 100%;
height: 400px;
}
& .slick-dots{
& .slick-dots {
position: absolute;
bottom: 10px;
}
Expand Down
24 changes: 12 additions & 12 deletions app/view/index/components/Service/CartList/CartList.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutableTypes from 'react-immutable-proptypes';
import { Link } from 'react-router-dom';
import { connect } from 'react-redux';
import { CLEAR_SERVICE, ADD_SERVICE_COUNT, REDUCE_SERVICE_COUNT } from '../../../actions';
import React from 'react'
import PropTypes from 'prop-types'
import ImmutableTypes from 'react-immutable-proptypes'
import { Link } from 'react-router-dom'
import { connect } from 'react-redux'
import { CLEAR_SERVICE, ADD_SERVICE_COUNT, REDUCE_SERVICE_COUNT } from '../../../actions'

function CartList(props) {
return (
<div className="cartList">
<div className="header">
<a
onTouchTap={() => { props.CLEAR_SERVICE(); }}
onTouchTap={() => props.CLEAR_SERVICE()}
className="clearAll"
>
清空
Expand Down Expand Up @@ -45,7 +45,7 @@ function CartList(props) {
}
</ul>
</div>
);
)
}

CartList.defaultProps = {
Expand All @@ -54,23 +54,23 @@ CartList.defaultProps = {
ADD_SERVICE_COUNT: () => false,
REDUCE_SERVICE_COUNT: () => false,
CLEAR_SERVICE: () => false
};
}

CartList.propTypes = {
$$order: ImmutableTypes.list,
location: PropTypes.object,
ADD_SERVICE_COUNT: PropTypes.func,
REDUCE_SERVICE_COUNT: PropTypes.func,
CLEAR_SERVICE: PropTypes.func
};
}

function mapStateToProps(state) {
return {
$$order: state.$$order
};
}
}
export default connect(mapStateToProps, {
CLEAR_SERVICE,
ADD_SERVICE_COUNT,
REDUCE_SERVICE_COUNT
})(CartList);
})(CartList)
6 changes: 5 additions & 1 deletion app/view/index/components/Service/CartList/cartList.pcss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.cartList {
padding: 90px 0;
margin: 90px 0;
background-color: #fff;
& .header {
position: fixed;
top: 0;
Expand Down Expand Up @@ -28,6 +29,9 @@
right: 30px;
font-size: 30px;
}
& ul{
padding: 20px 0;
}
& li {
width: 70%;
border-bottom: 2px solid #000; /*px*/
Expand Down
35 changes: 16 additions & 19 deletions app/view/index/components/Service/Footer/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutableTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import React from 'react'
import PropTypes from 'prop-types'
import ImmutableTypes from 'react-immutable-proptypes'
import { connect } from 'react-redux'
import { Link } from 'react-router-dom'

function Footer({ $$order, location }) {
console.log(location);
function Footer({ $$pay, location }) {
return (
<div id="serviceFooter">
<div className="content">
Expand All @@ -19,8 +18,7 @@ function Footer({ $$order, location }) {
{
<span>
{
$$order.map(item => Number.parseInt(item.get('num'), 10))
.reduce((pre, next) => pre + next) || 0
$$pay.get('num') || 0
}
</span>
}
Expand All @@ -29,8 +27,7 @@ function Footer({ $$order, location }) {
预估价格:¥
<strong>
{
$$order.map(item => Number.parseInt(item.get('price') * item.get('num'), 10))
.reduce((pre, next) => pre + next) || 0
$$pay.get('price') || 0
}
</strong>
</p>
Expand All @@ -45,21 +42,21 @@ function Footer({ $$order, location }) {
</Link>
</div>
</div>
);
)
}

Footer.defaultProps = {
$$order: [],
$$pay: {},
location: {}
};
}
Footer.propTypes = {
$$order: ImmutableTypes.list,
$$pay: ImmutableTypes.map,
location: PropTypes.object
};
}

function mapStateToProps(state) {
return {
$$order: state.$$order
};
$$pay: state.$$pay
}
}
export default connect(mapStateToProps)(Footer);
export default connect(mapStateToProps)(Footer)
109 changes: 56 additions & 53 deletions app/view/index/components/Service/Items/Items.jsx
Original file line number Diff line number Diff line change
@@ -1,77 +1,80 @@
import React, { Component } from 'react';
import immutableTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { connect } from 'react-redux';
import { ADD_SERVICE, FETCH_SERVICE } from '../../../actions';
import React, { Component } from 'react'
import immutableTypes from 'react-immutable-proptypes'
import PropTypes from 'prop-types'
import { Link } from 'react-router-dom'
import { connect } from 'react-redux'
import { ADD_SERVICE, FETCH_SERVICE } from '../../../actions'

class Items extends Component {
static propTypes() {
return {
service: immutableTypes.list,
$$service: immutableTypes.list,
ADD_SERVICE: PropTypes.func.isRequired,
FETCH_SERVICE: PropTypes.func.isRequired
};
}
}

componentWillMount() {
const props = this.props;
console.log(this.props);
props.FETCH_SERVICE(props.location.hash);
const props = this.props
props.FETCH_SERVICE(props.location.hash)
}

handleAddService(item) {
this.props.ADD_SERVICE(item);
this.props.ADD_SERVICE(item)
}

render() {
const props = this.props;
const props = this.props
return (
<div className="serviceItem">
<ul className="clear">
{
this.props.service.map(item => (
<li key={item.id}>
<Link
className="about"
to={{
pathname: '/service/about',
hash: props.location.hash
}}
<ul className="clear serviceItem">
{
this.props.$$service.map(item => (
<li key={item.id}>
<Link
className="about"
to={{
pathname: '/service/about',
hash: props.location.hash
}}
>
<img src={item.img} alt="" />
</Link>
<div className="textContent">
<h2>{item.type}</h2>
<p>注:{item.node}</p>
<p>{item.unit}</p>
<strong>{item.price}</strong>
<a
onTouchTap={() => this.handleAddService({
type: item.type,
num: 1,
node: item.node,
img: item.img,
price: item.price,
id: item.id
})}
className="shopCart"
>
<img src={item.img} alt="" />
</Link>
<div className="textContent">
<h2>{item.type}</h2>
<p>{item.node}</p>
<p>{item.unit}</p>
<strong>{item.price}</strong>
<a
onTouchTap={() => this.handleAddService({
type: item.type,
num: 1,
img: item.img,
price: item.price,
id: item.id
})}
className="shopCart"
>
<span>.</span>
</a>
</div>
</li>
))
}
</ul>
</div>
);
<span>
{
// 购买数量
props.$$order.map(o => o.get('type') === item.type && o.get('num'))
}
</span>
</a>
</div>
</li>
))
}
</ul>
)
}
}

export default connect(state => ({
order: state.order,
service: state.service
$$order: state.$$order,
$$service: state.$$service
}), {
ADD_SERVICE,
FETCH_SERVICE
})(Items);
})(Items)
7 changes: 2 additions & 5 deletions app/view/index/components/Service/Items/items.pcss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.serviceItem {
padding: 15px;
/* 顶层图片 */
& .banner {
width: 100%;
Expand Down Expand Up @@ -28,8 +27,8 @@
padding: 10px 0;
}
& img {
height: 235px; /*px*/
width: 100%;
height: 235px;
}
& p {
color: #8a8a8a;
Expand All @@ -54,15 +53,13 @@
right: -6px; /*px*/
top: -10px; /*px*/
display: block;
width: 24px;
height: 24px;
width: 24px; /*px*/
border-radius: 50%;
font-size: 20px; /*px*/
text-align: center;
line-height: 24px; /*px*/
background: #e60012;
color: #fff;
opacity: 0;
}
}
/* 添加选购的购物车 */
Expand Down
Loading

0 comments on commit 819160a

Please sign in to comment.