|
|
@@ -83,7 +83,7 @@ export default class ChargingPage extends Component {
|
|
|
if (!this.isPageShow) return;
|
|
|
//this.init();
|
|
|
apiCharge.getConnectorDetail(this.state.stationInfo).then(res => {
|
|
|
- if (res.data.status) {
|
|
|
+ if (res.data.status && !this.state.isStoping) {
|
|
|
const state = {
|
|
|
isStoping: false,
|
|
|
isCharging: false,
|
|
|
@@ -121,22 +121,14 @@ export default class ChargingPage extends Component {
|
|
|
this.refreshChargeData();
|
|
|
break;
|
|
|
case 'SuspendedEVSE':
|
|
|
- this.setState({
|
|
|
- errorCode: 'A5',
|
|
|
- showErrorDialog: true,
|
|
|
- errorMessage: $t('charging.errUnable2Charge')
|
|
|
- });
|
|
|
+ this.showErrorDialog('A5', $t('charging.errUnable2Charge'));
|
|
|
break;
|
|
|
case 'SuspendedEV': //已连接上但未充电
|
|
|
state.isAuthentic = true;
|
|
|
//this.refreshChargeData();
|
|
|
break;
|
|
|
case 'Reserved': //预定中
|
|
|
- this.setState({
|
|
|
- errorCode: 'A5',
|
|
|
- showErrorDialog: true,
|
|
|
- errorMessage: $t('charging.errUnable2Reserved')
|
|
|
- });
|
|
|
+ this.showErrorDialog('A5', $t('charging.errUnable2Reserved'));
|
|
|
break;
|
|
|
case 'Finishing': //已完成
|
|
|
if (res.data.chargingPk) {
|
|
|
@@ -160,11 +152,7 @@ export default class ChargingPage extends Component {
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
- this.setState({
|
|
|
- errorCode: 'A4',
|
|
|
- showErrorDialog: true,
|
|
|
- errorMessage: $t('charging.errNotChargeE0')
|
|
|
- });
|
|
|
+ this.showErrorDialog('A4', $t('charging.errNotChargeE0'));
|
|
|
break;
|
|
|
}
|
|
|
this.setState(state)
|
|
|
@@ -223,17 +211,9 @@ export default class ChargingPage extends Component {
|
|
|
console.log("[开始充电错误]", err, code);
|
|
|
//Dialog.dismissLoading();
|
|
|
if (code == 5200) {
|
|
|
- this.setState({
|
|
|
- errorCode: 'none',
|
|
|
- showErrorDialog: true,
|
|
|
- errorMessage: "(" + data.transactionPk + ') ' + err
|
|
|
- });
|
|
|
+ this.showErrorDialog('none', "(" + data.transactionPk + ') ' + err);
|
|
|
} else {
|
|
|
- this.setState({
|
|
|
- errorCode: 'A4',
|
|
|
- showErrorDialog: true,
|
|
|
- errorMessage: ''+err
|
|
|
- });
|
|
|
+ this.showErrorDialog('A4', err);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -263,6 +243,10 @@ export default class ChargingPage extends Component {
|
|
|
if (res.msg) {
|
|
|
toastShort(res.msg)
|
|
|
}
|
|
|
+ this.setState({
|
|
|
+ isCharging: false,
|
|
|
+ isAuthentic: false
|
|
|
+ });
|
|
|
//this.init();
|
|
|
startPage(PageList.summary, {
|
|
|
chargingPk: res.data.chargingPk,
|
|
|
@@ -297,6 +281,14 @@ export default class ChargingPage extends Component {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ showErrorDialog(code, msg) {
|
|
|
+ this.setState({
|
|
|
+ errorCode: code,
|
|
|
+ showErrorDialog: true,
|
|
|
+ errorMessage: ''+msg
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
closeError() {
|
|
|
this.setState({
|
|
|
showErrorDialog: false,
|
|
|
@@ -342,8 +334,7 @@ export default class ChargingPage extends Component {
|
|
|
message={this.state.errorMessage}
|
|
|
onClose={() => {
|
|
|
this.closeError();
|
|
|
- }}
|
|
|
- />
|
|
|
+ }}/>
|
|
|
</View>
|
|
|
);
|
|
|
}
|