Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sayll committed Apr 27, 2017
1 parent 819160a commit cdf63ae
Show file tree
Hide file tree
Showing 43 changed files with 639 additions and 527 deletions.
1 change: 1 addition & 0 deletions app/source/css/parts/phoneReset.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ html {
color: #000;
background: #fff;
-webkit-text-size-adjust: 100%;
-webkit-overflow-scrolling: touch;
-ms-text-size-adjust: 100%
}

Expand Down
Binary file added app/source/img/service/purge/item10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/source/img/service/purge/item6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/source/img/service/purge/item7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/source/img/service/purge/item8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/source/img/service/purge/item9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion app/view/index/actions/Order.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createAction } from 'redux-actions'

export const SELECT_CARD = createAction('SELECT_CARD', cardPrice => cardPrice)
export const UPDATE_PRICE = createAction('UPDATE_PRICE', price => price)
export const UPDATE_PRICE = createAction('UPDATE_PRICE', price => price)
export const UPDATE_SERVICE_TIME = createAction('UPDATE_SERVICE_TIME', time => time)
6 changes: 6 additions & 0 deletions app/view/index/actions/User.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createAction } from 'redux-actions'

export const FETCH_USER = createAction('FETCH_USER', items => items)
export const ADD_USER_ADDRESS = createAction('ADD_USER_ADDRESS', item => item)
export const DELETE_USER_ADDRESS = createAction('DELETE_USER_ADDRESS', key => key)
export const SELECT_USER_ADDRESS = createAction('SELECT_USER_ADDRESS', key => key)
1 change: 1 addition & 0 deletions app/view/index/actions/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import { createAction } from 'redux-actions';

export * from './Order';
export * from './Service';
export * from './User'
export const FETCH_ROOT_LIST = createAction('FETCH_ROOT_LIST');
export const GET_ROOT_LIST = createAction('GET_ROOT_LIST', items => items);
107 changes: 107 additions & 0 deletions app/view/index/components/AddAddress/AddAddress.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import React, { Component } from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import ImmutableTypes from 'react-immutable-proptypes'
import {
ADD_USER_ADDRESS
} from '../../actions'

class AddAddress extends Component {
static propTypes() {
return {
location: PropTypes.object,
$$user: ImmutableTypes.map,
ADD_USER_ADDRESS: PropTypes.func
}
}

shouldComponentUpdate() {
return false
}

render() {
const props = this.props
const address = props.$$user.get('address')
return (
<div id="addAddress">
<div className="header">
<a
onTouchTap={() => {
props.history.goBack()
}}
>X</a>
<h1>添加地址</h1>
</div>
<p>
请填写一下信息:
</p>
<ul>
<li>
<input
type="text"
placeholder="请输入姓名"
ref={e => {
this.name = e
}}
/>
</li>
<li>
<input
type="text"
placeholder="请输入手机号"
ref={e => {
this.phone = e
}}
/>
</li>
<li>
<input
type="text"
placeholder="详细地址(如余姚市xx街道xx号xx小区xx幢xx楼xx号)"
ref={e => {
this.address = e
}}
/>
</li>
</ul>
<input
type="button"
value="确认"
onTouchTap={() => {
if (this.name.value && this.phone.value.length === 11 && this.address.value) {
props.ADD_USER_ADDRESS({
name: this.name.value,
phone: this.phone.value,
address: this.address.value,
id: address[address.length - 1].id + 1
})
props.history.goBack()
}
else if (this.phone.value.length !== 11) {
this.phone.style.background = 'rgb(255, 237, 0)'
}
else {
const inputs = [this.name, this.phone, this.address]
inputs.map(item => {
/* eslint no-param-reassign:off */
if (!item.value) {
item.style.background = 'rgb(255, 237, 0)'
}
else {
item.style.background = 'rgb(255, 255, 255)'
}
return false
})
}
}}
/>
</div>
)
}
}

export default connect(state => ({
$$user: state.$$user
}), {
ADD_USER_ADDRESS
})(AddAddress)
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@
}

&:nth-child(1)::before {
background: url("../../../../../source/img/user/userName.png") no-repeat;
background: url("../../../../source/img/user/userName.png") no-repeat;
background-size: cover;
}
&:nth-child(2)::before {
background: url("../../../../../source/img/user/userPhone.png") no-repeat;
background: url("../../../../source/img/user/userPhone.png") no-repeat;
background-size: cover;
}
&:nth-child(3)::before {
background: url("../../../../../source/img/user/userMap.png") no-repeat;
background: url("../../../../source/img/user/userMap.png") no-repeat;
background-size: cover;
}
}
Expand Down
93 changes: 93 additions & 0 deletions app/view/index/components/Address/Address.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import React, { PureComponent } 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 {
SELECT_USER_ADDRESS,
DELETE_USER_ADDRESS
} from '../../actions'
import Header from '../Header'

class Address extends PureComponent {
static propTypes() {
return {
$$user: ImmutableTypes.map,
location: PropTypes.object,
SELECT_USER_ADDRESS: PropTypes.func,
DELETE_USER_ADDRESS: PropTypes.func
}
}

constructor(...props) {
super(props)
}

render() {
const props = this.props
return (
<div className="address">
<div className="addAddress">
<Header
title={'选择地址'}
href={
props.location.pathname === '/user/address' ?
'/user' : `/service/ordering${props.location.hash}`
}
white
/>
<Link to={`/service/addAddress${props.location.hash}`}>新添地址</Link>
</div>
<div className="addressList">
{/* 判断是否有地址,让div占据真个div覆盖背景 */}
{1 && (
<ul>
{
props.$$user.get('address').map(item => (
<li
className={item.id === props.$$user.get('defaultAddressId') && 'active'}
key={item.id}
onTouchTap={e => {
e.preventDefault()
props.SELECT_USER_ADDRESS(item.id)

props.history.push(
props.location.pathname === '/user/address' ?
'/user' : `/service/ordering${props.location.hash}`
)
}}
>
<a className="textContent">
<p>
<span>用户:{item.name}</span>
手机号:{item.phone}
</p>
<p>
地址:{item.address}
</p>
</a>
<a
className="clearAddress"
onTouchTap={e => {
e.stopPropagation()
props.DELETE_USER_ADDRESS(item.id)
return false
}}
>&nbsp;</a>
</li>
))
}
</ul>
)}
</div>
</div>
)
}
}

export default connect(state => ({
$$user: state.$$user
}), {
SELECT_USER_ADDRESS,
DELETE_USER_ADDRESS
})(Address)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
.addressList {
width: 100%;
height: calc(100vh - 90px); /*px*/
background: url("../../../../../source/img/user/noArea.png") no-repeat center;
background: url("../../../../source/img/user/noArea.png") no-repeat center;
background-size: 60%;
& ul {
box-sizing: border-box;
Expand Down Expand Up @@ -62,7 +62,7 @@
top: 24px;
width: 40px;
height: 40px;
background: url("../../../../../source/img/user/clearAddress.png") no-repeat;
background: url("../../../../source/img/user/clearAddress.png") no-repeat;
background-size: cover;
}
}
56 changes: 36 additions & 20 deletions app/view/index/components/Order/Pay/Pay.jsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import React, { Component } from 'react'
import { connect } from 'react-redux'
import ImmutableTypes from 'react-immutable-proptypes'
import { Link } from 'react-router-dom'

const orderPay = {
price: '45',
track: '20',
type: '洗衣',
};
type: '洗衣'
}

class Pay extends Component {
static propTypes() {
return {
$$pay: ImmutableTypes.map
}
}

constructor(props) {
super(props);
super(props)
this.state = {
mode: '余额',
};
mode: '余额'
}
}

tabMode(value) {
this.setState({
mode: value,
});
mode: value
})
}

render() {
const pay = this.props.pay;
console.log(pay.toJS(), pay.get('useCard'));
const $$pay = this.props.$$pay
return (
<div id="pay">
{
Expand All @@ -51,7 +57,11 @@ class Pay extends Component {
}
<div className="card">
优惠卷
<Link to={'/order/pay/card'}>{pay.get('useCard') ? pay.get('useCard') : '请选择优惠卷 >'}</Link>
<Link
to={'/order/pay/card'}
>
{$$pay.get('useCard') ? $$pay.get('useCard') : '请选择优惠卷 >'}
</Link>
</div>
{
<ul className="pay">
Expand All @@ -64,7 +74,9 @@ class Pay extends Component {
</li>
<li
className={this.state.mode === '余额' && 'active'}
onTouchTap={() => { this.tabMode('余额'); }}
onTouchTap={() => {
this.tabMode('余额')
}}
>
余额宝
<span className="red">
Expand All @@ -73,13 +85,17 @@ class Pay extends Component {
</li>
<li
className={this.state.mode === '微信' && 'active'}
onTouchTap={() => { this.tabMode('微信'); }}
onTouchTap={() => {
this.tabMode('微信')
}}
>
微信支付
</li>
<li
className={this.state.mode === '现金' && 'active'}
onTouchTap={() => { this.tabMode('现金'); }}
onTouchTap={() => {
this.tabMode('现金')
}}
>
现金支付
</li>
Expand All @@ -90,13 +106,13 @@ class Pay extends Component {
</p>
<input type="button" value="立即支付" />
</div>
);
)
}
}

function mapStateToProps(state) {
return {
pay: state.pay,
};
$$pay: state.$$pay
}
}
export default connect(mapStateToProps)(Pay);
export default connect(mapStateToProps)(Pay)
1 change: 1 addition & 0 deletions app/view/index/components/Root/Slider/slider.pcss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.mySlider {
height: 392px; /*px*/
position: relative;
& img {
height: 392px; /*px*/
Expand Down

0 comments on commit cdf63ae

Please sign in to comment.