| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- /**
- * 新版充电站信息页面
- * @邠心vbe on 2023/02/06
- */
- import React, { Component } from 'react';
- import { View, Text, StyleSheet } from 'react-native';
- import PagerUtil from './PagerUtil';
- export default class TabInfos extends Component {
- constructor(props) {
- super(props);
- this.state = {
- stationInfo: {}
- };
- }
- componentDidMount() {
- PagerUtil.addOnRefresh(this);
- this.onRefresh();
- }
- onRefresh() {
- console.log("info刷新", this.props.route.name);
- this.setState({
- stationInfo: PagerUtil.getStationInfo()
- });
- }
- getOperatingHours() {
- if (this.state.stationInfo?.endlessService) {
- return "24/7";
- } else if (this.state.stationInfo?.operatingHours) {
- return this.state.stationInfo?.operatingHours;
- } else {
- return $t('charging.toBeUpdated');
- }
- }
- getParkingFee() {
- if (this.state.stationInfo?.parkingFeeFree) {
- return $t('charging.free');
- } else if (this.state.stationInfo?.parkingFee) {
- return this.state.stationInfo.parkingFee;
- } else {
- return $t('charging.toBeUpdated');
- }
- }
-
- render() {
- return (
- <View style={$padding(0, 16)}>
- <Text style={styles.title}>{$t('charging.siteName')}</Text>
- <View style={styles.infoView}>
- <Text style={styles.infoText}>{this.state.stationInfo?.name}</Text>
- </View>
- <Text style={styles.title}>{$t('charging.siteAddress')}</Text>
- <View style={styles.infoView}>
- <Text style={styles.infoText}>{this.state.stationInfo?.address}</Text>
- </View>
- <Text style={styles.title}>{$t('charging.parkingFees')}</Text>
- <View style={styles.infoView}>
- <Text style={styles.infoText}>{this.getParkingFee()}</Text>
- </View>
- <Text style={styles.title}>{$t('charging.operatingHours')}</Text>
- <View style={styles.infoView}>
- <Text style={styles.infoText}>{this.getOperatingHours()}</Text>
- </View>
- <Text style={styles.title}>{$t('charging.additionalInformation')}</Text>
- <View style={styles.infoView}>
- <Text style={styles.infoText}>{this.state.stationInfo?.additionalNotes}</Text>
- </View>
- </View>
- );
- }
- }
- const styles = StyleSheet.create({
- title: {
- color: '#000',
- fontSize: 14,
- fontWeight: 'bold',
- ...$padding(16, 0, 8),
- borderBottomColor: '#eee',
- borderBottomWidth: 1
- },
- infoView: {
- paddingTop: 8,
- paddingBottom: 16
- },
- infoText: {
- color: '#444',
- fontSize: 14
- }
- })
|