|
@@ -32,11 +32,13 @@ export default class ChargingPage extends Component {
|
|
|
currentPayment: PaymentDefault.DEFAULT.payType,
|
|
currentPayment: PaymentDefault.DEFAULT.payType,
|
|
|
currentPaytype: PaymentDefault.DEFAULT.payName
|
|
currentPaytype: PaymentDefault.DEFAULT.payName
|
|
|
};
|
|
};
|
|
|
|
|
+ this.isPageShow = true;
|
|
|
this.waitStartCharging = false;
|
|
this.waitStartCharging = false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
|
this.init();
|
|
this.init();
|
|
|
|
|
+ this.isPageShow = true;
|
|
|
console.log("参数", this.props.route.params);
|
|
console.log("参数", this.props.route.params);
|
|
|
if (this.props.route.params.connectorId && this.props.route.params.chargeBoxId) {
|
|
if (this.props.route.params.connectorId && this.props.route.params.chargeBoxId) {
|
|
|
this.setState({
|
|
this.setState({
|
|
@@ -50,6 +52,10 @@ export default class ChargingPage extends Component {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ componentWillUnmount() {
|
|
|
|
|
+ this.isPageShow = false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
testInit() {
|
|
testInit() {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
isCharging: true,
|
|
isCharging: true,
|
|
@@ -74,6 +80,7 @@ export default class ChargingPage extends Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getConnectorInfo() {
|
|
getConnectorInfo() {
|
|
|
|
|
+ if (!this.isPageShow) return;
|
|
|
//this.init();
|
|
//this.init();
|
|
|
apiCharge.getConnectorDetail(this.state.stationInfo).then(res => {
|
|
apiCharge.getConnectorDetail(this.state.stationInfo).then(res => {
|
|
|
if (res.data.status) {
|
|
if (res.data.status) {
|
|
@@ -171,10 +178,12 @@ export default class ChargingPage extends Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
refreshChargeData(time=2000) {
|
|
refreshChargeData(time=2000) {
|
|
|
- //console.log("[刷新获取充电信息]", time);
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- this.getConnectorInfo();
|
|
|
|
|
- }, time);
|
|
|
|
|
|
|
+ if (this.isPageShow) {
|
|
|
|
|
+ //console.log("[刷新获取充电信息]", time);
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.getConnectorInfo();
|
|
|
|
|
+ }, time);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onPaymentMethodChanged(payment) {
|
|
onPaymentMethodChanged(payment) {
|