|
@@ -44,7 +44,7 @@ export default class ChargeAdapter extends Component {
|
|
|
component: Reserve
|
|
component: Reserve
|
|
|
}/*, {
|
|
}/*, {
|
|
|
title: "Explore",
|
|
title: "Explore",
|
|
|
- component: Reserve
|
|
|
|
|
|
|
+ component: Explore
|
|
|
}*/]
|
|
}*/]
|
|
|
this.tabBarStyle = {
|
|
this.tabBarStyle = {
|
|
|
style: styles.tabStyle,
|
|
style: styles.tabStyle,
|
|
@@ -54,6 +54,7 @@ export default class ChargeAdapter extends Component {
|
|
|
activeTintColor: textPrimary,
|
|
activeTintColor: textPrimary,
|
|
|
inactiveTintColor: textSecondary //"#E0E0E0",
|
|
inactiveTintColor: textSecondary //"#E0E0E0",
|
|
|
}
|
|
}
|
|
|
|
|
+ this.action = "";
|
|
|
this.isHide = false;
|
|
this.isHide = false;
|
|
|
this.titleName = "";
|
|
this.titleName = "";
|
|
|
}
|
|
}
|
|
@@ -101,9 +102,6 @@ export default class ChargeAdapter extends Component {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
action: act
|
|
action: act
|
|
|
});
|
|
});
|
|
|
- if (act == 'qr') {
|
|
|
|
|
- //this.onEnterStation();
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -128,11 +126,6 @@ export default class ChargeAdapter extends Component {
|
|
|
});
|
|
});
|
|
|
//if (this.action !== 'view')
|
|
//if (this.action !== 'view')
|
|
|
this.updateStationInfo();
|
|
this.updateStationInfo();
|
|
|
- if (this.action == 'qr') {
|
|
|
|
|
- // setTimeout(() => {
|
|
|
|
|
- // this.changeTab(1)
|
|
|
|
|
- // }, 300);
|
|
|
|
|
- }
|
|
|
|
|
} else {
|
|
} else {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
showLoginDialog: true
|
|
showLoginDialog: true
|
|
@@ -152,28 +145,42 @@ export default class ChargeAdapter extends Component {
|
|
|
updateStationInfo() {
|
|
updateStationInfo() {
|
|
|
navigator.geolocation.getCurrentPosition(location => {
|
|
navigator.geolocation.getCurrentPosition(location => {
|
|
|
let params = {
|
|
let params = {
|
|
|
- lat: location.coords.latitude,
|
|
|
|
|
- lng: location.coords.longitude,
|
|
|
|
|
- sitePk: this.state.stationInfo.id
|
|
|
|
|
|
|
+ latitude: location.coords.latitude,
|
|
|
|
|
+ longitude: location.coords.longitude,
|
|
|
}
|
|
}
|
|
|
- apiStation.getStationRate(params).then(res => {
|
|
|
|
|
- if (res.data.sitePk) {
|
|
|
|
|
- var info = utils.getSiteInfo(res.data);
|
|
|
|
|
- PagerUtil.setStationInfo(info);
|
|
|
|
|
- PagerUtil.setRefreshing(getFocusedRouteNameFromRoute(this.props.route));
|
|
|
|
|
- this.setState({
|
|
|
|
|
- refreshing: false,
|
|
|
|
|
- stationInfo: info
|
|
|
|
|
- }, () => {
|
|
|
|
|
- this.setPageTitle();
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }).catch(err => {
|
|
|
|
|
- toastLong(err);
|
|
|
|
|
|
|
+ this.getStationInfo(params)
|
|
|
|
|
+ }, err => {
|
|
|
|
|
+ this.getStationInfo()
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ getStationInfo(location={}) {
|
|
|
|
|
+ apiStation.getStationRate({
|
|
|
|
|
+ sitePk: this.state.stationInfo.id,
|
|
|
|
|
+ lat: location?.latitude,
|
|
|
|
|
+ lng: location?.longitude
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if (res.data.sitePk) {
|
|
|
|
|
+ var info = utils.getSiteInfo(res.data);
|
|
|
|
|
+ PagerUtil.setStationInfo(info);
|
|
|
|
|
+ PagerUtil.setRefreshing(getFocusedRouteNameFromRoute(this.props.route));
|
|
|
this.setState({
|
|
this.setState({
|
|
|
- refreshing: false
|
|
|
|
|
- })
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ refreshing: false,
|
|
|
|
|
+ stationInfo: info
|
|
|
|
|
+ }, () => {
|
|
|
|
|
+ this.setPageTitle();
|
|
|
|
|
+ });
|
|
|
|
|
+ if (this.action == 'qr') {
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.changeTab(1)
|
|
|
|
|
+ }, 300);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch((err) => {
|
|
|
|
|
+ toastLong(err);
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ refreshing: false
|
|
|
|
|
+ })
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|