-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
639 additions
and
527 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}} | ||
> </a> | ||
</li> | ||
)) | ||
} | ||
</ul> | ||
)} | ||
</div> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default connect(state => ({ | ||
$$user: state.$$user | ||
}), { | ||
SELECT_USER_ADDRESS, | ||
DELETE_USER_ADDRESS | ||
})(Address) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.mySlider { | ||
height: 392px; /*px*/ | ||
position: relative; | ||
& img { | ||
height: 392px; /*px*/ | ||
|
Oops, something went wrong.