Authored by 于良

代码格式化 review by 盖剑秋

... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
import DeviceInfo from 'react-native-device-info';
let {
const {
Component,
} = React;
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
let {
const {
Component,
} = React;
... ... @@ -99,4 +99,4 @@ let styles = StyleSheet.create({
textAlign: 'center',
},
});
\ No newline at end of file
});
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
let {
const {
Component,
} = React;
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
import Immutable, {List, Record} from 'immutable';
let {
const {
Component,
} = React;
... ...
... ... @@ -6,7 +6,7 @@ import ReactNative from 'react-native';
import GuideItem from './GuideItem';
import PageControl from './PageControl';
let {
const {
Component,
} = React;
... ... @@ -23,7 +23,7 @@ export default class Guide extends Component {
constructor(props) {
super(props);
this.state = {
currentPage: 0,
containerWidth: Dimensions.get('window').width,
... ... @@ -37,21 +37,21 @@ export default class Guide extends Component {
const { width, } = e.nativeEvent.layout;
if (width !== this.state.containerWidth) {
this.setState({
containerWidth: width,
this.setState({
containerWidth: width,
});
}
}
updateSelectedPage(currentPage) {
let localCurrentPage = currentPage;
if (typeof localCurrentPage === 'object') {
localCurrentPage = currentPage.nativeEvent.position;
}
this.setState({
currentPage: localCurrentPage,
currentPage: localCurrentPage,
});
}
... ... @@ -70,7 +70,7 @@ export default class Guide extends Component {
this.updateSelectedPage(page);
}
}}>
{/*<GuideItem uri={'guide1'} text={'客源多多,免费开店'} />
<GuideItem uri={'guide2'} text={'店铺随身管,实时查看数据'} />
<GuideItem uri={'guide3'} text={'各种工具,玩转销售'} buttonText={'立即使用'} />*/}
... ... @@ -78,7 +78,7 @@ export default class Guide extends Component {
{this.props.items.map((item, i) => {
return <GuideItem key={i} uri={item.uri} text={item.text} buttonText={item.buttonText} onPress={item.onPress} />;
})}
</ScrollView>
);
} else {
... ... @@ -107,7 +107,7 @@ export default class Guide extends Component {
return (
<View onLayout={this.onLayout}>
{this.renderGuide()}
{this.renderGuide()}
<PageControl style={{position:'absolute', left:0, right:0, top: pageTop}}
numberOfPages={this.props.items.length}
... ... @@ -115,11 +115,11 @@ export default class Guide extends Component {
hidesForSinglePage={true}
pageIndicatorTintColor='gray'
currentPageIndicatorTintColor='white'
indicatorStyle={{borderRadius: 5}}
indicatorStyle={{borderRadius: 5}}
currentIndicatorStyle={{borderRadius: 5}}
indicatorSize={{width:8, height:8}}/>
</View>
);
}
}
\ No newline at end of file
}
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
import Button from 'apsl-react-native-button';
let {
const {
Component,
} = React;
... ...
... ... @@ -7,7 +7,7 @@ import TrendTextSection from './TrendTextSection';
import Placeholder from './Placeholder';
import Category from './Category';
let {
const {
Component,
} = React;
... ... @@ -52,7 +52,7 @@ export default class Home extends Component {
return (
<ScrollView>
<TrendTextSection content={this.props.section1} />
<Placeholder />
<PlainTextSection content={this.props.section2} />
... ... @@ -61,6 +61,6 @@ export default class Home extends Component {
</ScrollView>
);
}
}
\ No newline at end of file
}
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
import Button from 'apsl-react-native-button';
let {
const {
Component,
} = React;
... ... @@ -15,7 +15,7 @@ const {
Text,
Dimensions,
TextInput,
TouchableWithoutFeedback,
TouchableOpacity,
} = ReactNative;
export default class Login extends Component {
... ... @@ -38,60 +38,60 @@ export default class Login extends Component {
renderUserText() {
return (
<View style={styles.textContainer}>
<TextInput
style={styles.username}
placeholder={'账号'}
underlineColorAndroid='transparent'
onChangeText={this.props.onAccountChange}
value={this.props.account}
selectionColor={'white'}
autoCapitalize={'none'}
autoCorrect={false}
/>
<TouchableWithoutFeedback
onPress={this.props.onDeleteUserPress}>
<Image
style={styles.buttonDelete}
source={require('../images/delete.png')}
/>
</TouchableWithoutFeedback>
</View>
);
}
renderPwdText() {
return (
<View style={styles.textContainer}>
<TextInput
style={styles.pwd}
secureTextEntry={this.props.isDisplayPwd?false:true}
placeholder={'密码'}
underlineColorAndroid='transparent'
onChangeText={this.props.onPwdChange}
value={this.props.pwd}
selectionColor={'white'}
autoCapitalize={'none'}
autoCorrect={false}
/>
<TouchableWithoutFeedback
onPress={this.props.onShowPwdPress}>
<Image
style={styles.buttonDelete}
source={require('../images/eyes@2x.png')}
/>
</TouchableWithoutFeedback>
</View>
);
return (
<View style={styles.textContainer}>
<TextInput
style={styles.username}
placeholder={'账号'}
underlineColorAndroid='transparent'
onChangeText={this.props.onAccountChange}
value={this.props.account}
selectionColor={'white'}
autoCapitalize={'none'}
autoCorrect={false}
/>
<TouchableOpacity
onPress={this.props.onDeleteUserPress}>
<Image
style={styles.buttonDelete}
source={require('../images/delete.png')}
/>
</TouchableOpacity>
</View>
);
}
renderPwdText() {
return (
<View style={styles.textContainer}>
<TextInput
style={styles.pwd}
secureTextEntry={this.props.isDisplayPwd?false:true}
placeholder={'密码'}
underlineColorAndroid='transparent'
onChangeText={this.props.onPwdChange}
value={this.props.pwd}
selectionColor={'white'}
autoCapitalize={'none'}
autoCorrect={false}
/>
<TouchableOpacity
onPress={this.props.onShowPwdPress}>
<Image
style={styles.buttonDelete}
source={require('../images/eyes.png')}
/>
</TouchableOpacity>
</View>
);
}
render() {
return (
<Image style={styles.container} source={require('../images/login@2x.png')} resizeMode={'cover'} >
<Image style={styles.container} source={require('../images/login.png')} resizeMode={'cover'} >
<Image
style={styles.logo}
source={require('../images/logo@2x.png')}
source={require('../images/logo.png')}
/>
{this.renderUserText()}
{this.renderPwdText()}
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
import Button from 'apsl-react-native-button';
let {
const {
Component,
} = React;
... ... @@ -116,10 +116,10 @@ var styles = StyleSheet.create({
line:{
width: width,
height: 1,
},
icon: {
marginRight:10,
},
});
... ...
... ... @@ -7,7 +7,7 @@ import Immutable, {List} from 'immutable';
import moment from 'moment';
import ImmutablePropTypes from 'react-immutable-proptypes';
let {
const {
Component,
} = React;
... ...
... ... @@ -3,7 +3,7 @@
import React from 'react';
import ReactNative from 'react-native';
let {
const {
Component,
} = React;
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
import Button from 'apsl-react-native-button';
let {
const {
Component,
} = React;
... ... @@ -41,7 +41,7 @@ export default class ModifyPassword extends Component {
<View style={styles.container}>
<View style={styles.accountContainer }>
<Text style={styles.text}>
原密码
原密码
</Text>
<TextInput
style={styles.pwd}
... ... @@ -54,7 +54,7 @@ export default class ModifyPassword extends Component {
<View style={styles.line}/>
<View style={styles.accountContainer }>
<Text style={styles.text}>
现密码
现密码
</Text>
<TextInput
style={styles.pwd}
... ... @@ -134,6 +134,6 @@ var styles = StyleSheet.create({
line:{
width: width,
height: 1,
}
});
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
import assign from 'object-assign';
let {
const {
Component,
} = React;
... ... @@ -90,4 +90,4 @@ let styles = StyleSheet.create({
justifyContent: 'center',
flexDirection: 'row'
}
});
\ No newline at end of file
});
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
let {
const {
Component,
} = React;
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
let {
const {
Component,
} = React;
... ... @@ -28,7 +28,7 @@ export default class PlainText extends Component {
};
render() {
return (
<View style={[styles.container, this.props.containerStyle]}>
<Text style={[styles.topText, this.props.topTextStyle]}>{this.props.topText}</Text>
... ... @@ -40,7 +40,7 @@ export default class PlainText extends Component {
let styles = StyleSheet.create({
container: {
},
topText: {
fontSize: 14,
... ... @@ -58,4 +58,4 @@ let styles = StyleSheet.create({
marginBottom: 15,
},
});
\ No newline at end of file
});
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
import PlainText from './PlainText';
let {
const {
Component,
} = React;
... ... @@ -35,7 +35,7 @@ export default class PlainTextSection extends Component {
return (
<View style={[styles.container, this.props.containerStyle]}>
{this.props.content.map((item, i) => <PlainText
{this.props.content.map((item, i) => <PlainText
key={i}
topText={item.top}
bottomText={item.bottom}
... ... @@ -58,4 +58,4 @@ let styles = StyleSheet.create({
width: width / 2,
},
});
\ No newline at end of file
});
... ...
... ... @@ -8,7 +8,7 @@ import CalendarTrigger from './calendar/CalendarTrigger';
import CalendarPicker from './calendar/CalendarPicker';
import ChartView from './LineChart/ChartView'
let {
const {
Component,
} = React;
... ...
... ... @@ -8,7 +8,7 @@ import {Actions} from "react-native-router-flux";
import Immutable, {List} from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes';
let {
const {
Component,
} = React;
... ...
... ... @@ -4,7 +4,7 @@ import React from 'react';
import ReactNative from 'react-native';
let {
const {
Component,
} = React;
... ...
... ... @@ -5,7 +5,7 @@ import ReactNative from 'react-native';
import PlainText from './PlainText';
import TrendText from './TrendText';
let {
const {
Component,
} = React;
... ...
... ... @@ -3,7 +3,7 @@
import React from 'react';
import ReactNative from 'react-native';
let {
const {
Component,
} = React;
... ...
... ... @@ -12,7 +12,7 @@ import AboutUs from '../components/AboutUs';
import * as userActions from '../reducers/user/userActions';
let {
const {
Component,
} = React;
... ...
... ... @@ -14,7 +14,7 @@ import {connect} from 'react-redux';
import {Map} from 'immutable';
import {Actions} from 'react-native-router-flux';
let {
const {
Component,
} = React;
... ...
... ... @@ -13,7 +13,7 @@ import * as deviceActions from '../reducers/device/deviceActions';
import Guide from '../components/Guide';
let {
const {
Component,
} = React;
... ...
... ... @@ -14,7 +14,7 @@ import * as homeActions from '../reducers/home/homeActions';
import * as messageActions from '../reducers/message/messageActions';
import CONFIG from '../constants/config';
let {
const {
Component,
} = React;
... ...
... ... @@ -12,7 +12,7 @@ import * as userActions from '../reducers/user/userActions';
import * as deviceActions from '../reducers/device/deviceActions';
import Login from '../components/Login';
let {
const {
Component,
} = React;
... ...
... ... @@ -12,7 +12,7 @@ import * as userActions from '../reducers/user/userActions';
import * as deviceActions from '../reducers/device/deviceActions';
import Logout from '../components/Logout';
let {
const {
Component,
} = React;
... ... @@ -87,7 +87,7 @@ export default class LogoutContainer extends Component {
render(){
return (
<Logout
<Logout
account={this.props.user.profile.account}
username={this.props.user.profile.username}
pwd={this.props.user.profile.password}
... ...
... ... @@ -12,7 +12,7 @@ import Message from '../components/Message';
import * as messageActions from '../reducers/message/messageActions';
let {
const {
Component,
} = React;
... ...
... ... @@ -13,7 +13,7 @@ import * as messageActions from '../reducers/message/messageActions';
import * as deviceActions from '../reducers/device/deviceActions';
import MessageDetail from '../components/MessageDetail';
let {
const {
Component,
} = React;
... ...
... ... @@ -12,7 +12,7 @@ import * as userActions from '../reducers/user/userActions';
import * as deviceActions from '../reducers/device/deviceActions';
import ModifyPassword from '../components/ModifyPassword';
let {
const {
Component,
} = React;
... ... @@ -98,13 +98,13 @@ export default class ModifyPasswordContainer extends Component {
Alert.alert(
'密码不相同'
);
}
}
render() {
return (
<ModifyPassword
<ModifyPassword
oldPwd={this.props.user.password.old}
newPwd={this.props.user.password.new}
repeatPwd={this.props.user.password.repeat}
... ...
... ... @@ -15,7 +15,7 @@ import moment from 'moment';
import Immutable, {List, Record} from 'immutable';
import config from '../constants/config';
let {
const {
Component,
} = React;
... ...
... ... @@ -12,7 +12,7 @@ import User from '../components/User';
import * as userActions from '../reducers/user/userActions';
let {
const {
Component,
} = React;
... ...
'use strict';
import store from 'react-native-simple-store';
import CONFIG from '../constants/config';
export default class AppAuthToken {
/**
* ## AppAuthToken
*
* set the key from the config
*/
constructor () {
this.SESSION_TOKEN_KEY = CONFIG.storeKey.SESSION_TOKEN_KEY;
}
/**
* ### storeSessionToken
* Store the session key
*/
storeSessionToken(sessionToken) {
return store.save(this.SESSION_TOKEN_KEY, {
sessionToken: sessionToken
});
}
/**
* ### getSessionToken
*/
getSessionToken() {
return store.get(this.SESSION_TOKEN_KEY);
}
/**
* ### deleteSessionToken
* Deleted during log out
*/
deleteSessionToken() {
return store.delete(this.SESSION_TOKEN_KEY);
}
}
'use strict';
import {Platform} from "react-native";
import {Platform, Dimensions} from 'react-native';
import CONFIG from '../constants/config';
import DeviceInfo from 'react-native-device-info';
import queryString from 'query-string';
... ... @@ -162,8 +162,8 @@ export default class Request {
_publicParams() {
let app_version = DeviceInfo.getBuildNumber();
let os_version = DeviceInfo.getSystemVersion();
let client_type = React.Platform.OS === 'ios' ? 'iphone' : 'android';
let {height, width} = React.Dimensions.get('window');
let client_type = Platform.OS === 'ios' ? 'iphone' : 'android';
let {height, width} = Dimensions.get('window');
let screen_size = width + 'x' + height;
return {
... ...
... ... @@ -3,7 +3,7 @@
export default function timeoutPromise(ms, promise) {
return new Promise((resolve, reject) => {
const timeoutId = setTimeout(() => {
reject(new Error("promise timeout"))
reject(new Error("Network timeout"))
}, ms);
promise.then(
(res) => {
... ... @@ -16,4 +16,4 @@ export default function timeoutPromise(ms, promise) {
}
);
});
}
\ No newline at end of file
}
... ...