Authored by 于良

增加登录时加载中提示框,登录成功后设置home中当前的品牌id和name review by 盖剑秋

'use strict';
import Immutable, {List, Record} from 'immutable';
import ActivityIndicator from './ActivityIndicator'
import LoadMoreIndicator from './indicator/LoadMoreIndicator'
import React, {Component} from 'react';
import {
... ... @@ -9,9 +9,7 @@ import {
Text,
ListView,
Dimensions,
ActivityIndicatorIOS,
Platform,
ProgressBarAndroid,
} from 'react-native';
... ... @@ -97,7 +95,7 @@ export default class AccountSettlement extends Component {
let loadText = 'All data loaded';
if (!this.props.reachEnd) {
loadText = isFetching?'加载中':'上拉加载更多';
loadText = isFetching?'正在加载...':'上拉加载更多';
}
return (
... ... @@ -110,7 +108,7 @@ export default class AccountSettlement extends Component {
onEndReached={this.props.fetchNextPage}
enableEmptySections={true}
renderFooter={()=>{
return <ActivityIndicator
return <LoadMoreIndicator
hidden={this.props.hideLoadingFooter}
loadingText={loadText}
animating={isFetching}
... ...
This diff could not be displayed because it is too large.
... ... @@ -3,6 +3,7 @@
import React from 'react';
import ReactNative from 'react-native';
import Button from 'apsl-react-native-button';
import LoadingIndicator from './indicator/LoadingIndicator';
const {
Component,
... ... @@ -95,12 +96,17 @@ export default class Login extends Component {
/>
{this.renderUserText()}
{this.renderPwdText()}
<Button style={styles.button}
<Button
style={styles.button}
textStyle={styles.buttonText}
onPress={this.props.onLoginPress}
>
登录
</Button>
<LoadingIndicator
isVisible={this.props.isFetching}
/>
</Image>
);
}
... ...
... ... @@ -12,7 +12,7 @@ import TrendTextSection from './TrendTextSection';
import Placeholder from './Placeholder';
import CalendarTrigger from './calendar/CalendarTrigger';
import CalendarPicker from './calendar/CalendarPicker';
import ChartView from './LineChart/ChartView'
import ChartView from './chart/ChartView'
export default class RefoundStatistics extends Component {
... ...
... ... @@ -6,7 +6,7 @@ import TrendTextSection from './TrendTextSection';
import Placeholder from './Placeholder';
import CalendarTrigger from './calendar/CalendarTrigger';
import CalendarPicker from './calendar/CalendarPicker';
import ChartView from './LineChart/ChartView'
import ChartView from './chart/ChartView'
const {
Component,
... ...
This diff could not be displayed because it is too large.
'use strict';
import React, {Component} from 'react'
import {
StyleSheet,
... ... @@ -9,7 +11,7 @@ import {
ProgressBarAndroid,
} from 'react-native';
export default class ActivityIndicator extends Component {
export default class LoadMoreIndicator extends Component {
renderFooter() {
if (this.props.hidden) {
... ... @@ -18,15 +20,21 @@ export default class ActivityIndicator extends Component {
if (Platform.OS === 'android') {
return (
<View style={styles.footerContainer}>
<ProgressBarAndroid style={styles.footerIndicator}/>
<Text style = {styles.footerText}>{this.props.loadingText}</Text>
{this.props.animating ?
<ProgressBarAndroid style={styles.footerIndicator} styleAttr={'SmallInverse'} /> :
null}
<Text style={styles.footerText}>{this.props.loadingText}</Text>
</View>
)
} else {
return (
<View style={styles.footerContainer}>
<ActivityIndicatorIOS style={styles.footerIndicator} size='small' animating={this.props.animating}/>
<Text style = {styles.footerText}>{this.props.loadingText}</Text>
{this.props.animating ?
<ActivityIndicatorIOS style={styles.footerIndicator} size={'small'} /> :
null}
<Text style={styles.footerText}>{this.props.loadingText}</Text>
</View>
)
}
... ... @@ -41,18 +49,19 @@ export default class ActivityIndicator extends Component {
}
const styles = StyleSheet.create({
footerContainer: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
height: 44,
},
footerIndicator: {
marginTop: 15,
marginLeft: Dimensions.get('window').width/2-50,
marginRight: 10,
// marginTop: 15,
// marginLeft: Dimensions.get('window').width/2-50,
// marginRight: 10,
},
footerText: {
marginTop: 17,
marginLeft: 10,
textAlign: 'center',
color:'#b1b1b1',
},
... ...
'use strict';
import React, {Component} from 'react'
import {
StyleSheet,
View,
Text,
Dimensions,
ActivityIndicatorIOS,
Platform,
ProgressBarAndroid,
} from 'react-native';
export default class LoadingIndicator extends Component {
static propTypes = {
isVisible: React.PropTypes.bool.isRequired,
size: React.PropTypes.string,
color: React.PropTypes.string,
overlayWidth: React.PropTypes.number,
overlayHeight: React.PropTypes.number,
overlayColor: React.PropTypes.string,
text: React.PropTypes.string,
textColor: React.PropTypes.string,
textFontSize: React.PropTypes.number,
};
static defaultProps = {
isDismissible: false,
overlayWidth: 100,
overlayHeight: 100,
overlayColor: 'rgba(0,0,0,0.6)',
size: (Platform.OS === 'ios') ? 'large' : 'Normal',
color: (Platform.OS === 'ios') ? 'gray' : 'gray',
text: '加载中...',
textColor: '#eeeeee',
textFontSize: 14,
};
render() {
if (!this.props.isVisible) {
return null;
}
let customStyles = StyleSheet.create({
overlay: {
alignItems: 'center',
justifyContent: 'center',
borderRadius: 10,
backgroundColor: this.props.overlayColor,
width: this.props.overlayWidth,
height: this.props.overlayHeight,
},
text: {
color: this.props.textColor,
fontSize: this.props.textFontSize,
marginTop: 8,
},
});
return (
<View style={styles.container}>
<View style={customStyles.overlay}>
{(Platform.OS === 'ios') ?
<ActivityIndicatorIOS color={this.props.color} size={this.props.size} /> :
<ProgressBarAndroid styleAttr={this.props.size} color={this.props.color}/>}
<Text style={customStyles.text}>{this.props.text}</Text>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
position: 'absolute',
backgroundColor: 'transparent',
justifyContent: 'center',
alignItems: 'center',
top: 0,
bottom: 0,
left: 0,
right: 0,
},
});
... ...
module.exports = {
dev: {
// baseUrl: 'http://testapi.yoho.cn:28077',
baseUrl: 'http://172.16.6.108:8080',
iosPrivateKey: 'a85bb0674e08986c6b115d5e3a4884fa',
baseUrl: 'http://192.168.102.205:8080',
androidPrivateKey: 'fd4ad5fcfa0de589ef238c0e7331b585',
httpTimeout: 30000, //毫秒
},
prd: {
baseUrl: 'http://172.16.6.108:8080',
iosPrivateKey: 'a85bb0674e08986c6b115d5e3a4884fa',
baseUrl: 'http://192.168.102.205:8080',
androidPrivateKey: 'fd4ad5fcfa0de589ef238c0e7331b585',
HTTPTimeout: 30000, //毫秒
... ...
... ... @@ -67,8 +67,8 @@ export default function userReducer(state = initialState, action) {
case HOME_OVERVIEW_SUCCESS: {
let nextState = state.set('isFetching', false)
.set('error', null)
.setIn(['overview', 'goodsCount'], action.payload.buyNumbers)
.setIn(['overview', 'goodsAmount'], action.payload.orderAmount);
.setIn(['overview', 'goodsCount'], action.payload.buyNumbers || 0)
.setIn(['overview', 'goodsAmount'], action.payload.orderAmount || 0);
return nextState;
}
... ... @@ -76,7 +76,7 @@ export default function userReducer(state = initialState, action) {
let rise = Math.abs(action.payload.rankChange) == action.payload.rankChange ? true : false;
let nextState = state.set('isFetching', false)
.set('error', null)
.setIn(['overview', 'rank'], action.payload.rankNow)
.setIn(['overview', 'rank'], action.payload.rankNow || 0)
.setIn(['overview', 'rise'], rise)
.setIn(['overview', 'riseCount'], Math.abs(action.payload.rankChange))
return nextState;
... ...
... ... @@ -230,6 +230,7 @@ export function login(account, password) {
return userService.storeUserInfo(json)
.then(() => {
dispatch(loginSuccess(json));
dispatch(setupHomeDefaultBrand(json.shops[0].shopsId, json.shops[0].shopName))
Actions.Drawer();
});
})
... ... @@ -260,7 +261,7 @@ export function getStoredUserInfo() {
.then(userInfo => {
if (userInfo) {
dispatch(storedUserInfo(userInfo));
dispatch(setupHomeDefaultBrand(userInfo.shops[0].shopsId, userInfo.shops[0].shopsName))
dispatch(setupHomeDefaultBrand(userInfo.shops[0].shopsId, userInfo.shops[0].shopName));
}
});
... ...
'use strict';
// let RNAutoUpdater = require('react-native').NativeModules.RNAutoUpdater;
import {NativeModules} from 'react-native';
// let RNAutoUpdater = NativeModules.RNAutoUpdater;
const INSTALL_MODE_IMMEDIATE = 1; //立即加载
const INSTALL_MODE_ON_NEXT_START = 2; //下次重新启动时加载
... ...
'use strict';
let RNNativeConfig = require('react-native').NativeModules.RNNativeConfig;
import {NativeModules} from 'react-native';
let RNNativeConfig = NativeModules.RNNativeConfig;
/**
*
... ...
... ... @@ -6,6 +6,7 @@ import DeviceInfo from 'react-native-device-info';
import queryString from 'query-string';
import md5 from 'md5';
import timeoutPromise from '../utils/timeoutPromise';
import RNNativeConfig from './RNNativeConfig';
export default class Request {
... ... @@ -17,7 +18,7 @@ export default class Request {
this.privateKey = '';
if (Platform.OS === 'ios') {
this.privateKey = this.config.iosPrivateKey;
this.privateKey = RNNativeConfig.getPrivateKey();
} else {
this.privateKey = this.config.androidPrivateKey;
}
... ...